dom/webidl/MozWifiP2pManager.webidl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/webidl/MozWifiP2pManager.webidl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,147 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +enum WPSMethod {
     1.9 +  "pbc",
    1.10 +  "keypad",
    1.11 +  "display"
    1.12 +};
    1.13 +
    1.14 +dictionary WPSInfo {
    1.15 +  WPSMethod method;
    1.16 +  DOMString pin;
    1.17 +};
    1.18 +
    1.19 +[JSImplementation="@mozilla.org/wifip2pgroupowner;1",
    1.20 + Func="Navigator::HasWifiManagerSupport"]
    1.21 +interface MozWifiP2pGroupOwner {
    1.22 +  readonly attribute DOMString groupName;
    1.23 +  readonly attribute DOMString macAddress;
    1.24 +  readonly attribute DOMString ipAddress;
    1.25 +  readonly attribute DOMString passphrase;
    1.26 +  readonly attribute DOMString ssid;
    1.27 +  readonly attribute any wpsCapabilities;
    1.28 +  readonly attribute unsigned long freq;
    1.29 +  readonly attribute boolean isLocal;
    1.30 +};
    1.31 +
    1.32 +[JSImplementation="@mozilla.org/wifip2pmanager;1",
    1.33 + NavigatorProperty="mozWifiP2pManager",
    1.34 + Func="Navigator::HasWifiManagerSupport"]
    1.35 +interface MozWifiP2pManager : EventTarget
    1.36 +{
    1.37 +  /**
    1.38 +   * Enable/Disable wifi direct scan.
    1.39 +   *
    1.40 +   * onsuccess: Succeeded in starting/stopping wifi direct scan.
    1.41 +   * onerror:   Failed to start/stop wifi direct scan.
    1.42 +   *
    1.43 +   */
    1.44 +  DOMRequest setScanEnabled(boolean enabled);
    1.45 +
    1.46 +  /**
    1.47 +   * Connect to a peer with given configuration.
    1.48 +   *
    1.49 +   * @param address The peer MAC address we are going to connect.
    1.50 +   * @param wpsMethod The WPS method we want to use.
    1.51 +   * @param goIntent Number from 0 ~ 15 to indicate how much we want to be
    1.52 +   *                 the group owner.
    1.53 +   *
    1.54 +   * onsuccess: Succeeded in issueing a 'connect' request. It doesn't mean we
    1.55 +   *            have connected to the peer.
    1.56 +   *
    1.57 +   * onerror:   Failed to issue a 'connect' request, probably due to an
    1.58 +   *            invalid peer address, unsupported wps method or any
    1.59 +   *            preliminary error.
    1.60 +   *
    1.61 +   **/
    1.62 +  DOMRequest connect(DOMString address, WPSMethod wpsMethod, optional byte goIntent);
    1.63 +
    1.64 +  /**
    1.65 +   * Disconnect with a peer.
    1.66 +   *
    1.67 +   * @param address The mac address of the peer.
    1.68 +   *
    1.69 +   * onsuccess: Succeeded to issue a 'disconnect' request. It doesn't mean we
    1.70 +   *            have disconnected with the peer.
    1.71 +   *
    1.72 +   * onerror:   Failed to issue a 'disconnect' request, probably due to the
    1.73 +   *            invalid peer address or any preliminary error.
    1.74 +   *
    1.75 +   */
    1.76 +  DOMRequest disconnect(DOMString address);
    1.77 +
    1.78 +  /**
    1.79 +   * Get peer list
    1.80 +   *
    1.81 +   * onsuccess: Command success, req.result contains an array of peer objects.
    1.82 +   * onerror: Command failed.
    1.83 +   *
    1.84 +   * Peer object format:
    1.85 +   *   .address          MAC address of the peer (string)
    1.86 +   *   .name             the peer's device name (string)
    1.87 +   *   .isGroupOwner     if the peer is the group owner (boolean)
    1.88 +   *   .wpsCapabilities  array of the supported |WPSMethod|
    1.89 +   *   .connectionStatus one of { "disconnected", "connecting", "connected", "disconnecting" }
    1.90 +   *
    1.91 +   */
    1.92 +  DOMRequest getPeerList();
    1.93 +
    1.94 +  /**
    1.95 +   * Set pairing confirmation result.
    1.96 +   *
    1.97 +   * @param accepted Boolean to indicate whether we accepted the request or not.
    1.98 +   * @param pin The user input pin number if the wps method is keypad.
    1.99 +   *
   1.100 +   * onsuccess: Command succeeded.
   1.101 +   * onerror:   Command failed.
   1.102 +   *
   1.103 +   */
   1.104 +  DOMRequest setPairingConfirmation(boolean accepted, optional DOMString pin);
   1.105 +
   1.106 +  /**
   1.107 +   * Set device name.
   1.108 +   *
   1.109 +   * @param devieName The new device name we are going to set.
   1.110 +   *
   1.111 +   * onsuccess: Command succeeded.
   1.112 +   * onerror:   Command failed.
   1.113 +   *
   1.114 +   */
   1.115 +  DOMRequest setDeviceName(DOMString deviceName);
   1.116 +
   1.117 +  /**
   1.118 +   * Returns if Wifi Direct is enabled.
   1.119 +   *
   1.120 +   */
   1.121 +  readonly attribute boolean enabled;
   1.122 +
   1.123 +  /**
   1.124 +   * The current group owner, null if none.
   1.125 +   */
   1.126 +  readonly attribute MozWifiP2pGroupOwner? groupOwner;
   1.127 +
   1.128 +  /**
   1.129 +   * An event listener that is called whenever the Wifi Direct peer list is
   1.130 +   * updated. Use getPeerList() to get the up-to-date peer list.
   1.131 +   */
   1.132 +  attribute EventHandler onpeerinfoupdate;
   1.133 +
   1.134 +  /**
   1.135 +   * An event listener that is called whenever Wifi Direct status changed.
   1.136 +   * The address of the changed peer will be stored in event.peerList.
   1.137 +   * See MozWifiP2pStatusChangeEvent.webidl.
   1.138 +   */
   1.139 +  attribute EventHandler onstatuschange;
   1.140 +
   1.141 +  /**
   1.142 +   * An event listener that is called whenever Wifi Direct is enabled.
   1.143 +   */
   1.144 +  attribute EventHandler onenabled;
   1.145 +
   1.146 +  /**
   1.147 +   * An event listener that is called whenever Wifi Direct is disabled.
   1.148 +   */
   1.149 +  attribute EventHandler ondisabled;
   1.150 +};

mercurial