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

Unified Diff: device/bluetooth/public/interfaces/device.mojom

Issue 2627243002: bluetooth: Add control for reading/writing of characteristics to internals page. (Closed)
Patch Set: DCHECK device Created 3 years, 11 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: device/bluetooth/public/interfaces/device.mojom
diff --git a/device/bluetooth/public/interfaces/device.mojom b/device/bluetooth/public/interfaces/device.mojom
index b8ee6ef753ef3669fd4914f96d7a73351dde2645..0e26e5ff5d5abbab87b1570749990fc331919496 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
+};
+
+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> last_known_value;
};
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);
+
+ // 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);
};

Powered by Google App Engine
This is Rietveld 408576698