Bug 811635 - Part 1: Webidls/idls for WifiP2pManager and WifiP2pStatusChangeEvent. r=vchang, sr=mrbkap
☠☠ backed out by 4e8b08358660 ☠ ☠
authorHenry Chang <hchang@mozilla.com>
Thu, 28 Nov 2013 15:54:07 +0800
changeset 174238 0338e84d99a70253a41d1445383663c96e5880b3
parent 174237 e56b32bd7317479b29c77a2468f2b5e6ffadbde9
child 174239 6c9ca70f582d25d5f31f205e4ef5ec6bf2053df1
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvchang, mrbkap
bugs811635
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 811635 - Part 1: Webidls/idls for WifiP2pManager and WifiP2pStatusChangeEvent. r=vchang, sr=mrbkap
CLOBBER
dom/webidl/MozWifiP2pStatusChangeEvent.webidl
dom/webidl/WifiP2pManager.webidl
dom/webidl/moz.build
dom/wifi/nsIDOMMozWifiP2pStatusChangeEvent.idl
--- a/CLOBBER
+++ b/CLOBBER
@@ -13,9 +13,9 @@
 #          |               |
 #          O <-- Clobber   O  <-- Clobber
 #
 # Note: The description below will be part of the error message shown to users.
 #
 # Modifying this file will now automatically clobber the buildbot machines \o/
 #
 
-Bug 915533 - Remove unused files under dom/bluetooth.
+Bug 811635 - Windows webidl changes.
new file mode 100644
--- /dev/null
+++ b/dom/webidl/MozWifiP2pStatusChangeEvent.webidl
@@ -0,0 +1,16 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+[Constructor(DOMString type, optional MozWifiP2pStatusChangeEventInit eventInitDict), HeaderFile="GeneratedEventClasses.h"]
+interface MozWifiP2pStatusChangeEvent : Event
+{
+  readonly attribute DOMString peerAddress;
+};
+
+dictionary MozWifiP2pStatusChangeEventInit : EventInit
+{
+  DOMString peerAddress = "";
+};
new file mode 100644
--- /dev/null
+++ b/dom/webidl/WifiP2pManager.webidl
@@ -0,0 +1,146 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+enum WPSMethod {
+  "pbc",
+  "keypad",
+  "display"
+};
+
+dictionary WPSInfo {
+  WPSMethod method;
+  DOMString pin;
+};
+
+[JSImplementation="@mozilla.org/wifip2pgroupowner;1"]
+interface WifiP2pGroupOwner {
+  readonly attribute DOMString groupName;
+  readonly attribute DOMString macAddress;
+  readonly attribute DOMString ipAddress;
+  readonly attribute DOMString passphrase;
+  readonly attribute DOMString ssid;
+  readonly attribute any wpsCapabilities;
+  readonly attribute unsigned long freq;
+  readonly attribute boolean isLocal;
+};
+
+[JSImplementation="@mozilla.org/wifip2pmanager;1",
+ NavigatorProperty="mozWifiP2pManager",
+ Func="Navigator::HasWifiManagerSupport"]
+interface DOMWifiP2pManager : EventTarget
+{
+  /**
+   * Enable/Disable wifi direct scan.
+   *
+   * onsuccess: Succeeded in starting/stopping wifi direct scan.
+   * onerror:   Failed to start/stop wifi direct scan.
+   *
+   */
+  DOMRequest setScanEnabled(boolean enabled);
+
+  /**
+   * Connect to a peer with given configuration.
+   *
+   * @param address The peer MAC address we are going to connect.
+   * @param wpsMethod The WPS method we want to use.
+   * @param goIntent Number from 0 ~ 15 to indicate how much we want to be
+   *                 the group owner.
+   *
+   * onsuccess: Succeeded in issueing a 'connect' request. It doesn't mean we
+   *            have connected to the peer.
+   *
+   * onerror:   Failed to issue a 'connect' request, probably due to an
+   *            invalid peer address, unsupported wps method or any
+   *            preliminary error.
+   *
+   **/
+  DOMRequest connect(DOMString address, WPSMethod wpsMethod, optional byte goIntent);
+
+  /**
+   * Disconnect with a peer.
+   *
+   * @param address The mac address of the peer.
+   *
+   * onsuccess: Succeeded to issue a 'disconnect' request. It doesn't mean we
+   *            have disconnected with the peer.
+   *
+   * onerror:   Failed to issue a 'disconnect' request, probably due to the
+   *            invalid peer address or any preliminary error.
+   *
+   */
+  DOMRequest disconnect(DOMString address);
+
+  /**
+   * Get peer list
+   *
+   * onsuccess: Command success, req.result contains an array of peer objects.
+   * onerror: Command failed.
+   *
+   * Peer object format:
+   *   .address          MAC address of the peer (string)
+   *   .name             the peer's device name (string)
+   *   .isGroupOwner     if the peer is the group owner (boolean)
+   *   .wpsCapabilities  array of the supported |WPSMethod|
+   *   .connectionStatus one of { "disconnected", "connecting", "connected", "disconnecting" }
+   *
+   */
+  DOMRequest getPeerList();
+
+  /**
+   * Set pairing confirmation result.
+   *
+   * @param accepted Boolean to indicate whether we accepted the request or not.
+   * @param pin The user input pin number if the wps method is keypad.
+   *
+   * onsuccess: Command succeeded.
+   * onerror:   Command failed.
+   *
+   */
+  DOMRequest setPairingConfirmation(boolean accepted, optional DOMString pin);
+
+  /**
+   * Set device name.
+   *
+   * @param devieName The new device name we are going to set.
+   *
+   * onsuccess: Command succeeded.
+   * onerror:   Command failed.
+   *
+   */
+  DOMRequest setDeviceName(DOMString deviceName);
+
+  /**
+   * Returns if Wifi Direct is enabled.
+   *
+   */
+  readonly attribute boolean enabled;
+
+  /**
+   * The current group owner, null if none.
+   */
+  readonly attribute WifiP2pGroupOwner? groupOwner;
+
+  /**
+   * An event listener that is called whenever the Wifi Direct peer list is
+   * updated. Use getPeerList() to get the up-to-date peer list.
+   */
+  attribute EventHandler onpeerinfoupdate;
+
+  /**
+   * An event listener that is called whenever Wifi Direct status changed.
+   * The address of the changed peer will be stored in event.peerList.
+   * See MozWifiP2pStatusChangeEvent.webidl.
+   */
+  attribute EventHandler onstatuschange;
+
+  /**
+   * An event listener that is called whenever Wifi Direct is enabled.
+   */
+  attribute EventHandler onenabled;
+
+  /**
+   * An event listener that is called whenever Wifi Direct is disabled.
+   */
+  attribute EventHandler ondisabled;
+};
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -533,17 +533,19 @@ if CONFIG['MOZ_NFC']:
          'MozNFCPeer.webidl',
          'MozNFCTag.webidl',
     ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
     WEBIDL_FILES += [
         'MozSpeakerManager.webidl',
         'MozWifiConnectionInfoEvent.webidl',
+        'MozWifiP2pStatusChangeEvent.webidl',
         'MozWifiStatusChangeEvent.webidl',
+        'WifiP2pManager.webidl',
     ]
 
 if CONFIG['MOZ_WEBSPEECH']:
     WEBIDL_FILES += [
         'SpeechRecognitionError.webidl',
         'SpeechRecognitionEvent.webidl',
     ]
 
new file mode 100644
--- /dev/null
+++ b/dom/wifi/nsIDOMMozWifiP2pStatusChangeEvent.idl
@@ -0,0 +1,24 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsIDOMEvent.idl"
+
+[scriptable, builtinclass, uuid(82cad910-2019-11e3-8224-0800200c9a66)]
+interface nsIDOMMozWifiP2pStatusChangeEvent : nsIDOMEvent
+{
+  /**
+   * The mac address of the peer whose status has just changed.
+   */
+  readonly attribute DOMString peerAddress;
+
+  [noscript] void initMozWifiP2pStatusChangeEvent(in DOMString aType,
+                                                  in boolean aCanBubble,
+                                                  in boolean aCancelable,
+                                                  in DOMString aPeerAddress);
+};
+
+dictionary MozWifiP2pStatusChangeEventInit : EventInit
+{
+  DOMString peerAddress;
+};