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

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

Issue 10837294: Add bluetooth.getName API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 8 years, 4 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // Simple Pairing Randomizer R. 47 // Simple Pairing Randomizer R.
48 // Always 16 octets long. 48 // Always 16 octets long.
49 ArrayBuffer randomizer; 49 ArrayBuffer randomizer;
50 }; 50 };
51 51
52 callback AddressCallback = void (DOMString result); 52 callback AddressCallback = void (DOMString result);
53 callback BooleanCallback = void (boolean result); 53 callback BooleanCallback = void (boolean result);
54 callback DataCallback = void (ArrayBuffer result); 54 callback DataCallback = void (ArrayBuffer result);
55 callback DeviceCallback = void (Device device); 55 callback DeviceCallback = void (Device device);
56 callback DevicesCallback = void (Device[] result); 56 callback DevicesCallback = void (Device[] result);
57 callback NameCallback = void (DOMString result);
57 callback OutOfBandPairingDataCallback = void (OutOfBandPairingData data); 58 callback OutOfBandPairingDataCallback = void (OutOfBandPairingData data);
58 callback ResultCallback = void (); 59 callback ResultCallback = void ();
59 callback ServicesCallback = void(ServiceRecord[] result); 60 callback ServicesCallback = void(ServiceRecord[] result);
60 callback SizeCallback = void (long result); 61 callback SizeCallback = void (long result);
61 callback SocketCallback = void (Socket result); 62 callback SocketCallback = void (Socket result);
62 63
63 // Options for the getDevices function. If neither |uuid| or |name| are 64 // Options for the getDevices function. If neither |uuid| or |name| are
64 // provided, all devices known to the system are returned. 65 // provided, all devices known to the system are returned.
65 dictionary GetDevicesOptions { 66 dictionary GetDevicesOptions {
66 // 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
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 }; 123 };
123 124
124 // Options for the startDiscovery function. 125 // Options for the startDiscovery function.
125 dictionary StartDiscoveryOptions { 126 dictionary StartDiscoveryOptions {
126 // Called for each device that is discovered. 127 // Called for each device that is discovered.
127 DeviceCallback deviceCallback; 128 DeviceCallback deviceCallback;
128 }; 129 };
129 130
130 // These functions all report failures via chrome.extension.lastError. 131 // These functions all report failures via chrome.extension.lastError.
131 interface Functions { 132 interface Functions {
132 // Checks if the system has bluetooth support. 133 // Checks if the system has Bluetooth support.
133 // |callback| : Called with the boolean result. 134 // |callback| : Called with the boolean result.
134 static void isAvailable(BooleanCallback callback); 135 static void isAvailable(BooleanCallback callback);
135 136
136 // Checks if the system's bluetooth module has power. 137 // Checks if the system's Bluetooth module has power.
137 // |callback| : Called with the boolean result. 138 // |callback| : Called with the boolean result.
138 static void isPowered(BooleanCallback callback); 139 static void isPowered(BooleanCallback callback);
139 140
140 // Get the bluetooth address of the system's bluetooth module. 141 // Get the Bluetooth address of the system's Bluetooth module.
141 // |callback| : Called with the address, or null if there was an error. 142 // |callback| : Called with the address of the Bluetooth adapter, or "" if
143 // there is no adapater available.
142 static void getAddress(AddressCallback callback); 144 static void getAddress(AddressCallback callback);
143 145
144 // Get a list of bluetooth devices. 146 // Get the name of the Bluetooth adapter.
147 // |callback| : Called with the name of the Bluetooth adapter, or "" if
148 // there is no adapater available.
149 static void getName(NameCallback callback);
150
151 // Get a list of Bluetooth devices.
145 // NOTE: This API is likely to change. Please see crbug.com/134545 152 // NOTE: This API is likely to change. Please see crbug.com/134545
146 // |options| : Controls which devices are returned. 153 // |options| : Controls which devices are returned.
147 // |callback| : Called with an array of Device objects. 154 // |callback| : Called with an array of Device objects.
148 static void getDevices(GetDevicesOptions options, 155 static void getDevices(GetDevicesOptions options,
149 DevicesCallback callback); 156 DevicesCallback callback);
150 157
151 // Get a list of services provided by a device. 158 // Get a list of services provided by a device.
152 static void getServices(GetServicesOptions options, 159 static void getServices(GetServicesOptions options,
153 ServicesCallback callback); 160 ServicesCallback callback);
154 161
155 // Connect to a service on a device. 162 // Connect to a service on a device.
156 // |options| : The options for the connection. 163 // |options| : The options for the connection.
157 // |callback| : Called when the connection is established with a Socket 164 // |callback| : Called when the connection is established with a Socket
158 // that can be used to communicate with |device|. 165 // that can be used to communicate with |device|.
159 static void connect(ConnectOptions options, 166 static void connect(ConnectOptions options,
160 SocketCallback callback); 167 SocketCallback callback);
161 168
162 // Close a bluetooth connection. 169 // Close a Bluetooth connection.
163 // |options| : The options for this function. 170 // |options| : The options for this function.
164 // |callback| : Called to indicate success or failure. 171 // |callback| : Called to indicate success or failure.
165 static void disconnect(DisconnectOptions options, 172 static void disconnect(DisconnectOptions options,
166 optional ResultCallback callback); 173 optional ResultCallback callback);
167 174
168 // Read data from a bluetooth connection. 175 // Read data from a Bluetooth connection.
169 // |options| : The options for this function. 176 // |options| : The options for this function.
170 // |callback| : Called with the data when it is available. 177 // |callback| : Called with the data when it is available.
171 static void read(ReadOptions options, 178 static void read(ReadOptions options,
172 DataCallback callback); 179 DataCallback callback);
173 180
174 // Write data to a bluetooth connection. 181 // Write data to a Bluetooth connection.
175 // |options| : The options for this function. 182 // |options| : The options for this function.
176 // |callback| : Called with the number of bytes written. 183 // |callback| : Called with the number of bytes written.
177 static void write(WriteOptions options, 184 static void write(WriteOptions options,
178 optional SizeCallback callback); 185 optional SizeCallback callback);
179 186
180 // Get the local Out of Band Pairing data. 187 // Get the local Out of Band Pairing data.
181 // |callback| : Called with the data. 188 // |callback| : Called with the data.
182 static void getLocalOutOfBandPairingData( 189 static void getLocalOutOfBandPairingData(
183 OutOfBandPairingDataCallback callback); 190 OutOfBandPairingDataCallback callback);
184 191
(...skipping 14 matching lines...) Expand all
199 StartDiscoveryOptions options, 206 StartDiscoveryOptions options,
200 optional ResultCallback callback); 207 optional ResultCallback callback);
201 208
202 // Stop discovery. 209 // Stop discovery.
203 // |callback| : Called to indicate success or failure. 210 // |callback| : Called to indicate success or failure.
204 static void stopDiscovery( 211 static void stopDiscovery(
205 optional ResultCallback callback); 212 optional ResultCallback callback);
206 }; 213 };
207 214
208 interface Events { 215 interface Events {
209 // Fired when the availability of bluetooth on the system changes. 216 // Fired when the availability of Bluetooth on the system changes.
210 // |available| : True if bluetooth is available, false otherwise. 217 // |available| : True if Bluetooth is available, false otherwise.
211 static void onAvailabilityChanged(boolean available); 218 static void onAvailabilityChanged(boolean available);
212 219
213 // Fired when the power state of bluetooth on the system changes. 220 // Fired when the power state of Bluetooth on the system changes.
214 // |powered| : True if bluetooth is powered, false otherwise. 221 // |powered| : True if Bluetooth is powered, false otherwise.
215 static void onPowerChanged(boolean has_power); 222 static void onPowerChanged(boolean has_power);
216 223
217 // Fired when the discovering state of the system changes. 224 // Fired when the discovering state of the system changes.
218 // |discovering| : True if the system is currently in discovery mode, false 225 // |discovering| : True if the system is currently in discovery mode, false
219 // otherwise. 226 // otherwise.
220 static void onDiscoveringChanged(boolean discovering); 227 static void onDiscoveringChanged(boolean discovering);
221 }; 228 };
222 }; 229 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698