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
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 enum WPSMethod {
6 "pbc",
7 "keypad",
8 "display"
9 };
11 dictionary WPSInfo {
12 WPSMethod method;
13 DOMString pin;
14 };
16 [JSImplementation="@mozilla.org/wifip2pgroupowner;1",
17 Func="Navigator::HasWifiManagerSupport"]
18 interface MozWifiP2pGroupOwner {
19 readonly attribute DOMString groupName;
20 readonly attribute DOMString macAddress;
21 readonly attribute DOMString ipAddress;
22 readonly attribute DOMString passphrase;
23 readonly attribute DOMString ssid;
24 readonly attribute any wpsCapabilities;
25 readonly attribute unsigned long freq;
26 readonly attribute boolean isLocal;
27 };
29 [JSImplementation="@mozilla.org/wifip2pmanager;1",
30 NavigatorProperty="mozWifiP2pManager",
31 Func="Navigator::HasWifiManagerSupport"]
32 interface MozWifiP2pManager : EventTarget
33 {
34 /**
35 * Enable/Disable wifi direct scan.
36 *
37 * onsuccess: Succeeded in starting/stopping wifi direct scan.
38 * onerror: Failed to start/stop wifi direct scan.
39 *
40 */
41 DOMRequest setScanEnabled(boolean enabled);
43 /**
44 * Connect to a peer with given configuration.
45 *
46 * @param address The peer MAC address we are going to connect.
47 * @param wpsMethod The WPS method we want to use.
48 * @param goIntent Number from 0 ~ 15 to indicate how much we want to be
49 * the group owner.
50 *
51 * onsuccess: Succeeded in issueing a 'connect' request. It doesn't mean we
52 * have connected to the peer.
53 *
54 * onerror: Failed to issue a 'connect' request, probably due to an
55 * invalid peer address, unsupported wps method or any
56 * preliminary error.
57 *
58 **/
59 DOMRequest connect(DOMString address, WPSMethod wpsMethod, optional byte goIntent);
61 /**
62 * Disconnect with a peer.
63 *
64 * @param address The mac address of the peer.
65 *
66 * onsuccess: Succeeded to issue a 'disconnect' request. It doesn't mean we
67 * have disconnected with the peer.
68 *
69 * onerror: Failed to issue a 'disconnect' request, probably due to the
70 * invalid peer address or any preliminary error.
71 *
72 */
73 DOMRequest disconnect(DOMString address);
75 /**
76 * Get peer list
77 *
78 * onsuccess: Command success, req.result contains an array of peer objects.
79 * onerror: Command failed.
80 *
81 * Peer object format:
82 * .address MAC address of the peer (string)
83 * .name the peer's device name (string)
84 * .isGroupOwner if the peer is the group owner (boolean)
85 * .wpsCapabilities array of the supported |WPSMethod|
86 * .connectionStatus one of { "disconnected", "connecting", "connected", "disconnecting" }
87 *
88 */
89 DOMRequest getPeerList();
91 /**
92 * Set pairing confirmation result.
93 *
94 * @param accepted Boolean to indicate whether we accepted the request or not.
95 * @param pin The user input pin number if the wps method is keypad.
96 *
97 * onsuccess: Command succeeded.
98 * onerror: Command failed.
99 *
100 */
101 DOMRequest setPairingConfirmation(boolean accepted, optional DOMString pin);
103 /**
104 * Set device name.
105 *
106 * @param devieName The new device name we are going to set.
107 *
108 * onsuccess: Command succeeded.
109 * onerror: Command failed.
110 *
111 */
112 DOMRequest setDeviceName(DOMString deviceName);
114 /**
115 * Returns if Wifi Direct is enabled.
116 *
117 */
118 readonly attribute boolean enabled;
120 /**
121 * The current group owner, null if none.
122 */
123 readonly attribute MozWifiP2pGroupOwner? groupOwner;
125 /**
126 * An event listener that is called whenever the Wifi Direct peer list is
127 * updated. Use getPeerList() to get the up-to-date peer list.
128 */
129 attribute EventHandler onpeerinfoupdate;
131 /**
132 * An event listener that is called whenever Wifi Direct status changed.
133 * The address of the changed peer will be stored in event.peerList.
134 * See MozWifiP2pStatusChangeEvent.webidl.
135 */
136 attribute EventHandler onstatuschange;
138 /**
139 * An event listener that is called whenever Wifi Direct is enabled.
140 */
141 attribute EventHandler onenabled;
143 /**
144 * An event listener that is called whenever Wifi Direct is disabled.
145 */
146 attribute EventHandler ondisabled;
147 };