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