Chromium Code Reviews| 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_ADAPTER_MAC_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ |
| 7 | 7 |
| 8 #include <IOKit/IOReturn.h> | 8 #include <IOKit/IOReturn.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 bool IsPresent() const override; | 63 bool IsPresent() const override; |
| 64 bool IsPowered() const override; | 64 bool IsPowered() const override; |
| 65 void SetPowered(bool powered, | 65 void SetPowered(bool powered, |
| 66 const base::Closure& callback, | 66 const base::Closure& callback, |
| 67 const ErrorCallback& error_callback) override; | 67 const ErrorCallback& error_callback) override; |
| 68 bool IsDiscoverable() const override; | 68 bool IsDiscoverable() const override; |
| 69 void SetDiscoverable(bool discoverable, | 69 void SetDiscoverable(bool discoverable, |
| 70 const base::Closure& callback, | 70 const base::Closure& callback, |
| 71 const ErrorCallback& error_callback) override; | 71 const ErrorCallback& error_callback) override; |
| 72 bool IsDiscovering() const override; | 72 bool IsDiscovering() const override; |
| 73 std::unordered_map<BluetoothDevice*, BluetoothDevice::UUIDSet> | |
| 74 RetrieveGattConnectedDevicesWithDiscoveryFilter( | |
| 75 const BluetoothDiscoveryFilter* discovery_filter) override; | |
| 73 UUIDList GetUUIDs() const override; | 76 UUIDList GetUUIDs() const override; |
| 74 void CreateRfcommService( | 77 void CreateRfcommService( |
| 75 const BluetoothUUID& uuid, | 78 const BluetoothUUID& uuid, |
| 76 const ServiceOptions& options, | 79 const ServiceOptions& options, |
| 77 const CreateServiceCallback& callback, | 80 const CreateServiceCallback& callback, |
| 78 const CreateServiceErrorCallback& error_callback) override; | 81 const CreateServiceErrorCallback& error_callback) override; |
| 79 void CreateL2capService( | 82 void CreateL2capService( |
| 80 const BluetoothUUID& uuid, | 83 const BluetoothUUID& uuid, |
| 81 const ServiceOptions& options, | 84 const ServiceOptions& options, |
| 82 const CreateServiceCallback& callback, | 85 const CreateServiceCallback& callback, |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 NSDictionary* advertisement_data, | 172 NSDictionary* advertisement_data, |
| 170 int rssi) override; | 173 int rssi) override; |
| 171 | 174 |
| 172 // Updates |devices_| when there is a change to the CBCentralManager's state. | 175 // Updates |devices_| when there is a change to the CBCentralManager's state. |
| 173 void LowEnergyCentralManagerUpdatedState(); | 176 void LowEnergyCentralManagerUpdatedState(); |
| 174 | 177 |
| 175 // Updates |devices_| to include the currently paired devices and notifies | 178 // Updates |devices_| to include the currently paired devices and notifies |
| 176 // observers. | 179 // observers. |
| 177 void AddPairedDevices(); | 180 void AddPairedDevices(); |
| 178 | 181 |
| 182 std::unordered_map<BluetoothDevice*, BluetoothDevice::UUIDSet> | |
| 183 RetrieveGattConnectedDevicesWithService(const BluetoothUUID* uuid); | |
| 184 | |
| 179 // Returns the BLE device associated with the CoreBluetooth peripheral. | 185 // Returns the BLE device associated with the CoreBluetooth peripheral. |
| 180 BluetoothLowEnergyDeviceMac* GetBluetoothLowEnergyDeviceMac( | 186 BluetoothLowEnergyDeviceMac* GetBluetoothLowEnergyDeviceMac( |
| 181 CBPeripheral* peripheral); | 187 CBPeripheral* peripheral); |
| 182 | 188 |
| 189 // Returns true if a new device collide with an existing device. | |
|
ortuno
2016/10/31 04:30:51
s/collide/collides/
jlebel
2016/11/07 01:43:17
Done.
| |
| 190 bool DoesCollideWithKnownDevice(CBPeripheral* peripheral, | |
| 191 BluetoothLowEnergyDeviceMac* device_mac); | |
| 192 | |
| 183 std::string address_; | 193 std::string address_; |
| 184 bool classic_powered_; | 194 bool classic_powered_; |
| 185 int num_discovery_sessions_; | 195 int num_discovery_sessions_; |
| 186 | 196 |
| 187 // Cached name. Updated in GetName if should_update_name_ is true. | 197 // Cached name. Updated in GetName if should_update_name_ is true. |
| 188 // | 198 // |
| 189 // For performance reasons, cache the adapter's name. It's not uncommon for | 199 // For performance reasons, cache the adapter's name. It's not uncommon for |
| 190 // a call to [controller nameAsString] to take tens of milliseconds. Note | 200 // a call to [controller nameAsString] to take tens of milliseconds. Note |
| 191 // that this caching strategy might result in clients receiving a stale | 201 // that this caching strategy might result in clients receiving a stale |
| 192 // name. If this is a significant issue, then some more sophisticated | 202 // name. If this is a significant issue, then some more sophisticated |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 212 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; | 222 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
| 213 | 223 |
| 214 base::WeakPtrFactory<BluetoothAdapterMac> weak_ptr_factory_; | 224 base::WeakPtrFactory<BluetoothAdapterMac> weak_ptr_factory_; |
| 215 | 225 |
| 216 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterMac); | 226 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterMac); |
| 217 }; | 227 }; |
| 218 | 228 |
| 219 } // namespace device | 229 } // namespace device |
| 220 | 230 |
| 221 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ | 231 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ |
| OLD | NEW |