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

Embed: (wiki syntax)

« Back to documentation index

Miscellaneous Methods

Miscellaneous Methods
[Core]

Other core methods. More...

Functions

static WiconnectgetInstance ()
 Get instance of previously instantiated Wiconnect Library.
WiconnectResult init (bool bringNetworkUp=false)
 Initialize library and communication link with WiConnect WiFi module.
void deinit ()
 De-initialize library.
bool isInitialized ()
 Return TRUE if library is able to communicated with WiConnect WiFi module.
bool updateRequired ()
 Return TRUE if the WiFi module's firmware supports the SDK version, FALSE if the WiFi module's firmware needs to be updated.
WiconnectResult reset ()
 Toggle the WiConnect WiFi module reset signal.
WiconnectResult wakeup ()
 Toggle the WiConnect WiFi moduel wakeup signal.
void flush (int delayMs=500)
 Flush any received data in serial RX buffer and terminate any commands on WiConnect WiFi module.
WiconnectResult getVersion (char *versionBuffer=NULL, int versionBufferSize=0, const Callback &completeCallback=Callback())
 Return current version of WiConnect WiFi module.
WiconnectResult updateFirmware (bool forced=false, const char *versionStr=NULL, const Callback &completeCallback=Callback())
 Update the wifi module's internal firmware.
const char * getLastCommandResponseCodeStr ()
 When the WiConnect WiFi module returns a response, it contains a response code in the header.
uint16_t getLastCommandResponseLength ()
 Return the length in bytes of the previous response.
char * getResponseBuffer ()
 Return pointer to internal response buffer.
WiconnectResult responseToUint32 (uint32_t *uint32Ptr)
 Helper method to convert previous response to uint32.
WiconnectResult responseToInt32 (int32_t *int32Ptr)
 Helper method to convert previous response to int32.

Detailed Description

Other core methods.


Function Documentation

void deinit ( void   ) [inherited]

De-initialize library.

Definition at line 208 of file Wiconnect.cpp.

void flush ( int  delayMs = 500 ) [inherited]

Flush any received data in serial RX buffer and terminate any commands on WiConnect WiFi module.

The delayMs parameter is used as the delay between terminating commands on the module and flushing the serial RX buffer. This is needed because after terminating commands on the module, the module will returns a response. These responses are invalid at this point and should be flushed from the serial RX buffer.

Parameters:
[in]delayMsOptional, if not specificed this only flushes the serial RX buffer.

Definition at line 251 of file Wiconnect.cpp.

Wiconnect * getInstance (  ) [static, inherited]

Get instance of previously instantiated Wiconnect Library.

Returns:
Pointer to instance of Wiconnect Library.

Definition at line 214 of file Wiconnect.cpp.

const char* getLastCommandResponseCodeStr (  ) [inherited]

When the WiConnect WiFi module returns a response, it contains a response code in the header.

This function converts the previous response code to a readable string.

Returns:
string representation of module response code
uint16_t getLastCommandResponseLength (  ) [inherited]

Return the length in bytes of the previous response.

Returns:
length of previous response
char* getResponseBuffer (  ) [inherited]

Return pointer to internal response buffer.

Returns:
pointer to internal response buffer
WiconnectResult getVersion ( char *  versionBuffer = NULL,
int  versionBufferSize = 0,
const Callback completeCallback = Callback() 
) [inherited]

Return current version of WiConnect WiFi module.

Parameters:
[in]versionBufferOptional, Buffer to hold received version string
[in]versionBufferSizeOptional, required if versionBuffer specified.
[in]completeCallbackOptional, callback when version is received. arg1 of callback contains version buffer pointer.
Returns:
Result of method. See WiconnectResult

Definition at line 268 of file Wiconnect.cpp.

WiconnectResult init ( bool  bringNetworkUp = false ) [inherited]

Initialize library and communication link with WiConnect WiFi module.

Note:
This function is always blocking regardless of configured mode.
Parameters:
[in]bringNetworkUpFlag indicating if the module should try to bring the network up upon initialization.
Returns:
Result of initialization. See WiconnectResult

Definition at line 131 of file Wiconnect.cpp.

bool isInitialized (  ) [inherited]

Return TRUE if library is able to communicated with WiConnect WiFi module.

FALSE else.

Returns:
TRUE if library can communicate with WiFi module, FALSE else.

Definition at line 220 of file Wiconnect.cpp.

WiconnectResult reset ( void   ) [inherited]

Toggle the WiConnect WiFi module reset signal.

Note:
This only resets the module if the library was instantiated with the 'reset' pin parameter in the Wiconnect::Wiconnect constructor.
This method is always blocking. A small (1s) delay is added to ensure the module has returned from reset and ready.
Returns:
Result of method. See WiconnectResult

Definition at line 232 of file Wiconnect.cpp.

WiconnectResult responseToInt32 ( int32_t *  int32Ptr ) [inherited]

Helper method to convert previous response to int32.

Note:
This uses the internal response buffer.
Parameters:
[out]int32PtrPointer to hold result of conversion.
Returns:
Result of conversion. See WiconnectResult
WiconnectResult responseToUint32 ( uint32_t *  uint32Ptr ) [inherited]

Helper method to convert previous response to uint32.

Note:
This uses the internal response buffer.
Parameters:
[out]uint32PtrPointer to hold result of conversion.
Returns:
Result of conversion. See WiconnectResult
WiconnectResult updateFirmware ( bool  forced = false,
const char *  versionStr = NULL,
const Callback completeCallback = Callback() 
) [inherited]

Update the wifi module's internal firmware.

Parameters:
[in]forcedOptional, If true, force update of all firmware files to latest version, else only update out-dated files.
[in]versionStrOptional, If specified, update to specific firmware version, else update to latest version.
[in]completeCallbackOptional, callback when update is complete. 'result' callback argument contains result of update.
Returns:
Result of method. See WiconnectResult

Definition at line 294 of file Wiconnect.cpp.

bool updateRequired (  ) [inherited]

Return TRUE if the WiFi module's firmware supports the SDK version, FALSE if the WiFi module's firmware needs to be updated.

See updateFirmware() to update the module's firmware.

Returns:
TRUE WiFi firmware version is supported, FALSE else

Definition at line 226 of file Wiconnect.cpp.

WiconnectResult wakeup (  ) [inherited]

Toggle the WiConnect WiFi moduel wakeup signal.

Note:
This only wakes the module if the library was instantiated with the 'wake' pin parameter in the Wiconnect::Wiconnect constructor.
This method is always blocking.
Returns:
Result of method. See WiconnectResult

Definition at line 242 of file Wiconnect.cpp.