Host library for controlling a WiConnect enabled Wi-Fi module.
Dependents: wiconnect-ota_example wiconnect-web_setup_example wiconnect-test-console wiconnect-tcp_server_example ... more
Revision 5:8d91a87ebba2, committed 2014-08-11
- Comitter:
- dan_ackme
- Date:
- Mon Aug 11 04:00:39 2014 -0700
- Parent:
- 4:c0966143aa22
- Child:
- 6:8a87a59d0d21
- Commit message:
- more warning fixes
Changed in this revision
--- a/internal/network/NetworkWebSetup.cpp Mon Aug 11 03:49:05 2014 -0700 +++ b/internal/network/NetworkWebSetup.cpp Mon Aug 11 04:00:39 2014 -0700 @@ -16,7 +16,7 @@ /*************************************************************************************************/ WiconnectResult NetworkInterface::startWebSetup(const char *ssid, const char *password, const Callback &completeHandler_) { - WiconnectResult result; + WiconnectResult result = WICONNECT_ERROR;; enum {
--- a/internal/wiconnect/AsyncCommand.cpp Mon Aug 11 03:49:05 2014 -0700 +++ b/internal/wiconnect/AsyncCommand.cpp Mon Aug 11 04:00:39 2014 -0700 @@ -41,7 +41,6 @@ return; } - WiconnectResult result = WICONNECT_SUCCESS; CommandContext *context = (CommandContext*)commandContext; CommandHeader *header = (CommandHeader*)commandHeaderBuffer;
--- a/internal/wiconnect/ProcessCommand.cpp Mon Aug 11 03:49:05 2014 -0700 +++ b/internal/wiconnect/ProcessCommand.cpp Mon Aug 11 04:00:39 2014 -0700 @@ -103,61 +103,57 @@ /*************************************************************************************************/ WiconnectResult Wiconnect::receiveResponse() { - for(;;) +loop: + WiconnectResult result = receivePacket(); + + if(result == WICONNECT_PROCESSING) { - WiconnectResult result = receivePacket(); + } + else if(result == WICONNECT_SUCCESS) + { + CommandHeader *header = (CommandHeader*)commandHeaderBuffer; + CommandContext *context = (CommandContext*)commandContext; - if(result == WICONNECT_PROCESSING) + // TODO: need to notify safemode + + if(header->response_type == WICONNECT_CMD_TYPE_REPLY || header->response_type == WICONNECT_CMD_TYPE_SAFEMODE) { - return WICONNECT_PROCESSING; - } - else if(result == WICONNECT_SUCCESS) - { - CommandHeader *header = (CommandHeader*)commandHeaderBuffer; - CommandContext *context = (CommandContext*)commandContext; - - // TODO: need to notify safemode - - if(header->response_type == WICONNECT_CMD_TYPE_REPLY || header->response_type == WICONNECT_CMD_TYPE_SAFEMODE) + if(header->response_code != WICONNECT_CMD_SUCCESS) { - if(header->response_code != WICONNECT_CMD_SUCCESS) - { - DEBUG_CMD_ERROR(header->response_code); - flush(); - issueCommandCallback(WICONNECT_CMD_RESPONSE_ERROR); - return WICONNECT_CMD_RESPONSE_ERROR; - } - else if(header->response_len > 0) - { - DEBUG_CMD_RESPONSE(context->responseBuffer); - header->response_len -= 2; - context->responseBuffer[header->response_len] = 0; - } - else - { - *context->responseBuffer = 0; - } - - issueCommandCallback(WICONNECT_SUCCESS); - - return WICONNECT_SUCCESS; + DEBUG_CMD_ERROR(header->response_code); + flush(); + issueCommandCallback(WICONNECT_CMD_RESPONSE_ERROR); + return WICONNECT_CMD_RESPONSE_ERROR; + } + else if(header->response_len > 0) + { + DEBUG_CMD_RESPONSE(context->responseBuffer); + header->response_len -= 2; + context->responseBuffer[header->response_len] = 0; } else { - DEBUG_CMD_LOG(context->responseBuffer); - RESET_CMD_HEADER(header); - context->responseBufferPtr = context->responseBuffer; + *context->responseBuffer = 0; } + + issueCommandCallback(WICONNECT_SUCCESS); + + return WICONNECT_SUCCESS; } else { - issueCommandCallback(result); - return result; + DEBUG_CMD_LOG(context->responseBuffer); + RESET_CMD_HEADER(header); + context->responseBufferPtr = context->responseBuffer; + goto loop; } } + else + { + issueCommandCallback(result); + } - // shouldn't get here... - return WICONNECT_ERROR; + return result; } /*************************************************************************************************/
--- a/internal/wiconnect/Wiconnect.cpp Mon Aug 11 03:49:05 2014 -0700 +++ b/internal/wiconnect/Wiconnect.cpp Mon Aug 11 04:00:39 2014 -0700 @@ -28,7 +28,7 @@ #ifdef WICONNECT_ENABLE_MALLOC #define MALLOC_ARGS , void* (*mallocPtr)(size_t), void (*freePtr)(void*) -#define MALLOC_CONSTRUCTORS , _malloc(mallocPtr), _free(freePtr) +#define MALLOC_CONSTRUCTORS _malloc(mallocPtr), _free(freePtr), #else #define MALLOC_ARGS #define MALLOC_CONSTRUCTORS @@ -78,14 +78,14 @@ /*************************************************************************************************/ Wiconnect::Wiconnect(const SerialConfig &serialConfig, void *internalBuffer, int internalBufferSize, Pin reset, Pin wake, bool nonBlocking MALLOC_ARGS) : - NetworkInterface(this), SocketInterface(this), FileInterface(this), serial(serialConfig, this), resetGpio(reset), wakeGpio(wake) MALLOC_CONSTRUCTORS + NetworkInterface(this), SocketInterface(this), FileInterface(this), MALLOC_CONSTRUCTORS serial(serialConfig, this), resetGpio(reset), wakeGpio(wake) { prepare(internalBuffer, internalBufferSize, nonBlocking); } /*************************************************************************************************/ Wiconnect::Wiconnect(const SerialConfig &serialConfig, Pin reset, Pin wake, bool nonBlocking MALLOC_ARGS) : - NetworkInterface(this), SocketInterface(this), FileInterface(this), serial(serialConfig, this), resetGpio(reset), wakeGpio(wake) MALLOC_CONSTRUCTORS + NetworkInterface(this), SocketInterface(this), FileInterface(this), MALLOC_CONSTRUCTORS serial(serialConfig, this), resetGpio(reset), wakeGpio(wake) { prepare(NULL, 0, nonBlocking); }
--- a/sdk/mbed/Gpio.cpp Mon Aug 11 03:49:05 2014 -0700 +++ b/sdk/mbed/Gpio.cpp Mon Aug 11 04:00:39 2014 -0700 @@ -46,4 +46,5 @@ Gpio& Gpio::operator= (const Gpio& other) { memcpy((void*)&gpio, (void*)&other.gpio, sizeof(gpio)); + return *this; }