Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_REMOTE_GATT_DESCRIPTOR_MAC_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_MAC_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_MAC_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_MAC_H_ |
| 7 | 7 |
| 8 #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" | 8 #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 // BluetoothRemoteGattDescriptor | 37 // BluetoothRemoteGattDescriptor |
| 38 const std::vector<uint8_t>& GetValue() const override; | 38 const std::vector<uint8_t>& GetValue() const override; |
| 39 BluetoothRemoteGattCharacteristic* GetCharacteristic() const override; | 39 BluetoothRemoteGattCharacteristic* GetCharacteristic() const override; |
| 40 void ReadRemoteDescriptor(const ValueCallback& callback, | 40 void ReadRemoteDescriptor(const ValueCallback& callback, |
| 41 const ErrorCallback& error_callback) override; | 41 const ErrorCallback& error_callback) override; |
| 42 void WriteRemoteDescriptor(const std::vector<uint8_t>& new_value, | 42 void WriteRemoteDescriptor(const std::vector<uint8_t>& new_value, |
| 43 const base::Closure& callback, | 43 const base::Closure& callback, |
| 44 const ErrorCallback& error_callback) override; | 44 const ErrorCallback& error_callback) override; |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 friend class BluetoothLowEnergyDeviceMac; | |
| 47 friend class BluetoothRemoteGattCharacteristicMac; | 48 friend class BluetoothRemoteGattCharacteristicMac; |
| 49 friend class BluetoothTestMac; | |
| 48 | 50 |
| 51 // Calls callbacks, when -[id<CBPeripheralDelegate> | |
| 52 // peripheral:didUpdateValueForDescriptor:error:] is called. | |
| 53 void DidUpdateValueForDescriptor(NSError* error); | |
| 54 // Calls callbacks, when -[id<CBPeripheralDelegate> | |
| 55 // peripheral:didWriteValueForDescriptor:error:] is called. | |
| 56 void DidWriteValueForDescriptor(NSError* error); | |
| 57 | |
| 58 // Returns CoreBluetooth peripheral. | |
| 59 CBPeripheral* GetCBPeripheral() const; | |
| 49 // Returns CoreBluetooth descriptor. | 60 // Returns CoreBluetooth descriptor. |
| 50 CBDescriptor* GetCBDescriptor() const; | 61 CBDescriptor* GetCBDescriptor() const; |
| 51 // gatt_characteristic_ owns instances of this class. | 62 // gatt_characteristic_ owns instances of this class. |
| 52 BluetoothRemoteGattCharacteristicMac* gatt_characteristic_; | 63 BluetoothRemoteGattCharacteristicMac* gatt_characteristic_; |
| 53 // Descriptor from CoreBluetooth. | 64 // Descriptor from CoreBluetooth. |
| 54 base::scoped_nsobject<CBDescriptor> cb_descriptor_; | 65 base::scoped_nsobject<CBDescriptor> cb_descriptor_; |
| 55 // Descriptor identifier. | 66 // Descriptor identifier. |
| 56 std::string identifier_; | 67 std::string identifier_; |
| 57 // Descriptor UUID. | 68 // Descriptor UUID. |
| 58 BluetoothUUID uuid_; | 69 BluetoothUUID uuid_; |
| 59 // Descriptor value. | 70 // Descriptor value. |
| 60 std::vector<uint8_t> value_; | 71 std::vector<uint8_t> value_; |
| 72 // True if a gatt read or write request is in progress. | |
| 73 bool value_read_or_write_in_progress_; | |
|
ortuno
2017/04/03 01:27:50
Don't forget to initialize this, otherwise we will
jlebel
2017/04/04 22:13:12
Done.
| |
| 74 // ReadRemoteDescriptor request callbacks. | |
| 75 std::pair<ValueCallback, ErrorCallback> read_value_callbacks_; | |
| 76 // WriteRemoteDescriptor request callbacks. | |
| 77 std::pair<base::Closure, ErrorCallback> write_value_callbacks_; | |
| 61 }; | 78 }; |
| 62 | 79 |
| 63 // Stream operator for logging. | 80 // Stream operator for logging. |
| 64 DEVICE_BLUETOOTH_EXPORT std::ostream& operator<<( | 81 DEVICE_BLUETOOTH_EXPORT std::ostream& operator<<( |
| 65 std::ostream& out, | 82 std::ostream& out, |
| 66 const BluetoothRemoteGattDescriptorMac& descriptor); | 83 const BluetoothRemoteGattDescriptorMac& descriptor); |
| 67 | 84 |
| 68 } // namespace device | 85 } // namespace device |
| 69 | 86 |
| 70 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_MAC_H_ | 87 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_MAC_H_ |
| OLD | NEW |