dom/webidl/BluetoothAdapter.webidl

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

mercurial