Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Scanning for a Wireless Access Point

When a wireless network interface is started, it becomes an active interface that is not yet capable of transmitting and receiving data since no operational link to a network medium is configured. The first step to join a network to have an operational link is the scan operation which consists to find the wireless network available in the range of the wireless module.

A wireless network interface should be able to scan any time after the network interface has been successfully started. A successful call to NetIF_WiFi_Scan() return the wireless network available to join which can be joined by the wireless network interface. See section C-10-1 “NetIF_WiFi_Scan()” for more information.

You can scan for a wireless network by calling the NetIF_WiFi_Scan() API function with the necessary parameters. A call to NetIF_WiFi_Scan() is shown below.

 

 

Listing 5-19 Calling NetIF_Start()

L5-19(1) NetIF_WiFi_Scan() requires six arguments. The first function argument is the interface number that the application wants to scan with. The interface number is acquired upon successful addition of the interface and upon the successful start of the interface.

L5-19(2) The second argument is a pointer to a wireless access point buffer to contain the wireless network found in the range of the interface.

L5-19(3) The third argument is the number of wireless access point that can be contained in the wireless access point buffer.

L5-19(4) The fourth argument is a pointer to a string that can contains the SSID of an hidden wireless access point to find.

L5-19(5) The fifth argument is the wireless channel to scan.

L5-19(6) 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 scan process has been completed successfully.

There are very few things that could cause a network interface to not scan properly. The application developer should always inspect the return error code and take the appropriate action if an error occurs. Once the error is resolved, the application may again attempt to call NetIF_WiFi_Scan().