Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: chrome/common/extensions/api/experimental_bluetooth.idl

Issue 10915148: Change getDevices to use a DeviceCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test breakage Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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;
74 }; 79 };
75 80
76 // Options for the getServices function. 81 // Options for the getServices function.
77 dictionary GetServicesOptions { 82 dictionary GetServicesOptions {
78 // The address of the device to inquire about. |deviceAddress| should be 83 // The address of the device to inquire about. |deviceAddress| should be
79 // in the format 'XX:XX:XX:XX:XX:XX'. 84 // in the format 'XX:XX:XX:XX:XX:XX'.
80 DOMString deviceAddress; 85 DOMString deviceAddress;
81 }; 86 };
82 87
83 // Options for the connect function. 88 // Options for the connect function.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 // Get the Bluetooth address of the system's Bluetooth module. 146 // Get the Bluetooth address of the system's Bluetooth module.
142 // |callback| : Called with the address of the Bluetooth adapter, or "" if 147 // |callback| : Called with the address of the Bluetooth adapter, or "" if
143 // there is no adapater available. 148 // there is no adapater available.
144 static void getAddress(AddressCallback callback); 149 static void getAddress(AddressCallback callback);
145 150
146 // Get the name of the Bluetooth adapter. 151 // Get the name of the Bluetooth adapter.
147 // |callback| : Called with the name of the Bluetooth adapter, or "" if 152 // |callback| : Called with the name of the Bluetooth adapter, or "" if
148 // there is no adapater available. 153 // there is no adapater available.
149 static void getName(NameCallback callback); 154 static void getName(NameCallback callback);
150 155
151 // Get a list of Bluetooth devices. 156 // Get a bluetooth devices known to the system. Known devices are either
152 // NOTE: This API is likely to change. Please see crbug.com/134545 157 // currently bonded, or have been bonded in the past.
153 // |options| : Controls which devices are returned. 158 // |options| : Controls which devices are returned and provides
154 // |callback| : Called with an array of Device objects. 159 // |deviceCallback|, which is called for each matching device.
160 // |callback| : Called when the search is completed.
161 // |options.deviceCallback| will not be called after
162 // |callback| has been called.
155 static void getDevices(GetDevicesOptions options, 163 static void getDevices(GetDevicesOptions options,
156 DevicesCallback callback); 164 ResultCallback callback);
157 165
158 // Get a list of services provided by a device. 166 // Get a list of services provided by a device.
159 static void getServices(GetServicesOptions options, 167 static void getServices(GetServicesOptions options,
160 ServicesCallback callback); 168 ServicesCallback callback);
161 169
162 // Connect to a service on a device. 170 // Connect to a service on a device.
163 // |options| : The options for the connection. 171 // |options| : The options for the connection.
164 // |callback| : Called when the connection is established with a Socket 172 // |callback| : Called when the connection is established with a Socket
165 // that can be used to communicate with |device|. 173 // that can be used to communicate with |device|.
166 static void connect(ConnectOptions options, 174 static void connect(ConnectOptions options,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 // Fired when the power state of Bluetooth on the system changes. 228 // Fired when the power state of Bluetooth on the system changes.
221 // |powered| : True if Bluetooth is powered, false otherwise. 229 // |powered| : True if Bluetooth is powered, false otherwise.
222 static void onPowerChanged(boolean has_power); 230 static void onPowerChanged(boolean has_power);
223 231
224 // Fired when the discovering state of the system changes. 232 // Fired when the discovering state of the system changes.
225 // |discovering| : True if the system is currently in discovery mode, false 233 // |discovering| : True if the system is currently in discovery mode, false
226 // otherwise. 234 // otherwise.
227 static void onDiscoveringChanged(boolean discovering); 235 static void onDiscoveringChanged(boolean discovering);
228 }; 236 };
229 }; 237 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698