Chromium Code Reviews| 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..689b413a980abc53b666c5316b9f7cdfc16dc0ad 100644 |
| --- a/chrome/common/extensions/api/bluetooth_low_energy.idl |
| +++ b/chrome/common/extensions/api/bluetooth_low_energy.idl |
| @@ -7,18 +7,30 @@ |
| // <a href="https://developer.bluetooth.org/TechnologyOverview/Pages/GATT.aspx"> |
| // Generic Attribute Profile (GATT)</a>. |
| namespace bluetoothLowEnergy { |
| + |
|
Devlin
2016/05/11 22:47:39
rm
rkc
2016/05/11 22:57:40
Done.
|
| // 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 }; |
|
Devlin
2016/05/11 22:47:39
put closing brace on newline (here and line 26)
rkc
2016/05/11 22:57:40
Done.
|
| + |
| + // 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 |
| // MAC Address. If set to 'peripheral', the advertisement type will be |
| // ADV_IND or ADV_SCAN_IND and the device will broadcast with real Bluetooth |
| // Adapter's MAC Address. |
| - enum AdvertisementType {broadcast, peripheral}; |
| + enum AdvertisementType { broadcast, peripheral }; |
|
Devlin
2016/05/11 22:47:39
no need to do this
rkc
2016/05/11 22:57:40
Done.
|
| // Result of a register or unregister service call. |
| enum ServiceResult { |
| @@ -30,6 +42,17 @@ namespace bluetoothLowEnergy { |
| notRegistered |
| }; |
| + // Result of a character value changed notification request. |
| + enum NotificationResult { |
| + // The notification operation was successful. |
| + success, |
| + // This characteristic wasn't created with the notification property. |
| + notifyPropertyNotSet, |
|
Devlin
2016/05/11 22:47:39
Shouldn't these just be errors?
rkc
2016/05/11 22:57:40
Sure, no reason these have to be enums here.
Done.
|
| + // The indicate flag was true but the property wasn't set on the |
| + // characteristic. |
| + indicatePropertyNotSet |
| + }; |
| + |
| // Represents a bluetooth central device that is connected to the local GATT |
| // server. |
| dictionary Device { |
| @@ -100,6 +123,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, |
| @@ -199,6 +225,7 @@ namespace bluetoothLowEnergy { |
| callback ServicesCallback = void(Service[] result); |
| callback ServiceResultCallback = void(ServiceResult result); |
| callback RegisterAdvertisementCallback = void (long advertisementId); |
| + callback NotificationCallback = void(NotificationResult result); |
| // These functions all report failures via chrome.runtime.lastError. |
| interface Functions { |
| @@ -356,6 +383,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. |
| + // Note, the characteristic needs to correctly set the notify/indicate |
|
Devlin
2016/05/11 22:47:39
What is the |notify| property?
rkc
2016/05/11 22:57:41
It is a CharacteristicProperty that we specify whi
|
| + // properties for this call to succeed. |
| + // 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. |
| + // |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, |
| + NotificationCallback callback); |
| + |
| // Retrieve the value of a specified characteristic descriptor from a remote |
| // peripheral. |
| // |descriptorId|: The instance ID of the GATT characteristic descriptor |
| @@ -397,6 +442,16 @@ namespace bluetoothLowEnergy { |
| static void unregisterService( |
| DOMString serviceId, ServiceResultCallback 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 |
| // bluetooth:peripheral permissions set to true. Additionally this API |