OLD | NEW |
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 |
| 10 // define how the characteristic can be used. Each of these properties serve |
| 11 // a role as defined in the Bluetooth Specification. |
| 12 // |EXTENDED_PROPERTIES| is a special property that, if present, |
| 13 // indicates that there is a characteristic descriptor (namely the |
| 14 // "Characteristic Extended Properties Descriptor" with UUID 0x2900) that |
| 15 // contains additional properties pertaining to the characteristic. |
| 16 // The properties |RELIABLE_WRITE| and |WRITABLE_AUXILIARIES| are retrieved from |
| 17 // that characteristic. |
| 18 enum Property { |
| 19 NONE = 0, |
| 20 BROADCAST = 1, |
| 21 READ = 2, |
| 22 WRITE_WITHOUT_RESPONSE = 4, |
| 23 WRITE = 8, |
| 24 NOTIFY = 16, |
| 25 INDICATE = 32, |
| 26 AUTHENTICATED_SIGNED_WRITES = 64, |
| 27 EXTENDED_PROPERTIES = 128, |
| 28 RELIABLE_WRITE = 256, |
| 29 WRITABLE_AUXILIARIES = 512, |
| 30 READ_ENCRYPTED = 1024, |
| 31 WRITE_ENCRYPTED = 2048, |
| 32 READ_ENCRYPTED_AUTHENTICATED = 4096, |
| 33 WRITE_ENCRYPTED_AUTHENTICATED = 8192 |
| 34 }; |
| 35 |
9 // TODO(crbug.com/657632): Remove when numerical values can be optional. | 36 // TODO(crbug.com/657632): Remove when numerical values can be optional. |
10 struct RSSIWrapper { | 37 struct RSSIWrapper { |
11 int8 value; | 38 int8 value; |
12 }; | 39 }; |
13 | 40 |
14 struct DeviceInfo { | 41 struct DeviceInfo { |
15 string? name; | 42 string? name; |
16 string name_for_display; | 43 string name_for_display; |
17 string address; | 44 string address; |
18 bool is_gatt_connected; | 45 bool is_gatt_connected; |
19 RSSIWrapper? rssi; | 46 RSSIWrapper? rssi; |
20 }; | 47 }; |
21 | 48 |
22 struct ServiceInfo { | 49 struct ServiceInfo { |
23 string id; | 50 string id; |
24 UUID uuid; | 51 UUID uuid; |
25 bool is_primary; | 52 bool is_primary; |
26 }; | 53 }; |
27 | 54 |
| 55 struct CharacteristicInfo { |
| 56 string id; |
| 57 UUID uuid; |
| 58 uint32 properties; |
| 59 }; |
| 60 |
28 interface Device { | 61 interface Device { |
29 // Disconnects and deletes the Device. | 62 // Disconnects and deletes the Device. |
30 Disconnect(); | 63 Disconnect(); |
31 | 64 |
32 // Gets basic information about the device. Returns null, if no device is | 65 // Gets basic information about the device. Returns null, if no device is |
33 // available. | 66 // available. |
34 GetInfo() => (DeviceInfo? info); | 67 GetInfo() => (DeviceInfo? info); |
35 | 68 |
36 // Gets the GATT Services in this device's GATT Server. | 69 // Gets the GATT Services in this device's GATT Server. |
37 GetServices() => (array<ServiceInfo> services); | 70 GetServices() => (array<ServiceInfo> services); |
| 71 |
| 72 // Gets the GATT Characteristics in the GATT Service with |service_id|. |
| 73 GetCharacteristics(string service_id) => |
| 74 (array<CharacteristicInfo> characteristics); |
38 }; | 75 }; |
OLD | NEW |