Chromium Code Reviews| Index: device/bluetooth/public/interfaces/device.mojom |
| diff --git a/device/bluetooth/public/interfaces/device.mojom b/device/bluetooth/public/interfaces/device.mojom |
| index b8ee6ef753ef3669fd4914f96d7a73351dde2645..ea666d69304da7d887c392ed3a93931243fb036c 100644 |
| --- a/device/bluetooth/public/interfaces/device.mojom |
| +++ b/device/bluetooth/public/interfaces/device.mojom |
| @@ -33,6 +33,43 @@ enum Property { |
| WRITE_ENCRYPTED_AUTHENTICATED = 8192 |
| }; |
| +// Values representing read, write, and encryption permissions for a |
| +// characteristic's value. While attribute permissions for all GATT |
| +// definitions have been set by the Bluetooth specification, characteristic |
| +// value permissions are left up to the higher-level profile. |
| +// |
| +// Attribute permissions are distinct from the characteristic properties. For |
| +// example, a characteristic may have the property |PROPERTY_READ| to make |
| +// clients know that it is possible to read the characteristic value and have |
| +// the permission |PERMISSION_READ_ENCRYPTED| to require a secure connection. |
| +// It is up to the application to properly specify the permissions and |
| +// properties for a local characteristic. |
| +// TODO(rkc): Currently BlueZ infers permissions for characteristics from |
| +// the properties. Once this is fixed, we will start sending the permissions |
| +// for characteristics to BlueZ. Till then permissions for characteristics |
| +// are unimplemented. |
| +enum Permission { |
| + NONE = 0, |
| + READ = 1, |
| + WRITE = 2, |
| + READ_ENCRYPTED = 4, |
| + WRITE_ENCRYPTED = 8, |
| + READ_ENCRYPTED_AUTHENTICATED = 16, |
| + WRITE_ENCRYPTED_AUTHENTICATED = 32 |
|
ortuno
2017/01/20 03:45:22
So sad that we have to manually write these... Are
mbrunson
2017/01/21 01:49:00
There are no open issues for this. rockot has told
ortuno
2017/01/22 22:38:00
Ah I should have been more explicit. I'm sad that
mbrunson
2017/01/24 00:25:31
I didn't find any open issues for this, so I made
|
| +}; |
| + |
| +enum GattResult { |
| + SUCCESS, |
| + UNKNOWN, |
| + FAILED, |
| + IN_PROGRESS, |
| + INVALID_LENGTH, |
| + NOT_PERMITTED, |
| + NOT_AUTHORIZED, |
| + NOT_PAIRED, |
| + NOT_SUPPORTED |
| +}; |
| + |
| // TODO(crbug.com/657632): Remove when numerical values can be optional. |
| struct RSSIWrapper { |
| int8 value; |
| @@ -56,6 +93,8 @@ struct CharacteristicInfo { |
| string id; |
| UUID uuid; |
| uint32 properties; |
| + uint32 permissions; |
| + array<uint8> value; |
|
ortuno
2017/01/20 03:45:22
I would rename this to last_known_value.
mbrunson
2017/01/21 01:49:00
Done.
|
| }; |
| interface Device { |
| @@ -72,4 +111,14 @@ interface Device { |
| // Gets the GATT Characteristics in the GATT Service with |service_id|. |
| GetCharacteristics(string service_id) => |
| (array<CharacteristicInfo> characteristics); |
| + |
| + // Reads the value for the GATT Characteristic with |characteristic_id| in |
| + // the GATT Service with |service_id|. |
| + ReadValueForCharacteristic(string service_id, string characteristic_id) => |
| + (GattResult result, array<uint8> value); |
|
ortuno
2017/01/20 03:45:22
shouldn't value be optional?
mbrunson
2017/01/21 01:49:00
Done.
|
| + |
| + // Writes the |value| to the GATT Characteristic with |characteristic_id| in |
| + // the GATT Service with |service_id|. |
| + WriteValueForCharacteristic(array<uint8> value, string service_id, |
|
ortuno
2017/01/20 03:45:22
optional: put value at the end.
mbrunson
2017/01/21 01:49:00
Done.
|
| + string characteristic_id) => (GattResult result); |
| }; |