| 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_DEVICE_WIN_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_WIN_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_WIN_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_WIN_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "device/bluetooth/bluetooth_device.h" | 12 #include "device/bluetooth/bluetooth_device.h" |
| 13 #include "device/bluetooth/bluetooth_task_manager_win.h" | 13 #include "device/bluetooth/bluetooth_task_manager_win.h" |
| 14 | 14 |
| 15 namespace device { | 15 namespace device { |
| 16 | 16 |
| 17 class BluetoothAdapterWin; | 17 class BluetoothAdapterWin; |
| 18 class BluetoothServiceRecord; | 18 class BluetoothServiceRecord; |
| 19 class BluetoothSocketThreadWin; |
| 19 | 20 |
| 20 class BluetoothDeviceWin : public BluetoothDevice { | 21 class BluetoothDeviceWin : public BluetoothDevice { |
| 21 public: | 22 public: |
| 22 explicit BluetoothDeviceWin( | 23 explicit BluetoothDeviceWin( |
| 23 const BluetoothTaskManagerWin::DeviceState& state); | 24 const BluetoothTaskManagerWin::DeviceState& state, |
| 25 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
| 26 scoped_refptr<BluetoothSocketThreadWin> socket_thread, |
| 27 net::NetLog* net_log, |
| 28 const net::NetLog::Source& net_log_source); |
| 24 virtual ~BluetoothDeviceWin(); | 29 virtual ~BluetoothDeviceWin(); |
| 25 | 30 |
| 26 // BluetoothDevice override | 31 // BluetoothDevice override |
| 27 virtual uint32 GetBluetoothClass() const OVERRIDE; | 32 virtual uint32 GetBluetoothClass() const OVERRIDE; |
| 28 virtual std::string GetAddress() const OVERRIDE; | 33 virtual std::string GetAddress() const OVERRIDE; |
| 29 virtual VendorIDSource GetVendorIDSource() const OVERRIDE; | 34 virtual VendorIDSource GetVendorIDSource() const OVERRIDE; |
| 30 virtual uint16 GetVendorID() const OVERRIDE; | 35 virtual uint16 GetVendorID() const OVERRIDE; |
| 31 virtual uint16 GetProductID() const OVERRIDE; | 36 virtual uint16 GetProductID() const OVERRIDE; |
| 32 virtual uint16 GetDeviceID() const OVERRIDE; | 37 virtual uint16 GetDeviceID() const OVERRIDE; |
| 33 virtual bool IsPaired() const OVERRIDE; | 38 virtual bool IsPaired() const OVERRIDE; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 56 virtual void Disconnect( | 61 virtual void Disconnect( |
| 57 const base::Closure& callback, | 62 const base::Closure& callback, |
| 58 const ErrorCallback& error_callback) OVERRIDE; | 63 const ErrorCallback& error_callback) OVERRIDE; |
| 59 virtual void Forget(const ErrorCallback& error_callback) OVERRIDE; | 64 virtual void Forget(const ErrorCallback& error_callback) OVERRIDE; |
| 60 virtual void ConnectToService( | 65 virtual void ConnectToService( |
| 61 const std::string& service_uuid, | 66 const std::string& service_uuid, |
| 62 const SocketCallback& callback) OVERRIDE; | 67 const SocketCallback& callback) OVERRIDE; |
| 63 virtual void ConnectToProfile( | 68 virtual void ConnectToProfile( |
| 64 device::BluetoothProfile* profile, | 69 device::BluetoothProfile* profile, |
| 65 const base::Closure& callback, | 70 const base::Closure& callback, |
| 66 const ErrorCallback& error_callback) OVERRIDE; | 71 const ConnectToProfileErrorCallback& error_callback) OVERRIDE; |
| 67 virtual void SetOutOfBandPairingData( | 72 virtual void SetOutOfBandPairingData( |
| 68 const BluetoothOutOfBandPairingData& data, | 73 const BluetoothOutOfBandPairingData& data, |
| 69 const base::Closure& callback, | 74 const base::Closure& callback, |
| 70 const ErrorCallback& error_callback) OVERRIDE; | 75 const ErrorCallback& error_callback) OVERRIDE; |
| 71 virtual void ClearOutOfBandPairingData( | 76 virtual void ClearOutOfBandPairingData( |
| 72 const base::Closure& callback, | 77 const base::Closure& callback, |
| 73 const ErrorCallback& error_callback) OVERRIDE; | 78 const ErrorCallback& error_callback) OVERRIDE; |
| 74 | 79 |
| 75 const BluetoothServiceRecord* GetServiceRecord(const std::string& uuid) const; | 80 const BluetoothServiceRecord* GetServiceRecord(const std::string& uuid) const; |
| 76 | 81 |
| 77 protected: | 82 protected: |
| 78 // BluetoothDevice override | 83 // BluetoothDevice override |
| 79 virtual std::string GetDeviceName() const OVERRIDE; | 84 virtual std::string GetDeviceName() const OVERRIDE; |
| 80 | 85 |
| 81 private: | 86 private: |
| 82 friend class BluetoothAdapterWin; | 87 friend class BluetoothAdapterWin; |
| 83 | 88 |
| 84 // Used by BluetoothAdapterWin to update the visible state during | 89 // Used by BluetoothAdapterWin to update the visible state during |
| 85 // discovery. | 90 // discovery. |
| 86 void SetVisible(bool visible); | 91 void SetVisible(bool visible); |
| 87 | 92 |
| 93 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
| 94 scoped_refptr<BluetoothSocketThreadWin> socket_thread_; |
| 95 net::NetLog* net_log_; |
| 96 net::NetLog::Source net_log_source_; |
| 97 |
| 88 // The Bluetooth class of the device, a bitmask that may be decoded using | 98 // The Bluetooth class of the device, a bitmask that may be decoded using |
| 89 // https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm | 99 // https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm |
| 90 uint32 bluetooth_class_; | 100 uint32 bluetooth_class_; |
| 91 | 101 |
| 92 // The name of the device, as supplied by the remote device. | 102 // The name of the device, as supplied by the remote device. |
| 93 std::string name_; | 103 std::string name_; |
| 94 | 104 |
| 95 // The Bluetooth address of the device. | 105 // The Bluetooth address of the device. |
| 96 std::string address_; | 106 std::string address_; |
| 97 | 107 |
| 98 // Tracked device state, updated by the adapter managing the lifecycle of | 108 // Tracked device state, updated by the adapter managing the lifecycle of |
| 99 // the device. | 109 // the device. |
| 100 bool paired_; | 110 bool paired_; |
| 101 bool connected_; | 111 bool connected_; |
| 102 | 112 |
| 103 // Used to send change notifications when a device disappears during | 113 // Used to send change notifications when a device disappears during |
| 104 // discovery. | 114 // discovery. |
| 105 bool visible_; | 115 bool visible_; |
| 106 | 116 |
| 107 // The services (identified by UUIDs) that this device provides. | 117 // The services (identified by UUIDs) that this device provides. |
| 108 ServiceList service_uuids_; | 118 ServiceList service_uuids_; |
| 109 ServiceRecordList service_record_list_; | 119 ServiceRecordList service_record_list_; |
| 110 | 120 |
| 111 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceWin); | 121 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceWin); |
| 112 }; | 122 }; |
| 113 | 123 |
| 114 } // namespace device | 124 } // namespace device |
| 115 | 125 |
| 116 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_WIN_H_ | 126 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_WIN_H_ |
| OLD | NEW |