| 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 // TODO(bryeung): mark this API as ChromeOS only (see crbug.com/119398). | 6 // TODO(bryeung): mark this API as ChromeOS only (see crbug.com/119398). |
| 7 | 7 |
| 8 namespace experimental.bluetooth { | 8 namespace experimental.bluetooth { |
| 9 dictionary Device { | 9 dictionary Device { |
| 10 // The address of the device, in the format 'XX:XX:XX:XX:XX:XX'. | 10 // The address of the device, in the format 'XX:XX:XX:XX:XX:XX'. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // Options for the getDevices function. If neither |uuid| or |name| are | 64 // Options for the getDevices function. If neither |uuid| or |name| are |
| 65 // provided, all devices known to the system are returned. | 65 // provided, all devices known to the system are returned. |
| 66 dictionary GetDevicesOptions { | 66 dictionary GetDevicesOptions { |
| 67 // Only devices providing a service with a UUID that matches |uuid| will be | 67 // Only devices providing a service with a UUID that matches |uuid| will be |
| 68 // returned. | 68 // returned. |
| 69 DOMString? uuid; | 69 DOMString? uuid; |
| 70 | 70 |
| 71 // Only devices providing a service with a name that matches |name| will be | 71 // Only devices providing a service with a name that matches |name| will be |
| 72 // returned. | 72 // returned. |
| 73 DOMString? name; | 73 DOMString? name; |
| 74 | |
| 75 // Called for each matching device. Note that a service discovery request | |
| 76 // must be made to each non-matching device before it can be definitively | |
| 77 // excluded. This can take some time. | |
| 78 DeviceCallback deviceCallback; | |
| 79 }; | 74 }; |
| 80 | 75 |
| 81 // Options for the getServices function. | 76 // Options for the getServices function. |
| 82 dictionary GetServicesOptions { | 77 dictionary GetServicesOptions { |
| 83 // The address of the device to inquire about. |deviceAddress| should be | 78 // The address of the device to inquire about. |deviceAddress| should be |
| 84 // in the format 'XX:XX:XX:XX:XX:XX'. | 79 // in the format 'XX:XX:XX:XX:XX:XX'. |
| 85 DOMString deviceAddress; | 80 DOMString deviceAddress; |
| 86 }; | 81 }; |
| 87 | 82 |
| 88 // Options for the connect function. | 83 // Options for the connect function. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // Get the Bluetooth address of the system's Bluetooth module. | 141 // Get the Bluetooth address of the system's Bluetooth module. |
| 147 // |callback| : Called with the address of the Bluetooth adapter, or "" if | 142 // |callback| : Called with the address of the Bluetooth adapter, or "" if |
| 148 // there is no adapater available. | 143 // there is no adapater available. |
| 149 static void getAddress(AddressCallback callback); | 144 static void getAddress(AddressCallback callback); |
| 150 | 145 |
| 151 // Get the name of the Bluetooth adapter. | 146 // Get the name of the Bluetooth adapter. |
| 152 // |callback| : Called with the name of the Bluetooth adapter, or "" if | 147 // |callback| : Called with the name of the Bluetooth adapter, or "" if |
| 153 // there is no adapater available. | 148 // there is no adapater available. |
| 154 static void getName(NameCallback callback); | 149 static void getName(NameCallback callback); |
| 155 | 150 |
| 156 // Get a bluetooth devices known to the system. Known devices are either | 151 // Get a list of Bluetooth devices. |
| 157 // currently bonded, or have been bonded in the past. | 152 // NOTE: This API is likely to change. Please see crbug.com/134545 |
| 158 // |options| : Controls which devices are returned and provides | 153 // |options| : Controls which devices are returned. |
| 159 // |deviceCallback|, which is called for each matching device. | 154 // |callback| : Called with an array of Device objects. |
| 160 // |callback| : Called when the search is completed. | |
| 161 // |options.deviceCallback| will not be called after | |
| 162 // |callback| has been called. | |
| 163 static void getDevices(GetDevicesOptions options, | 155 static void getDevices(GetDevicesOptions options, |
| 164 ResultCallback callback); | 156 DevicesCallback callback); |
| 165 | 157 |
| 166 // Get a list of services provided by a device. | 158 // Get a list of services provided by a device. |
| 167 static void getServices(GetServicesOptions options, | 159 static void getServices(GetServicesOptions options, |
| 168 ServicesCallback callback); | 160 ServicesCallback callback); |
| 169 | 161 |
| 170 // Connect to a service on a device. | 162 // Connect to a service on a device. |
| 171 // |options| : The options for the connection. | 163 // |options| : The options for the connection. |
| 172 // |callback| : Called when the connection is established with a Socket | 164 // |callback| : Called when the connection is established with a Socket |
| 173 // that can be used to communicate with |device|. | 165 // that can be used to communicate with |device|. |
| 174 static void connect(ConnectOptions options, | 166 static void connect(ConnectOptions options, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 // Fired when the power state of Bluetooth on the system changes. | 220 // Fired when the power state of Bluetooth on the system changes. |
| 229 // |powered| : True if Bluetooth is powered, false otherwise. | 221 // |powered| : True if Bluetooth is powered, false otherwise. |
| 230 static void onPowerChanged(boolean has_power); | 222 static void onPowerChanged(boolean has_power); |
| 231 | 223 |
| 232 // Fired when the discovering state of the system changes. | 224 // Fired when the discovering state of the system changes. |
| 233 // |discovering| : True if the system is currently in discovery mode, false | 225 // |discovering| : True if the system is currently in discovery mode, false |
| 234 // otherwise. | 226 // otherwise. |
| 235 static void onDiscoveringChanged(boolean discovering); | 227 static void onDiscoveringChanged(boolean discovering); |
| 236 }; | 228 }; |
| 237 }; | 229 }; |
| OLD | NEW |