Wifi Direct

From MozillaWiki
Jump to: navigation, search

Current Status

Wifi Direct is currently an opt-out feature on gecko. To enable Wifi Direct, you have to add 'ro.moz.wifi.p2p_supported' to your system/build.prop. Besides, there is still no application and gaia page to work with Wifi Direct. Please refer to this gaia remote for the example of the use the Wifi Direct APIs.

Web IDL

MozWifiP2pManager.webidl

Introduction

Wifi Direct is a peer-to-peer communication method based on Wifi technology. Two phones could connect to each other without the existence of access points. Wifi Direct is a pure software feature so it requires no hardware upgrade. The communication speed is as fast as regular Wifi speed so it's pretty appropriate to be used to transfer a large file.

As compared to another WiFi peer-to-peer technology, ad-hoc mode, Wifi Direct has some advantages over ad-host mode such as the security, the speed and the ease of use. However, Wifi Direct is difficult to build a complicated topology of network. The most common use case is only two phones connecting to each other. In this case, one phone will be a so-called "group owner" and the other will be "client". The participants in the network formed by Wifi Direct will be addressed in the following section.

Architecture

There are two main files to implement the internal Wifi Direct machinery:

  • dom/wifi/WifiP2pManager.jsm

Mainly responsible for communicating with wpa_supplicant and notifying the observer important events such as "peer found", "peer connecting", "peer connected", etc.

  • dom/wifi/WifiP2pWorkerObserver.jsm

Receives/sends DOM events and dispatches to WifiP2pManager to handle. It also translates chrome objects to DOM-facing objects.

Other than the mentioned files, dom/wifi/StateMachine.jsm is a helper module to build a Wifi Direct state machine; dom/wifi/DOMWifiP2pManager.jsm would sit in each window (may has multiple instances) to work with internal modules by message manager (ppmm/cpmm).

The relationship between DOM, WifiWorker.js and the Wifi Direct modules can be visualized in the following figure:

Wifi Direct Diagram.png

TODOs