2013-08-12 01:32:53 -07: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 = "";
|
|
|
|
};
|
|
|
|
|
|
|
|
interface BluetoothAdapter : EventTarget {
|
|
|
|
readonly attribute DOMString address;
|
|
|
|
readonly attribute unsigned long class;
|
|
|
|
readonly attribute boolean discovering;
|
|
|
|
readonly attribute DOMString name;
|
|
|
|
readonly attribute boolean discoverable;
|
|
|
|
readonly attribute unsigned long discoverableTimeout; // in seconds
|
|
|
|
|
|
|
|
// array of type BluetoothDevice[]
|
|
|
|
[GetterThrows]
|
|
|
|
readonly attribute any devices;
|
|
|
|
|
|
|
|
// array of type DOMString[]
|
|
|
|
[GetterThrows]
|
|
|
|
readonly attribute any uuids;
|
|
|
|
|
|
|
|
attribute EventHandler ondevicefound;
|
|
|
|
|
|
|
|
// Fired when pairing process is completed
|
|
|
|
attribute EventHandler onpairedstatuschanged;
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
2013-09-03 19:40:01 -07:00
|
|
|
// Fired when remote devices query current media play status
|
|
|
|
attribute EventHandler onrequestmediaplaystatus;
|
|
|
|
|
2013-10-23 07:51:48 -07:00
|
|
|
[Creator, Throws]
|
2013-08-12 01:32:53 -07:00
|
|
|
DOMRequest setName(DOMString name);
|
2013-10-23 07:51:48 -07:00
|
|
|
[Creator, Throws]
|
2013-08-12 01:32:53 -07:00
|
|
|
DOMRequest setDiscoverable(boolean discoverable);
|
2013-10-23 07:51:48 -07:00
|
|
|
[Creator, Throws]
|
2013-08-12 01:32:53 -07:00
|
|
|
DOMRequest setDiscoverableTimeout(unsigned long timeout);
|
2013-10-23 07:51:48 -07:00
|
|
|
[Creator, Throws]
|
2013-08-12 01:32:53 -07:00
|
|
|
DOMRequest startDiscovery();
|
2013-10-23 07:51:48 -07:00
|
|
|
[Creator, Throws]
|
2013-08-12 01:32:53 -07:00
|
|
|
DOMRequest stopDiscovery();
|
2013-10-23 07:51:48 -07:00
|
|
|
[Creator, Throws]
|
2013-08-12 01:32:53 -07:00
|
|
|
DOMRequest pair(BluetoothDevice device);
|
2013-10-23 07:51:48 -07:00
|
|
|
[Creator, Throws]
|
2013-08-12 01:32:53 -07:00
|
|
|
DOMRequest unpair(BluetoothDevice device);
|
2013-10-23 07:51:48 -07:00
|
|
|
[Creator, Throws]
|
2013-08-12 01:32:53 -07:00
|
|
|
DOMRequest getPairedDevices();
|
2013-10-23 07:51:48 -07:00
|
|
|
[Creator, Throws]
|
2013-09-06 04:19:46 -07:00
|
|
|
DOMRequest getConnectedDevices(unsigned short serviceUuid);
|
2013-10-23 07:51:48 -07:00
|
|
|
[Creator, Throws]
|
2013-08-12 01:32:53 -07:00
|
|
|
DOMRequest setPinCode(DOMString deviceAddress, DOMString pinCode);
|
2013-10-23 07:51:48 -07:00
|
|
|
[Creator, Throws]
|
2013-08-12 01:32:53 -07:00
|
|
|
DOMRequest setPasskey(DOMString deviceAddress, unsigned long passkey);
|
2013-10-23 07:51:48 -07:00
|
|
|
[Creator, Throws]
|
2013-08-12 01:32:53 -07:00
|
|
|
DOMRequest setPairingConfirmation(DOMString deviceAddress, boolean confirmation);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*
|
2013-09-06 04:19:46 -07:00
|
|
|
* 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.
|
|
|
|
*
|
2013-09-11 00:21:48 -07:00
|
|
|
* 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.
|
|
|
|
*
|
2013-09-06 04:19:46 -07:00
|
|
|
* @param device Remote device
|
|
|
|
* @param profile 2-octets service UUID. This is optional.
|
2013-08-12 01:32:53 -07:00
|
|
|
*/
|
2013-10-23 07:51:48 -07:00
|
|
|
[Creator, Throws]
|
2013-09-06 04:19:46 -07:00
|
|
|
DOMRequest connect(BluetoothDevice device, optional unsigned short serviceUuid);
|
|
|
|
|
2013-10-23 07:51:48 -07:00
|
|
|
[Creator, Throws]
|
2013-09-06 04:19:46 -07:00
|
|
|
DOMRequest disconnect(BluetoothDevice device, optional unsigned short serviceUuid);
|
2013-08-12 01:32:53 -07:00
|
|
|
|
|
|
|
// One device can only send one file at a time
|
2013-10-23 07:51:48 -07:00
|
|
|
[Creator, Throws]
|
2013-08-12 01:32:53 -07:00
|
|
|
DOMRequest sendFile(DOMString deviceAddress, Blob blob);
|
2013-10-23 07:51:48 -07:00
|
|
|
[Creator, Throws]
|
2013-08-12 01:32:53 -07:00
|
|
|
DOMRequest stopSendingFile(DOMString deviceAddress);
|
2013-10-23 07:51:48 -07:00
|
|
|
[Creator, Throws]
|
2013-08-12 01:32:53 -07:00
|
|
|
DOMRequest confirmReceivingFile(DOMString deviceAddress, boolean confirmation);
|
|
|
|
|
|
|
|
// Connect/Disconnect SCO (audio) connection
|
2013-10-23 07:51:48 -07:00
|
|
|
[Creator, Throws]
|
2013-08-12 01:32:53 -07:00
|
|
|
DOMRequest connectSco();
|
2013-10-23 07:51:48 -07:00
|
|
|
[Creator, Throws]
|
2013-08-12 01:32:53 -07:00
|
|
|
DOMRequest disconnectSco();
|
2013-10-23 07:51:48 -07:00
|
|
|
[Creator, Throws]
|
2013-08-12 01:32:53 -07:00
|
|
|
DOMRequest isScoConnected();
|
|
|
|
|
2013-10-15 19:49:50 -07:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
[Creator, Throws]
|
|
|
|
DOMRequest answerWaitingCall();
|
|
|
|
[Creator, Throws]
|
|
|
|
DOMRequest ignoreWaitingCall();
|
|
|
|
[Creator, Throws]
|
|
|
|
DOMRequest toggleCalls();
|
|
|
|
|
2013-08-12 01:32:53 -07:00
|
|
|
// AVRCP 1.3 methods
|
2013-10-23 07:51:48 -07:00
|
|
|
[Creator,Throws]
|
2013-08-12 01:32:53 -07:00
|
|
|
DOMRequest sendMediaMetaData(optional MediaMetaData mediaMetaData);
|
2013-10-23 07:51:48 -07:00
|
|
|
[Creator,Throws]
|
2013-08-12 01:32:53 -07:00
|
|
|
DOMRequest sendMediaPlayStatus(optional MediaPlayStatus mediaPlayStatus);
|
|
|
|
};
|