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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 static std::string GetPeripheralHashAddress(CBPeripheral* peripheral); | 100 static std::string GetPeripheralHashAddress(CBPeripheral* peripheral); |
| 101 | 101 |
| 102 private: | 102 private: |
| 103 friend class BluetoothAdapterMac; | 103 friend class BluetoothAdapterMac; |
| 104 friend class BluetoothAdapterMacTest; | 104 friend class BluetoothAdapterMacTest; |
| 105 friend class BluetoothLowEnergyPeripheralBridge; | 105 friend class BluetoothLowEnergyPeripheralBridge; |
| 106 friend class BluetoothRemoteGattServiceMac; | 106 friend class BluetoothRemoteGattServiceMac; |
| 107 friend class BluetoothTestMac; | 107 friend class BluetoothTestMac; |
| 108 friend class BluetoothRemoteGattServiceMac; | 108 friend class BluetoothRemoteGattServiceMac; |
| 109 | 109 |
| 110 // Calls the macOS to discover primary services. | |
| 111 void DiscoverPrimaryServices(); | |
| 112 | |
| 110 // Sends notification if this device is ready with all services discovered. | 113 // Sends notification if this device is ready with all services discovered. |
| 111 void SendNotificationIfDiscoveryComplete(); | 114 void SendNotificationIfDiscoveryComplete(); |
| 112 | 115 |
| 113 // Returns the Bluetooth adapter. | 116 // Returns the Bluetooth adapter. |
| 114 BluetoothAdapterMac* GetMacAdapter(); | 117 BluetoothAdapterMac* GetMacAdapter(); |
| 115 | 118 |
| 116 // Returns the CoreBluetooth Peripheral. | 119 // Returns the CoreBluetooth Peripheral. |
| 117 CBPeripheral* GetPeripheral(); | 120 CBPeripheral* GetPeripheral(); |
| 118 | 121 |
| 119 // Returns BluetoothRemoteGattServiceMac based on the CBService. | 122 // Returns BluetoothRemoteGattServiceMac based on the CBService. |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 133 // Whether the device is connectable. | 136 // Whether the device is connectable. |
| 134 bool connectable_; | 137 bool connectable_; |
| 135 | 138 |
| 136 // The peripheral's identifier, as returned by [CBPeripheral identifier]. | 139 // The peripheral's identifier, as returned by [CBPeripheral identifier]. |
| 137 std::string identifier_; | 140 std::string identifier_; |
| 138 | 141 |
| 139 // A local address for the device created by hashing the peripheral | 142 // A local address for the device created by hashing the peripheral |
| 140 // identifier. | 143 // identifier. |
| 141 std::string hash_address_; | 144 std::string hash_address_; |
| 142 | 145 |
| 146 // Increases each time -[CBPeripheral discoverServices:] is called, and | |
|
ortuno
2017/01/23 06:12:39
nit optional: I would move this comment to Discove
| |
| 147 // decreases each time DidDiscoverPrimaryServices() is called. Once the | |
| 148 // value is set to 0, characteristics and properties are discovered. | |
| 149 int discovery_pending_count_; | |
| 150 | |
| 143 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDeviceMac); | 151 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDeviceMac); |
| 144 }; | 152 }; |
| 145 | 153 |
| 146 } // namespace device | 154 } // namespace device |
| 147 | 155 |
| 148 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ | 156 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ |
| OLD | NEW |