Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ |
michael@0 | 2 | /* vim: set ts=2 et sw=2 tw=80: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 5 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | // MediaMetadata and MediaPlayStatus are used to keep data from Applications. |
michael@0 | 8 | // Please see specification of AVRCP 1.3 for more details. |
michael@0 | 9 | dictionary MediaMetaData |
michael@0 | 10 | { |
michael@0 | 11 | // track title |
michael@0 | 12 | DOMString title = ""; |
michael@0 | 13 | // artist name |
michael@0 | 14 | DOMString artist = ""; |
michael@0 | 15 | // album name |
michael@0 | 16 | DOMString album = ""; |
michael@0 | 17 | // track number |
michael@0 | 18 | long long mediaNumber = -1; |
michael@0 | 19 | // number of tracks in the album |
michael@0 | 20 | long long totalMediaCount = -1; |
michael@0 | 21 | // playing time (ms) |
michael@0 | 22 | long long duration = -1; |
michael@0 | 23 | }; |
michael@0 | 24 | |
michael@0 | 25 | dictionary MediaPlayStatus |
michael@0 | 26 | { |
michael@0 | 27 | // current track length (ms) |
michael@0 | 28 | long long duration = -1; |
michael@0 | 29 | // playing time (ms) |
michael@0 | 30 | long long position = -1; |
michael@0 | 31 | // one of 'STOPPED'/'PLAYING'/'PAUSED'/'FWD_SEEK'/'REV_SEEK'/'ERROR' |
michael@0 | 32 | DOMString playStatus = ""; |
michael@0 | 33 | }; |
michael@0 | 34 | |
michael@0 | 35 | interface BluetoothAdapter : EventTarget { |
michael@0 | 36 | readonly attribute DOMString address; |
michael@0 | 37 | readonly attribute unsigned long class; |
michael@0 | 38 | readonly attribute boolean discovering; |
michael@0 | 39 | readonly attribute DOMString name; |
michael@0 | 40 | readonly attribute boolean discoverable; |
michael@0 | 41 | readonly attribute unsigned long discoverableTimeout; // in seconds |
michael@0 | 42 | |
michael@0 | 43 | // array of type BluetoothDevice[] |
michael@0 | 44 | [GetterThrows] |
michael@0 | 45 | readonly attribute any devices; |
michael@0 | 46 | |
michael@0 | 47 | // array of type DOMString[] |
michael@0 | 48 | [GetterThrows] |
michael@0 | 49 | readonly attribute any uuids; |
michael@0 | 50 | |
michael@0 | 51 | attribute EventHandler ondevicefound; |
michael@0 | 52 | |
michael@0 | 53 | // Fired when pairing process is completed |
michael@0 | 54 | attribute EventHandler onpairedstatuschanged; |
michael@0 | 55 | |
michael@0 | 56 | // Fired when a2dp connection status changed |
michael@0 | 57 | attribute EventHandler ona2dpstatuschanged; |
michael@0 | 58 | |
michael@0 | 59 | // Fired when handsfree connection status changed |
michael@0 | 60 | attribute EventHandler onhfpstatuschanged; |
michael@0 | 61 | |
michael@0 | 62 | // Fired when sco connection status changed |
michael@0 | 63 | attribute EventHandler onscostatuschanged; |
michael@0 | 64 | |
michael@0 | 65 | // Fired when remote devices query current media play status |
michael@0 | 66 | attribute EventHandler onrequestmediaplaystatus; |
michael@0 | 67 | |
michael@0 | 68 | [NewObject, Throws] |
michael@0 | 69 | DOMRequest setName(DOMString name); |
michael@0 | 70 | [NewObject, Throws] |
michael@0 | 71 | DOMRequest setDiscoverable(boolean discoverable); |
michael@0 | 72 | [NewObject, Throws] |
michael@0 | 73 | DOMRequest setDiscoverableTimeout(unsigned long timeout); |
michael@0 | 74 | [NewObject, Throws] |
michael@0 | 75 | DOMRequest startDiscovery(); |
michael@0 | 76 | [NewObject, Throws] |
michael@0 | 77 | DOMRequest stopDiscovery(); |
michael@0 | 78 | [NewObject, Throws] |
michael@0 | 79 | DOMRequest pair(DOMString deviceAddress); |
michael@0 | 80 | [NewObject, Throws] |
michael@0 | 81 | DOMRequest unpair(DOMString deviceAddress); |
michael@0 | 82 | [NewObject, Throws] |
michael@0 | 83 | DOMRequest getPairedDevices(); |
michael@0 | 84 | [NewObject, Throws] |
michael@0 | 85 | DOMRequest getConnectedDevices(unsigned short serviceUuid); |
michael@0 | 86 | [NewObject, Throws] |
michael@0 | 87 | DOMRequest setPinCode(DOMString deviceAddress, DOMString pinCode); |
michael@0 | 88 | [NewObject, Throws] |
michael@0 | 89 | DOMRequest setPasskey(DOMString deviceAddress, unsigned long passkey); |
michael@0 | 90 | [NewObject, Throws] |
michael@0 | 91 | DOMRequest setPairingConfirmation(DOMString deviceAddress, boolean confirmation); |
michael@0 | 92 | |
michael@0 | 93 | /** |
michael@0 | 94 | * Connect/Disconnect to a specific service of a target remote device. |
michael@0 | 95 | * To check the value of service UUIDs, please check "Bluetooth Assigned |
michael@0 | 96 | * Numbers" / "Service Discovery Protocol" for more information. |
michael@0 | 97 | * |
michael@0 | 98 | * Note that service UUID is optional. If it isn't passed when calling |
michael@0 | 99 | * Connect, multiple profiles are tried sequentially based on the class of |
michael@0 | 100 | * device (CoD). If it isn't passed when calling Disconnect, all connected |
michael@0 | 101 | * profiles are going to be closed. |
michael@0 | 102 | * |
michael@0 | 103 | * Reply success if the connection of any profile is successfully |
michael@0 | 104 | * established/released; reply error if we failed to connect/disconnect all |
michael@0 | 105 | * of the planned profiles. |
michael@0 | 106 | * |
michael@0 | 107 | * @param device Remote device |
michael@0 | 108 | * @param profile 2-octets service UUID. This is optional. |
michael@0 | 109 | */ |
michael@0 | 110 | [NewObject, Throws] |
michael@0 | 111 | DOMRequest connect(BluetoothDevice device, optional unsigned short serviceUuid); |
michael@0 | 112 | |
michael@0 | 113 | [NewObject, Throws] |
michael@0 | 114 | DOMRequest disconnect(BluetoothDevice device, optional unsigned short serviceUuid); |
michael@0 | 115 | |
michael@0 | 116 | // One device can only send one file at a time |
michael@0 | 117 | [NewObject, Throws] |
michael@0 | 118 | DOMRequest sendFile(DOMString deviceAddress, Blob blob); |
michael@0 | 119 | [NewObject, Throws] |
michael@0 | 120 | DOMRequest stopSendingFile(DOMString deviceAddress); |
michael@0 | 121 | [NewObject, Throws] |
michael@0 | 122 | DOMRequest confirmReceivingFile(DOMString deviceAddress, boolean confirmation); |
michael@0 | 123 | |
michael@0 | 124 | // Connect/Disconnect SCO (audio) connection |
michael@0 | 125 | [NewObject, Throws] |
michael@0 | 126 | DOMRequest connectSco(); |
michael@0 | 127 | [NewObject, Throws] |
michael@0 | 128 | DOMRequest disconnectSco(); |
michael@0 | 129 | [NewObject, Throws] |
michael@0 | 130 | DOMRequest isScoConnected(); |
michael@0 | 131 | |
michael@0 | 132 | /** |
michael@0 | 133 | * Additional HFP methods to handle CDMA network. |
michael@0 | 134 | * |
michael@0 | 135 | * In GSM network we observe call operations from RIL call state changes; |
michael@0 | 136 | * however in CDMA network RIL call states do not change under some call |
michael@0 | 137 | * operations, so we need these additional methods to be informed of these |
michael@0 | 138 | * operations from dialer. |
michael@0 | 139 | * |
michael@0 | 140 | * For more information please refer to bug 912005 and 925638. |
michael@0 | 141 | */ |
michael@0 | 142 | [NewObject, Throws] |
michael@0 | 143 | DOMRequest answerWaitingCall(); |
michael@0 | 144 | [NewObject, Throws] |
michael@0 | 145 | DOMRequest ignoreWaitingCall(); |
michael@0 | 146 | [NewObject, Throws] |
michael@0 | 147 | DOMRequest toggleCalls(); |
michael@0 | 148 | |
michael@0 | 149 | // AVRCP 1.3 methods |
michael@0 | 150 | [NewObject,Throws] |
michael@0 | 151 | DOMRequest sendMediaMetaData(optional MediaMetaData mediaMetaData); |
michael@0 | 152 | [NewObject,Throws] |
michael@0 | 153 | DOMRequest sendMediaPlayStatus(optional MediaPlayStatus mediaPlayStatus); |
michael@0 | 154 | }; |