OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_WIN_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_WIN_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_WIN_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_WIN_H_ |
7 | 7 |
8 #include <WinSock2.h> | 8 #include <WinSock2.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 class BluetoothAdapter; | 23 class BluetoothAdapter; |
24 class BluetoothDeviceWin; | 24 class BluetoothDeviceWin; |
25 | 25 |
26 // The BluetoothSocketWin class implements BluetoothSocket for the Microsoft | 26 // The BluetoothSocketWin class implements BluetoothSocket for the Microsoft |
27 // Windows platform. | 27 // Windows platform. |
28 class BluetoothSocketWin : public BluetoothSocketNet { | 28 class BluetoothSocketWin : public BluetoothSocketNet { |
29 public: | 29 public: |
30 static scoped_refptr<BluetoothSocketWin> CreateBluetoothSocket( | 30 static scoped_refptr<BluetoothSocketWin> CreateBluetoothSocket( |
31 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | 31 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
32 scoped_refptr<BluetoothSocketThread> socket_thread, | 32 scoped_refptr<BluetoothSocketThread> socket_thread); |
33 net::NetLog* net_log, | |
34 const net::NetLog::Source& source); | |
35 | 33 |
36 // Connect to the peer device and calls |success_callback| when the | 34 // Connect to the peer device and calls |success_callback| when the |
37 // connection has been established successfully. If an error occurs, calls | 35 // connection has been established successfully. If an error occurs, calls |
38 // |error_callback| with a system error message. | 36 // |error_callback| with a system error message. |
39 void Connect(const BluetoothDeviceWin* device, | 37 void Connect(const BluetoothDeviceWin* device, |
40 const BluetoothUUID& uuid, | 38 const BluetoothUUID& uuid, |
41 const base::Closure& success_callback, | 39 const base::Closure& success_callback, |
42 const ErrorCompletionCallback& error_callback); | 40 const ErrorCompletionCallback& error_callback); |
43 | 41 |
44 // Listens using this socket using an RFCOMM service published as UUID |uuid| | 42 // Listens using this socket using an RFCOMM service published as UUID |uuid| |
(...skipping 14 matching lines...) Expand all Loading... |
59 virtual void Accept(const AcceptCompletionCallback& success_callback, | 57 virtual void Accept(const AcceptCompletionCallback& success_callback, |
60 const ErrorCompletionCallback& error_callback) OVERRIDE; | 58 const ErrorCompletionCallback& error_callback) OVERRIDE; |
61 | 59 |
62 protected: | 60 protected: |
63 virtual ~BluetoothSocketWin(); | 61 virtual ~BluetoothSocketWin(); |
64 | 62 |
65 private: | 63 private: |
66 struct ServiceRegData; | 64 struct ServiceRegData; |
67 | 65 |
68 BluetoothSocketWin(scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | 66 BluetoothSocketWin(scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
69 scoped_refptr<BluetoothSocketThread> socket_thread, | 67 scoped_refptr<BluetoothSocketThread> socket_thread); |
70 net::NetLog* net_log, | |
71 const net::NetLog::Source& source); | |
72 | |
73 | 68 |
74 void DoConnect(const base::Closure& success_callback, | 69 void DoConnect(const base::Closure& success_callback, |
75 const ErrorCompletionCallback& error_callback); | 70 const ErrorCompletionCallback& error_callback); |
76 void DoListen(const BluetoothUUID& uuid, | 71 void DoListen(const BluetoothUUID& uuid, |
77 int rfcomm_channel, | 72 int rfcomm_channel, |
78 const base::Closure& success_callback, | 73 const base::Closure& success_callback, |
79 const ErrorCompletionCallback& error_callback); | 74 const ErrorCompletionCallback& error_callback); |
80 void DoAccept(const AcceptCompletionCallback& success_callback, | 75 void DoAccept(const AcceptCompletionCallback& success_callback, |
81 const ErrorCompletionCallback& error_callback); | 76 const ErrorCompletionCallback& error_callback); |
82 void OnAcceptOnSocketThread(const AcceptCompletionCallback& success_callback, | 77 void OnAcceptOnSocketThread(const AcceptCompletionCallback& success_callback, |
(...skipping 14 matching lines...) Expand all Loading... |
97 scoped_ptr<ServiceRegData> service_reg_data_; | 92 scoped_ptr<ServiceRegData> service_reg_data_; |
98 scoped_ptr<net::TCPSocket> accept_socket_; | 93 scoped_ptr<net::TCPSocket> accept_socket_; |
99 net::IPEndPoint accept_address_; | 94 net::IPEndPoint accept_address_; |
100 | 95 |
101 DISALLOW_COPY_AND_ASSIGN(BluetoothSocketWin); | 96 DISALLOW_COPY_AND_ASSIGN(BluetoothSocketWin); |
102 }; | 97 }; |
103 | 98 |
104 } // namespace device | 99 } // namespace device |
105 | 100 |
106 #endif // DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_WIN_H_ | 101 #endif // DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_WIN_H_ |
OLD | NEW |