2014-05-21 10:12:24 +04:00
|
|
|
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
|
|
/* 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/. */
|
|
|
|
|
|
|
|
// MediaMetadata and MediaPlayStatus are used to keep data from Applications.
|
|
|
|
// Please see specification of AVRCP 1.3 for more details.
|
|
|
|
dictionary MediaMetaData
|
|
|
|
{
|
|
|
|
// track title
|
|
|
|
DOMString title = "";
|
|
|
|
// artist name
|
|
|
|
DOMString artist = "";
|
|
|
|
// album name
|
|
|
|
DOMString album = "";
|
|
|
|
// track number
|
|
|
|
long long mediaNumber = -1;
|
|
|
|
// number of tracks in the album
|
|
|
|
long long totalMediaCount = -1;
|
|
|
|
// playing time (ms)
|
|
|
|
long long duration = -1;
|
|
|
|
};
|
|
|
|
|
|
|
|
dictionary MediaPlayStatus
|
|
|
|
{
|
|
|
|
// current track length (ms)
|
|
|
|
long long duration = -1;
|
|
|
|
// playing time (ms)
|
|
|
|
long long position = -1;
|
|
|
|
// one of 'STOPPED'/'PLAYING'/'PAUSED'/'FWD_SEEK'/'REV_SEEK'/'ERROR'
|
|
|
|
DOMString playStatus = "";
|
|
|
|
};
|
|
|
|
|
2015-07-14 05:25:26 +03:00
|
|
|
[CheckAnyPermissions="bluetooth"]
|
2014-05-21 10:12:24 +04:00
|
|
|
interface BluetoothAdapter : EventTarget {
|
2014-05-28 14:16:18 +04:00
|
|
|
readonly attribute BluetoothAdapterState state;
|
2014-10-01 13:43:26 +04:00
|
|
|
[AvailableIn=CertifiedApps]
|
2014-05-28 14:16:18 +04:00
|
|
|
readonly attribute DOMString address;
|
|
|
|
readonly attribute DOMString name;
|
|
|
|
readonly attribute boolean discoverable;
|
|
|
|
readonly attribute boolean discovering;
|
2015-07-24 11:32:35 +03:00
|
|
|
readonly attribute BluetoothGattServer? gattServer;
|
2014-05-21 10:12:24 +04:00
|
|
|
|
2014-08-05 14:25:54 +04:00
|
|
|
[AvailableIn=CertifiedApps]
|
|
|
|
readonly attribute BluetoothPairingListener pairingReqs;
|
|
|
|
|
2014-09-11 06:03:40 +04:00
|
|
|
// Fired when attribute(s) of BluetoothAdapter changed
|
|
|
|
attribute EventHandler onattributechanged;
|
|
|
|
|
|
|
|
// Fired when a remote device gets paired with the adapter
|
|
|
|
attribute EventHandler ondevicepaired;
|
|
|
|
|
|
|
|
// Fired when a remote device gets unpaired from the adapter
|
|
|
|
attribute EventHandler ondeviceunpaired;
|
|
|
|
|
2015-03-06 06:55:30 +03:00
|
|
|
// Fired when the pairing process aborted
|
|
|
|
attribute EventHandler onpairingaborted;
|
|
|
|
|
2014-05-21 10:12:24 +04:00
|
|
|
// Fired when a2dp connection status changed
|
|
|
|
attribute EventHandler ona2dpstatuschanged;
|
|
|
|
|
|
|
|
// Fired when handsfree connection status changed
|
|
|
|
attribute EventHandler onhfpstatuschanged;
|
|
|
|
|
|
|
|
// Fired when sco connection status changed
|
|
|
|
attribute EventHandler onscostatuschanged;
|
|
|
|
|
|
|
|
// Fired when remote devices query current media play status
|
|
|
|
attribute EventHandler onrequestmediaplaystatus;
|
|
|
|
|
2014-07-02 07:16:26 +04:00
|
|
|
/**
|
|
|
|
* Enable/Disable a local bluetooth adapter by asynchronus methods and return
|
|
|
|
* its result through a Promise.
|
|
|
|
*
|
|
|
|
* Several onattributechanged events would be triggered during processing the
|
2014-09-11 06:03:40 +04:00
|
|
|
* request, and the last one indicates adapter.state becomes enabled/disabled.
|
2014-07-02 07:16:26 +04:00
|
|
|
*/
|
2015-01-28 02:58:00 +03:00
|
|
|
[NewObject, AvailableIn=CertifiedApps]
|
2014-08-01 07:50:30 +04:00
|
|
|
Promise<void> enable();
|
2015-01-28 02:58:00 +03:00
|
|
|
[NewObject, AvailableIn=CertifiedApps]
|
2014-08-01 07:50:30 +04:00
|
|
|
Promise<void> disable();
|
2014-07-02 07:16:26 +04:00
|
|
|
|
2015-01-28 02:58:00 +03:00
|
|
|
[NewObject, AvailableIn=CertifiedApps]
|
2015-03-06 06:55:30 +03:00
|
|
|
Promise<void> setName(DOMString name);
|
2015-01-12 19:52:25 +03:00
|
|
|
[NewObject]
|
2015-03-06 06:55:30 +03:00
|
|
|
Promise<void> setDiscoverable(boolean discoverable);
|
2014-07-02 07:16:26 +04:00
|
|
|
|
2015-01-12 19:52:25 +03:00
|
|
|
[NewObject]
|
2014-08-01 07:50:30 +04:00
|
|
|
Promise<BluetoothDiscoveryHandle> startDiscovery();
|
2015-01-12 19:52:25 +03:00
|
|
|
[NewObject]
|
2014-08-01 07:50:30 +04:00
|
|
|
Promise<void> stopDiscovery();
|
2014-07-02 07:16:26 +04:00
|
|
|
|
2015-01-12 19:52:25 +03:00
|
|
|
[NewObject]
|
2014-08-12 12:30:36 +04:00
|
|
|
Promise<void> pair(DOMString deviceAddress);
|
2015-01-12 19:52:25 +03:00
|
|
|
[NewObject]
|
2014-08-12 12:30:36 +04:00
|
|
|
Promise<void> unpair(DOMString deviceAddress);
|
|
|
|
|
|
|
|
sequence<BluetoothDevice> getPairedDevices();
|
|
|
|
|
2015-05-04 13:59:02 +03:00
|
|
|
[NewObject]
|
|
|
|
Promise<BluetoothDiscoveryHandle> startLeScan(sequence<DOMString> serviceUuids);
|
|
|
|
|
|
|
|
[NewObject]
|
|
|
|
Promise<void> stopLeScan(BluetoothDiscoveryHandle discoveryHandle);
|
|
|
|
|
2014-10-01 13:43:26 +04:00
|
|
|
[NewObject, Throws, AvailableIn=CertifiedApps]
|
2014-05-21 10:12:24 +04:00
|
|
|
DOMRequest getConnectedDevices(unsigned short serviceUuid);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* Note that service UUID is optional. If it isn't passed when calling
|
|
|
|
* Connect, multiple profiles are tried sequentially based on the class of
|
|
|
|
* device (CoD). If it isn't passed when calling Disconnect, all connected
|
|
|
|
* profiles are going to be closed.
|
|
|
|
*
|
|
|
|
* Reply success if the connection of any profile is successfully
|
|
|
|
* established/released; reply error if we failed to connect/disconnect all
|
|
|
|
* of the planned profiles.
|
|
|
|
*
|
|
|
|
* @param device Remote device
|
|
|
|
* @param profile 2-octets service UUID. This is optional.
|
|
|
|
*/
|
2014-10-01 13:43:26 +04:00
|
|
|
[NewObject, Throws, AvailableIn=CertifiedApps]
|
2014-05-21 10:12:24 +04:00
|
|
|
DOMRequest connect(BluetoothDevice device, optional unsigned short serviceUuid);
|
|
|
|
|
2014-10-01 13:43:26 +04:00
|
|
|
[NewObject, Throws, AvailableIn=CertifiedApps]
|
2014-05-21 10:12:24 +04:00
|
|
|
DOMRequest disconnect(BluetoothDevice device, optional unsigned short serviceUuid);
|
|
|
|
|
|
|
|
// One device can only send one file at a time
|
2014-10-01 13:43:26 +04:00
|
|
|
[NewObject, Throws, AvailableIn=CertifiedApps]
|
2014-05-21 10:12:24 +04:00
|
|
|
DOMRequest sendFile(DOMString deviceAddress, Blob blob);
|
2014-10-01 13:43:26 +04:00
|
|
|
[NewObject, Throws, AvailableIn=CertifiedApps]
|
2014-05-21 10:12:24 +04:00
|
|
|
DOMRequest stopSendingFile(DOMString deviceAddress);
|
2014-10-01 13:43:26 +04:00
|
|
|
[NewObject, Throws, AvailableIn=CertifiedApps]
|
2014-05-21 10:12:24 +04:00
|
|
|
DOMRequest confirmReceivingFile(DOMString deviceAddress, boolean confirmation);
|
|
|
|
|
|
|
|
// Connect/Disconnect SCO (audio) connection
|
2014-10-01 13:43:26 +04:00
|
|
|
[NewObject, Throws, AvailableIn=CertifiedApps]
|
2014-05-21 10:12:24 +04:00
|
|
|
DOMRequest connectSco();
|
2014-10-01 13:43:26 +04:00
|
|
|
[NewObject, Throws, AvailableIn=CertifiedApps]
|
2014-05-21 10:12:24 +04:00
|
|
|
DOMRequest disconnectSco();
|
2014-10-01 13:43:26 +04:00
|
|
|
[NewObject, Throws, AvailableIn=CertifiedApps]
|
2014-05-21 10:12:24 +04:00
|
|
|
DOMRequest isScoConnected();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Additional HFP methods to handle CDMA network.
|
|
|
|
*
|
|
|
|
* In GSM network we observe call operations from RIL call state changes;
|
|
|
|
* however in CDMA network RIL call states do not change under some call
|
|
|
|
* operations, so we need these additional methods to be informed of these
|
|
|
|
* operations from dialer.
|
|
|
|
*
|
|
|
|
* For more information please refer to bug 912005 and 925638.
|
|
|
|
*/
|
2014-10-01 13:43:26 +04:00
|
|
|
[NewObject, Throws, AvailableIn=CertifiedApps]
|
2014-05-21 10:12:24 +04:00
|
|
|
DOMRequest answerWaitingCall();
|
2014-10-01 13:43:26 +04:00
|
|
|
[NewObject, Throws, AvailableIn=CertifiedApps]
|
2014-05-21 10:12:24 +04:00
|
|
|
DOMRequest ignoreWaitingCall();
|
2014-10-01 13:43:26 +04:00
|
|
|
[NewObject, Throws, AvailableIn=CertifiedApps]
|
2014-05-21 10:12:24 +04:00
|
|
|
DOMRequest toggleCalls();
|
|
|
|
|
|
|
|
// AVRCP 1.3 methods
|
2014-10-01 13:43:26 +04:00
|
|
|
[NewObject, Throws, AvailableIn=CertifiedApps]
|
2014-05-21 10:12:24 +04:00
|
|
|
DOMRequest sendMediaMetaData(optional MediaMetaData mediaMetaData);
|
2014-10-01 13:43:26 +04:00
|
|
|
[NewObject, Throws, AvailableIn=CertifiedApps]
|
2014-05-21 10:12:24 +04:00
|
|
|
DOMRequest sendMediaPlayStatus(optional MediaPlayStatus mediaPlayStatus);
|
|
|
|
};
|
2014-09-11 06:03:40 +04:00
|
|
|
|
|
|
|
enum BluetoothAdapterState
|
|
|
|
{
|
|
|
|
"disabled",
|
|
|
|
"disabling",
|
|
|
|
"enabled",
|
|
|
|
"enabling"
|
|
|
|
};
|
|
|
|
|
|
|
|
enum BluetoothAdapterAttribute
|
|
|
|
{
|
|
|
|
"unknown",
|
|
|
|
"state",
|
|
|
|
"address",
|
|
|
|
"name",
|
|
|
|
"discoverable",
|
|
|
|
"discovering"
|
|
|
|
};
|
|
|
|
|