| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 const ConnectToServiceErrorCallback& error_callback) override; | 74 const ConnectToServiceErrorCallback& error_callback) override; |
| 75 void ConnectToServiceInsecurely( | 75 void ConnectToServiceInsecurely( |
| 76 const device::BluetoothUUID& uuid, | 76 const device::BluetoothUUID& uuid, |
| 77 const ConnectToServiceCallback& callback, | 77 const ConnectToServiceCallback& callback, |
| 78 const ConnectToServiceErrorCallback& error_callback) override; | 78 const ConnectToServiceErrorCallback& error_callback) override; |
| 79 | 79 |
| 80 protected: | 80 protected: |
| 81 // BluetoothDevice override. | 81 // BluetoothDevice override. |
| 82 void CreateGattConnectionImpl() override; | 82 void CreateGattConnectionImpl() override; |
| 83 void DisconnectGatt() override; | 83 void DisconnectGatt() override; |
| 84 void DidConnectGatt() override; |
| 84 | 85 |
| 85 // Methods used by BluetoothLowEnergyPeripheralBridge. | 86 // Methods used by BluetoothLowEnergyPeripheralBridge. |
| 86 void DidDiscoverPrimaryServices(NSError* error); | 87 void DidDiscoverPrimaryServices(NSError* error); |
| 87 void DidModifyServices(NSArray* invalidatedServices); | 88 void DidModifyServices(NSArray* invalidatedServices); |
| 88 void DidDiscoverCharacteristics(CBService* cb_service, NSError* error); | 89 void DidDiscoverCharacteristics(CBService* cb_service, NSError* error); |
| 89 void DidUpdateValue(CBCharacteristic* characteristic, NSError* error); | 90 void DidUpdateValue(CBCharacteristic* characteristic, NSError* error); |
| 90 void DidWriteValue(CBCharacteristic* characteristic, NSError* error); | 91 void DidWriteValue(CBCharacteristic* characteristic, NSError* error); |
| 91 void DidUpdateNotificationState(CBCharacteristic* characteristic, | 92 void DidUpdateNotificationState(CBCharacteristic* characteristic, |
| 92 NSError* error); | 93 NSError* error); |
| 93 void DidDiscoverDescriptors(CBCharacteristic* characteristic, NSError* error); | 94 void DidDiscoverDescriptors(CBCharacteristic* characteristic, NSError* error); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // CoreBluetooth data structure. | 137 // CoreBluetooth data structure. |
| 137 base::scoped_nsobject<CBPeripheral> peripheral_; | 138 base::scoped_nsobject<CBPeripheral> peripheral_; |
| 138 | 139 |
| 139 // Objective-C delegate for the CBPeripheral. | 140 // Objective-C delegate for the CBPeripheral. |
| 140 base::scoped_nsobject<BluetoothLowEnergyPeripheralDelegate> | 141 base::scoped_nsobject<BluetoothLowEnergyPeripheralDelegate> |
| 141 peripheral_delegate_; | 142 peripheral_delegate_; |
| 142 | 143 |
| 143 // Whether the device is connectable. | 144 // Whether the device is connectable. |
| 144 bool connectable_; | 145 bool connectable_; |
| 145 | 146 |
| 147 // Whether the device is connected. |
| 148 bool connected_; |
| 149 |
| 146 // The peripheral's identifier, as returned by [CBPeripheral identifier]. | 150 // The peripheral's identifier, as returned by [CBPeripheral identifier]. |
| 147 std::string identifier_; | 151 std::string identifier_; |
| 148 | 152 |
| 149 // A local address for the device created by hashing the peripheral | 153 // A local address for the device created by hashing the peripheral |
| 150 // identifier. | 154 // identifier. |
| 151 std::string hash_address_; | 155 std::string hash_address_; |
| 152 | 156 |
| 153 // Increases each time -[CBPeripheral discoverServices:] is called, and | 157 // Increases each time -[CBPeripheral discoverServices:] is called, and |
| 154 // decreases each time DidDiscoverPrimaryServices() is called. Once the | 158 // decreases each time DidDiscoverPrimaryServices() is called. Once the |
| 155 // value is set to 0, characteristics and properties are discovered. | 159 // value is set to 0, characteristics and properties are discovered. |
| 156 int discovery_pending_count_; | 160 int discovery_pending_count_; |
| 157 | 161 |
| 158 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDeviceMac); | 162 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDeviceMac); |
| 159 }; | 163 }; |
| 160 | 164 |
| 161 // Stream operator for logging. | 165 // Stream operator for logging. |
| 162 DEVICE_BLUETOOTH_EXPORT std::ostream& operator<<( | 166 DEVICE_BLUETOOTH_EXPORT std::ostream& operator<<( |
| 163 std::ostream& out, | 167 std::ostream& out, |
| 164 const BluetoothLowEnergyDeviceMac& device); | 168 const BluetoothLowEnergyDeviceMac& device); |
| 165 | 169 |
| 166 } // namespace device | 170 } // namespace device |
| 167 | 171 |
| 168 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ | 172 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ |
| OLD | NEW |