User Manual

Error Handling Functions
The following functions are defined to work with any SDEP errors generated by the system:
err_t errno (void)
If sdep or sdep_n returned false as a return value, if means the SDEP command failed. To determine the error
message, you can read the results from .errno() immediately after the .sdep or .sdep_n command, which will give you a
16-bit (uint16_t) error code.
char const* errstr(void)
To provide further details on the value returned in errno you can also call .errstr() which will return a char array
containing the internam enum name for the last error code.
Unfortunately, for copyright reasons we're not able to release the Broadcom WICED WiFi stack source, but seeing the
string associated with your errno provides an excellent indicator of what went wrong executing the SDEP command.
char const* cmdstr (uint16_t cmd_id)
Returns the name of the command associated with the specified SDEP command ID.
Parameters:
cmd_id: The 16-bit SDEP command ID to lookup (based on .errno, for example)
Returns: A string representing the name of the SDEP command associated with 'cmd_id'.
void err_actions (bool print, bool halt)
This function allows you to enable various optional 'actions' that should be automatically taken when an SDEP error
occurs. By default all actions are disabled.
Parameters:
print: If set to true, any SDEP error will be displayed in the Serial Monitor via Serial.print, including both the .errstr
and .errno values. This can help keep your code clean and make it easier to switch between debug and release
mode.
halt: If set to true, the code will stop executing and wait in a 'while(1)' loop as soon as an SDEP error is
encountered.
Returns: Nothing
Error Handling Example
The following example shows an example of how you can use the .errno and .errstr functions to handle the last SDEP
error generated by the system:
return '0' if an error was encountered.
© Adafruit Industries https://learn.adafruit.com/introducing-the-adafruit-wiced-feather-wifi Page 154 of 202