Chromium Code Reviews| 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 d8d62efc4d276da29463a10ac7d40eb9e5e7789e..d5d06dec2aa9d7509ec40e030fdf43843181bdb8 100644 |
| --- a/device/bluetooth/bluetooth_low_energy_device_mac.h |
| +++ b/device/bluetooth/bluetooth_low_energy_device_mac.h |
| @@ -7,19 +7,21 @@ |
| #if defined(OS_IOS) |
| #import <CoreBluetooth/CoreBluetooth.h> |
| -#else |
| +#else // !defined(OS_IOS) |
| #import <IOBluetooth/IOBluetooth.h> |
| -#endif |
| +#endif // defined(OS_IOS) |
| #include "base/mac/scoped_nsobject.h" |
| #include "base/mac/sdk_forward_declarations.h" |
| +#include "crypto/sha2.h" |
| #include "device/bluetooth/bluetooth_device_mac.h" |
| namespace device { |
| class BluetoothLowEnergyDiscoverManagerMac; |
| -class BluetoothLowEnergyDeviceMac : public BluetoothDeviceMac { |
| +class DEVICE_BLUETOOTH_EXPORT BluetoothLowEnergyDeviceMac |
| + : public BluetoothDeviceMac { |
| public: |
| BluetoothLowEnergyDeviceMac(CBPeripheral* peripheral, |
| NSDictionary* advertisementData, |
| @@ -84,8 +86,15 @@ class BluetoothLowEnergyDeviceMac : public BluetoothDeviceMac { |
| static std::string GetPeripheralIdentifier(CBPeripheral* peripheral); |
| + // Hashes and truncates the peripheral identifier to deterministically |
| + // construct an address. The use of fake addresses is a temporary fix before |
|
armansito
2015/07/07 22:07:54
nit: Remove extra space character before the secon
krstnmnlsn
2015/07/07 22:43:10
Done.
|
| + // we switch to using bluetooth identifiers throughout Chrome. |
| + // http://crbug.com/507824 |
| + static std::string GetPeripheralHashAddress(CBPeripheral* peripheral); |
| + |
| private: |
| friend class BluetoothAdapterMac; |
| + friend class BluetoothAdapterMacTest; |
| // CoreBluetooth data structure. |
| base::scoped_nsobject<CBPeripheral> peripheral_; |
| @@ -96,6 +105,13 @@ class BluetoothLowEnergyDeviceMac : public BluetoothDeviceMac { |
| // Whether the device is connectable. |
| bool connectable_; |
| + // The peripheral's identifier, as returned by [CBPeripheral identifier]. |
| + std::string identifier_; |
| + |
| + // A local address for the device created by hashing the peripheral |
| + // identifier. |
| + std::string hash_address_; |
| + |
| // Stores the time of the most recent call to Update(). |
| base::scoped_nsobject<NSDate> last_update_time_; |