| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 15 #include "device/bluetooth/bluetooth_adapter_win.h" |
| 15 #include "device/bluetooth/bluetooth_device.h" | 16 #include "device/bluetooth/bluetooth_device.h" |
| 16 #include "device/bluetooth/bluetooth_export.h" | 17 #include "device/bluetooth/bluetooth_export.h" |
| 17 #include "device/bluetooth/bluetooth_task_manager_win.h" | 18 #include "device/bluetooth/bluetooth_task_manager_win.h" |
| 18 | 19 |
| 19 namespace device { | 20 namespace device { |
| 20 | 21 |
| 21 class BluetoothAdapterWin; | |
| 22 class BluetoothServiceRecordWin; | 22 class BluetoothServiceRecordWin; |
| 23 class BluetoothSocketThread; | 23 class BluetoothSocketThread; |
| 24 | 24 |
| 25 class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceWin : public BluetoothDevice { | 25 class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceWin : public BluetoothDevice { |
| 26 public: | 26 public: |
| 27 explicit BluetoothDeviceWin( | 27 explicit BluetoothDeviceWin( |
| 28 BluetoothAdapterWin* adapter, | 28 BluetoothAdapterWin* adapter, |
| 29 const BluetoothTaskManagerWin::DeviceState& device_state, | 29 const BluetoothTaskManagerWin::DeviceState& device_state, |
| 30 const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner, | 30 const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner, |
| 31 const scoped_refptr<BluetoothSocketThread>& socket_thread, | 31 const scoped_refptr<BluetoothSocketThread>& socket_thread, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 const device::BluetoothUUID& uuid) const; | 82 const device::BluetoothUUID& uuid) const; |
| 83 | 83 |
| 84 // Returns true if all fields and services of this instance are equal to the | 84 // Returns true if all fields and services of this instance are equal to the |
| 85 // fields and services stored in |device_state|. | 85 // fields and services stored in |device_state|. |
| 86 bool IsEqual(const BluetoothTaskManagerWin::DeviceState& device_state); | 86 bool IsEqual(const BluetoothTaskManagerWin::DeviceState& device_state); |
| 87 | 87 |
| 88 // Updates this instance with all fields and properties stored in | 88 // Updates this instance with all fields and properties stored in |
| 89 // |device_state|. | 89 // |device_state|. |
| 90 void Update(const BluetoothTaskManagerWin::DeviceState& device_state); | 90 void Update(const BluetoothTaskManagerWin::DeviceState& device_state); |
| 91 | 91 |
| 92 const BluetoothAdapterWin* GetAdapter() { |
| 93 return static_cast<BluetoothAdapterWin*>(adapter_); |
| 94 } |
| 95 |
| 92 protected: | 96 protected: |
| 93 // BluetoothDevice override | 97 // BluetoothDevice override |
| 94 std::string GetDeviceName() const override; | 98 std::string GetDeviceName() const override; |
| 95 void CreateGattConnectionImpl() override; | 99 void CreateGattConnectionImpl() override; |
| 96 void DisconnectGatt() override; | 100 void DisconnectGatt() override; |
| 97 | 101 |
| 98 private: | 102 private: |
| 99 friend class BluetoothAdapterWin; | 103 friend class BluetoothAdapterWin; |
| 104 friend class BluetoothDeviceWinTest; |
| 105 |
| 106 void UpdateGattServices( |
| 107 const BluetoothTaskManagerWin::DeviceState& device_state); |
| 100 | 108 |
| 101 typedef ScopedVector<BluetoothServiceRecordWin> ServiceRecordList; | 109 typedef ScopedVector<BluetoothServiceRecordWin> ServiceRecordList; |
| 102 | 110 |
| 103 // Used by BluetoothAdapterWin to update the visible state during | 111 // Used by BluetoothAdapterWin to update the visible state during |
| 104 // discovery. | 112 // discovery. |
| 105 void SetVisible(bool visible); | 113 void SetVisible(bool visible); |
| 106 | 114 |
| 107 // Updates the services with services stored in |device_state|. | 115 // Updates the services with services stored in |device_state|. |
| 108 void UpdateServices(const BluetoothTaskManagerWin::DeviceState& device_state); | 116 void UpdateServices(const BluetoothTaskManagerWin::DeviceState& device_state); |
| 109 | 117 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 136 | 144 |
| 137 // The service records retrieved from SDP. | 145 // The service records retrieved from SDP. |
| 138 ServiceRecordList service_record_list_; | 146 ServiceRecordList service_record_list_; |
| 139 | 147 |
| 140 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceWin); | 148 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceWin); |
| 141 }; | 149 }; |
| 142 | 150 |
| 143 } // namespace device | 151 } // namespace device |
| 144 | 152 |
| 145 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_WIN_H_ | 153 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_WIN_H_ |
| OLD | NEW |