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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 // Returns the CoreBluetooth Peripheral. | 119 // Returns the CoreBluetooth Peripheral. |
120 CBPeripheral* GetPeripheral(); | 120 CBPeripheral* GetPeripheral(); |
121 | 121 |
122 // Returns BluetoothRemoteGattServiceMac based on the CBService. | 122 // Returns BluetoothRemoteGattServiceMac based on the CBService. |
123 BluetoothRemoteGattServiceMac* GetBluetoothRemoteGattService( | 123 BluetoothRemoteGattServiceMac* GetBluetoothRemoteGattService( |
124 CBService* service) const; | 124 CBService* service) const; |
125 | 125 |
126 // Callback used when the CoreBluetooth Peripheral is disconnected. | 126 // Callback used when the CoreBluetooth Peripheral is disconnected. |
127 void DidDisconnectPeripheral(NSError* error); | 127 void DidDisconnectPeripheral(NSError* error); |
128 | 128 |
129 // Returns a description for the device, that should be used for logs. | |
ortuno
2017/03/14 00:34:33
I should have suggested this before but I wasn't s
jlebel
2017/03/15 01:08:40
Done.
| |
130 std::string ToString() const; | |
131 | |
129 // CoreBluetooth data structure. | 132 // CoreBluetooth data structure. |
130 base::scoped_nsobject<CBPeripheral> peripheral_; | 133 base::scoped_nsobject<CBPeripheral> peripheral_; |
131 | 134 |
132 // Objective-C delegate for the CBPeripheral. | 135 // Objective-C delegate for the CBPeripheral. |
133 base::scoped_nsobject<BluetoothLowEnergyPeripheralDelegate> | 136 base::scoped_nsobject<BluetoothLowEnergyPeripheralDelegate> |
134 peripheral_delegate_; | 137 peripheral_delegate_; |
135 | 138 |
136 // Whether the device is connectable. | 139 // Whether the device is connectable. |
137 bool connectable_; | 140 bool connectable_; |
138 | 141 |
139 // The peripheral's identifier, as returned by [CBPeripheral identifier]. | 142 // The peripheral's identifier, as returned by [CBPeripheral identifier]. |
140 std::string identifier_; | 143 std::string identifier_; |
141 | 144 |
142 // A local address for the device created by hashing the peripheral | 145 // A local address for the device created by hashing the peripheral |
143 // identifier. | 146 // identifier. |
144 std::string hash_address_; | 147 std::string hash_address_; |
145 | 148 |
146 // Increases each time -[CBPeripheral discoverServices:] is called, and | 149 // Increases each time -[CBPeripheral discoverServices:] is called, and |
147 // decreases each time DidDiscoverPrimaryServices() is called. Once the | 150 // decreases each time DidDiscoverPrimaryServices() is called. Once the |
148 // value is set to 0, characteristics and properties are discovered. | 151 // value is set to 0, characteristics and properties are discovered. |
149 int discovery_pending_count_; | 152 int discovery_pending_count_; |
150 | 153 |
151 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDeviceMac); | 154 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDeviceMac); |
152 }; | 155 }; |
153 | 156 |
154 } // namespace device | 157 } // namespace device |
155 | 158 |
156 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ | 159 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ |
OLD | NEW |