ACKme
/
wiconnect-test-console
Test serial console demonstrating various API functions of WiConnect library.
tests/blocking/network/JoinNetworkTest.cpp
- Committer:
- dan_ackme
- Date:
- 2014-08-11
- Revision:
- 0:836c9a6383e0
- Child:
- 1:5137ec8f4c45
File content as of revision 0:836c9a6383e0:
/* * Copyright 2014, ACKme Networks * All Rights Reserved. * * This is UNPUBLISHED PROPRIETARY SOURCE CODE of ACKme Networks; * the contents of this file may not be disclosed to third parties, copied * or duplicated in any form, in whole or in part, without the prior * written permission of ACKme Networks. */ #include "tests/Tests.h" #include "Wiconnect.h" static void joinCompleteCallback(WiconnectResult result, void *arg1, void *arg2); /*************************************************************************************************/ WiconnectResult networkJoinCommand(int argc, char **argv) { WiconnectResult result; Wiconnect *wiconnect = Wiconnect::getInstance(); 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)))) { LOG_INFO("Joining network"); } return result; } /*************************************************************************************************/ WiconnectResult networkLeaveCommand(int argc, char **argv) { WiconnectResult result; Wiconnect *wiconnect = Wiconnect::getInstance(); if(!WICONNECT_FAILED(result, wiconnect->leave())) { LOG_INFO("Successfully disconnected from network"); } return result; } /*************************************************************************************************/ static void joinCompleteCallback(WiconnectResult result, void *arg1, void *arg2) { if(result == WICONNECT_SUCCESS) { LOG_INFO("Successfully joined network"); } else { LOG_WICONNECT_ERROR(result, "Errors occurred while joining network"); } }