Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2243)

Unified Diff: device/bluetooth/bluetooth_low_energy_device_mac.h

Issue 1216583003: Adding Hashed Address to BluetoothLowEnergyDeviceMac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@timeinfo
Patch Set: agl comments Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..502e082a185b97c6fb21cdde24ed75fad7ec1878 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,18 @@ 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
+ // 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;
+
+ // Equivalent to [peripheral_ state]. Allows compilation on OS X 10.6.
+ CBPeripheralState GetPeripheralState() const;
// CoreBluetooth data structure.
base::scoped_nsobject<CBPeripheral> peripheral_;
@@ -96,6 +108,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_;
« no previous file with comments | « device/bluetooth/bluetooth_adapter_mac_unittest.mm ('k') | device/bluetooth/bluetooth_low_energy_device_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698