Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Side by Side Diff: chrome/common/extensions/api/bluetooth_low_energy.idl

Issue 1966893003: IDL changes for BLE GATT server support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // Characteristic permissions are inferred from these properties.
12 notify, indicate, authenticatedSignedWrites, 12 // Please see the Bluetooth 4.x spec to see the meaning of each individual
13 extendedProperties, reliableWrite, 13 // property.
14 writableAuxiliaries}; 14 enum CharacteristicProperty {
15 broadcast, read, writeWithoutResponse, write, notify, indicate,
16 authenticatedSignedWrites, extendedProperties, reliableWrite,
17 writableAuxiliaries, encryptRead, encryptWrite, encryptAuthenticatedRead,
18 encryptAuthenticatedWrite
19 };
20
21 // Values representing possible permissions for a descriptor.
22 // Please see the Bluetooth 4.x spec to see the meaning of each individual
23 // permission.
24 enum DescriptorPermission {
25 read, write, encryptedRead, encryptedWrite, encryptedAuthenticatedRead,
26 encryptedAuthenticatedWrite
27 };
15 28
16 // Type of advertisement. If 'broadcast' is chosen, the sent advertisement 29 // 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 30 // 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 31 // 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 32 // ADV_IND or ADV_SCAN_IND and the device will broadcast with real Bluetooth
20 // Adapter's MAC Address. 33 // Adapter's MAC Address.
21 enum AdvertisementType {broadcast, peripheral}; 34 enum AdvertisementType {broadcast, peripheral};
22 35
23 // Result of a register or unregister service call.
24 enum ServiceResult {
25 // The service operation was successful.
26 success,
27 // The service that is being registered is already regsitered.
28 alreadyRegistered,
29 // The service that is being unregistered is not regsitered.
30 notRegistered
31 };
32
33 // Represents a bluetooth central device that is connected to the local GATT 36 // Represents a bluetooth central device that is connected to the local GATT
34 // server. 37 // server.
35 dictionary Device { 38 dictionary Device {
36 // The address of the device, in the format 'XX:XX:XX:XX:XX:XX'. 39 // The address of the device, in the format 'XX:XX:XX:XX:XX:XX'.
37 DOMString address; 40 DOMString address;
38 41
39 // The human-readable name of the device. 42 // The human-readable name of the device.
40 DOMString? name; 43 DOMString? name;
41 44
42 // The class of the device, a bit-field defined by 45 // The class of the device, a bit-field defined by
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // Represents a GATT characteristic descriptor, which provides further 96 // Represents a GATT characteristic descriptor, which provides further
94 // information about a characteristic's value. 97 // information about a characteristic's value.
95 dictionary Descriptor { 98 dictionary Descriptor {
96 // The UUID of the characteristic descriptor, e.g. 99 // The UUID of the characteristic descriptor, e.g.
97 // 00002902-0000-1000-8000-00805f9b34fb. 100 // 00002902-0000-1000-8000-00805f9b34fb.
98 DOMString uuid; 101 DOMString uuid;
99 102
100 // The GATT characteristic this descriptor belongs to. 103 // The GATT characteristic this descriptor belongs to.
101 Characteristic? characteristic; 104 Characteristic? characteristic;
102 105
106 // The permissions of this descriptor.
107 DescriptorPermission[] permissions;
108
103 // Returns the identifier assigned to this descriptor. Use the instance ID 109 // Returns the identifier assigned to this descriptor. Use the instance ID
104 // to distinguish between descriptors from a peripheral with the same UUID 110 // to distinguish between descriptors from a peripheral with the same UUID
105 // and to make function calls that take in a descriptor identifier. Present, 111 // and to make function calls that take in a descriptor identifier. Present,
106 // if this instance represents a remote characteristic. 112 // if this instance represents a remote characteristic.
107 DOMString? instanceId; 113 DOMString? instanceId;
108 114
109 // The currently cached descriptor value. This value gets updated when 115 // The currently cached descriptor value. This value gets updated when
110 // the value of the descriptor is read. 116 // the value of the descriptor is read.
111 ArrayBuffer? value; 117 ArrayBuffer? value;
112 }; 118 };
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 callback CharacteristicCallback = void(Characteristic result); 196 callback CharacteristicCallback = void(Characteristic result);
191 callback CreateCharacteristicCallback = void(DOMString characteristicId); 197 callback CreateCharacteristicCallback = void(DOMString characteristicId);
192 callback CharacteristicsCallback = void(Characteristic[] result); 198 callback CharacteristicsCallback = void(Characteristic[] result);
193 callback DescriptorCallback = void(Descriptor result); 199 callback DescriptorCallback = void(Descriptor result);
194 callback CreateDescriptorCallback = void(DOMString descriptorId); 200 callback CreateDescriptorCallback = void(DOMString descriptorId);
195 callback DescriptorsCallback = void(Descriptor[] result); 201 callback DescriptorsCallback = void(Descriptor[] result);
196 callback ResultCallback = void(); 202 callback ResultCallback = void();
197 callback ServiceCallback = void(Service result); 203 callback ServiceCallback = void(Service result);
198 callback CreateServiceCallback = void(DOMString serviceId); 204 callback CreateServiceCallback = void(DOMString serviceId);
199 callback ServicesCallback = void(Service[] result); 205 callback ServicesCallback = void(Service[] result);
200 callback ServiceResultCallback = void(ServiceResult result);
201 callback RegisterAdvertisementCallback = void (long advertisementId); 206 callback RegisterAdvertisementCallback = void (long advertisementId);
202 207
203 // These functions all report failures via chrome.runtime.lastError. 208 // These functions all report failures via chrome.runtime.lastError.
204 interface Functions { 209 interface Functions {
205 // Establishes a connection between the application and the device with the 210 // Establishes a connection between the application and the device with the
206 // given address. A device may be already connected and its GATT services 211 // given address. A device may be already connected and its GATT services
207 // available without calling <code>connect</code>, however, an app that 212 // available without calling <code>connect</code>, however, an app that
208 // wants to access GATT services of a device should call this function to 213 // wants to access GATT services of a device should call this function to
209 // make sure that a connection to the device is maintained. If the device 214 // make sure that a connection to the device is maintained. If the device
210 // is not connected, all GATT services of the device will be discovered 215 // is not connected, all GATT services of the device will be discovered
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 // Disable value notifications/indications from the specified 354 // Disable value notifications/indications from the specified
350 // characteristic. After a successful call, the application will stop 355 // characteristic. After a successful call, the application will stop
351 // receiving notifications/indications from this characteristic. 356 // receiving notifications/indications from this characteristic.
352 // |characteristicId|: The instance ID of the GATT characteristic on which 357 // |characteristicId|: The instance ID of the GATT characteristic on which
353 // this app's notification session should be stopped. 358 // this app's notification session should be stopped.
354 // |callback|: Called when the request has completed (optional). 359 // |callback|: Called when the request has completed (optional).
355 static void stopCharacteristicNotifications( 360 static void stopCharacteristicNotifications(
356 DOMString characteristicId, 361 DOMString characteristicId,
357 optional ResultCallback callback); 362 optional ResultCallback callback);
358 363
364 // Notify a remote device of a new value for a characteristic. If
365 // indicate is true, we will send an indication instead of a notification.
Devlin 2016/05/12 00:16:41 who is "we"?
rkc 2016/05/12 00:42:32 Done.
366 // Note, the characteristic needs to correctly set the 'notify' or
367 // 'indicate' property while creation for this call to succeed.
Devlin 2016/05/12 00:16:41 s/while/during
rkc 2016/05/12 00:42:32 Done.
368 // This function is only available if the app has both the
369 // bluetooth:low_energy and the bluetooth:peripheral permissions set to
370 // true. The peripheral permission may not be available to all apps.
371 // |characteristicId|: The characteristic to send the notication for.
Devlin 2016/05/12 00:16:41 often for functions like this, a single dictionary
rkc 2016/05/12 00:42:32 Done.
372 // |value|: New value of the characteristic.
373 // |indicate|: Send a notification or an indication.
374 // |callback|: Callback called once the notification or indication has
375 // been sent successfully.
376 static void notifyCharacteristicValueChanged(
377 DOMString characteristicId,
378 ArrayBuffer value,
379 boolean indicate,
380 ResultCallback callback);
381
359 // Retrieve the value of a specified characteristic descriptor from a remote 382 // Retrieve the value of a specified characteristic descriptor from a remote
360 // peripheral. 383 // peripheral.
361 // |descriptorId|: The instance ID of the GATT characteristic descriptor 384 // |descriptorId|: The instance ID of the GATT characteristic descriptor
362 // whose value should be read from the remote device. 385 // whose value should be read from the remote device.
363 // |callback|: Called with the Descriptor object whose value was requested. 386 // |callback|: Called with the Descriptor object whose value was requested.
364 // The <code>value</code> field of the returned Descriptor object contains 387 // The <code>value</code> field of the returned Descriptor object contains
365 // the result of the read request. 388 // the result of the read request.
366 static void readDescriptorValue(DOMString descriptorId, 389 static void readDescriptorValue(DOMString descriptorId,
367 DescriptorCallback callback); 390 DescriptorCallback callback);
368 391
369 // Write the value of a specified characteristic descriptor from a remote 392 // Write the value of a specified characteristic descriptor from a remote
370 // peripheral. 393 // peripheral.
371 // |descriptorId|: The instance ID of the GATT characteristic descriptor 394 // |descriptorId|: The instance ID of the GATT characteristic descriptor
372 // whose value should be written to. 395 // whose value should be written to.
373 // |value|: The value that should be sent to the remote descriptor as part 396 // |value|: The value that should be sent to the remote descriptor as part
374 // of the write request. 397 // of the write request.
375 // |callback|: Called when the write request has completed. 398 // |callback|: Called when the write request has completed.
376 static void writeDescriptorValue(DOMString descriptorId, 399 static void writeDescriptorValue(DOMString descriptorId,
377 ArrayBuffer value, 400 ArrayBuffer value,
378 ResultCallback callback); 401 ResultCallback callback);
379 402
380 // Register the given service with the local GATT server. If the service 403 // Register the given service with the local GATT server. If the service
381 // ID is invalid, the lastError will be set. 404 // ID is invalid, the lastError will be set.
382 // This function is only available if the app has both the 405 // This function is only available if the app has both the
383 // bluetooth:low_energy and the bluetooth:peripheral permissions set to 406 // bluetooth:low_energy and the bluetooth:peripheral permissions set to
384 // true. The peripheral permission may not be available to all apps. 407 // true. The peripheral permission may not be available to all apps.
385 // |serviceId|: Unique ID of a created service. 408 // |serviceId|: Unique ID of a created service.
386 // |callback|: Callback with the result of the register operation. 409 // |callback|: Callback with the result of the register operation.
387 static void registerService( 410 static void registerService(
388 DOMString serviceId, ServiceResultCallback callback); 411 DOMString serviceId, ResultCallback callback);
389 412
390 // Unregister the given service with the local GATT server. If the service 413 // Unregister the given service with the local GATT server. If the service
391 // ID is invalid, the lastError will be set. 414 // ID is invalid, the lastError will be set.
392 // This function is only available if the app has both the 415 // This function is only available if the app has both the
393 // bluetooth:low_energy and the bluetooth:peripheral permissions set to 416 // bluetooth:low_energy and the bluetooth:peripheral permissions set to
394 // true. The peripheral permission may not be available to all apps. 417 // true. The peripheral permission may not be available to all apps.
395 // |serviceId|: Unique ID of a current registered service. 418 // |serviceId|: Unique ID of a current registered service.
396 // |callback|: Callback with the result of the register operation. 419 // |callback|: Callback with the result of the register operation.
397 static void unregisterService( 420 static void unregisterService(
398 DOMString serviceId, ServiceResultCallback callback); 421 DOMString serviceId, ResultCallback callback);
422
423 // Remove the specified service, unregistering it if it was registered.
424 // If the service ID is invalid, the lastError will be set.
425 // This function is only available if the app has both the
426 // bluetooth:low_energy and the bluetooth:peripheral permissions set to
427 // true. The peripheral permission may not be available to all apps.
428 // |serviceId|: Unique ID of a current registered service.
429 // |callback|: Callback called once the service is removed.
430 static void removeService(
431 DOMString serviceId, optional ResultCallback callback);
399 432
400 // Create an advertisement and register it for advertising. To call this 433 // Create an advertisement and register it for advertising. To call this
401 // function, the app must have the bluetooth:low_energy and 434 // function, the app must have the bluetooth:low_energy and
402 // bluetooth:peripheral permissions set to true. Additionally this API 435 // bluetooth:peripheral permissions set to true. Additionally this API
403 // is only available to auto launched apps in Kiosk Mode of by setting 436 // is only available to auto launched apps in Kiosk Mode of by setting
404 // the 'enable-ble-advertising-in-apps' flag. 437 // the 'enable-ble-advertising-in-apps' flag.
405 // See https://developer.chrome.com/apps/manifest/bluetooth 438 // See https://developer.chrome.com/apps/manifest/bluetooth
406 // Note: On some hardware, central and peripheral modes at the same time is 439 // Note: On some hardware, central and peripheral modes at the same time is
407 // supported but on hardware that doesn't support this, making this call 440 // supported but on hardware that doesn't support this, making this call
408 // will switch the device to peripheral mode. In the case of hardware which 441 // will switch the device to peripheral mode. In the case of hardware which
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 // this request for a long time may lead to a disconnection. 537 // this request for a long time may lead to a disconnection.
505 // This event is only available if the app has both the 538 // This event is only available if the app has both the
506 // bluetooth:low_energy and the bluetooth:peripheral permissions set to 539 // bluetooth:low_energy and the bluetooth:peripheral permissions set to
507 // true. The peripheral permission may not be available to all apps. 540 // true. The peripheral permission may not be available to all apps.
508 // |request|: Request data for this request. 541 // |request|: Request data for this request.
509 // |descriptor|: The GATT descriptor whose value is being written. 542 // |descriptor|: The GATT descriptor whose value is being written.
510 static void onDescriptorWriteRequest( 543 static void onDescriptorWriteRequest(
511 Request request, DOMString descriptorId); 544 Request request, DOMString descriptorId);
512 }; 545 };
513 }; 546 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698