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_DESCRIPTOR_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_GATT_DESCRIPTOR_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_GATT_DESCRIPTOR_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_GATT_DESCRIPTOR_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 virtual bool IsLocal() const = 0; | 139 virtual bool IsLocal() const = 0; |
140 | 140 |
141 // Returns the value of the descriptor. For remote descriptors, this is the | 141 // Returns the value of the descriptor. For remote descriptors, this is the |
142 // most recently cached value of the remote descriptor. For local descriptors | 142 // most recently cached value of the remote descriptor. For local descriptors |
143 // this is the most recently updated value or the value retrieved from the | 143 // this is the most recently updated value or the value retrieved from the |
144 // delegate. | 144 // delegate. |
145 virtual const std::vector<uint8>& GetValue() const = 0; | 145 virtual const std::vector<uint8>& GetValue() const = 0; |
146 | 146 |
147 // Returns a pointer to the GATT characteristic that this characteristic | 147 // Returns a pointer to the GATT characteristic that this characteristic |
148 // descriptor belongs to. | 148 // descriptor belongs to. |
149 virtual const BluetoothGattCharacteristic* GetCharacteristic() const = 0; | 149 virtual BluetoothGattCharacteristic* GetCharacteristic() const = 0; |
150 | 150 |
151 // Sends a read request to a remote characteristic descriptor to read its | 151 // Sends a read request to a remote characteristic descriptor to read its |
152 // value. |callback| is called to return the read value on success and | 152 // value. |callback| is called to return the read value on success and |
153 // |error_callback| is called for failures. | 153 // |error_callback| is called for failures. |
154 virtual void ReadRemoteDescriptor(const ValueCallback& callback, | 154 virtual void ReadRemoteDescriptor(const ValueCallback& callback, |
155 const ErrorCallback& error_callback) = 0; | 155 const ErrorCallback& error_callback) = 0; |
156 | 156 |
157 // Sends a write request to a remote characteristic descriptor, to modify the | 157 // Sends a write request to a remote characteristic descriptor, to modify the |
158 // value of the descriptor starting at offset |offset| with the new value | 158 // value of the descriptor starting at offset |offset| with the new value |
159 // |new_value|. |callback| is called to signal success and |error_callback| | 159 // |new_value|. |callback| is called to signal success and |error_callback| |
160 // for failures. This method only applies to remote descriptors and will fail | 160 // for failures. This method only applies to remote descriptors and will fail |
161 // for those that are locally hosted. | 161 // for those that are locally hosted. |
162 virtual void WriteRemoteDescriptor( | 162 virtual void WriteRemoteDescriptor( |
163 int offset, | 163 int offset, |
164 const std::vector<uint8>& new_value, | 164 const std::vector<uint8>& new_value, |
165 const base::Closure& callback, | 165 const base::Closure& callback, |
166 const ErrorCallback& error_callback) = 0; | 166 const ErrorCallback& error_callback) = 0; |
167 | 167 |
168 protected: | 168 protected: |
169 BluetoothGattDescriptor(); | 169 BluetoothGattDescriptor(); |
170 virtual ~BluetoothGattDescriptor(); | 170 virtual ~BluetoothGattDescriptor(); |
171 | 171 |
172 private: | 172 private: |
173 DISALLOW_COPY_AND_ASSIGN(BluetoothGattDescriptor); | 173 DISALLOW_COPY_AND_ASSIGN(BluetoothGattDescriptor); |
174 }; | 174 }; |
175 | 175 |
176 } // namespace device | 176 } // namespace device |
177 | 177 |
178 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_DESCRIPTOR_H_ | 178 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_DESCRIPTOR_H_ |
OLD | NEW |