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 michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: enum WPSMethod { michael@0: "pbc", michael@0: "keypad", michael@0: "display" michael@0: }; michael@0: michael@0: dictionary WPSInfo { michael@0: WPSMethod method; michael@0: DOMString pin; michael@0: }; michael@0: michael@0: [JSImplementation="@mozilla.org/wifip2pgroupowner;1", michael@0: Func="Navigator::HasWifiManagerSupport"] michael@0: interface MozWifiP2pGroupOwner { michael@0: readonly attribute DOMString groupName; michael@0: readonly attribute DOMString macAddress; michael@0: readonly attribute DOMString ipAddress; michael@0: readonly attribute DOMString passphrase; michael@0: readonly attribute DOMString ssid; michael@0: readonly attribute any wpsCapabilities; michael@0: readonly attribute unsigned long freq; michael@0: readonly attribute boolean isLocal; michael@0: }; michael@0: michael@0: [JSImplementation="@mozilla.org/wifip2pmanager;1", michael@0: NavigatorProperty="mozWifiP2pManager", michael@0: Func="Navigator::HasWifiManagerSupport"] michael@0: interface MozWifiP2pManager : EventTarget michael@0: { michael@0: /** michael@0: * Enable/Disable wifi direct scan. michael@0: * michael@0: * onsuccess: Succeeded in starting/stopping wifi direct scan. michael@0: * onerror: Failed to start/stop wifi direct scan. michael@0: * michael@0: */ michael@0: DOMRequest setScanEnabled(boolean enabled); michael@0: michael@0: /** michael@0: * Connect to a peer with given configuration. michael@0: * michael@0: * @param address The peer MAC address we are going to connect. michael@0: * @param wpsMethod The WPS method we want to use. michael@0: * @param goIntent Number from 0 ~ 15 to indicate how much we want to be michael@0: * the group owner. michael@0: * michael@0: * onsuccess: Succeeded in issueing a 'connect' request. It doesn't mean we michael@0: * have connected to the peer. michael@0: * michael@0: * onerror: Failed to issue a 'connect' request, probably due to an michael@0: * invalid peer address, unsupported wps method or any michael@0: * preliminary error. michael@0: * michael@0: **/ michael@0: DOMRequest connect(DOMString address, WPSMethod wpsMethod, optional byte goIntent); michael@0: michael@0: /** michael@0: * Disconnect with a peer. michael@0: * michael@0: * @param address The mac address of the peer. michael@0: * michael@0: * onsuccess: Succeeded to issue a 'disconnect' request. It doesn't mean we michael@0: * have disconnected with the peer. michael@0: * michael@0: * onerror: Failed to issue a 'disconnect' request, probably due to the michael@0: * invalid peer address or any preliminary error. michael@0: * michael@0: */ michael@0: DOMRequest disconnect(DOMString address); michael@0: michael@0: /** michael@0: * Get peer list michael@0: * michael@0: * onsuccess: Command success, req.result contains an array of peer objects. michael@0: * onerror: Command failed. michael@0: * michael@0: * Peer object format: michael@0: * .address MAC address of the peer (string) michael@0: * .name the peer's device name (string) michael@0: * .isGroupOwner if the peer is the group owner (boolean) michael@0: * .wpsCapabilities array of the supported |WPSMethod| michael@0: * .connectionStatus one of { "disconnected", "connecting", "connected", "disconnecting" } michael@0: * michael@0: */ michael@0: DOMRequest getPeerList(); michael@0: michael@0: /** michael@0: * Set pairing confirmation result. michael@0: * michael@0: * @param accepted Boolean to indicate whether we accepted the request or not. michael@0: * @param pin The user input pin number if the wps method is keypad. michael@0: * michael@0: * onsuccess: Command succeeded. michael@0: * onerror: Command failed. michael@0: * michael@0: */ michael@0: DOMRequest setPairingConfirmation(boolean accepted, optional DOMString pin); michael@0: michael@0: /** michael@0: * Set device name. michael@0: * michael@0: * @param devieName The new device name we are going to set. michael@0: * michael@0: * onsuccess: Command succeeded. michael@0: * onerror: Command failed. michael@0: * michael@0: */ michael@0: DOMRequest setDeviceName(DOMString deviceName); michael@0: michael@0: /** michael@0: * Returns if Wifi Direct is enabled. michael@0: * michael@0: */ michael@0: readonly attribute boolean enabled; michael@0: michael@0: /** michael@0: * The current group owner, null if none. michael@0: */ michael@0: readonly attribute MozWifiP2pGroupOwner? groupOwner; michael@0: michael@0: /** michael@0: * An event listener that is called whenever the Wifi Direct peer list is michael@0: * updated. Use getPeerList() to get the up-to-date peer list. michael@0: */ michael@0: attribute EventHandler onpeerinfoupdate; michael@0: michael@0: /** michael@0: * An event listener that is called whenever Wifi Direct status changed. michael@0: * The address of the changed peer will be stored in event.peerList. michael@0: * See MozWifiP2pStatusChangeEvent.webidl. michael@0: */ michael@0: attribute EventHandler onstatuschange; michael@0: michael@0: /** michael@0: * An event listener that is called whenever Wifi Direct is enabled. michael@0: */ michael@0: attribute EventHandler onenabled; michael@0: michael@0: /** michael@0: * An event listener that is called whenever Wifi Direct is disabled. michael@0: */ michael@0: attribute EventHandler ondisabled; michael@0: };