| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_CHARACTERISTIC_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 virtual void StartNotifySession(const NotifySessionCallback& callback, | 116 virtual void StartNotifySession(const NotifySessionCallback& callback, |
| 117 const ErrorCallback& error_callback); | 117 const ErrorCallback& error_callback); |
| 118 | 118 |
| 119 // Sends a read request to a remote characteristic to read its value. | 119 // Sends a read request to a remote characteristic to read its value. |
| 120 // |callback| is called to return the read value on success and | 120 // |callback| is called to return the read value on success and |
| 121 // |error_callback| is called for failures. | 121 // |error_callback| is called for failures. |
| 122 virtual void ReadRemoteCharacteristic( | 122 virtual void ReadRemoteCharacteristic( |
| 123 const ValueCallback& callback, | 123 const ValueCallback& callback, |
| 124 const ErrorCallback& error_callback) = 0; | 124 const ErrorCallback& error_callback) = 0; |
| 125 | 125 |
| 126 // Sends a write request to a remote characteristic, to modify the | 126 // Sends a write request to a remote characteristic with the value |value|. |
| 127 // characteristic's value with the new value |new_value|. |callback| is | 127 // |callback| is called to signal success and |error_callback| for failures. |
| 128 // called to signal success and |error_callback| for failures. This method | 128 // This method only applies to remote characteristics and will fail for those |
| 129 // only applies to remote characteristics and will fail for those that are | 129 // that are locally hosted. |
| 130 // locally hosted. | |
| 131 virtual void WriteRemoteCharacteristic( | 130 virtual void WriteRemoteCharacteristic( |
| 132 const std::vector<uint8_t>& new_value, | 131 const std::vector<uint8_t>& value, |
| 133 const base::Closure& callback, | 132 const base::Closure& callback, |
| 134 const ErrorCallback& error_callback) = 0; | 133 const ErrorCallback& error_callback) = 0; |
| 135 | 134 |
| 136 protected: | 135 protected: |
| 137 BluetoothRemoteGattCharacteristic(); | 136 BluetoothRemoteGattCharacteristic(); |
| 138 ~BluetoothRemoteGattCharacteristic() override; | 137 ~BluetoothRemoteGattCharacteristic() override; |
| 139 | 138 |
| 140 // Writes to the Client Characteristic Configuration descriptor to enable | 139 // Writes to the Client Characteristic Configuration descriptor to enable |
| 141 // notifications/indications. This method is meant to be called from | 140 // notifications/indications. This method is meant to be called from |
| 142 // StartNotifySession and should contain only the code necessary to start | 141 // StartNotifySession and should contain only the code necessary to start |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 std::set<BluetoothGattNotifySession*> notify_sessions_; | 230 std::set<BluetoothGattNotifySession*> notify_sessions_; |
| 232 | 231 |
| 233 base::WeakPtrFactory<BluetoothRemoteGattCharacteristic> weak_ptr_factory_; | 232 base::WeakPtrFactory<BluetoothRemoteGattCharacteristic> weak_ptr_factory_; |
| 234 | 233 |
| 235 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristic); | 234 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristic); |
| 236 }; | 235 }; |
| 237 | 236 |
| 238 } // namespace device | 237 } // namespace device |
| 239 | 238 |
| 240 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_H_ | 239 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_H_ |
| OLD | NEW |