| 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 void RetrieveUnknownGattConnectedDevices() override; |
| 73 UUIDList GetUUIDs() const override; | 74 UUIDList GetUUIDs() const override; |
| 74 void CreateRfcommService( | 75 void CreateRfcommService( |
| 75 const BluetoothUUID& uuid, | 76 const BluetoothUUID& uuid, |
| 76 const ServiceOptions& options, | 77 const ServiceOptions& options, |
| 77 const CreateServiceCallback& callback, | 78 const CreateServiceCallback& callback, |
| 78 const CreateServiceErrorCallback& error_callback) override; | 79 const CreateServiceErrorCallback& error_callback) override; |
| 79 void CreateL2capService( | 80 void CreateL2capService( |
| 80 const BluetoothUUID& uuid, | 81 const BluetoothUUID& uuid, |
| 81 const ServiceOptions& options, | 82 const ServiceOptions& options, |
| 82 const CreateServiceCallback& callback, | 83 const CreateServiceCallback& callback, |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 void LowEnergyCentralManagerUpdatedState(); | 174 void LowEnergyCentralManagerUpdatedState(); |
| 174 | 175 |
| 175 // Updates |devices_| to include the currently paired devices and notifies | 176 // Updates |devices_| to include the currently paired devices and notifies |
| 176 // observers. | 177 // observers. |
| 177 void AddPairedDevices(); | 178 void AddPairedDevices(); |
| 178 | 179 |
| 179 // Returns the BLE device associated with the CoreBluetooth peripheral. | 180 // Returns the BLE device associated with the CoreBluetooth peripheral. |
| 180 BluetoothLowEnergyDeviceMac* GetBluetoothLowEnergyDeviceMac( | 181 BluetoothLowEnergyDeviceMac* GetBluetoothLowEnergyDeviceMac( |
| 181 CBPeripheral* peripheral); | 182 CBPeripheral* peripheral); |
| 182 | 183 |
| 184 // Returns true if a new device collide with an existing device. |
| 185 bool DoesCollideWithKnownDevice(CBPeripheral* peripheral, |
| 186 BluetoothLowEnergyDeviceMac* device_mac); |
| 187 |
| 183 std::string address_; | 188 std::string address_; |
| 184 std::string name_; | 189 std::string name_; |
| 185 bool classic_powered_; | 190 bool classic_powered_; |
| 186 int num_discovery_sessions_; | 191 int num_discovery_sessions_; |
| 187 | 192 |
| 188 // Discovery manager for Bluetooth Classic. | 193 // Discovery manager for Bluetooth Classic. |
| 189 std::unique_ptr<BluetoothDiscoveryManagerMac> classic_discovery_manager_; | 194 std::unique_ptr<BluetoothDiscoveryManagerMac> classic_discovery_manager_; |
| 190 | 195 |
| 191 // Discovery manager for Bluetooth Low Energy. | 196 // Discovery manager for Bluetooth Low Energy. |
| 192 std::unique_ptr<BluetoothLowEnergyDiscoveryManagerMac> | 197 std::unique_ptr<BluetoothLowEnergyDiscoveryManagerMac> |
| 193 low_energy_discovery_manager_; | 198 low_energy_discovery_manager_; |
| 194 | 199 |
| 195 // Underlying CoreBluetooth CBCentralManager and its delegate. | 200 // Underlying CoreBluetooth CBCentralManager and its delegate. |
| 196 base::scoped_nsobject<CBCentralManager> low_energy_central_manager_; | 201 base::scoped_nsobject<CBCentralManager> low_energy_central_manager_; |
| 197 base::scoped_nsobject<BluetoothLowEnergyCentralManagerDelegate> | 202 base::scoped_nsobject<BluetoothLowEnergyCentralManagerDelegate> |
| 198 low_energy_central_manager_delegate_; | 203 low_energy_central_manager_delegate_; |
| 199 | 204 |
| 200 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; | 205 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
| 201 | 206 |
| 202 base::WeakPtrFactory<BluetoothAdapterMac> weak_ptr_factory_; | 207 base::WeakPtrFactory<BluetoothAdapterMac> weak_ptr_factory_; |
| 203 | 208 |
| 204 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterMac); | 209 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterMac); |
| 205 }; | 210 }; |
| 206 | 211 |
| 207 } // namespace device | 212 } // namespace device |
| 208 | 213 |
| 209 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ | 214 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ |
| OLD | NEW |