![](/media/cache/group/ackmelogo_1.png.50x50_q85.png)
Test serial console demonstrating various API functions of WiConnect library.
Diff: tests/blocking/network/JoinNetworkTest.cpp
- Revision:
- 22:26420b641605
- Parent:
- 12:3dd3a1be40c1
--- a/tests/blocking/network/JoinNetworkTest.cpp Tue Aug 26 23:57:16 2014 +0000 +++ b/tests/blocking/network/JoinNetworkTest.cpp Thu Oct 23 15:17:15 2014 -0700 @@ -43,8 +43,13 @@ const char *ssid = (argc > 0) ? argv[0] : NULL; const char *password = (argc > 1) ? argv[1] : NULL; - - if(!WICONNECT_FAILED(result, wiconnect->join(ssid, password, Callback(joinCompleteCallback)))) + + // if we're changing the ssid, then we need to leave the current network we're connected to first + if(ssid != NULL && WICONNECT_FAILED(result, wiconnect->leave())) + { + LOG_WICONNECT_ERROR(result, "Failed to disconnect from the network first"); + } + else if(!WICONNECT_FAILED(result, wiconnect->join(ssid, password, Callback(joinCompleteCallback)))) { LOG_INFO("Joining network"); } @@ -73,7 +78,8 @@ LOG_INFO("Successfully joined network"); } else - { - LOG_WICONNECT_ERROR(result, "Errors occurred while joining network"); + { + NetworkJoinResult joinResult = (NetworkJoinResult)(uint32_t)arg1; + LOG_WICONNECT_ERROR(result, "Errors occurred while joining network. Join result: %s", Wiconnect::networkJoinResultToStr(joinResult)); } }