| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_GATT_CHARACTERISTIC_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_GATT_CHARACTERISTIC_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_GATT_CHARACTERISTIC_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_GATT_CHARACTERISTIC_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // to implement the delegate methods. | 174 // to implement the delegate methods. |
| 175 // | 175 // |
| 176 // This method only makes sense for local characteristics and does nothing and | 176 // This method only makes sense for local characteristics and does nothing and |
| 177 // returns false if this instance represents a remote characteristic. | 177 // returns false if this instance represents a remote characteristic. |
| 178 virtual bool UpdateValue(const std::vector<uint8_t>& value) = 0; | 178 virtual bool UpdateValue(const std::vector<uint8_t>& value) = 0; |
| 179 | 179 |
| 180 // Starts a notify session for the remote characteristic, if it supports | 180 // Starts a notify session for the remote characteristic, if it supports |
| 181 // notifications/indications. On success, the characteristic starts sending | 181 // notifications/indications. On success, the characteristic starts sending |
| 182 // value notifications and |callback| is called with a session object whose | 182 // value notifications and |callback| is called with a session object whose |
| 183 // ownership belongs to the caller. |error_callback| is called on errors. | 183 // ownership belongs to the caller. |error_callback| is called on errors. |
| 184 // |
| 185 // Writes to the Client Characteristic Configuration descriptor to enable |
| 186 // notifications/indications. Core Bluetooth Specification [V4.2 Vol 3 Part G |
| 187 // Section 3.3.1.1. Characteristic Properties] requires this descriptor to be |
| 188 // present when notifications/indications are supported. If the descriptor is |
| 189 // not present |error_callback| will be run. |
| 184 virtual void StartNotifySession(const NotifySessionCallback& callback, | 190 virtual void StartNotifySession(const NotifySessionCallback& callback, |
| 185 const ErrorCallback& error_callback) = 0; | 191 const ErrorCallback& error_callback) = 0; |
| 186 | 192 |
| 187 // Sends a read request to a remote characteristic to read its value. | 193 // Sends a read request to a remote characteristic to read its value. |
| 188 // |callback| is called to return the read value on success and | 194 // |callback| is called to return the read value on success and |
| 189 // |error_callback| is called for failures. | 195 // |error_callback| is called for failures. |
| 190 virtual void ReadRemoteCharacteristic( | 196 virtual void ReadRemoteCharacteristic( |
| 191 const ValueCallback& callback, | 197 const ValueCallback& callback, |
| 192 const ErrorCallback& error_callback) = 0; | 198 const ErrorCallback& error_callback) = 0; |
| 193 | 199 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 205 BluetoothGattCharacteristic(); | 211 BluetoothGattCharacteristic(); |
| 206 virtual ~BluetoothGattCharacteristic(); | 212 virtual ~BluetoothGattCharacteristic(); |
| 207 | 213 |
| 208 private: | 214 private: |
| 209 DISALLOW_COPY_AND_ASSIGN(BluetoothGattCharacteristic); | 215 DISALLOW_COPY_AND_ASSIGN(BluetoothGattCharacteristic); |
| 210 }; | 216 }; |
| 211 | 217 |
| 212 } // namespace device | 218 } // namespace device |
| 213 | 219 |
| 214 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_CHARACTERISTIC_H_ | 220 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_CHARACTERISTIC_H_ |
| OLD | NEW |