dom/webidl/MozWifiManager.webidl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/webidl/MozWifiManager.webidl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,275 @@
     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 WifiWPSMethod {
     1.9 +  "pbc",
    1.10 +  "pin",
    1.11 +  "cancel"
    1.12 +};
    1.13 +
    1.14 +enum ConnectionStatus {
    1.15 +  "connecting",
    1.16 +  "associated",
    1.17 +  "connected",
    1.18 +  "disconnected",
    1.19 +  "wps-timeout",
    1.20 +  "wps-failed",
    1.21 +  "wps-overlapped",
    1.22 +  "connectingfailed"
    1.23 +};
    1.24 +
    1.25 +dictionary WifiWPSInfo {
    1.26 +  WifiWPSMethod method;
    1.27 +  DOMString? pin;
    1.28 +  DOMString? bssid;
    1.29 +};
    1.30 +
    1.31 +dictionary NetworkProperties {
    1.32 +  DOMString ssid;
    1.33 +  sequence<DOMString>? security;
    1.34 +  sequence<DOMString>? capabilities;
    1.35 +  boolean known;
    1.36 +  boolean connected;
    1.37 +  boolean hidden;
    1.38 +  DOMString bssid;
    1.39 +  DOMString signalStrength;
    1.40 +  long relSignalStrength;
    1.41 +  DOMString psk;
    1.42 +  DOMString wep;
    1.43 +  DOMString wep_key0;
    1.44 +  DOMString wep_key1;
    1.45 +  DOMString wep_key2;
    1.46 +  DOMString wep_key3;
    1.47 +  long wep_tx_keyidx;
    1.48 +  long priority;
    1.49 +  long scan_ssid;
    1.50 +  DOMString keyManagement;
    1.51 +  DOMString identity;
    1.52 +  DOMString password;
    1.53 +  DOMString auth_alg;
    1.54 +  DOMString phase1;
    1.55 +  DOMString phase2;
    1.56 +  DOMString eap;
    1.57 +  DOMString pin;
    1.58 +  boolean dontConnect;
    1.59 +};
    1.60 +
    1.61 +[Constructor(optional NetworkProperties properties),
    1.62 + JSImplementation="@mozilla.org/mozwifinetwork;1",
    1.63 + Func="Navigator::HasWifiManagerSupport"]
    1.64 +interface MozWifiNetwork {
    1.65 +  readonly attribute DOMString ssid;
    1.66 +  [Constant, Cached] readonly attribute sequence<DOMString>? security;
    1.67 +  [Constant, Cached] readonly attribute sequence<DOMString>? capabilities;
    1.68 +  readonly attribute boolean known;
    1.69 +  readonly attribute boolean connected;
    1.70 +  readonly attribute boolean hidden;
    1.71 +
    1.72 +           attribute DOMString? bssid;
    1.73 +           attribute DOMString? signalStrength;
    1.74 +           attribute long? relSignalStrength;
    1.75 +           attribute DOMString? psk;
    1.76 +           attribute DOMString? wep;
    1.77 +           attribute DOMString? wep_key0;
    1.78 +           attribute DOMString? wep_key1;
    1.79 +           attribute DOMString? wep_key2;
    1.80 +           attribute DOMString? wep_key3;
    1.81 +           attribute long? wep_tx_keyidx;
    1.82 +           attribute long? priority;
    1.83 +           attribute long? scan_ssid;
    1.84 +           attribute DOMString? keyManagement;
    1.85 +           attribute DOMString? identity;
    1.86 +           attribute DOMString? password;
    1.87 +           attribute DOMString? auth_alg;
    1.88 +           attribute DOMString? phase1;
    1.89 +           attribute DOMString? phase2;
    1.90 +           attribute DOMString? eap;
    1.91 +           attribute DOMString? pin;
    1.92 +           attribute boolean? dontConnect;
    1.93 +};
    1.94 +
    1.95 +[JSImplementation="@mozilla.org/mozwificonnection;1",
    1.96 + ChromeOnly]
    1.97 +interface MozWifiConnection {
    1.98 +  readonly attribute ConnectionStatus status;
    1.99 +  readonly attribute MozWifiNetwork? network;
   1.100 +};
   1.101 +
   1.102 +[JSImplementation="@mozilla.org/mozwificonnectioninfo;1",
   1.103 + ChromeOnly]
   1.104 +interface MozWifiConnectionInfo {
   1.105 +  readonly attribute short signalStrength;
   1.106 +  readonly attribute short relSignalStrength;
   1.107 +  readonly attribute long linkSpeed;
   1.108 +  readonly attribute DOMString? ipAddress;
   1.109 +};
   1.110 +
   1.111 +dictionary IPConfiguration {
   1.112 +  boolean enabled;
   1.113 +  DOMString ipaddr;
   1.114 +  DOMString proxy;
   1.115 +  short maskLength;
   1.116 +  DOMString gateway;
   1.117 +  DOMString dns1;
   1.118 +  DOMString dns2;
   1.119 +};
   1.120 +
   1.121 +[JSImplementation="@mozilla.org/wifimanager;1",
   1.122 + NavigatorProperty="mozWifiManager",
   1.123 + Func="Navigator::HasWifiManagerSupport"]
   1.124 +interface MozWifiManager : EventTarget {
   1.125 +  /**
   1.126 +   * Returns the list of currently available networks.
   1.127 +   * onsuccess: We have obtained the current list of networks. request.value
   1.128 +   *            is an object whose property names are SSIDs and values are
   1.129 +   *            network objects.
   1.130 +   * onerror: We were unable to obtain a list of property names.
   1.131 +   */
   1.132 +  DOMRequest getNetworks();
   1.133 +
   1.134 +  /**
   1.135 +   * Returns the list of networks known to the system that will be
   1.136 +   * automatically connected to if they're in range.
   1.137 +   * onsuccess: request.value is an object whose property names are
   1.138 +   *            SSIDs and values are network objects.
   1.139 +   * onerror: We were unable to obtain a list of known networks.
   1.140 +   */
   1.141 +  DOMRequest getKnownNetworks();
   1.142 +
   1.143 +  /**
   1.144 +   * Takes one of the networks returned from getNetworks and tries to
   1.145 +   * connect to it.
   1.146 +   * @param network A network object with information about the network,
   1.147 +   *                such as the SSID, key management desired, etc.
   1.148 +   * onsuccess: We have started attempting to associate with the network.
   1.149 +   *            request.value is true.
   1.150 +   * onerror: We were unable to select the network. This most likely means a
   1.151 +   *          configuration error.
   1.152 +   */
   1.153 +  DOMRequest associate(MozWifiNetwork network);
   1.154 +
   1.155 +  /**
   1.156 +   * Given a network, removes it from the list of networks that we'll
   1.157 +   * automatically connect to. In order to re-connect to the network, it is
   1.158 +   * necessary to call associate on it.
   1.159 +   * @param network A network object with the SSID of the network to remove.
   1.160 +   * onsuccess: We have removed this network. If we were previously
   1.161 +   *            connected to it, we have started reconnecting to the next
   1.162 +   *            network in the list.
   1.163 +   * onerror: We were unable to remove the network.
   1.164 +   */
   1.165 +  DOMRequest forget(MozWifiNetwork network);
   1.166 +
   1.167 +  /**
   1.168 +   * Wi-Fi Protected Setup functionality.
   1.169 +   * @param detail WPS detail which has 'method' and 'pin' field.
   1.170 +   *               The possible method field values are:
   1.171 +   *                 - pbc: The Push Button Configuration.
   1.172 +   *                 - pin: The PIN configuration.
   1.173 +   *                 - cancel: Request to cancel WPS in progress.
   1.174 +   *               If method field is 'pin', 'pin' field can exist and has
   1.175 +   *               a PIN number.
   1.176 +   *               If method field is 'pin', 'bssid' field can exist and has
   1.177 +   *               a opposite BSSID.
   1.178 +   * onsuccess: We have successfully started/canceled wps.
   1.179 +   * onerror: We have failed to start/cancel wps.
   1.180 +   */
   1.181 +  DOMRequest wps(optional WifiWPSInfo detail);
   1.182 +
   1.183 +  /**
   1.184 +   * Turn on/off wifi power saving mode.
   1.185 +   * @param enabled true or false.
   1.186 +   * onsuccess: We have successfully turn on/off wifi power saving mode.
   1.187 +   * onerror: We have failed to turn on/off wifi power saving mode.
   1.188 +   */
   1.189 +  DOMRequest setPowerSavingMode(boolean enabled);
   1.190 +
   1.191 +  /**
   1.192 +   * Given a network, configure using static IP instead of running DHCP
   1.193 +   * @param network A network object with the SSID of the network to set static ip.
   1.194 +   * @param info info should have following field:
   1.195 +   *        - enabled True to enable static IP, false to use DHCP
   1.196 +   *        - ipaddr configured static IP address
   1.197 +   *        - proxy configured proxy server address
   1.198 +   *        - maskLength configured mask length
   1.199 +   *        - gateway configured gateway address
   1.200 +   *        - dns1 configured first DNS server address
   1.201 +   *        - dns2 configured seconf DNS server address
   1.202 +   * onsuccess: We have successfully configure the static ip mode.
   1.203 +   * onerror: We have failed to configure the static ip mode.
   1.204 +   */
   1.205 +  DOMRequest setStaticIpMode(MozWifiNetwork network, optional IPConfiguration info);
   1.206 +
   1.207 +  /**
   1.208 +   * Given a network, configure http proxy when using wifi.
   1.209 +   * @param network A network object with the SSID of the network to set http proxy.
   1.210 +   * @param info info should have following field:
   1.211 +   *        - httpProxyHost ip address of http proxy.
   1.212 +   *        - httpProxyPort port of http proxy, set 0 to use default port 8080.
   1.213 +   *        set info to null to clear http proxy.
   1.214 +   * onsuccess: We have successfully configure http proxy.
   1.215 +   * onerror: We have failed to configure http proxy.
   1.216 +   */
   1.217 +  DOMRequest setHttpProxy(MozWifiNetwork network, any info);
   1.218 +
   1.219 +  /**
   1.220 +   * Returns whether or not wifi is currently enabled.
   1.221 +   */
   1.222 +  readonly attribute boolean enabled;
   1.223 +
   1.224 +  /**
   1.225 +   * Returns the MAC address of the wifi adapter.
   1.226 +   */
   1.227 +  readonly attribute DOMString macAddress;
   1.228 +
   1.229 +  /**
   1.230 +   * An non-null object containing the following information:
   1.231 +   *  - status ("disconnected", "connecting", "associated", "connected")
   1.232 +   *  - network
   1.233 +   *
   1.234 +   *  Note that the object returned is read only. Any changes required must
   1.235 +   *  be done by calling other APIs.
   1.236 +   */
   1.237 +  readonly attribute MozWifiConnection connection;
   1.238 +
   1.239 +  /**
   1.240 +   * A connectionInformation object with the same information found in an
   1.241 +   * nsIDOMMozWifiConnectionInfoEvent (but without the network).
   1.242 +   * If we are not currently connected to a network, this will be null.
   1.243 +   */
   1.244 +  readonly attribute MozWifiConnectionInfo? connectionInformation;
   1.245 +
   1.246 +  /**
   1.247 +   * State notification listeners. These all take an
   1.248 +   * nsIDOMMozWifiStatusChangeEvent with the new status and a network (which
   1.249 +   * may be null).
   1.250 +   *
   1.251 +   * The possible statuses are:
   1.252 +   *   - connecting: Fires when we start the process of connecting to a
   1.253 +   *                 network.
   1.254 +   *   - associated: Fires when we have connected to an access point but do
   1.255 +   *                 not yet have an IP address.
   1.256 +   *   - connected: Fires once we are fully connected to an access point and
   1.257 +   *                can access the internet.
   1.258 +   *   - disconnected: Fires when we either fail to connect to an access
   1.259 +   *                   point (transition: associated -> disconnected) or
   1.260 +   *                   when we were connected to a network but have
   1.261 +   *                   disconnected for any reason (transition: connected ->
   1.262 +   *                   disconnected).
   1.263 +   */
   1.264 +  attribute EventHandler onstatuschange;
   1.265 +
   1.266 +  /**
   1.267 +   * An event listener that is called with information about the signal
   1.268 +   * strength and link speed every 5 seconds.
   1.269 +   */
   1.270 +  attribute EventHandler onconnectionInfoUpdate;
   1.271 +
   1.272 +  /**
   1.273 +   * These two events fire when the wifi system is brought online or taken
   1.274 +   * offline.
   1.275 +   */
   1.276 +  attribute EventHandler onenabled;
   1.277 +  attribute EventHandler ondisabled;
   1.278 +};

mercurial