User Manual

Function Prototype:
Parameters:
cmd_id: The 16-bit SDEP command ID
param_len: The length of the p_param field containing the parameter data. Set this to '0' if no parameter is
provided.
p_param: A pointer to the parameter value to pass into the SDEP command handler. Set this to NULL if no
parameter is provided.
p_result_len: A pointer to the 16-bit value where the response length will be written by the SDEP command
handler
p_result: A pointer to where the response data should be written by the SDEP command handler
Return Value:
'true' if the function executed properly, otherwise 'false' if an error occured (check .errno or .errstr for details).
Examples
The simplest possible example of using this function can be seen below.
No parameter data is sent to the SDEP command, we don't check any response data (there is none from
SDEP_CMD_FACTORYRESET anyway), and we don't even check if 'sdep' returned false to indicate that there was an
error executing the command:
A more complex example of sending a simple SDEP command with this function can be seen below, where we flush
the contents of the TCP buffer.
'_tcp_handle' is an internal 32-bit value (so 4 bytes), and we pass a pointer to the value to the SDEP command handler
(notice the '&' symbol before the name saying that we should pass the address in memory for '_tcp_handle').
No response data is read back, so the last two parameters are set to NULL.
This last example checks if any TCP data is available in the buffer, and the command will set the 'result' variable to a
bool sdep(uint16_t cmd_id ,
uint16_t param_len , void const* p_param,
uint16_t* p_result_len , void* p_result)
void AdafruitFeather::factoryReset(void)
{
sdep(SDEP_CMD_FACTORYRESET, 0, NULL, NULL, NULL);
}
void AdafruitTCP::flush()
{
if ( _tcp_handle == 0 ) return;
// flush write
sdep(SDEP_CMD_TCP_FLUSH, 4, &_tcp_handle, NULL, NULL);
}
© Adafruit Industries https://learn.adafruit.com/introducing-the-adafruit-wiced-feather-wifi Page 151 of 202