Name

cyg_ccb_check_response — Check response

Synopsis

#include <cyg/io/ccb.h>

cyg_bool cyg_ccb_check_response(const char *response, cyg_uint8 rlen, int *ecode);

Description

This helper function allows standard CCB client-application message responses to be parsed. The response is a pointer to the response data to be processed, with the rlen specifying the number of bytes (characters) of data valid in the supplied response buffer.

Responses are expected to be either the non-error “OK\r” or an error number indicated “ERR#\r” form (where # is either a positive or negative decimal number).

If non-NULL then the ecode parameter references the location updated with the “ERR” response error number, or the value 0 if an “OK”: response is given.

Return value

The boolean true result indicates that a valid response string was supplied. The return value of false indicates that the string was malformed (possibly a data reply and not a response string after all).