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 // The <code>chrome.bluetoothLowEnergy</code> API is used to communicate with | 5 // The <code>chrome.bluetoothLowEnergy</code> API is used to communicate with |
6 // Bluetooth Smart (Low Energy) devices using the | 6 // Bluetooth Smart (Low Energy) devices using the |
7 // <a href="https://developer.bluetooth.org/TechnologyOverview/Pages/GATT.aspx"> | 7 // <a href="https://developer.bluetooth.org/TechnologyOverview/Pages/GATT.aspx"> |
8 // Generic Attribute Profile (GATT)</a>. | 8 // Generic Attribute Profile (GATT)</a>. |
9 namespace bluetoothLowEnergy { | 9 namespace bluetoothLowEnergy { |
10 // Values representing the possible properties of a characteristic. | 10 // Values representing the possible properties of a characteristic. |
11 enum CharacteristicProperty {broadcast, read, writeWithoutResponse, write, | 11 enum CharacteristicProperty {broadcast, read, writeWithoutResponse, write, |
12 notify, indicate, authenticatedSignedWrites, | 12 notify, indicate, authenticatedSignedWrites, |
13 extendedProperties, reliableWrite, | 13 extendedProperties, reliableWrite, |
14 writableAuxiliaries}; | 14 writableAuxiliaries}; |
15 | 15 |
16 // Type of advertisement. If 'broadcast' is chosen, the sent advertisement | 16 // Type of advertisement. If 'broadcast' is chosen, the sent advertisement |
17 // type will be ADV_NONCONN_IND and the device will broadcast with a random | 17 // type will be ADV_NONCONN_IND and the device will broadcast with a random |
18 // MAC Address. If set to 'peripheral', the advertisement type will be | 18 // MAC Address. If set to 'peripheral', the advertisement type will be |
19 // ADV_IND or ADV_SCAN_IND and the device will broadcast with real Bluetooth | 19 // ADV_IND or ADV_SCAN_IND and the device will broadcast with real Bluetooth |
20 // Adapter's MAC Address. | 20 // Adapter's MAC Address. |
21 enum AdvertisementType {broadcast, peripheral}; | 21 enum AdvertisementType {broadcast, peripheral}; |
22 | 22 |
23 // Result of a register or unregister service call. | |
24 enum ServiceResult {success, alreadyRegistered, notRegistered}; | |
Devlin
2016/04/26 23:14:05
comment these enums.
rkc
2016/04/27 00:00:39
Done.
| |
25 | |
26 // Represents a bluetooth central device that is connected to the local GATT | |
27 // server. | |
28 dictionary Device { | |
29 // The address of the device, in the format 'XX:XX:XX:XX:XX:XX'. | |
30 DOMString address; | |
31 | |
32 // The human-readable name of the device. | |
33 DOMString? name; | |
34 | |
35 // The class of the device, a bit-field defined by | |
36 // http://www.bluetooth.org/en-us/specification/assigned-numbers/baseband. | |
37 long? deviceClass; | |
38 }; | |
39 | |
23 // Represents a peripheral's Bluetooth GATT Service, a collection of | 40 // Represents a peripheral's Bluetooth GATT Service, a collection of |
24 // characteristics and relationships to other services that encapsulate | 41 // characteristics and relationships to other services that encapsulate |
25 // the behavior of part of a device. | 42 // the behavior of part of a device. |
26 dictionary Service { | 43 dictionary Service { |
27 // The UUID of the service, e.g. 0000180d-0000-1000-8000-00805f9b34fb. | 44 // The UUID of the service, e.g. 0000180d-0000-1000-8000-00805f9b34fb. |
28 DOMString uuid; | 45 DOMString uuid; |
29 | 46 |
30 // Indicates whether the type of this service is primary or secondary. | 47 // Indicates whether the type of this service is primary or secondary. |
31 boolean isPrimary; | 48 boolean isPrimary; |
32 | 49 |
33 // Indicates whether this service represents a local service hosted by the | |
34 // application and available to other peripherals, or a remote service | |
35 // hosted and received from a remote peripheral. | |
36 [nodoc] boolean isLocal; | |
37 | |
38 // Returns the identifier assigned to this service. Use the instance ID to | 50 // Returns the identifier assigned to this service. Use the instance ID to |
39 // distinguish between services from a peripheral with the same UUID and | 51 // distinguish between services from a peripheral with the same UUID and |
40 // to make function calls that take in a service identifier. Present, if | 52 // to make function calls that take in a service identifier. Present, if |
41 // this instance represents a remote service. | 53 // this instance represents a remote service. |
42 DOMString? instanceId; | 54 DOMString? instanceId; |
43 | 55 |
44 // The device address of the remote peripheral that the GATT service belongs | 56 // The device address of the remote peripheral that the GATT service belongs |
45 // to. Present, if this instance represents a remote service. | 57 // to. Present, if this instance represents a remote service. |
46 DOMString? deviceAddress; | 58 DOMString? deviceAddress; |
47 }; | 59 }; |
48 | 60 |
49 // Represents a GATT characteristic, which is a basic data element that | 61 // Represents a GATT characteristic, which is a basic data element that |
50 // provides further information about a peripheral's service. | 62 // provides further information about a peripheral's service. |
51 dictionary Characteristic { | 63 dictionary Characteristic { |
52 // The UUID of the characteristic, e.g. | 64 // The UUID of the characteristic, e.g. |
53 // 00002a37-0000-1000-8000-00805f9b34fb. | 65 // 00002a37-0000-1000-8000-00805f9b34fb. |
54 DOMString uuid; | 66 DOMString uuid; |
55 | 67 |
56 // Indicates whether this characteristic represents a local characteristic | |
57 // hosted by the application and available to other peripherals, or a remote | |
58 // characteristic hosted and received from a remote peripheral. | |
59 [nodoc] boolean isLocal; | |
60 | |
61 // The GATT service this characteristic belongs to. | 68 // The GATT service this characteristic belongs to. |
62 Service service; | 69 Service? service; |
63 | 70 |
64 // The properties of this characteristic. | 71 // The properties of this characteristic. |
65 CharacteristicProperty[] properties; | 72 CharacteristicProperty[] properties; |
66 | 73 |
67 // Returns the identifier assigned to this characteristic. Use the instance | 74 // Returns the identifier assigned to this characteristic. Use the instance |
68 // ID to distinguish between characteristics from a peripheral with the same | 75 // ID to distinguish between characteristics from a peripheral with the same |
69 // UUID and to make function calls that take in a characteristic identifier. | 76 // UUID and to make function calls that take in a characteristic identifier. |
70 // Present, if this instance represents a remote characteristic. | 77 // Present, if this instance represents a remote characteristic. |
71 DOMString? instanceId; | 78 DOMString? instanceId; |
72 | 79 |
73 // The currently cached characteristic value. This value gets updated when | 80 // The currently cached characteristic value. This value gets updated when |
74 // the value of the characteristic is read or updated via a notification | 81 // the value of the characteristic is read or updated via a notification |
75 // or indication. | 82 // or indication. |
76 ArrayBuffer? value; | 83 ArrayBuffer? value; |
77 }; | 84 }; |
78 | 85 |
79 // Represents a GATT characteristic descriptor, which provides further | 86 // Represents a GATT characteristic descriptor, which provides further |
80 // information about a characteristic's value. | 87 // information about a characteristic's value. |
81 dictionary Descriptor { | 88 dictionary Descriptor { |
82 // The UUID of the characteristic descriptor, e.g. | 89 // The UUID of the characteristic descriptor, e.g. |
83 // 00002902-0000-1000-8000-00805f9b34fb. | 90 // 00002902-0000-1000-8000-00805f9b34fb. |
84 DOMString uuid; | 91 DOMString uuid; |
85 | 92 |
86 // Indicates whether this descriptor represents a local descriptor | |
87 // hosted by the application and available to other peripherals, or a remote | |
88 // descriptor hosted and received from a remote peripheral. | |
89 [nodoc] boolean isLocal; | |
90 | |
91 // The GATT characteristic this descriptor belongs to. | 93 // The GATT characteristic this descriptor belongs to. |
92 Characteristic characteristic; | 94 Characteristic? characteristic; |
93 | 95 |
94 // Returns the identifier assigned to this descriptor. Use the instance ID | 96 // Returns the identifier assigned to this descriptor. Use the instance ID |
95 // to distinguish between descriptors from a peripheral with the same UUID | 97 // to distinguish between descriptors from a peripheral with the same UUID |
96 // and to make function calls that take in a descriptor identifier. Present, | 98 // and to make function calls that take in a descriptor identifier. Present, |
97 // if this instance represents a remote characteristic. | 99 // if this instance represents a remote characteristic. |
98 DOMString? instanceId; | 100 DOMString? instanceId; |
99 | 101 |
100 // The currently cached descriptor value. This value gets updated when | 102 // The currently cached descriptor value. This value gets updated when |
101 // the value of the descriptor is read. | 103 // the value of the descriptor is read. |
102 ArrayBuffer? value; | 104 ArrayBuffer? value; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 // List of UUIDs to include in the "Solicit UUIDs" field of the Advertising | 153 // List of UUIDs to include in the "Solicit UUIDs" field of the Advertising |
152 // Data. These UUIDs can be of the 16bit, 32bit or 128 formats. | 154 // Data. These UUIDs can be of the 16bit, 32bit or 128 formats. |
153 DOMString[]? solicitUuids; | 155 DOMString[]? solicitUuids; |
154 | 156 |
155 // List of service data to be included in "Service Data" fields of the adver tising | 157 // List of service data to be included in "Service Data" fields of the adver tising |
156 // data. | 158 // data. |
157 ServiceData[]? serviceData; | 159 ServiceData[]? serviceData; |
158 }; | 160 }; |
159 | 161 |
160 callback CharacteristicCallback = void(Characteristic result); | 162 callback CharacteristicCallback = void(Characteristic result); |
163 callback CreateCharacteristicCallback = void(DOMString characteristicId); | |
161 callback CharacteristicsCallback = void(Characteristic[] result); | 164 callback CharacteristicsCallback = void(Characteristic[] result); |
162 callback DescriptorCallback = void(Descriptor result); | 165 callback DescriptorCallback = void(Descriptor result); |
166 callback CreateDescriptorCallback = void(DOMString descriptorId); | |
163 callback DescriptorsCallback = void(Descriptor[] result); | 167 callback DescriptorsCallback = void(Descriptor[] result); |
164 callback ResultCallback = void(); | 168 callback ResultCallback = void(); |
165 callback ServiceCallback = void(Service result); | 169 callback ServiceCallback = void(Service result); |
170 callback CreateServiceCallback = void(DOMString serviceId); | |
166 callback ServicesCallback = void(Service[] result); | 171 callback ServicesCallback = void(Service[] result); |
172 callback ServiceResultCallback = void(ServiceResult result); | |
167 callback RegisterAdvertisementCallback = void (long advertisementId); | 173 callback RegisterAdvertisementCallback = void (long advertisementId); |
174 callback ValueCallback = void (ArrayBuffer value); | |
Devlin
2016/04/26 23:14:05
no space after void
rkc
2016/04/27 00:00:39
Done.
| |
168 | 175 |
169 // These functions all report failures via chrome.runtime.lastError. | 176 // These functions all report failures via chrome.runtime.lastError. |
170 interface Functions { | 177 interface Functions { |
171 // Establishes a connection between the application and the device with the | 178 // Establishes a connection between the application and the device with the |
172 // given address. A device may be already connected and its GATT services | 179 // given address. A device may be already connected and its GATT services |
173 // available without calling <code>connect</code>, however, an app that | 180 // available without calling <code>connect</code>, however, an app that |
174 // wants to access GATT services of a device should call this function to | 181 // wants to access GATT services of a device should call this function to |
175 // make sure that a connection to the device is maintained. If the device | 182 // make sure that a connection to the device is maintained. If the device |
176 // is not connected, all GATT services of the device will be discovered | 183 // is not connected, all GATT services of the device will be discovered |
177 // after a successful call to <code>connect</code>. | 184 // after a successful call to <code>connect</code>. |
(...skipping 11 matching lines...) Expand all Loading... | |
189 // |deviceAddress| : The Bluetooth address of the remote device. | 196 // |deviceAddress| : The Bluetooth address of the remote device. |
190 // |callback| : Called when the disconnect request has completed. | 197 // |callback| : Called when the disconnect request has completed. |
191 static void disconnect(DOMString deviceAddress, | 198 static void disconnect(DOMString deviceAddress, |
192 optional ResultCallback callback); | 199 optional ResultCallback callback); |
193 | 200 |
194 // Get the GATT service with the given instance ID. | 201 // Get the GATT service with the given instance ID. |
195 // |serviceId| : The instance ID of the requested GATT service. | 202 // |serviceId| : The instance ID of the requested GATT service. |
196 // |callback| : Called with the requested Service object. | 203 // |callback| : Called with the requested Service object. |
197 static void getService(DOMString serviceId, ServiceCallback callback); | 204 static void getService(DOMString serviceId, ServiceCallback callback); |
198 | 205 |
206 // Create a locally hosted GATT service. This service can be registered | |
207 // to be available on a local GATT server. | |
208 // |service| : The service to create. | |
Devlin
2016/04/26 23:14:06
no space after |service|
rkc
2016/04/27 00:00:39
I think I am missing something. All other paramete
Devlin
2016/04/27 14:45:03
They probably copied style from another API idl fi
rkc
2016/04/27 20:38:56
Sure. Also fixed all of the parameters in this fil
| |
209 // |callback| : Called with the created services's unique ID. | |
210 static void createService(Service service, CreateServiceCallback callback); | |
211 | |
199 // Get all the GATT services that were discovered on the remote device with | 212 // Get all the GATT services that were discovered on the remote device with |
200 // the given device address. | 213 // the given device address. |
201 // |deviceAddress| : The Bluetooth address of the remote device whose GATT | 214 // |deviceAddress| : The Bluetooth address of the remote device whose GATT |
202 // services should be returned. | 215 // services should be returned. |
203 // |callback| : Called with the list of requested Service objects. | 216 // |callback| : Called with the list of requested Service objects. |
204 static void getServices(DOMString deviceAddress, ServicesCallback callback); | 217 static void getServices(DOMString deviceAddress, ServicesCallback callback); |
205 | 218 |
206 // Get the GATT characteristic with the given instance ID that belongs to | 219 // Get the GATT characteristic with the given instance ID that belongs to |
207 // the given GATT service, if the characteristic exists. | 220 // the given GATT service, if the characteristic exists. |
208 // |characteristicId| : The instance ID of the requested GATT | 221 // |characteristicId| : The instance ID of the requested GATT |
209 // characteristic. | 222 // characteristic. |
210 // |callback| : Called with the requested Characteristic object. | 223 // |callback| : Called with the requested Characteristic object. |
211 static void getCharacteristic(DOMString characteristicId, | 224 static void getCharacteristic(DOMString characteristicId, |
212 CharacteristicCallback callback); | 225 CharacteristicCallback callback); |
213 | 226 |
227 // Create a locally hosted GATT characteristic. This characteristic must | |
228 // be hosted under a valid service. If the service ID is not valid, the | |
229 // lastError will be set. | |
230 // |characteristic| : The characteristic to create. | |
231 // |serviceId| : ID of the service to create this characteristic for. | |
232 // |callback| : Called with the created characteristic's unique ID. | |
233 static void createCharacteristic(Characteristic characteristic, | |
234 DOMString serviceId, | |
235 CreateCharacteristicCallback callback); | |
236 | |
214 // Get a list of all discovered GATT characteristics that belong to the | 237 // Get a list of all discovered GATT characteristics that belong to the |
215 // given service. | 238 // given service. |
216 // |serviceId| : The instance ID of the GATT service whose characteristics | 239 // |serviceId| : The instance ID of the GATT service whose characteristics |
217 // should be returned. | 240 // should be returned. |
218 // |callback| : Called with the list of characteristics that belong to the | 241 // |callback| : Called with the list of characteristics that belong to the |
219 // given service. | 242 // given service. |
220 static void getCharacteristics(DOMString serviceId, | 243 static void getCharacteristics(DOMString serviceId, |
221 CharacteristicsCallback callback); | 244 CharacteristicsCallback callback); |
222 | 245 |
223 // Get a list of GATT services that are included by the given service. | 246 // Get a list of GATT services that are included by the given service. |
224 // |serviceId| : The instance ID of the GATT service whose included | 247 // |serviceId| : The instance ID of the GATT service whose included |
225 // services should be returned. | 248 // services should be returned. |
226 // |callback| : Called with the list of GATT services included from the | 249 // |callback| : Called with the list of GATT services included from the |
227 // given service. | 250 // given service. |
228 static void getIncludedServices(DOMString serviceId, | 251 static void getIncludedServices(DOMString serviceId, |
229 ServicesCallback callback); | 252 ServicesCallback callback); |
230 | 253 |
231 // Get the GATT characteristic descriptor with the given instance ID. | 254 // Get the GATT characteristic descriptor with the given instance ID. |
232 // |descriptorId| : The instance ID of the requested GATT characteristic | 255 // |descriptorId| : The instance ID of the requested GATT characteristic |
233 // descriptor. | 256 // descriptor. |
234 // |callback| : Called with the requested Descriptor object. | 257 // |callback| : Called with the requested Descriptor object. |
235 static void getDescriptor(DOMString descriptorId, | 258 static void getDescriptor(DOMString descriptorId, |
236 DescriptorCallback callback); | 259 DescriptorCallback callback); |
237 | 260 |
261 // Create a locally hosted GATT descriptor. This descriptor must | |
262 // be hosted under a valid characteristic. If the characteristic ID is not | |
263 // valid, the lastError will be set. | |
264 // |descriptor| : The descriptor to create. | |
265 // |characteristicId| : ID of the characteristic to create this descriptor | |
266 // for. | |
267 // |callback| : Called with the created descriptor's unique ID. | |
268 static void createDescriptor(Descriptor descriptor, | |
269 DOMString characteristicId, | |
270 CreateDescriptorCallback callback); | |
271 | |
238 // Get a list of GATT characteristic descriptors that belong to the given | 272 // Get a list of GATT characteristic descriptors that belong to the given |
239 // characteristic. | 273 // characteristic. |
240 // |characteristicId| : The instance ID of the GATT characteristic whose | 274 // |characteristicId| : The instance ID of the GATT characteristic whose |
241 // descriptors should be returned. | 275 // descriptors should be returned. |
242 // |callback| : Called with the list of descriptors that belong to the given | 276 // |callback| : Called with the list of descriptors that belong to the given |
243 // characteristic. | 277 // characteristic. |
244 static void getDescriptors(DOMString characteristicId, | 278 static void getDescriptors(DOMString characteristicId, |
245 DescriptorsCallback callback); | 279 DescriptorsCallback callback); |
246 | 280 |
247 // Retrieve the value of a specified characteristic from a remote | 281 // Retrieve the value of a specified characteristic from a remote |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
300 // peripheral. | 334 // peripheral. |
301 // |descriptorId| : The instance ID of the GATT characteristic descriptor | 335 // |descriptorId| : The instance ID of the GATT characteristic descriptor |
302 // whose value should be written to. | 336 // whose value should be written to. |
303 // |value| : The value that should be sent to the remote descriptor as part | 337 // |value| : The value that should be sent to the remote descriptor as part |
304 // of the write request. | 338 // of the write request. |
305 // |callback| : Called when the write request has completed. | 339 // |callback| : Called when the write request has completed. |
306 static void writeDescriptorValue(DOMString descriptorId, | 340 static void writeDescriptorValue(DOMString descriptorId, |
307 ArrayBuffer value, | 341 ArrayBuffer value, |
308 ResultCallback callback); | 342 ResultCallback callback); |
309 | 343 |
344 // Register the given service with the local GATT server. If the service | |
345 // ID is invalid, this call will return false. | |
Devlin
2016/04/26 23:14:05
No it won't. ;) Also, should this be an error?
rkc
2016/04/27 00:00:39
Done.
| |
346 // |serviceId| : Unique ID of a created service. | |
347 // |callback| : Callback with the result of the register operation. | |
348 static boolean registerService(DOMString serviceId, | |
349 ServiceResultCallback callback); | |
350 | |
351 // Unregister the given service with the local GATT server. If the service | |
352 // ID is invalid, this call will return false. | |
Devlin
2016/04/26 23:14:05
ditto
rkc
2016/04/27 00:00:39
Done.
| |
353 // |serviceId| : Unique ID of a current registered service. | |
354 // |callback| : Callback with the result of the register operation. | |
355 static boolean unregisterService(DOMString serviceId, | |
356 ServiceResultCallback callback); | |
357 | |
310 // Create an advertisement and register it for advertising. To call this | 358 // Create an advertisement and register it for advertising. To call this |
311 // function, the app must have the bluetooth:low_energy and | 359 // function, the app must have the bluetooth:low_energy and |
312 // bluetooth:peripheral permissions set to true. Additionally this API | 360 // bluetooth:peripheral permissions set to true. Additionally this API |
313 // is only available to auto launched apps in Kiosk Mode of by setting | 361 // is only available to auto launched apps in Kiosk Mode of by setting |
314 // the 'enable-ble-advertising-in-apps' flag. | 362 // the 'enable-ble-advertising-in-apps' flag. |
315 // See https://developer.chrome.com/apps/manifest/bluetooth | 363 // See https://developer.chrome.com/apps/manifest/bluetooth |
316 // Note: On some hardware, central and peripheral modes at the same time is | 364 // Note: On some hardware, central and peripheral modes at the same time is |
317 // supported but on hardware that doesn't support this, making this call | 365 // supported but on hardware that doesn't support this, making this call |
318 // will switch the device to peripheral mode. In the case of hardware which | 366 // will switch the device to peripheral mode. In the case of hardware which |
319 // does not support both central and peripheral mode, attempting to use the | 367 // does not support both central and peripheral mode, attempting to use the |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
360 // |characteristic| : The GATT characteristic whose value has changed. | 408 // |characteristic| : The GATT characteristic whose value has changed. |
361 static void onCharacteristicValueChanged(Characteristic characteristic); | 409 static void onCharacteristicValueChanged(Characteristic characteristic); |
362 | 410 |
363 // Fired when the value of a remote GATT characteristic descriptor changes, | 411 // Fired when the value of a remote GATT characteristic descriptor changes, |
364 // usually as a result of a read request. This event exists | 412 // usually as a result of a read request. This event exists |
365 // mostly for convenience and will always be sent after a successful | 413 // mostly for convenience and will always be sent after a successful |
366 // call to $(ref:readDescriptorValue). | 414 // call to $(ref:readDescriptorValue). |
367 // |descriptor| : The GATT characteristic descriptor whose value has | 415 // |descriptor| : The GATT characteristic descriptor whose value has |
368 // changed. | 416 // changed. |
369 static void onDescriptorValueChanged(Descriptor descriptor); | 417 static void onDescriptorValueChanged(Descriptor descriptor); |
418 | |
419 // Fired when a connected central device requests to read the value of a | |
Devlin
2016/04/26 23:14:05
Do we ever call these events?
rkc
2016/04/27 00:00:39
Not yet, but I have CLs on the way that will be ca
Devlin
2016/04/27 14:45:03
I'd rather add idl entries with support. These ge
rkc
2016/04/27 20:38:56
This is part 1 of a 3 patch series. The third patc
| |
420 // characteristic registered on the local GATT server. | |
421 // Calling both the valueCallback and errorCallback will have undefined | |
422 // results. Calling neither will cause a timeout and the device may | |
423 // disconnect. | |
424 // |device| : The bluetooth device that is requesting this read. | |
425 // |characteristic| : The GATT characteristic whose value is requested. | |
426 // |valueCallback| : Callback to call with the value. | |
427 // |errorCallback| : Callback to call if the read failed. | |
428 static void onCharacteristicReadRequest( | |
429 Device device, Characteristic characteristic, | |
430 ValueCallback valueCallback, ResultCallback errorCallback); | |
431 | |
432 // Fired when a connected central device requests to write the value of a | |
433 // characteristic registered on the local GATT server. | |
434 // Calling both the successCallback and errorCallback will have undefined | |
435 // results. Calling neither will cause a timeout and the device may | |
436 // disconnect. | |
437 // |device| : The bluetooth device that is requesting this write. | |
438 // |characteristic| : The GATT characteristic whose value is being written. | |
439 // |successCallback| : Callback to call if the write was successful. | |
440 // |errorCallback| : Callback to call if the write failed. | |
441 static void onCharacteristicWriteRequest( | |
442 Device device, Characteristic characteristic, ArrayBuffer value, | |
443 ResultCallback successCallback, ResultCallback errorCallback); | |
444 | |
445 // Fired when a connected central device requests to read the value of a | |
446 // descriptor registered on the local GATT server. | |
447 // Calling both the valueCallback and errorCallback will have undefined | |
448 // results. Calling neither will cause a timeout and the device may | |
449 // disconnect. | |
450 // |device| : The bluetooth device that is requesting this read. | |
451 // |descriptor| : The GATT descriptor whose value is requested. | |
452 // |valueCallback| : Callback to call with the value. | |
453 // |errorCallback| : Callback to call if the read failed. | |
454 static void onDescriptorReadRequest( | |
455 Device device, Descriptor descriptor, ValueCallback valueCallback, | |
456 ResultCallback errorCallback); | |
457 | |
458 // Fired when a connected central device requests to write the value of a | |
459 // descriptor registered on the local GATT server. | |
460 // Calling both the successCallback and errorCallback will have undefined | |
461 // results. Calling neither will cause a timeout and the device may | |
462 // disconnect. | |
463 // |device| : The bluetooth device that is requesting this write. | |
464 // |descriptor| : The GATT descriptor whose value is being written. | |
465 // |successCallback| : Callback to call if the write was successful. | |
466 // |errorCallback| : Callback to call if the write failed. | |
467 static void onDescriptorWriteRequest( | |
468 Device device, Descriptor descriptor, ArrayBuffer value, | |
469 ResultCallback successCallback, ResultCallback errorCallback); | |
470 | |
370 }; | 471 }; |
371 }; | 472 }; |
OLD | NEW |