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