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

Side by Side Diff: tools/dom/src/chrome/bluetooth.dart

Issue 12316032: Added more Chrome.* libraries to dart:chrome (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed local hardcoded paths Created 7 years, 10 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
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Generated from namespace: bluetooth
6
7 part of chrome;
8
9 /**
10 * Types
11 */
12
13 class BluetoothAdapterState extends ChromeObject {
14 /*
15 * Public constructor
16 */
17 BluetoothAdapterState({String address, String name, bool powered, bool availab le, bool discovering}) {
18 if (?address)
19 this.address = address;
20 if (?name)
21 this.name = name;
22 if (?powered)
23 this.powered = powered;
24 if (?available)
25 this.available = available;
26 if (?discovering)
27 this.discovering = discovering;
28 }
29
30 /*
31 * Private constructor
32 */
33 BluetoothAdapterState._proxy(_jsObject) : super._proxy(_jsObject);
34
35 /*
36 * Public accessors
37 */
38 /// The address of the adapter, in the format 'XX:XX:XX:XX:XX:XX'.
39 String get address => JS('String', '#.address', this._jsObject);
40
41 void set address(String address) {
42 JS('void', '#.address = #', this._jsObject, address);
43 }
44
45 /// The human-readable name of the adapter.
46 String get name => JS('String', '#.name', this._jsObject);
47
48 void set name(String name) {
49 JS('void', '#.name = #', this._jsObject, name);
50 }
51
52 /// Indicates whether or not the adapter has power.
53 bool get powered => JS('bool', '#.powered', this._jsObject);
54
55 void set powered(bool powered) {
56 JS('void', '#.powered = #', this._jsObject, powered);
57 }
58
59 /// Indicates whether or not the adapter is available (i.e. enabled).
60 bool get available => JS('bool', '#.available', this._jsObject);
61
62 void set available(bool available) {
63 JS('void', '#.available = #', this._jsObject, available);
64 }
65
66 /// Indicates whether or not the adapter is currently discovering.
67 bool get discovering => JS('bool', '#.discovering', this._jsObject);
68
69 void set discovering(bool discovering) {
70 JS('void', '#.discovering = #', this._jsObject, discovering);
71 }
72
73 }
74
75 class BluetoothDevice extends ChromeObject {
76 /*
77 * Public constructor
78 */
79 BluetoothDevice({String address, String name, bool paired, bool bonded, bool c onnected}) {
80 if (?address)
81 this.address = address;
82 if (?name)
83 this.name = name;
84 if (?paired)
85 this.paired = paired;
86 if (?bonded)
87 this.bonded = bonded;
88 if (?connected)
89 this.connected = connected;
90 }
91
92 /*
93 * Private constructor
94 */
95 BluetoothDevice._proxy(_jsObject) : super._proxy(_jsObject);
96
97 /*
98 * Public accessors
99 */
100 /// The address of the device, in the format 'XX:XX:XX:XX:XX:XX'.
101 String get address => JS('String', '#.address', this._jsObject);
102
103 void set address(String address) {
104 JS('void', '#.address = #', this._jsObject, address);
105 }
106
107 /// The human-readable name of the device.
108 String get name => JS('String', '#.name', this._jsObject);
109
110 void set name(String name) {
111 JS('void', '#.name = #', this._jsObject, name);
112 }
113
114 /// Indicates whether or not the device is paired with the system.
115 bool get paired => JS('bool', '#.paired', this._jsObject);
116
117 void set paired(bool paired) {
118 JS('void', '#.paired = #', this._jsObject, paired);
119 }
120
121 /// Indicates whether or not the device is bonded with the system. A device is
122 /// bonded if it is paired and high-security link keys have been exchanged so
123 /// that connections may be encrypted.
124 bool get bonded => JS('bool', '#.bonded', this._jsObject);
125
126 void set bonded(bool bonded) {
127 JS('void', '#.bonded = #', this._jsObject, bonded);
128 }
129
130 /// Indicates whether the device is currently connected to the system.
131 bool get connected => JS('bool', '#.connected', this._jsObject);
132
133 void set connected(bool connected) {
134 JS('void', '#.connected = #', this._jsObject, connected);
135 }
136
137 }
138
139 class BluetoothServiceRecord extends ChromeObject {
140 /*
141 * Public constructor
142 */
143 BluetoothServiceRecord({String name, String uuid}) {
144 if (?name)
145 this.name = name;
146 if (?uuid)
147 this.uuid = uuid;
148 }
149
150 /*
151 * Private constructor
152 */
153 BluetoothServiceRecord._proxy(_jsObject) : super._proxy(_jsObject);
154
155 /*
156 * Public accessors
157 */
158 /// The name of the service.
159 String get name => JS('String', '#.name', this._jsObject);
160
161 void set name(String name) {
162 JS('void', '#.name = #', this._jsObject, name);
163 }
164
165 /// The UUID of the service.
166 String get uuid => JS('String', '#.uuid', this._jsObject);
167
168 void set uuid(String uuid) {
169 JS('void', '#.uuid = #', this._jsObject, uuid);
170 }
171
172 }
173
174 class BluetoothSocket extends ChromeObject {
175 /*
176 * Public constructor
177 */
178 BluetoothSocket({BluetoothDevice device, String serviceUuid, int id}) {
179 if (?device)
180 this.device = device;
181 if (?serviceUuid)
182 this.serviceUuid = serviceUuid;
183 if (?id)
184 this.id = id;
185 }
186
187 /*
188 * Private constructor
189 */
190 BluetoothSocket._proxy(_jsObject) : super._proxy(_jsObject);
191
192 /*
193 * Public accessors
194 */
195 /// The remote Bluetooth device associated with this socket.
196 BluetoothDevice get device => new BluetoothDevice._proxy(JS('', '#.device', th is._jsObject));
197
198 void set device(BluetoothDevice device) {
199 JS('void', '#.device = #', this._jsObject, convertArgument(device));
200 }
201
202 /// The remote Bluetooth service associated with this socket.
203 String get serviceUuid => JS('String', '#.serviceUuid', this._jsObject);
204
205 void set serviceUuid(String serviceUuid) {
206 JS('void', '#.serviceUuid = #', this._jsObject, serviceUuid);
207 }
208
209 /// An identifier for this socket that should be used with the
210 /// read/write/disconnect methods.
211 int get id => JS('int', '#.id', this._jsObject);
212
213 void set id(int id) {
214 JS('void', '#.id = #', this._jsObject, id);
215 }
216
217 }
218
219 class BluetoothOutOfBandPairingData extends ChromeObject {
220 /*
221 * Public constructor
222 */
223 BluetoothOutOfBandPairingData({String hash, String randomizer}) {
224 if (?hash)
225 this.hash = hash;
226 if (?randomizer)
227 this.randomizer = randomizer;
228 }
229
230 /*
231 * Private constructor
232 */
233 BluetoothOutOfBandPairingData._proxy(_jsObject) : super._proxy(_jsObject);
234
235 /*
236 * Public accessors
237 */
238 /// Simple Pairing Hash C. Always 16 octets long.
239 String get hash => JS('String', '#.hash', this._jsObject);
240
241 void set hash(String hash) {
242 JS('void', '#.hash = #', this._jsObject, hash);
243 }
244
245 /// Simple Pairing Randomizer R. Always 16 octets long.
246 String get randomizer => JS('String', '#.randomizer', this._jsObject);
247
248 void set randomizer(String randomizer) {
249 JS('void', '#.randomizer = #', this._jsObject, randomizer);
250 }
251
252 }
253
254 class BluetoothGetDevicesOptions extends ChromeObject {
255 /*
256 * Private constructor
257 */
258 BluetoothGetDevicesOptions._proxy(_jsObject) : super._proxy(_jsObject);
259
260 /*
261 * Public accessors
262 */
263 /// Only devices providing a service with a UUID that matches |uuid| will be
264 /// returned.
265 String get uuid => JS('String', '#.uuid', this._jsObject);
266
267 void set uuid(String uuid) {
268 JS('void', '#.uuid = #', this._jsObject, uuid);
269 }
270
271 /// Only devices providing a service with a name that matches |name| will be
272 /// returned.
273 String get name => JS('String', '#.name', this._jsObject);
274
275 void set name(String name) {
276 JS('void', '#.name = #', this._jsObject, name);
277 }
278
279
280 /*
281 * Methods
282 */
283 /// Called for each matching device. Note that a service discovery request
284 /// must be made to each non-matching device before it can be definitively
285 /// excluded. This can take some time.
286 void deviceCallback(BluetoothDevice device) => JS('void', '#.deviceCallback(#) ', this._jsObject, convertArgument(device));
287
288 }
289
290 class BluetoothGetServicesOptions extends ChromeObject {
291 /*
292 * Public constructor
293 */
294 BluetoothGetServicesOptions({String deviceAddress}) {
295 if (?deviceAddress)
296 this.deviceAddress = deviceAddress;
297 }
298
299 /*
300 * Private constructor
301 */
302 BluetoothGetServicesOptions._proxy(_jsObject) : super._proxy(_jsObject);
303
304 /*
305 * Public accessors
306 */
307 /// The address of the device to inquire about. |deviceAddress| should be in
308 /// the format 'XX:XX:XX:XX:XX:XX'.
309 String get deviceAddress => JS('String', '#.deviceAddress', this._jsObject);
310
311 void set deviceAddress(String deviceAddress) {
312 JS('void', '#.deviceAddress = #', this._jsObject, deviceAddress);
313 }
314
315 }
316
317 class BluetoothConnectOptions extends ChromeObject {
318 /*
319 * Public constructor
320 */
321 BluetoothConnectOptions({String deviceAddress, String serviceUuid}) {
322 if (?deviceAddress)
323 this.deviceAddress = deviceAddress;
324 if (?serviceUuid)
325 this.serviceUuid = serviceUuid;
326 }
327
328 /*
329 * Private constructor
330 */
331 BluetoothConnectOptions._proxy(_jsObject) : super._proxy(_jsObject);
332
333 /*
334 * Public accessors
335 */
336 /// The connection is made to the device at |deviceAddress|. |deviceAddress|
337 /// should be in the format 'XX:XX:XX:XX:XX:XX'.
338 String get deviceAddress => JS('String', '#.deviceAddress', this._jsObject);
339
340 void set deviceAddress(String deviceAddress) {
341 JS('void', '#.deviceAddress = #', this._jsObject, deviceAddress);
342 }
343
344 /// The connection is made to the service with UUID |serviceUuid|.
345 String get serviceUuid => JS('String', '#.serviceUuid', this._jsObject);
346
347 void set serviceUuid(String serviceUuid) {
348 JS('void', '#.serviceUuid = #', this._jsObject, serviceUuid);
349 }
350
351 }
352
353 class BluetoothDisconnectOptions extends ChromeObject {
354 /*
355 * Public constructor
356 */
357 BluetoothDisconnectOptions({int socketId}) {
358 if (?socketId)
359 this.socketId = socketId;
360 }
361
362 /*
363 * Private constructor
364 */
365 BluetoothDisconnectOptions._proxy(_jsObject) : super._proxy(_jsObject);
366
367 /*
368 * Public accessors
369 */
370 /// The socket to disconnect.
371 int get socketId => JS('int', '#.socketId', this._jsObject);
372
373 void set socketId(int socketId) {
374 JS('void', '#.socketId = #', this._jsObject, socketId);
375 }
376
377 }
378
379 class BluetoothReadOptions extends ChromeObject {
380 /*
381 * Public constructor
382 */
383 BluetoothReadOptions({int socketId}) {
384 if (?socketId)
385 this.socketId = socketId;
386 }
387
388 /*
389 * Private constructor
390 */
391 BluetoothReadOptions._proxy(_jsObject) : super._proxy(_jsObject);
392
393 /*
394 * Public accessors
395 */
396 /// The socket to read from.
397 int get socketId => JS('int', '#.socketId', this._jsObject);
398
399 void set socketId(int socketId) {
400 JS('void', '#.socketId = #', this._jsObject, socketId);
401 }
402
403 }
404
405 class BluetoothWriteOptions extends ChromeObject {
406 /*
407 * Public constructor
408 */
409 BluetoothWriteOptions({int socketId, String data}) {
410 if (?socketId)
411 this.socketId = socketId;
412 if (?data)
413 this.data = data;
414 }
415
416 /*
417 * Private constructor
418 */
419 BluetoothWriteOptions._proxy(_jsObject) : super._proxy(_jsObject);
420
421 /*
422 * Public accessors
423 */
424 /// The socket to write to.
425 int get socketId => JS('int', '#.socketId', this._jsObject);
426
427 void set socketId(int socketId) {
428 JS('void', '#.socketId = #', this._jsObject, socketId);
429 }
430
431 /// The data to write.
432 String get data => JS('String', '#.data', this._jsObject);
433
434 void set data(String data) {
435 JS('void', '#.data = #', this._jsObject, data);
436 }
437
438 }
439
440 class BluetoothSetOutOfBandPairingDataOptions extends ChromeObject {
441 /*
442 * Public constructor
443 */
444 BluetoothSetOutOfBandPairingDataOptions({String address, BluetoothOutOfBandPai ringData data}) {
445 if (?address)
446 this.address = address;
447 if (?data)
448 this.data = data;
449 }
450
451 /*
452 * Private constructor
453 */
454 BluetoothSetOutOfBandPairingDataOptions._proxy(_jsObject) : super._proxy(_jsOb ject);
455
456 /*
457 * Public accessors
458 */
459 /// The address of the remote device that the data should be associated with.
460 /// |deviceAddress| should be in the format 'XX:XX:XX:XX:XX:XX'.
461 String get address => JS('String', '#.address', this._jsObject);
462
463 void set address(String address) {
464 JS('void', '#.address = #', this._jsObject, address);
465 }
466
467 /// The Out Of Band Pairing Data. If this is omitted, the data for the device
468 /// is cleared instead.
469 BluetoothOutOfBandPairingData get data => new BluetoothOutOfBandPairingData._p roxy(JS('', '#.data', this._jsObject));
470
471 void set data(BluetoothOutOfBandPairingData data) {
472 JS('void', '#.data = #', this._jsObject, convertArgument(data));
473 }
474
475 }
476
477 class BluetoothStartDiscoveryOptions extends ChromeObject {
478 /*
479 * Private constructor
480 */
481 BluetoothStartDiscoveryOptions._proxy(_jsObject) : super._proxy(_jsObject);
482
483 /*
484 * Methods
485 */
486 /// Called for each device that is discovered.
487 void deviceCallback(BluetoothDevice device) => JS('void', '#.deviceCallback(#) ', this._jsObject, convertArgument(device));
488
489 }
490
491 /**
492 * Events
493 */
494
495 /// Fired when the state of the Bluetooth adapter changes.
496 class Event_bluetooth_onAdapterStateChanged extends Event {
497 void addListener(void callback(BluetoothAdapterState state)) {
498 void __proxy_callback(state) {
499 if (?callback) {
500 callback(new BluetoothAdapterState._proxy(state));
501 }
502 }
503 super.addListener(callback);
504 }
505
506 void removeListener(void callback(BluetoothAdapterState state)) {
507 void __proxy_callback(state) {
508 if (?callback) {
509 callback(new BluetoothAdapterState._proxy(state));
510 }
511 }
512 super.removeListener(callback);
513 }
514
515 bool hasListener(void callback(BluetoothAdapterState state)) {
516 void __proxy_callback(state) {
517 if (?callback) {
518 callback(new BluetoothAdapterState._proxy(state));
519 }
520 }
521 super.hasListener(callback);
522 }
523
524 Event_bluetooth_onAdapterStateChanged(jsObject) : super._(jsObject, 1);
525 }
526
527 /**
528 * Functions
529 */
530
531 class API_bluetooth {
532 /*
533 * API connection
534 */
535 Object _jsObject;
536
537 /*
538 * Events
539 */
540 Event_bluetooth_onAdapterStateChanged onAdapterStateChanged;
541
542 /*
543 * Functions
544 */
545 /// Get information about the Bluetooth adapter.
546 void getAdapterState(void callback(BluetoothAdapterState result)) {
547 void __proxy_callback(result) {
548 if (?callback) {
549 callback(new BluetoothAdapterState._proxy(result));
550 }
551 }
552 JS('void', '#.getAdapterState(#)', this._jsObject, convertDartClosureToJS(__ proxy_callback, 1));
553 }
554
555 /// Get a bluetooth devices known to the system. Known devices are either
556 /// currently bonded, or have been bonded in the past.
557 void getDevices(BluetoothGetDevicesOptions options, void callback()) => JS('vo id', '#.getDevices(#, #)', this._jsObject, convertArgument(options), convertDart ClosureToJS(callback, 0));
558
559 /// Get a list of services provided by a device.
560 void getServices(BluetoothGetServicesOptions options, void callback(List<Bluet oothServiceRecord> result)) {
561 void __proxy_callback(result) {
562 if (?callback) {
563 List<BluetoothServiceRecord> __proxy_result = new List<BluetoothServiceR ecord>();
564 for (var o in result) {
565 __proxy_result.add(new BluetoothServiceRecord._proxy(o));
566 }
567 callback(__proxy_result);
568 }
569 }
570 JS('void', '#.getServices(#, #)', this._jsObject, convertArgument(options), convertDartClosureToJS(__proxy_callback, 1));
571 }
572
573 /// Connect to a service on a device.
574 void connect(BluetoothConnectOptions options, void callback(BluetoothSocket re sult)) {
575 void __proxy_callback(result) {
576 if (?callback) {
577 callback(new BluetoothSocket._proxy(result));
578 }
579 }
580 JS('void', '#.connect(#, #)', this._jsObject, convertArgument(options), conv ertDartClosureToJS(__proxy_callback, 1));
581 }
582
583 /// Close a Bluetooth connection.
584 void disconnect(BluetoothDisconnectOptions options, [void callback()]) => JS(' void', '#.disconnect(#, #)', this._jsObject, convertArgument(options), convertDa rtClosureToJS(callback, 0));
585
586 /// Read data from a Bluetooth connection.
587 void read(BluetoothReadOptions options, void callback(String result)) => JS('v oid', '#.read(#, #)', this._jsObject, convertArgument(options), convertDartClosu reToJS(callback, 1));
588
589 /// Write data to a Bluetooth connection.
590 void write(BluetoothWriteOptions options, [void callback(int result)]) => JS(' void', '#.write(#, #)', this._jsObject, convertArgument(options), convertDartClo sureToJS(callback, 1));
591
592 /// Get the local Out of Band Pairing data.
593 void getLocalOutOfBandPairingData(void callback(BluetoothOutOfBandPairingData data)) {
594 void __proxy_callback(data) {
595 if (?callback) {
596 callback(new BluetoothOutOfBandPairingData._proxy(data));
597 }
598 }
599 JS('void', '#.getLocalOutOfBandPairingData(#)', this._jsObject, convertDartC losureToJS(__proxy_callback, 1));
600 }
601
602 /// Set the Out of Band Pairing data for a remote device. Any previous Out Of
603 /// Band Pairing Data for this device is overwritten.
604 void setOutOfBandPairingData(BluetoothSetOutOfBandPairingDataOptions options, [void callback()]) => JS('void', '#.setOutOfBandPairingData(#, #)', this._jsObje ct, convertArgument(options), convertDartClosureToJS(callback, 0));
605
606 /// Start discovery. Discovered devices will be returned via the
607 /// |onDeviceDiscovered| callback. Discovery will fail to start if it is
608 /// already in progress. Discovery can be resource intensive: stopDiscovery
609 /// should be called as soon as possible.
610 void startDiscovery(BluetoothStartDiscoveryOptions options, [void callback()]) => JS('void', '#.startDiscovery(#, #)', this._jsObject, convertArgument(options ), convertDartClosureToJS(callback, 0));
611
612 /// Stop discovery.
613 void stopDiscovery([void callback()]) => JS('void', '#.stopDiscovery(#)', this ._jsObject, convertDartClosureToJS(callback, 0));
614
615 API_bluetooth(this._jsObject) {
616 onAdapterStateChanged = new Event_bluetooth_onAdapterStateChanged(JS('', '#. onAdapterStateChanged', this._jsObject));
617 }
618 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698