Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_LOW_ENERGY_DEVICE_MAC_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ |
| 7 | 7 |
| 8 #if defined(OS_IOS) | 8 #if defined(OS_IOS) |
| 9 #import <CoreBluetooth/CoreBluetooth.h> | 9 #import <CoreBluetooth/CoreBluetooth.h> |
| 10 #else // !defined(OS_IOS) | 10 #else // !defined(OS_IOS) |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 void DisconnectGatt() override; | 82 void DisconnectGatt() override; |
| 83 | 83 |
| 84 // Methods used by BluetoothLowEnergyPeripheralBridge. | 84 // Methods used by BluetoothLowEnergyPeripheralBridge. |
| 85 void DidDiscoverPrimaryServices(NSError* error); | 85 void DidDiscoverPrimaryServices(NSError* error); |
| 86 void DidModifyServices(NSArray* invalidatedServices); | 86 void DidModifyServices(NSArray* invalidatedServices); |
| 87 void DidDiscoverCharacteristics(CBService* cb_service, NSError* error); | 87 void DidDiscoverCharacteristics(CBService* cb_service, NSError* error); |
| 88 void DidUpdateValue(CBCharacteristic* characteristic, NSError* error); | 88 void DidUpdateValue(CBCharacteristic* characteristic, NSError* error); |
| 89 void DidWriteValue(CBCharacteristic* characteristic, NSError* error); | 89 void DidWriteValue(CBCharacteristic* characteristic, NSError* error); |
| 90 void DidUpdateNotificationState(CBCharacteristic* characteristic, | 90 void DidUpdateNotificationState(CBCharacteristic* characteristic, |
| 91 NSError* error); | 91 NSError* error); |
| 92 void DidDiscoverDescriptors(CBCharacteristic* characteristic, NSError* error); | |
| 92 | 93 |
| 93 static std::string GetPeripheralIdentifier(CBPeripheral* peripheral); | 94 static std::string GetPeripheralIdentifier(CBPeripheral* peripheral); |
| 94 | 95 |
| 95 // Hashes and truncates the peripheral identifier to deterministically | 96 // Hashes and truncates the peripheral identifier to deterministically |
| 96 // construct an address. The use of fake addresses is a temporary fix before | 97 // construct an address. The use of fake addresses is a temporary fix before |
| 97 // we switch to using bluetooth identifiers throughout Chrome. | 98 // we switch to using bluetooth identifiers throughout Chrome. |
| 98 // http://crbug.com/507824 | 99 // http://crbug.com/507824 |
| 99 static std::string GetPeripheralHashAddress(CBPeripheral* peripheral); | 100 static std::string GetPeripheralHashAddress(CBPeripheral* peripheral); |
| 100 | 101 |
| 101 private: | 102 private: |
| 102 friend class BluetoothAdapterMac; | 103 friend class BluetoothAdapterMac; |
| 103 friend class BluetoothAdapterMacTest; | 104 friend class BluetoothAdapterMacTest; |
| 104 friend class BluetoothLowEnergyPeripheralBridge; | 105 friend class BluetoothLowEnergyPeripheralBridge; |
| 105 friend class BluetoothRemoteGattServiceMac; | 106 friend class BluetoothRemoteGattServiceMac; |
| 106 friend class BluetoothTestMac; | 107 friend class BluetoothTestMac; |
| 107 friend class BluetoothRemoteGattServiceMac; | 108 friend class BluetoothRemoteGattServiceMac; |
| 108 | 109 |
| 110 // Sends notification if this device is ready with all services discovered. | |
| 111 void SendNotificationIfComplete(); | |
|
scheib
2017/01/09 21:07:37
Perhaps naming such as SendNotificationIfDiscovery
jlebel
2017/01/09 22:58:32
Done.
| |
| 112 | |
| 109 // Returns the Bluetooth adapter. | 113 // Returns the Bluetooth adapter. |
| 110 BluetoothAdapterMac* GetMacAdapter(); | 114 BluetoothAdapterMac* GetMacAdapter(); |
| 111 | 115 |
| 112 // Returns the CoreBluetooth Peripheral. | 116 // Returns the CoreBluetooth Peripheral. |
| 113 CBPeripheral* GetPeripheral(); | 117 CBPeripheral* GetPeripheral(); |
| 114 | 118 |
| 115 // Returns BluetoothRemoteGattServiceMac based on the CBService. | 119 // Returns BluetoothRemoteGattServiceMac based on the CBService. |
| 116 BluetoothRemoteGattServiceMac* GetBluetoothRemoteGattService( | 120 BluetoothRemoteGattServiceMac* GetBluetoothRemoteGattService( |
| 117 CBService* service) const; | 121 CBService* service) const; |
| 118 | 122 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 135 // A local address for the device created by hashing the peripheral | 139 // A local address for the device created by hashing the peripheral |
| 136 // identifier. | 140 // identifier. |
| 137 std::string hash_address_; | 141 std::string hash_address_; |
| 138 | 142 |
| 139 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDeviceMac); | 143 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDeviceMac); |
| 140 }; | 144 }; |
| 141 | 145 |
| 142 } // namespace device | 146 } // namespace device |
| 143 | 147 |
| 144 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ | 148 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ |
| OLD | NEW |