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..2ed3e2306f5ff7d88c5f152ce95239ccf0056d6d 100644 |
--- a/device/bluetooth/public/interfaces/device.mojom |
+++ b/device/bluetooth/public/interfaces/device.mojom |
@@ -15,6 +15,7 @@ import "device/bluetooth/public/interfaces/uuid.mojom"; |
// contains additional properties pertaining to the characteristic. |
// The properties |RELIABLE_WRITE| and |WRITABLE_AUXILIARIES| are retrieved from |
// that characteristic. |
+// TODO(crbug.com/684168): Remove assignment of values when this is automated. |
enum Property { |
NONE = 0, |
BROADCAST = 1, |
@@ -33,6 +34,46 @@ 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. |
+// TODO(crbug.com/684168): Remove assignment of values when this is automated. |
+enum Permission { |
+ NONE = 0, |
+ READ = 1, |
+ WRITE = 2, |
+ READ_ENCRYPTED = 4, |
+ WRITE_ENCRYPTED = 8, |
+ READ_ENCRYPTED_AUTHENTICATED = 16, |
+ WRITE_ENCRYPTED_AUTHENTICATED = 32 |
+}; |
+ |
+enum GattResult { |
+ SUCCESS, |
+ UNKNOWN, |
+ FAILED, |
+ IN_PROGRESS, |
+ INVALID_LENGTH, |
+ NOT_PERMITTED, |
+ NOT_AUTHORIZED, |
+ NOT_PAIRED, |
+ NOT_SUPPORTED, |
+ SERVICE_NOT_FOUND, |
+ CHARACTERISTIC_NOT_FOUND |
+}; |
+ |
// TODO(crbug.com/657632): Remove when numerical values can be optional. |
struct RSSIWrapper { |
int8 value; |
@@ -56,6 +97,8 @@ struct CharacteristicInfo { |
string id; |
UUID uuid; |
uint32 properties; |
+ uint32 permissions; |
+ array<uint8> last_known_value; |
}; |
interface Device { |
@@ -72,4 +115,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); |
+ |
+ // Writes the |value| to the GATT Characteristic with |characteristic_id| in |
+ // the GATT Service with |service_id|. |
+ WriteValueForCharacteristic(string service_id, string characteristic_id, |
+ array<uint8> value) => (GattResult result); |
}; |