| Index: device/bluetooth/bluetooth_low_energy_device_mac.h
|
| diff --git a/device/bluetooth/bluetooth_low_energy_device_mac.h b/device/bluetooth/bluetooth_low_energy_device_mac.h
|
| index 2a341767ab30a6029846a1a7853dcfca0b8724c0..34bdc76f8fdfa4d52feb5738b9a9e9de992db412 100644
|
| --- a/device/bluetooth/bluetooth_low_energy_device_mac.h
|
| +++ b/device/bluetooth/bluetooth_low_energy_device_mac.h
|
| @@ -16,6 +16,7 @@
|
| #include "base/mac/scoped_nsobject.h"
|
| #include "base/mac/sdk_forward_declarations.h"
|
| #include "crypto/sha2.h"
|
| +#include "device/bluetooth/bluetooth_adapter.h"
|
| #include "device/bluetooth/bluetooth_device_mac.h"
|
|
|
| namespace device {
|
| @@ -27,7 +28,9 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothLowEnergyDeviceMac
|
| public:
|
| BluetoothLowEnergyDeviceMac(CBPeripheral* peripheral,
|
| NSDictionary* advertisement_data,
|
| - int rssi);
|
| + int rssi,
|
| + BluetoothAdapter* adapter,
|
| + CBCentralManager* central_manager);
|
| ~BluetoothLowEnergyDeviceMac() override;
|
|
|
| int GetRSSI() const;
|
| @@ -97,13 +100,23 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothLowEnergyDeviceMac
|
| private:
|
| friend class BluetoothAdapterMac;
|
| friend class BluetoothAdapterMacTest;
|
| + friend class BluetoothGattConnectionMac;
|
|
|
| // Equivalent to [peripheral_ state]. Allows compilation on OS X 10.6.
|
| CBPeripheralState GetPeripheralState() const;
|
|
|
| - // CoreBluetooth data structure.
|
| + // Convenience method to clear the four callback vectors.
|
| + void ClearConnectionCallbacks();
|
| +
|
| + // Underylying CoreBluetooth representation of the bluetooth device.
|
| base::scoped_nsobject<CBPeripheral> peripheral_;
|
|
|
| + // Underlying CoreBluetooth CBCentralManager.
|
| + CBCentralManager* central_manager_ = nil;
|
| +
|
| + // The adapter that owns this device instance.
|
| + BluetoothAdapter* adapter_ = NULL;
|
| +
|
| // RSSI value.
|
| int rssi_;
|
|
|
| @@ -123,6 +136,16 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothLowEnergyDeviceMac
|
| // The services (identified by UUIDs) that this device provides.
|
| std::set<BluetoothUUID> advertised_uuids_;
|
|
|
| + // Lists of CreateGattConnection() and Disconnect() callbacks.
|
| + std::vector<GattConnectionCallback> create_gatt_connection_success_callbacks_;
|
| + std::vector<ConnectErrorCallback> create_gatt_connection_error_callbacks_;
|
| + std::vector<base::Closure> disconnect_success_callbacks_;
|
| + std::vector<ErrorCallback> disconnect_error_callbacks_;
|
| +
|
| + // Note: This should remain the last member so it'll be destroyed and
|
| + // invalidate its weak pointers before any other members are destroyed.
|
| + base::WeakPtrFactory<BluetoothLowEnergyDeviceMac> weak_ptr_factory_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDeviceMac);
|
| };
|
|
|
|
|