2012-02-20 07:15:19 -08:00
|
|
|
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
2012-08-16 19:53:45 -07:00
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
2012-02-20 07:15:19 -08:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2012-02-23 07:55:48 -08:00
|
|
|
#include "nsIDOMEventTarget.idl"
|
2012-02-20 07:15:19 -08:00
|
|
|
|
2012-07-17 20:41:54 -07:00
|
|
|
interface nsIDOMDOMRequest;
|
2012-09-29 03:26:46 -07:00
|
|
|
interface nsIDOMBlob;
|
2012-07-17 20:41:54 -07:00
|
|
|
interface nsIDOMBluetoothDevice;
|
|
|
|
|
2012-10-18 23:16:13 -07:00
|
|
|
[scriptable, builtinclass, uuid(6a4a9415-cda3-4a19-b79e-05d9bc2c2700)]
|
2012-02-23 07:55:48 -08:00
|
|
|
interface nsIDOMBluetoothAdapter : nsIDOMEventTarget
|
2012-02-20 07:15:19 -08:00
|
|
|
{
|
2012-07-17 20:41:54 -07:00
|
|
|
readonly attribute DOMString address;
|
|
|
|
[binaryname(AdapterClass)] readonly attribute unsigned long class;
|
|
|
|
readonly attribute bool enabled;
|
|
|
|
readonly attribute bool discovering;
|
|
|
|
|
|
|
|
[implicit_jscontext]
|
|
|
|
readonly attribute jsval devices;
|
|
|
|
|
2012-07-31 21:53:04 -07:00
|
|
|
[implicit_jscontext]
|
|
|
|
readonly attribute jsval uuids;
|
|
|
|
|
2012-07-17 20:41:54 -07:00
|
|
|
readonly attribute DOMString name;
|
|
|
|
readonly attribute bool discoverable;
|
|
|
|
// Unit: sec
|
|
|
|
readonly attribute unsigned long discoverableTimeout;
|
|
|
|
|
2012-07-31 21:53:04 -07:00
|
|
|
nsIDOMDOMRequest setName(in DOMString name);
|
|
|
|
nsIDOMDOMRequest setDiscoverable(in bool discoverable);
|
|
|
|
nsIDOMDOMRequest setDiscoverableTimeout(in unsigned long timeout);
|
2012-07-17 20:41:54 -07:00
|
|
|
nsIDOMDOMRequest startDiscovery();
|
|
|
|
nsIDOMDOMRequest stopDiscovery();
|
2012-08-17 03:35:59 -07:00
|
|
|
nsIDOMDOMRequest pair(in nsIDOMBluetoothDevice aDevice);
|
|
|
|
nsIDOMDOMRequest unpair(in nsIDOMBluetoothDevice aDevice);
|
2012-08-16 19:53:45 -07:00
|
|
|
nsIDOMDOMRequest getPairedDevices();
|
2012-09-19 16:37:42 -07:00
|
|
|
nsIDOMDOMRequest setPinCode(in DOMString aDeviceAddress, in DOMString aPinCode);
|
|
|
|
nsIDOMDOMRequest setPasskey(in DOMString aDeviceAddress, in unsigned long aPasskey);
|
|
|
|
nsIDOMDOMRequest setPairingConfirmation(in DOMString aDeviceAddress, in bool aConfirmation);
|
|
|
|
nsIDOMDOMRequest setAuthorization(in DOMString aDeviceAddress, in bool aAllow);
|
2012-08-17 03:35:59 -07:00
|
|
|
|
2012-09-29 03:26:46 -07:00
|
|
|
/**
|
|
|
|
* Connect/Disconnect to a specific service of a target remote device.
|
|
|
|
* To check the value of service UUIDs, please check "Bluetooth Assigned
|
|
|
|
* Numbers" / "Service Discovery Protocol" for more information.
|
|
|
|
*
|
|
|
|
* @param aDeviceAddress Remote device address
|
|
|
|
* @param aProfile 2-octets service UUID
|
|
|
|
*/
|
|
|
|
nsIDOMDOMRequest connect(in DOMString aDeviceAddress, in unsigned short aProfile);
|
|
|
|
nsIDOMDOMRequest disconnect(in unsigned short aProfile);
|
|
|
|
|
|
|
|
// One device can only send one file at a time
|
|
|
|
nsIDOMDOMRequest sendFile(in DOMString aDeviceAddress, in nsIDOMBlob aBlob);
|
|
|
|
nsIDOMDOMRequest stopSendingFile(in DOMString aDeviceAddress);
|
2012-10-18 23:16:13 -07:00
|
|
|
nsIDOMDOMRequest confirmReceivingFile(in DOMString aDeviceAddress, in bool aConfirmation);
|
2012-09-29 03:26:46 -07:00
|
|
|
|
2012-07-17 20:41:54 -07:00
|
|
|
// Fired when discoverying and any device is discovered.
|
2012-08-30 20:45:16 -07:00
|
|
|
[implicit_jscontext] attribute jsval ondevicefound;
|
2012-07-17 20:41:54 -07:00
|
|
|
// Fired when any device is out of discoverable range.
|
2012-08-30 20:45:16 -07:00
|
|
|
[implicit_jscontext] attribute jsval ondevicedisappeared;
|
2012-09-16 23:39:47 -07:00
|
|
|
// Fired when any device is created.
|
|
|
|
[implicit_jscontext] attribute jsval ondevicecreated;
|
2012-07-17 20:41:54 -07:00
|
|
|
// Fired when a property of the adapter is changed
|
2012-08-30 20:45:16 -07:00
|
|
|
[implicit_jscontext] attribute jsval onpropertychanged;
|
2012-08-17 03:35:59 -07:00
|
|
|
// Pairing related events
|
2012-08-30 20:45:16 -07:00
|
|
|
[implicit_jscontext] attribute jsval onrequestconfirmation;
|
|
|
|
[implicit_jscontext] attribute jsval onrequestpincode;
|
|
|
|
[implicit_jscontext] attribute jsval onrequestpasskey;
|
|
|
|
[implicit_jscontext] attribute jsval onauthorize;
|
|
|
|
[implicit_jscontext] attribute jsval oncancel;
|
2012-02-20 07:15:19 -08:00
|
|
|
};
|