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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: tools/dom/src/chrome/bluetooth.dart
diff --git a/tools/dom/src/chrome/bluetooth.dart b/tools/dom/src/chrome/bluetooth.dart
new file mode 100644
index 0000000000000000000000000000000000000000..42902ad2c06f64f64d84309fcaf8f911324fe84a
--- /dev/null
+++ b/tools/dom/src/chrome/bluetooth.dart
@@ -0,0 +1,618 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Generated from namespace: bluetooth
+
+part of chrome;
+
+/**
+ * Types
+ */
+
+class BluetoothAdapterState extends ChromeObject {
+ /*
+ * Public constructor
+ */
+ BluetoothAdapterState({String address, String name, bool powered, bool available, bool discovering}) {
+ if (?address)
+ this.address = address;
+ if (?name)
+ this.name = name;
+ if (?powered)
+ this.powered = powered;
+ if (?available)
+ this.available = available;
+ if (?discovering)
+ this.discovering = discovering;
+ }
+
+ /*
+ * Private constructor
+ */
+ BluetoothAdapterState._proxy(_jsObject) : super._proxy(_jsObject);
+
+ /*
+ * Public accessors
+ */
+ /// The address of the adapter, in the format 'XX:XX:XX:XX:XX:XX'.
+ String get address => JS('String', '#.address', this._jsObject);
+
+ void set address(String address) {
+ JS('void', '#.address = #', this._jsObject, address);
+ }
+
+ /// The human-readable name of the adapter.
+ String get name => JS('String', '#.name', this._jsObject);
+
+ void set name(String name) {
+ JS('void', '#.name = #', this._jsObject, name);
+ }
+
+ /// Indicates whether or not the adapter has power.
+ bool get powered => JS('bool', '#.powered', this._jsObject);
+
+ void set powered(bool powered) {
+ JS('void', '#.powered = #', this._jsObject, powered);
+ }
+
+ /// Indicates whether or not the adapter is available (i.e. enabled).
+ bool get available => JS('bool', '#.available', this._jsObject);
+
+ void set available(bool available) {
+ JS('void', '#.available = #', this._jsObject, available);
+ }
+
+ /// Indicates whether or not the adapter is currently discovering.
+ bool get discovering => JS('bool', '#.discovering', this._jsObject);
+
+ void set discovering(bool discovering) {
+ JS('void', '#.discovering = #', this._jsObject, discovering);
+ }
+
+}
+
+class BluetoothDevice extends ChromeObject {
+ /*
+ * Public constructor
+ */
+ BluetoothDevice({String address, String name, bool paired, bool bonded, bool connected}) {
+ if (?address)
+ this.address = address;
+ if (?name)
+ this.name = name;
+ if (?paired)
+ this.paired = paired;
+ if (?bonded)
+ this.bonded = bonded;
+ if (?connected)
+ this.connected = connected;
+ }
+
+ /*
+ * Private constructor
+ */
+ BluetoothDevice._proxy(_jsObject) : super._proxy(_jsObject);
+
+ /*
+ * Public accessors
+ */
+ /// The address of the device, in the format 'XX:XX:XX:XX:XX:XX'.
+ String get address => JS('String', '#.address', this._jsObject);
+
+ void set address(String address) {
+ JS('void', '#.address = #', this._jsObject, address);
+ }
+
+ /// The human-readable name of the device.
+ String get name => JS('String', '#.name', this._jsObject);
+
+ void set name(String name) {
+ JS('void', '#.name = #', this._jsObject, name);
+ }
+
+ /// Indicates whether or not the device is paired with the system.
+ bool get paired => JS('bool', '#.paired', this._jsObject);
+
+ void set paired(bool paired) {
+ JS('void', '#.paired = #', this._jsObject, paired);
+ }
+
+ /// Indicates whether or not the device is bonded with the system. A device is
+ /// bonded if it is paired and high-security link keys have been exchanged so
+ /// that connections may be encrypted.
+ bool get bonded => JS('bool', '#.bonded', this._jsObject);
+
+ void set bonded(bool bonded) {
+ JS('void', '#.bonded = #', this._jsObject, bonded);
+ }
+
+ /// Indicates whether the device is currently connected to the system.
+ bool get connected => JS('bool', '#.connected', this._jsObject);
+
+ void set connected(bool connected) {
+ JS('void', '#.connected = #', this._jsObject, connected);
+ }
+
+}
+
+class BluetoothServiceRecord extends ChromeObject {
+ /*
+ * Public constructor
+ */
+ BluetoothServiceRecord({String name, String uuid}) {
+ if (?name)
+ this.name = name;
+ if (?uuid)
+ this.uuid = uuid;
+ }
+
+ /*
+ * Private constructor
+ */
+ BluetoothServiceRecord._proxy(_jsObject) : super._proxy(_jsObject);
+
+ /*
+ * Public accessors
+ */
+ /// The name of the service.
+ String get name => JS('String', '#.name', this._jsObject);
+
+ void set name(String name) {
+ JS('void', '#.name = #', this._jsObject, name);
+ }
+
+ /// The UUID of the service.
+ String get uuid => JS('String', '#.uuid', this._jsObject);
+
+ void set uuid(String uuid) {
+ JS('void', '#.uuid = #', this._jsObject, uuid);
+ }
+
+}
+
+class BluetoothSocket extends ChromeObject {
+ /*
+ * Public constructor
+ */
+ BluetoothSocket({BluetoothDevice device, String serviceUuid, int id}) {
+ if (?device)
+ this.device = device;
+ if (?serviceUuid)
+ this.serviceUuid = serviceUuid;
+ if (?id)
+ this.id = id;
+ }
+
+ /*
+ * Private constructor
+ */
+ BluetoothSocket._proxy(_jsObject) : super._proxy(_jsObject);
+
+ /*
+ * Public accessors
+ */
+ /// The remote Bluetooth device associated with this socket.
+ BluetoothDevice get device => new BluetoothDevice._proxy(JS('', '#.device', this._jsObject));
+
+ void set device(BluetoothDevice device) {
+ JS('void', '#.device = #', this._jsObject, convertArgument(device));
+ }
+
+ /// The remote Bluetooth service associated with this socket.
+ String get serviceUuid => JS('String', '#.serviceUuid', this._jsObject);
+
+ void set serviceUuid(String serviceUuid) {
+ JS('void', '#.serviceUuid = #', this._jsObject, serviceUuid);
+ }
+
+ /// An identifier for this socket that should be used with the
+ /// read/write/disconnect methods.
+ int get id => JS('int', '#.id', this._jsObject);
+
+ void set id(int id) {
+ JS('void', '#.id = #', this._jsObject, id);
+ }
+
+}
+
+class BluetoothOutOfBandPairingData extends ChromeObject {
+ /*
+ * Public constructor
+ */
+ BluetoothOutOfBandPairingData({String hash, String randomizer}) {
+ if (?hash)
+ this.hash = hash;
+ if (?randomizer)
+ this.randomizer = randomizer;
+ }
+
+ /*
+ * Private constructor
+ */
+ BluetoothOutOfBandPairingData._proxy(_jsObject) : super._proxy(_jsObject);
+
+ /*
+ * Public accessors
+ */
+ /// Simple Pairing Hash C. Always 16 octets long.
+ String get hash => JS('String', '#.hash', this._jsObject);
+
+ void set hash(String hash) {
+ JS('void', '#.hash = #', this._jsObject, hash);
+ }
+
+ /// Simple Pairing Randomizer R. Always 16 octets long.
+ String get randomizer => JS('String', '#.randomizer', this._jsObject);
+
+ void set randomizer(String randomizer) {
+ JS('void', '#.randomizer = #', this._jsObject, randomizer);
+ }
+
+}
+
+class BluetoothGetDevicesOptions extends ChromeObject {
+ /*
+ * Private constructor
+ */
+ BluetoothGetDevicesOptions._proxy(_jsObject) : super._proxy(_jsObject);
+
+ /*
+ * Public accessors
+ */
+ /// Only devices providing a service with a UUID that matches |uuid| will be
+ /// returned.
+ String get uuid => JS('String', '#.uuid', this._jsObject);
+
+ void set uuid(String uuid) {
+ JS('void', '#.uuid = #', this._jsObject, uuid);
+ }
+
+ /// Only devices providing a service with a name that matches |name| will be
+ /// returned.
+ String get name => JS('String', '#.name', this._jsObject);
+
+ void set name(String name) {
+ JS('void', '#.name = #', this._jsObject, name);
+ }
+
+
+ /*
+ * Methods
+ */
+ /// Called for each matching device. Note that a service discovery request
+ /// must be made to each non-matching device before it can be definitively
+ /// excluded. This can take some time.
+ void deviceCallback(BluetoothDevice device) => JS('void', '#.deviceCallback(#)', this._jsObject, convertArgument(device));
+
+}
+
+class BluetoothGetServicesOptions extends ChromeObject {
+ /*
+ * Public constructor
+ */
+ BluetoothGetServicesOptions({String deviceAddress}) {
+ if (?deviceAddress)
+ this.deviceAddress = deviceAddress;
+ }
+
+ /*
+ * Private constructor
+ */
+ BluetoothGetServicesOptions._proxy(_jsObject) : super._proxy(_jsObject);
+
+ /*
+ * Public accessors
+ */
+ /// The address of the device to inquire about. |deviceAddress| should be in
+ /// the format 'XX:XX:XX:XX:XX:XX'.
+ String get deviceAddress => JS('String', '#.deviceAddress', this._jsObject);
+
+ void set deviceAddress(String deviceAddress) {
+ JS('void', '#.deviceAddress = #', this._jsObject, deviceAddress);
+ }
+
+}
+
+class BluetoothConnectOptions extends ChromeObject {
+ /*
+ * Public constructor
+ */
+ BluetoothConnectOptions({String deviceAddress, String serviceUuid}) {
+ if (?deviceAddress)
+ this.deviceAddress = deviceAddress;
+ if (?serviceUuid)
+ this.serviceUuid = serviceUuid;
+ }
+
+ /*
+ * Private constructor
+ */
+ BluetoothConnectOptions._proxy(_jsObject) : super._proxy(_jsObject);
+
+ /*
+ * Public accessors
+ */
+ /// The connection is made to the device at |deviceAddress|. |deviceAddress|
+ /// should be in the format 'XX:XX:XX:XX:XX:XX'.
+ String get deviceAddress => JS('String', '#.deviceAddress', this._jsObject);
+
+ void set deviceAddress(String deviceAddress) {
+ JS('void', '#.deviceAddress = #', this._jsObject, deviceAddress);
+ }
+
+ /// The connection is made to the service with UUID |serviceUuid|.
+ String get serviceUuid => JS('String', '#.serviceUuid', this._jsObject);
+
+ void set serviceUuid(String serviceUuid) {
+ JS('void', '#.serviceUuid = #', this._jsObject, serviceUuid);
+ }
+
+}
+
+class BluetoothDisconnectOptions extends ChromeObject {
+ /*
+ * Public constructor
+ */
+ BluetoothDisconnectOptions({int socketId}) {
+ if (?socketId)
+ this.socketId = socketId;
+ }
+
+ /*
+ * Private constructor
+ */
+ BluetoothDisconnectOptions._proxy(_jsObject) : super._proxy(_jsObject);
+
+ /*
+ * Public accessors
+ */
+ /// The socket to disconnect.
+ int get socketId => JS('int', '#.socketId', this._jsObject);
+
+ void set socketId(int socketId) {
+ JS('void', '#.socketId = #', this._jsObject, socketId);
+ }
+
+}
+
+class BluetoothReadOptions extends ChromeObject {
+ /*
+ * Public constructor
+ */
+ BluetoothReadOptions({int socketId}) {
+ if (?socketId)
+ this.socketId = socketId;
+ }
+
+ /*
+ * Private constructor
+ */
+ BluetoothReadOptions._proxy(_jsObject) : super._proxy(_jsObject);
+
+ /*
+ * Public accessors
+ */
+ /// The socket to read from.
+ int get socketId => JS('int', '#.socketId', this._jsObject);
+
+ void set socketId(int socketId) {
+ JS('void', '#.socketId = #', this._jsObject, socketId);
+ }
+
+}
+
+class BluetoothWriteOptions extends ChromeObject {
+ /*
+ * Public constructor
+ */
+ BluetoothWriteOptions({int socketId, String data}) {
+ if (?socketId)
+ this.socketId = socketId;
+ if (?data)
+ this.data = data;
+ }
+
+ /*
+ * Private constructor
+ */
+ BluetoothWriteOptions._proxy(_jsObject) : super._proxy(_jsObject);
+
+ /*
+ * Public accessors
+ */
+ /// The socket to write to.
+ int get socketId => JS('int', '#.socketId', this._jsObject);
+
+ void set socketId(int socketId) {
+ JS('void', '#.socketId = #', this._jsObject, socketId);
+ }
+
+ /// The data to write.
+ String get data => JS('String', '#.data', this._jsObject);
+
+ void set data(String data) {
+ JS('void', '#.data = #', this._jsObject, data);
+ }
+
+}
+
+class BluetoothSetOutOfBandPairingDataOptions extends ChromeObject {
+ /*
+ * Public constructor
+ */
+ BluetoothSetOutOfBandPairingDataOptions({String address, BluetoothOutOfBandPairingData data}) {
+ if (?address)
+ this.address = address;
+ if (?data)
+ this.data = data;
+ }
+
+ /*
+ * Private constructor
+ */
+ BluetoothSetOutOfBandPairingDataOptions._proxy(_jsObject) : super._proxy(_jsObject);
+
+ /*
+ * Public accessors
+ */
+ /// The address of the remote device that the data should be associated with.
+ /// |deviceAddress| should be in the format 'XX:XX:XX:XX:XX:XX'.
+ String get address => JS('String', '#.address', this._jsObject);
+
+ void set address(String address) {
+ JS('void', '#.address = #', this._jsObject, address);
+ }
+
+ /// The Out Of Band Pairing Data. If this is omitted, the data for the device
+ /// is cleared instead.
+ BluetoothOutOfBandPairingData get data => new BluetoothOutOfBandPairingData._proxy(JS('', '#.data', this._jsObject));
+
+ void set data(BluetoothOutOfBandPairingData data) {
+ JS('void', '#.data = #', this._jsObject, convertArgument(data));
+ }
+
+}
+
+class BluetoothStartDiscoveryOptions extends ChromeObject {
+ /*
+ * Private constructor
+ */
+ BluetoothStartDiscoveryOptions._proxy(_jsObject) : super._proxy(_jsObject);
+
+ /*
+ * Methods
+ */
+ /// Called for each device that is discovered.
+ void deviceCallback(BluetoothDevice device) => JS('void', '#.deviceCallback(#)', this._jsObject, convertArgument(device));
+
+}
+
+/**
+ * Events
+ */
+
+/// Fired when the state of the Bluetooth adapter changes.
+class Event_bluetooth_onAdapterStateChanged extends Event {
+ void addListener(void callback(BluetoothAdapterState state)) {
+ void __proxy_callback(state) {
+ if (?callback) {
+ callback(new BluetoothAdapterState._proxy(state));
+ }
+ }
+ super.addListener(callback);
+ }
+
+ void removeListener(void callback(BluetoothAdapterState state)) {
+ void __proxy_callback(state) {
+ if (?callback) {
+ callback(new BluetoothAdapterState._proxy(state));
+ }
+ }
+ super.removeListener(callback);
+ }
+
+ bool hasListener(void callback(BluetoothAdapterState state)) {
+ void __proxy_callback(state) {
+ if (?callback) {
+ callback(new BluetoothAdapterState._proxy(state));
+ }
+ }
+ super.hasListener(callback);
+ }
+
+ Event_bluetooth_onAdapterStateChanged(jsObject) : super._(jsObject, 1);
+}
+
+/**
+ * Functions
+ */
+
+class API_bluetooth {
+ /*
+ * API connection
+ */
+ Object _jsObject;
+
+ /*
+ * Events
+ */
+ Event_bluetooth_onAdapterStateChanged onAdapterStateChanged;
+
+ /*
+ * Functions
+ */
+ /// Get information about the Bluetooth adapter.
+ void getAdapterState(void callback(BluetoothAdapterState result)) {
+ void __proxy_callback(result) {
+ if (?callback) {
+ callback(new BluetoothAdapterState._proxy(result));
+ }
+ }
+ JS('void', '#.getAdapterState(#)', this._jsObject, convertDartClosureToJS(__proxy_callback, 1));
+ }
+
+ /// Get a bluetooth devices known to the system. Known devices are either
+ /// currently bonded, or have been bonded in the past.
+ void getDevices(BluetoothGetDevicesOptions options, void callback()) => JS('void', '#.getDevices(#, #)', this._jsObject, convertArgument(options), convertDartClosureToJS(callback, 0));
+
+ /// Get a list of services provided by a device.
+ void getServices(BluetoothGetServicesOptions options, void callback(List<BluetoothServiceRecord> result)) {
+ void __proxy_callback(result) {
+ if (?callback) {
+ List<BluetoothServiceRecord> __proxy_result = new List<BluetoothServiceRecord>();
+ for (var o in result) {
+ __proxy_result.add(new BluetoothServiceRecord._proxy(o));
+ }
+ callback(__proxy_result);
+ }
+ }
+ JS('void', '#.getServices(#, #)', this._jsObject, convertArgument(options), convertDartClosureToJS(__proxy_callback, 1));
+ }
+
+ /// Connect to a service on a device.
+ void connect(BluetoothConnectOptions options, void callback(BluetoothSocket result)) {
+ void __proxy_callback(result) {
+ if (?callback) {
+ callback(new BluetoothSocket._proxy(result));
+ }
+ }
+ JS('void', '#.connect(#, #)', this._jsObject, convertArgument(options), convertDartClosureToJS(__proxy_callback, 1));
+ }
+
+ /// Close a Bluetooth connection.
+ void disconnect(BluetoothDisconnectOptions options, [void callback()]) => JS('void', '#.disconnect(#, #)', this._jsObject, convertArgument(options), convertDartClosureToJS(callback, 0));
+
+ /// Read data from a Bluetooth connection.
+ void read(BluetoothReadOptions options, void callback(String result)) => JS('void', '#.read(#, #)', this._jsObject, convertArgument(options), convertDartClosureToJS(callback, 1));
+
+ /// Write data to a Bluetooth connection.
+ void write(BluetoothWriteOptions options, [void callback(int result)]) => JS('void', '#.write(#, #)', this._jsObject, convertArgument(options), convertDartClosureToJS(callback, 1));
+
+ /// Get the local Out of Band Pairing data.
+ void getLocalOutOfBandPairingData(void callback(BluetoothOutOfBandPairingData data)) {
+ void __proxy_callback(data) {
+ if (?callback) {
+ callback(new BluetoothOutOfBandPairingData._proxy(data));
+ }
+ }
+ JS('void', '#.getLocalOutOfBandPairingData(#)', this._jsObject, convertDartClosureToJS(__proxy_callback, 1));
+ }
+
+ /// Set the Out of Band Pairing data for a remote device. Any previous Out Of
+ /// Band Pairing Data for this device is overwritten.
+ void setOutOfBandPairingData(BluetoothSetOutOfBandPairingDataOptions options, [void callback()]) => JS('void', '#.setOutOfBandPairingData(#, #)', this._jsObject, convertArgument(options), convertDartClosureToJS(callback, 0));
+
+ /// Start discovery. Discovered devices will be returned via the
+ /// |onDeviceDiscovered| callback. Discovery will fail to start if it is
+ /// already in progress. Discovery can be resource intensive: stopDiscovery
+ /// should be called as soon as possible.
+ void startDiscovery(BluetoothStartDiscoveryOptions options, [void callback()]) => JS('void', '#.startDiscovery(#, #)', this._jsObject, convertArgument(options), convertDartClosureToJS(callback, 0));
+
+ /// Stop discovery.
+ void stopDiscovery([void callback()]) => JS('void', '#.stopDiscovery(#)', this._jsObject, convertDartClosureToJS(callback, 0));
+
+ API_bluetooth(this._jsObject) {
+ onAdapterStateChanged = new Event_bluetooth_onAdapterStateChanged(JS('', '#.onAdapterStateChanged', this._jsObject));
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698