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

Side by Side Diff: device/bluetooth/public/interfaces/device.mojom

Issue 2627243002: bluetooth: Add control for reading/writing of characteristics to internals page. (Closed)
Patch Set: Merge upstream, add comment detail for type converter Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 module bluetooth.mojom; 5 module bluetooth.mojom;
6 6
7 import "device/bluetooth/public/interfaces/uuid.mojom"; 7 import "device/bluetooth/public/interfaces/uuid.mojom";
8 8
9 // Values representing the possible properties of a characteristic, which 9 // Values representing the possible properties of a characteristic, which
10 // define how the characteristic can be used. Each of these properties serve 10 // define how the characteristic can be used. Each of these properties serve
11 // a role as defined in the Bluetooth Specification. 11 // a role as defined in the Bluetooth Specification.
12 // |EXTENDED_PROPERTIES| is a special property that, if present, 12 // |EXTENDED_PROPERTIES| is a special property that, if present,
13 // indicates that there is a characteristic descriptor (namely the 13 // indicates that there is a characteristic descriptor (namely the
14 // "Characteristic Extended Properties Descriptor" with UUID 0x2900) that 14 // "Characteristic Extended Properties Descriptor" with UUID 0x2900) that
15 // contains additional properties pertaining to the characteristic. 15 // contains additional properties pertaining to the characteristic.
16 // The properties |RELIABLE_WRITE| and |WRITABLE_AUXILIARIES| are retrieved from 16 // The properties |RELIABLE_WRITE| and |WRITABLE_AUXILIARIES| are retrieved from
17 // that characteristic. 17 // that characteristic.
18 // TODO(crbug.com/684168): Remove assignment of values when this is automated.
18 enum Property { 19 enum Property {
19 NONE = 0, 20 NONE = 0,
20 BROADCAST = 1, 21 BROADCAST = 1,
21 READ = 2, 22 READ = 2,
22 WRITE_WITHOUT_RESPONSE = 4, 23 WRITE_WITHOUT_RESPONSE = 4,
23 WRITE = 8, 24 WRITE = 8,
24 NOTIFY = 16, 25 NOTIFY = 16,
25 INDICATE = 32, 26 INDICATE = 32,
26 AUTHENTICATED_SIGNED_WRITES = 64, 27 AUTHENTICATED_SIGNED_WRITES = 64,
27 EXTENDED_PROPERTIES = 128, 28 EXTENDED_PROPERTIES = 128,
28 RELIABLE_WRITE = 256, 29 RELIABLE_WRITE = 256,
29 WRITABLE_AUXILIARIES = 512, 30 WRITABLE_AUXILIARIES = 512,
30 READ_ENCRYPTED = 1024, 31 READ_ENCRYPTED = 1024,
31 WRITE_ENCRYPTED = 2048, 32 WRITE_ENCRYPTED = 2048,
32 READ_ENCRYPTED_AUTHENTICATED = 4096, 33 READ_ENCRYPTED_AUTHENTICATED = 4096,
33 WRITE_ENCRYPTED_AUTHENTICATED = 8192 34 WRITE_ENCRYPTED_AUTHENTICATED = 8192
34 }; 35 };
35 36
37 enum GattResult {
38 SUCCESS,
39 UNKNOWN,
40 FAILED,
41 IN_PROGRESS,
42 INVALID_LENGTH,
43 NOT_PERMITTED,
44 NOT_AUTHORIZED,
45 NOT_PAIRED,
46 NOT_SUPPORTED,
47 SERVICE_NOT_FOUND,
48 CHARACTERISTIC_NOT_FOUND
49 };
50
36 // TODO(crbug.com/657632): Remove when numerical values can be optional. 51 // TODO(crbug.com/657632): Remove when numerical values can be optional.
37 struct RSSIWrapper { 52 struct RSSIWrapper {
38 int8 value; 53 int8 value;
39 }; 54 };
40 55
41 struct DeviceInfo { 56 struct DeviceInfo {
42 string? name; 57 string? name;
43 string name_for_display; 58 string name_for_display;
44 string address; 59 string address;
45 bool is_gatt_connected; 60 bool is_gatt_connected;
46 RSSIWrapper? rssi; 61 RSSIWrapper? rssi;
47 }; 62 };
48 63
49 struct ServiceInfo { 64 struct ServiceInfo {
50 string id; 65 string id;
51 UUID uuid; 66 UUID uuid;
52 bool is_primary; 67 bool is_primary;
53 }; 68 };
54 69
55 struct CharacteristicInfo { 70 struct CharacteristicInfo {
56 string id; 71 string id;
57 UUID uuid; 72 UUID uuid;
58 uint32 properties; 73 uint32 properties;
74 array<uint8> last_known_value;
59 }; 75 };
60 76
61 struct DescriptorInfo { 77 struct DescriptorInfo {
62 string id; 78 string id;
63 UUID uuid; 79 UUID uuid;
64 }; 80 };
65 81
66 interface Device { 82 interface Device {
67 // Disconnects and deletes the Device. 83 // Disconnects and deletes the Device.
68 Disconnect(); 84 Disconnect();
69 85
70 // Gets basic information about the device. Returns null, if no device is 86 // Gets basic information about the device. Returns null, if no device is
71 // available. 87 // available.
72 GetInfo() => (DeviceInfo? info); 88 GetInfo() => (DeviceInfo? info);
73 89
74 // Gets the GATT Services in this device's GATT Server. 90 // Gets the GATT Services in this device's GATT Server.
75 GetServices() => (array<ServiceInfo> services); 91 GetServices() => (array<ServiceInfo> services);
76 92
77 // Gets the GATT Characteristics in the GATT Service with |service_id|. 93 // Gets the GATT Characteristics in the GATT Service with |service_id|.
78 // If |characteristics| is null, an error occured while attempting to retrieve 94 // If |characteristics| is null, an error occured while attempting to retrieve
79 // the array of characteristics. If |characteristics| is empty, this simply 95 // the array of characteristics. If |characteristics| is empty, this simply
80 // means that no characteristics were found. 96 // means that no characteristics were found.
81 GetCharacteristics(string service_id) => 97 GetCharacteristics(string service_id) =>
82 (array<CharacteristicInfo>? characteristics); 98 (array<CharacteristicInfo>? characteristics);
83 99
100 // Reads the value for the GATT Characteristic with |characteristic_id| in
101 // the GATT Service with |service_id|.
102 ReadValueForCharacteristic(string service_id, string characteristic_id) =>
103 (GattResult result, array<uint8>? value);
104
105 // Writes the |value| to the GATT Characteristic with |characteristic_id| in
106 // the GATT Service with |service_id|.
107 WriteValueForCharacteristic(string service_id, string characteristic_id,
108 array<uint8> value) => (GattResult result);
109
84 // Gets the GATT Descriptors of the GATT Characteristic with matching 110 // Gets the GATT Descriptors of the GATT Characteristic with matching
85 // |characteristic_id| in the GATT Service with matching |service_id|. 111 // |characteristic_id| in the GATT Service with matching |service_id|.
86 // If |descriptors| is null, an error occured while attempting to retrieve 112 // If |descriptors| is null, an error occured while attempting to retrieve
87 // the array of descriptors. If |descriptors| is empty, this simply 113 // the array of descriptors. If |descriptors| is empty, this simply
88 // means that no descriptors were found. 114 // means that no descriptors were found.
89 GetDescriptors(string service_id, string characteristic_id) => 115 GetDescriptors(string service_id, string characteristic_id) =>
90 (array<DescriptorInfo>? descriptors); 116 (array<DescriptorInfo>? descriptors);
91 }; 117 };
OLDNEW
« no previous file with comments | « device/bluetooth/device.cc ('k') | device/bluetooth/public/interfaces/gatt_result_type_converter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698