MozWifiP2pManager.connect()

The MozWifiP2pManager.connect() method binds, with a given configuration, to a peer identified by its MAC address and returns a DOMRequest that will report if the connect request has been issued successfully or not (but not about its result).

Syntax

JavaScript
 req = wifiP2pMgr.connect(address, wps, intent)

Parameters

address
Is a DOMString containing the MAC Address of the peer to connect to.
wps
Is a keyword containing the WPS method to use. The following values are valid:
  • "pbc" (push-button connection), the connection is activated by a negotiation between both devices, without the user interacting anymore.
  • "display", the device display a PIN on its display and expect it to be entered on the peer before activating the connection.
  • "keypad", the connection is activated by entering a PIN code on the keypad. It is the symmetric of "display".
intent
Is a positive number between 0 and 15, included, that indicates if the local host wants to be the group owner. A value of 0 means that the device don't want to be the group owner, a value of 15 that he wants to be it. The device with the higher value wins.

Return value

The result is a DOMRequest:

  • on success, it means that the connection requests has been issued (but not necessary accepted).
  • on failure, it means that one of the parameter is incorrect: the MAC address may be non existing or invalid, the WPS method not supported or the intent outside the allowed range.

Specifications

This is a non-standard API, not on an any standard track.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support No support No support No support No support No support
Feature Android Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support No support No support 1.4 No support No support No support No support

See also

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/mozwifip2pmanager/connect

API Firefox OS Method MozWifiP2pManager Non-standard Reference WiFi