dey-examples: cloudconnector:return status code in device request data callbacks
This commit syncs the device request code to match with the latest 'cc_api' layer implementation. See commit 99a2ff39b771f0e36af8d15d40f970462352e0b6 in 'cc_api' repository and commit d8c848fc2f516a6c2197181f7540c9c23feaf44f in 'cc_dey' repository. Signed-off-by: Tatiana Leon <Tatiana.Leon@digi.com>
This commit is contained in:
parent
bd684cec15
commit
c533e12a4d
|
|
@ -39,10 +39,10 @@
|
|||
* Logs information about the received request and executes the corresponding
|
||||
* command.
|
||||
*/
|
||||
void get_time_cb(char const *const target,
|
||||
ccapi_transport_t const transport,
|
||||
ccapi_buffer_info_t const *const req_buf_info,
|
||||
ccapi_buffer_info_t *const resp_buf_info)
|
||||
ccapi_receive_error_t get_time_cb(char const *const target,
|
||||
ccapi_transport_t const transport,
|
||||
ccapi_buffer_info_t const *const req_buf_info,
|
||||
ccapi_buffer_info_t *const resp_buf_info)
|
||||
{
|
||||
time_t t = time(NULL);
|
||||
char *time_str = ctime(&t);
|
||||
|
|
@ -54,12 +54,12 @@ void get_time_cb(char const *const target,
|
|||
resp_buf_info->buffer = calloc(resp_buf_info->length + 1, sizeof(char));
|
||||
if (resp_buf_info->buffer == NULL) {
|
||||
log_error("%s: resp_buf_info calloc error", __func__);
|
||||
return;
|
||||
return CCAPI_RECEIVE_ERROR_INSUFFICIENT_MEMORY;
|
||||
}
|
||||
|
||||
resp_buf_info->length = sprintf(resp_buf_info->buffer, "Time: %s", time_str);
|
||||
|
||||
return;
|
||||
return CCAPI_RECEIVE_ERROR_NONE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -24,9 +24,10 @@
|
|||
|
||||
#define TARGET_GET_TIME "get_time"
|
||||
|
||||
void get_time_cb(char const *const target, ccapi_transport_t const transport,
|
||||
ccapi_buffer_info_t const *const req_buf_info,
|
||||
ccapi_buffer_info_t *const resp_buf_info);
|
||||
ccapi_receive_error_t get_time_cb(char const *const target,
|
||||
ccapi_transport_t const transport,
|
||||
ccapi_buffer_info_t const *const req_buf_info,
|
||||
ccapi_buffer_info_t *const resp_buf_info);
|
||||
void get_time_status_cb(char const *const target,
|
||||
ccapi_transport_t const transport,
|
||||
ccapi_buffer_info_t *const resp_buf_info,
|
||||
|
|
|
|||
Loading…
Reference in New Issue