michael@0: /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: // MediaMetadata and MediaPlayStatus are used to keep data from Applications. michael@0: // Please see specification of AVRCP 1.3 for more details. michael@0: dictionary MediaMetaData michael@0: { michael@0: // track title michael@0: DOMString title = ""; michael@0: // artist name michael@0: DOMString artist = ""; michael@0: // album name michael@0: DOMString album = ""; michael@0: // track number michael@0: long long mediaNumber = -1; michael@0: // number of tracks in the album michael@0: long long totalMediaCount = -1; michael@0: // playing time (ms) michael@0: long long duration = -1; michael@0: }; michael@0: michael@0: dictionary MediaPlayStatus michael@0: { michael@0: // current track length (ms) michael@0: long long duration = -1; michael@0: // playing time (ms) michael@0: long long position = -1; michael@0: // one of 'STOPPED'/'PLAYING'/'PAUSED'/'FWD_SEEK'/'REV_SEEK'/'ERROR' michael@0: DOMString playStatus = ""; michael@0: }; michael@0: michael@0: interface BluetoothAdapter : EventTarget { michael@0: readonly attribute DOMString address; michael@0: readonly attribute unsigned long class; michael@0: readonly attribute boolean discovering; michael@0: readonly attribute DOMString name; michael@0: readonly attribute boolean discoverable; michael@0: readonly attribute unsigned long discoverableTimeout; // in seconds michael@0: michael@0: // array of type BluetoothDevice[] michael@0: [GetterThrows] michael@0: readonly attribute any devices; michael@0: michael@0: // array of type DOMString[] michael@0: [GetterThrows] michael@0: readonly attribute any uuids; michael@0: michael@0: attribute EventHandler ondevicefound; michael@0: michael@0: // Fired when pairing process is completed michael@0: attribute EventHandler onpairedstatuschanged; michael@0: michael@0: // Fired when a2dp connection status changed michael@0: attribute EventHandler ona2dpstatuschanged; michael@0: michael@0: // Fired when handsfree connection status changed michael@0: attribute EventHandler onhfpstatuschanged; michael@0: michael@0: // Fired when sco connection status changed michael@0: attribute EventHandler onscostatuschanged; michael@0: michael@0: // Fired when remote devices query current media play status michael@0: attribute EventHandler onrequestmediaplaystatus; michael@0: michael@0: [NewObject, Throws] michael@0: DOMRequest setName(DOMString name); michael@0: [NewObject, Throws] michael@0: DOMRequest setDiscoverable(boolean discoverable); michael@0: [NewObject, Throws] michael@0: DOMRequest setDiscoverableTimeout(unsigned long timeout); michael@0: [NewObject, Throws] michael@0: DOMRequest startDiscovery(); michael@0: [NewObject, Throws] michael@0: DOMRequest stopDiscovery(); michael@0: [NewObject, Throws] michael@0: DOMRequest pair(DOMString deviceAddress); michael@0: [NewObject, Throws] michael@0: DOMRequest unpair(DOMString deviceAddress); michael@0: [NewObject, Throws] michael@0: DOMRequest getPairedDevices(); michael@0: [NewObject, Throws] michael@0: DOMRequest getConnectedDevices(unsigned short serviceUuid); michael@0: [NewObject, Throws] michael@0: DOMRequest setPinCode(DOMString deviceAddress, DOMString pinCode); michael@0: [NewObject, Throws] michael@0: DOMRequest setPasskey(DOMString deviceAddress, unsigned long passkey); michael@0: [NewObject, Throws] michael@0: DOMRequest setPairingConfirmation(DOMString deviceAddress, boolean confirmation); michael@0: michael@0: /** michael@0: * Connect/Disconnect to a specific service of a target remote device. michael@0: * To check the value of service UUIDs, please check "Bluetooth Assigned michael@0: * Numbers" / "Service Discovery Protocol" for more information. michael@0: * michael@0: * Note that service UUID is optional. If it isn't passed when calling michael@0: * Connect, multiple profiles are tried sequentially based on the class of michael@0: * device (CoD). If it isn't passed when calling Disconnect, all connected michael@0: * profiles are going to be closed. michael@0: * michael@0: * Reply success if the connection of any profile is successfully michael@0: * established/released; reply error if we failed to connect/disconnect all michael@0: * of the planned profiles. michael@0: * michael@0: * @param device Remote device michael@0: * @param profile 2-octets service UUID. This is optional. michael@0: */ michael@0: [NewObject, Throws] michael@0: DOMRequest connect(BluetoothDevice device, optional unsigned short serviceUuid); michael@0: michael@0: [NewObject, Throws] michael@0: DOMRequest disconnect(BluetoothDevice device, optional unsigned short serviceUuid); michael@0: michael@0: // One device can only send one file at a time michael@0: [NewObject, Throws] michael@0: DOMRequest sendFile(DOMString deviceAddress, Blob blob); michael@0: [NewObject, Throws] michael@0: DOMRequest stopSendingFile(DOMString deviceAddress); michael@0: [NewObject, Throws] michael@0: DOMRequest confirmReceivingFile(DOMString deviceAddress, boolean confirmation); michael@0: michael@0: // Connect/Disconnect SCO (audio) connection michael@0: [NewObject, Throws] michael@0: DOMRequest connectSco(); michael@0: [NewObject, Throws] michael@0: DOMRequest disconnectSco(); michael@0: [NewObject, Throws] michael@0: DOMRequest isScoConnected(); michael@0: michael@0: /** michael@0: * Additional HFP methods to handle CDMA network. michael@0: * michael@0: * In GSM network we observe call operations from RIL call state changes; michael@0: * however in CDMA network RIL call states do not change under some call michael@0: * operations, so we need these additional methods to be informed of these michael@0: * operations from dialer. michael@0: * michael@0: * For more information please refer to bug 912005 and 925638. michael@0: */ michael@0: [NewObject, Throws] michael@0: DOMRequest answerWaitingCall(); michael@0: [NewObject, Throws] michael@0: DOMRequest ignoreWaitingCall(); michael@0: [NewObject, Throws] michael@0: DOMRequest toggleCalls(); michael@0: michael@0: // AVRCP 1.3 methods michael@0: [NewObject,Throws] michael@0: DOMRequest sendMediaMetaData(optional MediaMetaData mediaMetaData); michael@0: [NewObject,Throws] michael@0: DOMRequest sendMediaPlayStatus(optional MediaPlayStatus mediaPlayStatus); michael@0: };