OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Bluetooth API. | 5 // Bluetooth API. |
6 | 6 |
7 namespace bluetooth { | 7 namespace bluetooth { |
8 dictionary AdapterState { | 8 dictionary AdapterState { |
9 // The address of the adapter, in the format 'XX:XX:XX:XX:XX:XX'. | 9 // The address of the adapter, in the format 'XX:XX:XX:XX:XX:XX'. |
10 DOMString address; | 10 DOMString address; |
(...skipping 14 matching lines...) Expand all Loading... |
25 dictionary Device { | 25 dictionary Device { |
26 // The address of the device, in the format 'XX:XX:XX:XX:XX:XX'. | 26 // The address of the device, in the format 'XX:XX:XX:XX:XX:XX'. |
27 DOMString address; | 27 DOMString address; |
28 | 28 |
29 // The human-readable name of the device. | 29 // The human-readable name of the device. |
30 DOMString name; | 30 DOMString name; |
31 | 31 |
32 // Indicates whether or not the device is paired with the system. | 32 // Indicates whether or not the device is paired with the system. |
33 boolean paired; | 33 boolean paired; |
34 | 34 |
35 // Indicates whether or not the device is bonded with the system. A device | |
36 // is bonded if it is paired and high-security link keys have been | |
37 // exchanged so that connections may be encrypted. | |
38 boolean bonded; | |
39 | |
40 // Indicates whether the device is currently connected to the system. | 35 // Indicates whether the device is currently connected to the system. |
41 boolean connected; | 36 boolean connected; |
42 }; | 37 }; |
43 | 38 |
44 dictionary ServiceRecord { | 39 dictionary ServiceRecord { |
45 // The name of the service. | 40 // The name of the service. |
46 DOMString name; | 41 DOMString name; |
47 | 42 |
48 // The UUID of the service. | 43 // The UUID of the service. |
49 DOMString? uuid; | 44 DOMString? uuid; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 }; | 152 }; |
158 | 153 |
159 // These functions all report failures via chrome.runtime.lastError. | 154 // These functions all report failures via chrome.runtime.lastError. |
160 interface Functions { | 155 interface Functions { |
161 // Get information about the Bluetooth adapter. | 156 // Get information about the Bluetooth adapter. |
162 // |callback| : Called with an AdapterState object describing the adapter | 157 // |callback| : Called with an AdapterState object describing the adapter |
163 // state. | 158 // state. |
164 static void getAdapterState(AdapterStateCallback callback); | 159 static void getAdapterState(AdapterStateCallback callback); |
165 | 160 |
166 // Get a bluetooth devices known to the system. Known devices are either | 161 // Get a bluetooth devices known to the system. Known devices are either |
167 // currently bonded, or have been bonded in the past. | 162 // currently paired, or have been paired in the past. |
168 // |options| : Controls which devices are returned and provides | 163 // |options| : Controls which devices are returned and provides |
169 // |deviceCallback|, which is called for each matching device. | 164 // |deviceCallback|, which is called for each matching device. |
170 // |callback| : Called when the search is completed. | 165 // |callback| : Called when the search is completed. |
171 // |options.deviceCallback| will not be called after | 166 // |options.deviceCallback| will not be called after |
172 // |callback| has been called. | 167 // |callback| has been called. |
173 static void getDevices(GetDevicesOptions options, | 168 static void getDevices(GetDevicesOptions options, |
174 ResultCallback callback); | 169 ResultCallback callback); |
175 | 170 |
176 // Get a list of services provided by a device. | 171 // Get a list of services provided by a device. |
177 static void getServices(GetServicesOptions options, | 172 static void getServices(GetServicesOptions options, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 static void stopDiscovery( | 224 static void stopDiscovery( |
230 optional ResultCallback callback); | 225 optional ResultCallback callback); |
231 }; | 226 }; |
232 | 227 |
233 interface Events { | 228 interface Events { |
234 // Fired when the state of the Bluetooth adapter changes. | 229 // Fired when the state of the Bluetooth adapter changes. |
235 // |state| : The new state of the adapter. | 230 // |state| : The new state of the adapter. |
236 static void onAdapterStateChanged(AdapterState state); | 231 static void onAdapterStateChanged(AdapterState state); |
237 }; | 232 }; |
238 }; | 233 }; |
OLD | NEW |