Versions Compared

Key

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

...

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 returns the wireless network networks available to join which can be joined by the wireless network interface. See 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.

Code Block
languagecpp
themeConfluence
firstline1
title Listing - Calling NetIF_WiFi_Scan()
linenumberstrue
NET_IF_WIFI_AP  ap_buf[NB_AP_MAX]
CPU_INT16U      ap_ctn;
NET_ERR         err;

ap_ctn = NetIF_WiFi_Scan(if_nbr,             (1)
                         ap_buf,             (2)
                         NB_AP_MAX,          (3)
                         0,                  (4)
                         NET_IF_WIFI_CH_ALL, (5)
                        &err);               (6)


Panel
bgColor#f0f0f0
  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.
  2. The second argument is a pointer to a wireless access point buffer that contains the wireless network found in the range of the interface.
  3. The third argument is the number of wireless access points that can be contained in the wireless access point buffer.
  4. The fourth argument is a pointer to a string that contains the SSID of any hidden wireless access points to find.
  5. The fifth argument is the wireless channel to scan.
  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().