Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Creating Wireless Ad Hoc Access Point

Some applications may need to create an wireless ad hoc access point that can be accessed by other devices. Wireless ad hoc access points can be created by calling the NetIF_WiFi_CreateAdhoc() API function with the necessary parameters. See section C-10-3 “NetIF_WiFi_CreateAdhoc()” for more information.

A call to NetIF_WiFi_CreateAdhoc() is shown below:

 

 

Listing 5-21 Call to NetIF_WiFi_CreateAdhoc()

L5-21(1) NetIF_WiFi_CreateAdhoc() requires height arguments. The first argument is the interface number, which is acquired upon successful addition and successful start of the interface.

L5-21(2) The second argument is the data rate used on the wireless network.

L5-21(3) The third argument is the wireless security type of wireless network.

L5-21(4) The fourth argument is the radio power level use to communicate on the wireless network.

L5-21(5) The fifth argument is the wireless channel for the ad hoc network.

L5-21(6) The sixth argument is a pointer to a string that contains the SSID of the wireless access point.

L5-21(7) The seventh argument is a pointer to a string that contains the pre-shared key of the wireless access point.

L5-21(8) The last argument is a pointer to a NET_ERR to contain the return error code. The return error variable will contain the value NET_IF_WIFI_ERR_NONE if the create process has been completed successfully.

If an error occurs, you should always inspect the return error code and take the appropriate action. There are very few things that could cause a failure to create an ad hoc network properly. Once the error is resolved, the application may again attempt to call NetIF_WiFi_CreateAdhoc().

  • No labels