| 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 <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
| 14 #include "base/mac/scoped_nsobject.h" | 14 #include "base/mac/scoped_nsobject.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
| 19 #include "device/bluetooth/bluetooth_adapter.h" | 19 #include "device/bluetooth/bluetooth_adapter.h" |
| 20 #include "device/bluetooth/bluetooth_audio_sink.h" | 20 #include "device/bluetooth/bluetooth_audio_sink.h" |
| 21 #include "device/bluetooth/bluetooth_device.h" |
| 21 #include "device/bluetooth/bluetooth_discovery_manager_mac.h" | 22 #include "device/bluetooth/bluetooth_discovery_manager_mac.h" |
| 22 #include "device/bluetooth/bluetooth_export.h" | 23 #include "device/bluetooth/bluetooth_export.h" |
| 23 #include "device/bluetooth/bluetooth_low_energy_device_mac.h" | 24 #include "device/bluetooth/bluetooth_low_energy_device_mac.h" |
| 24 #include "device/bluetooth/bluetooth_low_energy_discovery_manager_mac.h" | 25 #include "device/bluetooth/bluetooth_low_energy_discovery_manager_mac.h" |
| 25 | 26 |
| 26 @class IOBluetoothDevice; | 27 @class IOBluetoothDevice; |
| 27 @class NSArray; | 28 @class NSArray; |
| 28 @class NSDate; | 29 @class NSDate; |
| 29 | 30 |
| 30 namespace base { | 31 namespace base { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 void CreateGattConnection(BluetoothLowEnergyDeviceMac* device_mac); | 102 void CreateGattConnection(BluetoothLowEnergyDeviceMac* device_mac); |
| 102 | 103 |
| 103 // Closes the GATT connection by calling CoreBluetooth APIs. | 104 // Closes the GATT connection by calling CoreBluetooth APIs. |
| 104 void DisconnectGatt(BluetoothLowEnergyDeviceMac* device_mac); | 105 void DisconnectGatt(BluetoothLowEnergyDeviceMac* device_mac); |
| 105 | 106 |
| 106 // Methods called from CBCentralManager delegate. | 107 // Methods called from CBCentralManager delegate. |
| 107 void DidConnectPeripheral(CBPeripheral* peripheral); | 108 void DidConnectPeripheral(CBPeripheral* peripheral); |
| 108 void DidFailToConnectPeripheral(CBPeripheral* peripheral, NSError* error); | 109 void DidFailToConnectPeripheral(CBPeripheral* peripheral, NSError* error); |
| 109 void DidDisconnectPeripheral(CBPeripheral* peripheral, NSError* error); | 110 void DidDisconnectPeripheral(CBPeripheral* peripheral, NSError* error); |
| 110 | 111 |
| 112 static NSError* GetNSErrorFromConnectErrorCode( |
| 113 BluetoothDevice::ConnectErrorCode error_code); |
| 114 static BluetoothDevice::ConnectErrorCode GetConnectErrorCodeFromNSError( |
| 115 NSError* error); |
| 116 |
| 111 protected: | 117 protected: |
| 112 // BluetoothAdapter override: | 118 // BluetoothAdapter override: |
| 113 void RemovePairingDelegateInternal( | 119 void RemovePairingDelegateInternal( |
| 114 device::BluetoothDevice::PairingDelegate* pairing_delegate) override; | 120 device::BluetoothDevice::PairingDelegate* pairing_delegate) override; |
| 115 | 121 |
| 116 // Resets |low_energy_central_manager_| to |central_manager| and sets | 122 // Resets |low_energy_central_manager_| to |central_manager| and sets |
| 117 // |low_energy_central_manager_delegate_| as the manager's delegate. Should | 123 // |low_energy_central_manager_delegate_| as the manager's delegate. Should |
| 118 // be called only when |IsLowEnergyAvailable()|. | 124 // be called only when |IsLowEnergyAvailable()|. |
| 119 void SetCentralManagerForTesting(CBCentralManager* central_manager); | 125 void SetCentralManagerForTesting(CBCentralManager* central_manager); |
| 120 CBCentralManager* GetCentralManagerForTesting(); | 126 CBCentralManager* GetCentralManagerForTesting(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; | 204 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
| 199 | 205 |
| 200 base::WeakPtrFactory<BluetoothAdapterMac> weak_ptr_factory_; | 206 base::WeakPtrFactory<BluetoothAdapterMac> weak_ptr_factory_; |
| 201 | 207 |
| 202 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterMac); | 208 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterMac); |
| 203 }; | 209 }; |
| 204 | 210 |
| 205 } // namespace device | 211 } // namespace device |
| 206 | 212 |
| 207 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ | 213 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ |
| OLD | NEW |