| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CHROMEOS_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 class BluetoothDeviceChromeOS; | 28 class BluetoothDeviceChromeOS; |
| 29 | 29 |
| 30 // The BluetoothSocketChromeOS class implements BluetoothSocket for the | 30 // The BluetoothSocketChromeOS class implements BluetoothSocket for the |
| 31 // Chrome OS platform. | 31 // Chrome OS platform. |
| 32 class CHROMEOS_EXPORT BluetoothSocketChromeOS | 32 class CHROMEOS_EXPORT BluetoothSocketChromeOS |
| 33 : public device::BluetoothSocketNet, | 33 : public device::BluetoothSocketNet, |
| 34 public device::BluetoothAdapter::Observer, | 34 public device::BluetoothAdapter::Observer, |
| 35 public BluetoothProfileServiceProvider::Delegate { | 35 public BluetoothProfileServiceProvider::Delegate { |
| 36 public: | 36 public: |
| 37 enum SecurityLevel { |
| 38 SECURITY_LEVEL_LOW, |
| 39 SECURITY_LEVEL_MEDIUM |
| 40 }; |
| 41 |
| 37 static scoped_refptr<BluetoothSocketChromeOS> CreateBluetoothSocket( | 42 static scoped_refptr<BluetoothSocketChromeOS> CreateBluetoothSocket( |
| 38 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | 43 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
| 39 scoped_refptr<device::BluetoothSocketThread> socket_thread); | 44 scoped_refptr<device::BluetoothSocketThread> socket_thread); |
| 40 | 45 |
| 41 // Connects this socket to the service on |device| published as UUID |uuid|, | 46 // Connects this socket to the service on |device| published as UUID |uuid|, |
| 42 // the underlying protocol and PSM or Channel is obtained through service | 47 // the underlying protocol and PSM or Channel is obtained through service |
| 43 // discovery. On a successful connection the socket properties will be updated | 48 // discovery. On a successful connection the socket properties will be updated |
| 44 // and |success_callback| called. On failure |error_callback| will be called | 49 // and |success_callback| called. On failure |error_callback| will be called |
| 45 // with a message explaining the cause of the failure. | 50 // with a message explaining the cause of the failure. |
| 46 virtual void Connect(const BluetoothDeviceChromeOS* device, | 51 virtual void Connect(const BluetoothDeviceChromeOS* device, |
| 47 const device::BluetoothUUID& uuid, | 52 const device::BluetoothUUID& uuid, |
| 53 SecurityLevel security_level, |
| 48 const base::Closure& success_callback, | 54 const base::Closure& success_callback, |
| 49 const ErrorCompletionCallback& error_callback); | 55 const ErrorCompletionCallback& error_callback); |
| 50 | 56 |
| 51 // Listens using this socket using a service published on |adapter|. The | 57 // Listens using this socket using a service published on |adapter|. The |
| 52 // service is either RFCOMM or L2CAP depending on |socket_type| and published | 58 // service is either RFCOMM or L2CAP depending on |socket_type| and published |
| 53 // as UUID |uuid|. The |service_options| argument is interpreted according to | 59 // as UUID |uuid|. The |service_options| argument is interpreted according to |
| 54 // |socket_type|. |success_callback| will be called if the service is | 60 // |socket_type|. |success_callback| will be called if the service is |
| 55 // successfully registered, |error_callback| on failure with a message | 61 // successfully registered, |error_callback| on failure with a message |
| 56 // explaining the cause. | 62 // explaining the cause. |
| 57 enum SocketType { kRfcomm, kL2cap }; | 63 enum SocketType { kRfcomm, kL2cap }; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 bool cancelled; | 202 bool cancelled; |
| 197 }; | 203 }; |
| 198 std::queue<linked_ptr<ConnectionRequest> > connection_request_queue_; | 204 std::queue<linked_ptr<ConnectionRequest> > connection_request_queue_; |
| 199 | 205 |
| 200 DISALLOW_COPY_AND_ASSIGN(BluetoothSocketChromeOS); | 206 DISALLOW_COPY_AND_ASSIGN(BluetoothSocketChromeOS); |
| 201 }; | 207 }; |
| 202 | 208 |
| 203 } // namespace chromeos | 209 } // namespace chromeos |
| 204 | 210 |
| 205 #endif // DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_ | 211 #endif // DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_ |
| OLD | NEW |