Versions Compared

Key

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

...

A call to NetIF_WiFi_CreateAdhoc() is shown below:

Code Block
languagecpp
titleListing - Listing - Call to NetIF_WiFi_CreateAdhoc()
linenumberstrue
NET_ERR         err;

ap_ctn = NetIF_WiFi_CreateAdhoc(if_nbr,                              (1)
                                NET_IF_WIFI_DATA_RATE_AUTO,          (2)
                                NET_IF_WIFI_SECURITY_WEP,            (3)
                                NET_IF_WIFI_PWR_LEVEL_HI,            (4)
                                NET_IF_WIFI_CH_1                     (5)
                               "adhoc_ssid",                         (6)
                               "adhoc_password",                     (7)
                               &err);                                (8)


Panel
bgColor#f0f0f0
  1. NetIF_WiFi_CreateAdhoc() requires height arguments. The first argument is the interface number, which is acquired upon successfully adding and starting the interface.
  2. The second argument is the data rate used on the wireless network.
  3. The third argument is the wireless security type of the wireless network.
  4. The fourth argument is the radio power level used to communicate on the wireless network.
  5. The fifth argument is the wireless channel for the ad hoc network.
  6. The sixth argument is a pointer to a string that contains the SSID of the wireless access point.
  7. The seventh argument is a pointer to a string that contains the pre-shared key of the wireless access point.
  8. The last argument is a pointer to a NET_ERR that contains 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().