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_SERVICE_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_GATT_SERVICE_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_GATT_SERVICE_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_GATT_SERVICE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 // service |service| has been removed. This method is for convenience | 166 // service |service| has been removed. This method is for convenience |
167 // and will be followed by a call to GattServiceChanged (except when called | 167 // and will be followed by a call to GattServiceChanged (except when called |
168 // after the service gets removed) which should be used for bootstrapping a | 168 // after the service gets removed) which should be used for bootstrapping a |
169 // GATT based profile. See the documentation of GattCharacteristicAdded and | 169 // GATT based profile. See the documentation of GattCharacteristicAdded and |
170 // GattServiceChanged for more information. Try to obtain the service from | 170 // GattServiceChanged for more information. Try to obtain the service from |
171 // its device to see whether or not the service has been removed. | 171 // its device to see whether or not the service has been removed. |
172 virtual void GattCharacteristicRemoved( | 172 virtual void GattCharacteristicRemoved( |
173 BluetoothGattService* service, | 173 BluetoothGattService* service, |
174 BluetoothGattCharacteristic* characteristic) {} | 174 BluetoothGattCharacteristic* characteristic) {} |
175 | 175 |
| 176 // Called when the remote GATT characteristic descriptor |descriptor| |
| 177 // belonging to characteristic |characteristic| has been discovered. Don't |
| 178 // cache the arguments as the pointers may become invalid. Instead, use the |
| 179 // specially assigned identifier to obtain a descriptor and cache that |
| 180 // identifier as necessary. |
| 181 // |
| 182 // This method will always be followed by a call to GattServiceChanged, |
| 183 // which can be used by observers to get all the characteristics of a |
| 184 // service and perform the necessary updates. GattDescriptorAdded exists |
| 185 // mostly for convenience. |
| 186 virtual void GattDescriptorAdded( |
| 187 BluetoothGattCharacteristic* characteristic, |
| 188 BluetoothGattDescriptor* descriptor) {} |
| 189 |
| 190 // Called when a GATT characteristic descriptor |descriptor| belonging to |
| 191 // characteristic |characteristic| has been removed. This method is for |
| 192 // convenience and will be followed by a call to GattServiceChanged (except |
| 193 // when called after the service gets removed). |
| 194 virtual void GattDescriptorRemoved( |
| 195 BluetoothGattCharacteristic* characteristic, |
| 196 BluetoothGattDescriptor* descriptor) {} |
| 197 |
176 // Called when the value of a characteristic has changed. This might be a | 198 // Called when the value of a characteristic has changed. This might be a |
177 // result of a read/write request to, or a notification/indication from, a | 199 // result of a read/write request to, or a notification/indication from, a |
178 // remote GATT characteristic. | 200 // remote GATT characteristic. |
179 virtual void GattCharacteristicValueChanged( | 201 virtual void GattCharacteristicValueChanged( |
180 BluetoothGattService* service, | 202 BluetoothGattService* service, |
181 BluetoothGattCharacteristic* characteristic, | 203 BluetoothGattCharacteristic* characteristic, |
182 const std::vector<uint8>& value) {} | 204 const std::vector<uint8>& value) {} |
| 205 |
| 206 // Called when the value of a characteristic descriptor has been updated. |
| 207 virtual void GattDescriptorValueChanged( |
| 208 BluetoothGattCharacteristic* characteristic, |
| 209 BluetoothGattDescriptor* descriptor, |
| 210 const std::vector<uint8>& value) {} |
183 }; | 211 }; |
184 | 212 |
185 // The ErrorCallback is used by methods to asynchronously report errors. | 213 // The ErrorCallback is used by methods to asynchronously report errors. |
186 typedef base::Closure ErrorCallback; | 214 typedef base::Closure ErrorCallback; |
187 | 215 |
188 virtual ~BluetoothGattService(); | 216 virtual ~BluetoothGattService(); |
189 | 217 |
190 // Adds and removes observers for events on this GATT service. If monitoring | 218 // Adds and removes observers for events on this GATT service. If monitoring |
191 // multiple services, check the |service| parameter of observer methods to | 219 // multiple services, check the |service| parameter of observer methods to |
192 // determine which service is issuing the event. | 220 // determine which service is issuing the event. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 protected: | 298 protected: |
271 BluetoothGattService(); | 299 BluetoothGattService(); |
272 | 300 |
273 private: | 301 private: |
274 DISALLOW_COPY_AND_ASSIGN(BluetoothGattService); | 302 DISALLOW_COPY_AND_ASSIGN(BluetoothGattService); |
275 }; | 303 }; |
276 | 304 |
277 } // namespace device | 305 } // namespace device |
278 | 306 |
279 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_SERVICE_H_ | 307 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_SERVICE_H_ |
OLD | NEW |