| 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 <memory> |
| 10 #include <string> | 11 #include <string> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/observer_list.h" | 15 #include "base/observer_list.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 #include "net/log/net_log_source.h" | 19 #include "net/log/net_log_source.h" |
| 19 | 20 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 void Update(const BluetoothTaskManagerWin::DeviceState& device_state); | 98 void Update(const BluetoothTaskManagerWin::DeviceState& device_state); |
| 98 | 99 |
| 99 protected: | 100 protected: |
| 100 // BluetoothDevice override | 101 // BluetoothDevice override |
| 101 void CreateGattConnectionImpl() override; | 102 void CreateGattConnectionImpl() override; |
| 102 void DisconnectGatt() override; | 103 void DisconnectGatt() override; |
| 103 | 104 |
| 104 private: | 105 private: |
| 105 friend class BluetoothAdapterWin; | 106 friend class BluetoothAdapterWin; |
| 106 | 107 |
| 107 typedef ScopedVector<BluetoothServiceRecordWin> ServiceRecordList; | |
| 108 | |
| 109 // Used by BluetoothAdapterWin to update the visible state during | 108 // Used by BluetoothAdapterWin to update the visible state during |
| 110 // discovery. | 109 // discovery. |
| 111 void SetVisible(bool visible); | 110 void SetVisible(bool visible); |
| 112 | 111 |
| 113 // Updates the services with services stored in |device_state|. | 112 // Updates the services with services stored in |device_state|. |
| 114 void UpdateServices(const BluetoothTaskManagerWin::DeviceState& device_state); | 113 void UpdateServices(const BluetoothTaskManagerWin::DeviceState& device_state); |
| 115 | 114 |
| 116 // Checks if GATT service with |uuid| and |attribute_handle| has already been | 115 // Checks if GATT service with |uuid| and |attribute_handle| has already been |
| 117 // discovered. | 116 // discovered. |
| 118 bool IsGattServiceDiscovered(BluetoothUUID& uuid, uint16_t attribute_handle); | 117 bool IsGattServiceDiscovered(BluetoothUUID& uuid, uint16_t attribute_handle); |
| 119 | 118 |
| 120 // Checks if |service| still exist on device according to newly discovered | 119 // Checks if |service| still exist on device according to newly discovered |
| 121 // |service_state|. | 120 // |service_state|. |
| 122 bool DoesGattServiceExist( | 121 bool DoesGattServiceExist( |
| 123 const ScopedVector<BluetoothTaskManagerWin::ServiceRecordState>& | 122 const std::vector<std::unique_ptr< |
| 124 service_state, | 123 BluetoothTaskManagerWin::ServiceRecordState>>& service_state, |
| 125 BluetoothRemoteGattService* service); | 124 BluetoothRemoteGattService* service); |
| 126 | 125 |
| 127 // Updates the GATT services with the services stored in |service_state|. | 126 // Updates the GATT services with the services stored in |service_state|. |
| 128 void UpdateGattServices( | 127 void UpdateGattServices( |
| 129 const ScopedVector<BluetoothTaskManagerWin::ServiceRecordState>& | 128 const std::vector< |
| 129 std::unique_ptr<BluetoothTaskManagerWin::ServiceRecordState>>& |
| 130 service_state); | 130 service_state); |
| 131 | 131 |
| 132 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; | 132 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
| 133 scoped_refptr<BluetoothSocketThread> socket_thread_; | 133 scoped_refptr<BluetoothSocketThread> socket_thread_; |
| 134 net::NetLog* net_log_; | 134 net::NetLog* net_log_; |
| 135 net::NetLogSource net_log_source_; | 135 net::NetLogSource net_log_source_; |
| 136 | 136 |
| 137 // The Bluetooth class of the device, a bitmask that may be decoded using | 137 // The Bluetooth class of the device, a bitmask that may be decoded using |
| 138 // https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm | 138 // https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm |
| 139 uint32_t bluetooth_class_; | 139 uint32_t bluetooth_class_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 150 bool connected_; | 150 bool connected_; |
| 151 | 151 |
| 152 // Used to send change notifications when a device disappears during | 152 // Used to send change notifications when a device disappears during |
| 153 // discovery. | 153 // discovery. |
| 154 bool visible_; | 154 bool visible_; |
| 155 | 155 |
| 156 // The services (identified by UUIDs) that this device provides. | 156 // The services (identified by UUIDs) that this device provides. |
| 157 UUIDSet uuids_; | 157 UUIDSet uuids_; |
| 158 | 158 |
| 159 // The service records retrieved from SDP. | 159 // The service records retrieved from SDP. |
| 160 ServiceRecordList service_record_list_; | 160 std::vector<std::unique_ptr<BluetoothServiceRecordWin>> service_record_list_; |
| 161 | 161 |
| 162 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceWin); | 162 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceWin); |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 } // namespace device | 165 } // namespace device |
| 166 | 166 |
| 167 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_WIN_H_ | 167 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_WIN_H_ |
| OLD | NEW |