gecko/dom/bluetooth/nsIDOMBluetoothAdapter.idl

118 lines
4.1 KiB
Plaintext

/* -*- 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/. */
#include "nsIDOMEventTarget.idl"
/**
* MediaMetadata and MediaPlayStatus are used to keep data from Applications.
* Please see specification of AVRCP 1.3 for more details.
*
* @title: track title
* @artist: artist name
* @album: album name
* @mediaNumber: track number
* @totalMediaCount: number of tracks in the album
* @duration: playing time (ms)
*/
dictionary MediaMetaData
{
DOMString title;
DOMString artist;
DOMString album;
unsigned long mediaNumber;
unsigned long totalMediaCount;
unsigned long duration;
};
/**
* @duration: current track length (ms)
* @position: playing time (ms)
* @playStatus: STOPPED/PLAYING/PAUSED/FWD_SEEK/REV_SEEK/ERROR
*/
dictionary MediaPlayStatus
{
unsigned long duration;
unsigned long position;
DOMString playStatus;
};
interface nsIDOMDOMRequest;
interface nsIDOMBlob;
interface nsIDOMBluetoothDevice;
[scriptable, builtinclass, uuid(54bf9aa2-1208-47ab-ac96-c7df349fcf0e)]
interface nsIDOMBluetoothAdapter : nsIDOMEventTarget
{
readonly attribute DOMString address;
[binaryname(AdapterClass)] readonly attribute unsigned long class;
readonly attribute bool discovering;
[implicit_jscontext]
readonly attribute jsval devices;
[implicit_jscontext]
readonly attribute jsval uuids;
readonly attribute DOMString name;
readonly attribute bool discoverable;
// Unit: sec
readonly attribute unsigned long discoverableTimeout;
nsIDOMDOMRequest setName(in DOMString name);
nsIDOMDOMRequest setDiscoverable(in bool discoverable);
nsIDOMDOMRequest setDiscoverableTimeout(in unsigned long timeout);
nsIDOMDOMRequest startDiscovery();
nsIDOMDOMRequest stopDiscovery();
nsIDOMDOMRequest pair(in nsIDOMBluetoothDevice aDevice);
nsIDOMDOMRequest unpair(in nsIDOMBluetoothDevice aDevice);
nsIDOMDOMRequest getPairedDevices();
nsIDOMDOMRequest getConnectedDevices(in unsigned short aProfile);
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);
/**
* 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);
nsIDOMDOMRequest confirmReceivingFile(in DOMString aDeviceAddress, in bool aConfirmation);
// AVRCP 1.3 methods
nsIDOMDOMRequest sendMediaMetaData(in jsval aOptions);
nsIDOMDOMRequest sendMediaPlayStatus(in jsval aOptions);
// Connect/Disconnect SCO (audio) connection
nsIDOMDOMRequest connectSco();
nsIDOMDOMRequest disconnectSco();
nsIDOMDOMRequest isScoConnected();
// Fired when discoverying and any device is discovered.
[implicit_jscontext] attribute jsval ondevicefound;
// Fired when pairing process is completed
[implicit_jscontext] attribute jsval onpairedstatuschanged;
// Fired when a2dp connection status changed
[implicit_jscontext] attribute jsval ona2dpstatuschanged;
// Fired when handsfree connection status changed
[implicit_jscontext] attribute jsval onhfpstatuschanged;
// Fired when sco connection status changed
[implicit_jscontext] attribute jsval onscostatuschanged;
};