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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/api/bluetooth_low_energy.idl
diff --git a/chrome/common/extensions/api/bluetooth_low_energy.idl b/chrome/common/extensions/api/bluetooth_low_energy.idl
index 9bb5e49f2517d893d86ba6b7b8993c1125d50fba..0394d645c530c5325c60416fb44ab8dde041c7f0 100644
--- a/chrome/common/extensions/api/bluetooth_low_energy.idl
+++ b/chrome/common/extensions/api/bluetooth_low_energy.idl
@@ -8,10 +8,23 @@
// Generic Attribute Profile (GATT)</a>.
namespace bluetoothLowEnergy {
// Values representing the possible properties of a characteristic.
- enum CharacteristicProperty {broadcast, read, writeWithoutResponse, write,
- notify, indicate, authenticatedSignedWrites,
- extendedProperties, reliableWrite,
- writableAuxiliaries};
+ // Characteristic permissions are inferred from these properties.
+ // Please see the Bluetooth 4.x spec to see the meaning of each individual
+ // property.
+ enum CharacteristicProperty {
+ broadcast, read, writeWithoutResponse, write, notify, indicate,
+ authenticatedSignedWrites, extendedProperties, reliableWrite,
+ writableAuxiliaries, encryptRead, encryptWrite, encryptAuthenticatedRead,
+ encryptAuthenticatedWrite
+ };
+
+ // Values representing possible permissions for a descriptor.
+ // Please see the Bluetooth 4.x spec to see the meaning of each individual
+ // permission.
+ enum DescriptorPermission {
+ read, write, encryptedRead, encryptedWrite, encryptedAuthenticatedRead,
+ encryptedAuthenticatedWrite
+ };
// Type of advertisement. If 'broadcast' is chosen, the sent advertisement
// type will be ADV_NONCONN_IND and the device will broadcast with a random
@@ -20,16 +33,6 @@ namespace bluetoothLowEnergy {
// Adapter's MAC Address.
enum AdvertisementType {broadcast, peripheral};
- // Result of a register or unregister service call.
- enum ServiceResult {
- // The service operation was successful.
- success,
- // The service that is being registered is already regsitered.
- alreadyRegistered,
- // The service that is being unregistered is not regsitered.
- notRegistered
- };
-
// Represents a bluetooth central device that is connected to the local GATT
// server.
dictionary Device {
@@ -100,6 +103,9 @@ namespace bluetoothLowEnergy {
// The GATT characteristic this descriptor belongs to.
Characteristic? characteristic;
+ // The permissions of this descriptor.
+ DescriptorPermission[] permissions;
+
// Returns the identifier assigned to this descriptor. Use the instance ID
// to distinguish between descriptors from a peripheral with the same UUID
// and to make function calls that take in a descriptor identifier. Present,
@@ -197,7 +203,6 @@ namespace bluetoothLowEnergy {
callback ServiceCallback = void(Service result);
callback CreateServiceCallback = void(DOMString serviceId);
callback ServicesCallback = void(Service[] result);
- callback ServiceResultCallback = void(ServiceResult result);
callback RegisterAdvertisementCallback = void (long advertisementId);
// These functions all report failures via chrome.runtime.lastError.
@@ -356,6 +361,24 @@ namespace bluetoothLowEnergy {
DOMString characteristicId,
optional ResultCallback callback);
+ // Notify a remote device of a new value for a characteristic. If
+ // 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.
+ // Note, the characteristic needs to correctly set the 'notify' or
+ // '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.
+ // This function is only available if the app has both the
+ // bluetooth:low_energy and the bluetooth:peripheral permissions set to
+ // true. The peripheral permission may not be available to all apps.
+ // |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.
+ // |value|: New value of the characteristic.
+ // |indicate|: Send a notification or an indication.
+ // |callback|: Callback called once the notification or indication has
+ // been sent successfully.
+ static void notifyCharacteristicValueChanged(
+ DOMString characteristicId,
+ ArrayBuffer value,
+ boolean indicate,
+ ResultCallback callback);
+
// Retrieve the value of a specified characteristic descriptor from a remote
// peripheral.
// |descriptorId|: The instance ID of the GATT characteristic descriptor
@@ -385,7 +408,7 @@ namespace bluetoothLowEnergy {
// |serviceId|: Unique ID of a created service.
// |callback|: Callback with the result of the register operation.
static void registerService(
- DOMString serviceId, ServiceResultCallback callback);
+ DOMString serviceId, ResultCallback callback);
// Unregister the given service with the local GATT server. If the service
// ID is invalid, the lastError will be set.
@@ -395,7 +418,17 @@ namespace bluetoothLowEnergy {
// |serviceId|: Unique ID of a current registered service.
// |callback|: Callback with the result of the register operation.
static void unregisterService(
- DOMString serviceId, ServiceResultCallback callback);
+ DOMString serviceId, ResultCallback callback);
+
+ // Remove the specified service, unregistering it if it was registered.
+ // If the service ID is invalid, the lastError will be set.
+ // This function is only available if the app has both the
+ // bluetooth:low_energy and the bluetooth:peripheral permissions set to
+ // true. The peripheral permission may not be available to all apps.
+ // |serviceId|: Unique ID of a current registered service.
+ // |callback|: Callback called once the service is removed.
+ static void removeService(
+ DOMString serviceId, optional ResultCallback callback);
// Create an advertisement and register it for advertising. To call this
// function, the app must have the bluetooth:low_energy and

Powered by Google App Engine
This is Rietveld 408576698