Android4.0 new connector feature WI-FI direct

Source: Internet
Author: User
WiFi direct technology Overview

Wi-Fi direct allows devices in a wireless network to connect to each other without using a wireless router. Similar to Bluetooth technology, this standard allows wireless devices to interconnect in point-to-point mode, but it significantly improves transmission speed and distance compared with Bluetooth.

Features of Wi-Fi direct technology

Mobility and Portability: Wi-Fi direct devices can connect to each other anytime, anywhere. Because you do not need a Wi-Fi router or access point, a Wi-Fi device can be connected anywhere.

Instant availability: users will be able to establish direct connections using the first Wi-Fi Direct Authentication device that takes home. For example, a newly purchased Wi-Fi direct notebook can be directly connected to a user's existing traditional Wi-Fi device.

Ease of use: the Wi-Fi direct device discovery and service discovery functions help users determine available devices and services and establish connections. For example, if users want to print files, they can use the above service to find out which Wi-Fi network has a printer.

Simple and secure connection: Wi-Fi direct devices use Wi-Fi Protected setup to simplify the process of creating secure connections between devices. You can press the button on any device or enter a PIN code (that is, the PIN code displayed on the device) to easily create a secure connection.

 

Wi-Fi direct has the following advantages: high transmission rate and compatibility with original devices.

Major disadvantage of Wi-Fi direct: High Power Consumption (compared with Bluetooth ).

 

Android P2P source code learning

①: Wifip2pset1_wi-fi P2P settings

 

Method

Explanation

Mreceiver

Process various received action methods:
Wifi_p2p_peers_changed_action: Call requestpeers;
Wifi_p2p_connection_changed_action: Obtain networkinfo and determine whether it is in the connection status;
Wifi_p2p_this_device_changed_action: Call updatedevicepref

Oncreate

Called at creation

Obtain the system service wifip2pmanager and wifip2pmanager. Channel; mconnectlistener/mdisconnectlistener set listener for wifip2pdialog; sethasoptionsmenu (true) set operation menu

Onresume ()

Register mcycler; discoverpeers () to explore nearby devices

Onpause ()

Log out of mcycler;

Onoptionsitemselected

Menu Event Response:
Menu_id_search: discoverpeers () to explore nearby devices;
Menu_id_create_group: creategroup () creates a group;
Menu_id_remove_group: removegroup () removes a group;
Menu_id_advanced: not processed;

Onpreferencetreeclick

Click a device. The related dialog box is displayed.

Updatedevicepref

Update Device Properties
First, set the device configuration information, and then call
Onpeersavailable () method to update the UI

Onpeersavailable

Update the UI

 

 

Wifip2pdialog Method

Explanation

Getconfig ()

Obtain P2P configuration information and device address and WPS

Oncreate

Call at creation and set the address and name of the device.

 

 

 

Wifip2penabler

Method

Understanding

Mreceiver

Process various received action methods:
Wifi_p2p_state_changed_action: Call Method
Handlep2pstatechanged () for processing

Handlep2pstatechanged

Set the checkbox attribute value based on the status.

Onpreferencechange

Enable/disable WiFi P2P Based on the checkbox attribute changes

Resume/pause

Register/deregister mcycler, set/cancel the listener of checkbox

 

 

 

 

Wifip2ppeer

Method

Understanding

Onbindview

Set the basic configuration information (the name, address, the image of the received image and the semaphore ),
Set summary with refresh ()

Compareto

Checks whether a device is the same as a local device.

Getlevel

Obtain signal level

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.