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 struct DeviceInfo { | 7 struct DeviceInfo { |
8 string? name; | 8 string? name; |
9 string name_for_display; | 9 string name_for_display; |
10 string id; | 10 string id; |
11 string address; | 11 string address; |
12 }; | 12 }; |
13 | 13 |
14 interface Adapter { | 14 interface Adapter { |
| 15 // Gets the address of the adapter. |
| 16 // Returns empty string if address cannot be retrieved. |
| 17 GetAddress() => (string address); |
| 18 |
| 19 // Gets the name of the adapter. |
| 20 // Returns empty string if name cannot be retrieved. |
| 21 GetName() => (string name); |
| 22 |
| 23 // Returns true if adapter is powered. |
| 24 IsPowered() => (bool powered); |
| 25 |
| 26 // Returns true if adapter is present. |
| 27 IsPresent() => (bool present); |
| 28 |
15 // Retrieves the list of the devices known by the adapter including Connected | 29 // Retrieves the list of the devices known by the adapter including Connected |
16 // Devices, GATT Connected Devices, Paired Devices and Devices discovered | 30 // Devices, GATT Connected Devices, Paired Devices and Devices discovered |
17 // during a classic or low-energy scan. | 31 // during a classic or low-energy scan. |
18 GetDevices() => (array<DeviceInfo> devices); | 32 GetDevices() => (array<DeviceInfo> devices); |
19 | 33 |
20 // Sets the client that listens for the adapter's events. | 34 // Sets the client that listens for the adapter's events. |
21 SetClient(AdapterClient client); | 35 SetClient(AdapterClient client); |
22 }; | 36 }; |
23 | 37 |
24 interface AdapterClient { | 38 interface AdapterClient { |
25 // Called the first time a device is discovered. | 39 // Called the first time a device is discovered. |
26 DeviceAdded(DeviceInfo device); | 40 DeviceAdded(DeviceInfo device); |
27 | 41 |
28 // Called after the device hasn't been seen for 3 minutes. | 42 // Called after the device hasn't been seen for 3 minutes. |
29 DeviceRemoved(DeviceInfo device); | 43 DeviceRemoved(DeviceInfo device); |
30 }; | 44 }; |
OLD | NEW |