| 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 "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 13 #include "device/bluetooth/bluetooth_device.h" | 13 #include "device/bluetooth/bluetooth_device.h" |
| 14 #include "device/bluetooth/bluetooth_task_manager_win.h" | 14 #include "device/bluetooth/bluetooth_task_manager_win.h" |
| 15 | 15 |
| 16 namespace device { | 16 namespace device { |
| 17 | 17 |
| 18 class BluetoothAdapterWin; | 18 class BluetoothAdapterWin; |
| 19 class BluetoothServiceRecordWin; | 19 class BluetoothServiceRecordWin; |
| 20 class BluetoothSocketThread; | 20 class BluetoothSocketThread; |
| 21 | 21 |
| 22 class BluetoothDeviceWin : public BluetoothDevice { | 22 class BluetoothDeviceWin : public BluetoothDevice { |
| 23 public: | 23 public: |
| 24 explicit BluetoothDeviceWin( | 24 explicit BluetoothDeviceWin( |
| 25 const BluetoothTaskManagerWin::DeviceState& state, | 25 const BluetoothTaskManagerWin::DeviceState& device_state, |
| 26 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | 26 const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner, |
| 27 scoped_refptr<BluetoothSocketThread> socket_thread, | 27 const scoped_refptr<BluetoothSocketThread>& socket_thread, |
| 28 net::NetLog* net_log, | 28 net::NetLog* net_log, |
| 29 const net::NetLog::Source& net_log_source); | 29 const net::NetLog::Source& net_log_source); |
| 30 virtual ~BluetoothDeviceWin(); | 30 virtual ~BluetoothDeviceWin(); |
| 31 | 31 |
| 32 // BluetoothDevice override | 32 // BluetoothDevice override |
| 33 virtual uint32 GetBluetoothClass() const OVERRIDE; | 33 virtual uint32 GetBluetoothClass() const OVERRIDE; |
| 34 virtual std::string GetAddress() const OVERRIDE; | 34 virtual std::string GetAddress() const OVERRIDE; |
| 35 virtual VendorIDSource GetVendorIDSource() const OVERRIDE; | 35 virtual VendorIDSource GetVendorIDSource() const OVERRIDE; |
| 36 virtual uint16 GetVendorID() const OVERRIDE; | 36 virtual uint16 GetVendorID() const OVERRIDE; |
| 37 virtual uint16 GetProductID() const OVERRIDE; | 37 virtual uint16 GetProductID() const OVERRIDE; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 const ConnectErrorCallback& error_callback) OVERRIDE; | 69 const ConnectErrorCallback& error_callback) OVERRIDE; |
| 70 virtual void StartConnectionMonitor( | 70 virtual void StartConnectionMonitor( |
| 71 const base::Closure& callback, | 71 const base::Closure& callback, |
| 72 const ErrorCallback& error_callback) OVERRIDE; | 72 const ErrorCallback& error_callback) OVERRIDE; |
| 73 | 73 |
| 74 // Used by BluetoothProfileWin to retrieve the service record for the given | 74 // Used by BluetoothProfileWin to retrieve the service record for the given |
| 75 // |uuid|. | 75 // |uuid|. |
| 76 const BluetoothServiceRecordWin* GetServiceRecord( | 76 const BluetoothServiceRecordWin* GetServiceRecord( |
| 77 const device::BluetoothUUID& uuid) const; | 77 const device::BluetoothUUID& uuid) const; |
| 78 | 78 |
| 79 // Returns true if all fields and services of this instance are equal to the |
| 80 // fields and services stored in |device_state|. |
| 81 bool IsEqual(const BluetoothTaskManagerWin::DeviceState& device_state); |
| 82 |
| 83 // Updates this instance with all fields and properties stored in |
| 84 // |device_state|. |
| 85 void Update(const BluetoothTaskManagerWin::DeviceState& device_state); |
| 86 |
| 79 protected: | 87 protected: |
| 80 // BluetoothDevice override | 88 // BluetoothDevice override |
| 81 virtual std::string GetDeviceName() const OVERRIDE; | 89 virtual std::string GetDeviceName() const OVERRIDE; |
| 82 | 90 |
| 83 private: | 91 private: |
| 84 friend class BluetoothAdapterWin; | 92 friend class BluetoothAdapterWin; |
| 85 | 93 |
| 86 // Used by BluetoothAdapterWin to update the visible state during | 94 // Used by BluetoothAdapterWin to update the visible state during |
| 87 // discovery. | 95 // discovery. |
| 88 void SetVisible(bool visible); | 96 void SetVisible(bool visible); |
| 89 | 97 |
| 98 // Updates the services with services stored in |device_state|. |
| 99 void UpdateServices(const BluetoothTaskManagerWin::DeviceState& device_state); |
| 100 |
| 90 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; | 101 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
| 91 scoped_refptr<BluetoothSocketThread> socket_thread_; | 102 scoped_refptr<BluetoothSocketThread> socket_thread_; |
| 92 net::NetLog* net_log_; | 103 net::NetLog* net_log_; |
| 93 net::NetLog::Source net_log_source_; | 104 net::NetLog::Source net_log_source_; |
| 94 | 105 |
| 95 // The Bluetooth class of the device, a bitmask that may be decoded using | 106 // The Bluetooth class of the device, a bitmask that may be decoded using |
| 96 // https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm | 107 // https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm |
| 97 uint32 bluetooth_class_; | 108 uint32 bluetooth_class_; |
| 98 | 109 |
| 99 // The name of the device, as supplied by the remote device. | 110 // The name of the device, as supplied by the remote device. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 117 // The service records retrieved from SDP. | 128 // The service records retrieved from SDP. |
| 118 typedef ScopedVector<BluetoothServiceRecordWin> ServiceRecordList; | 129 typedef ScopedVector<BluetoothServiceRecordWin> ServiceRecordList; |
| 119 ServiceRecordList service_record_list_; | 130 ServiceRecordList service_record_list_; |
| 120 | 131 |
| 121 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceWin); | 132 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceWin); |
| 122 }; | 133 }; |
| 123 | 134 |
| 124 } // namespace device | 135 } // namespace device |
| 125 | 136 |
| 126 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_WIN_H_ | 137 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_WIN_H_ |
| OLD | NEW |