Question about the MDF light example
Posted: Wed Oct 20, 2021 9:47 am
I am studying the code of the light example for my project but I am quite not understand following.
1. how do the root node relay the required message to the node?
2. what is the purpose for the following code? I found those code in the node_handle_task
3. If I need to modify the control message of this example for project development. Which part I should change?
Thanks
Samuel
1. how do the root node relay the required message to the node?
2. what is the purpose for the following code? I found those code in the node_handle_task
Code: Select all
/**
* @brief Processing request commands, generating response data
*
* @note Handling only the body part of http, the header
* of http is handled by mlink_httpd
*/
mlink_handle_data_t handle_data = {
.req_data = (char *)data,
.req_size = size,
.req_fromat = MLINK_HTTPD_FORMAT_JSON,
.resp_data = NULL,
.resp_size = 0,
.resp_fromat = MLINK_HTTPD_FORMAT_JSON,
};
ret = mlink_handle_request(&handle_data);
MDF_ERROR_GOTO(ret != MDF_OK, FREE_MEM, "<%s> mlink_handle", mdf_err_to_name(ret));
if (handle_data.resp_fromat == MLINK_HTTPD_FORMAT_JSON) {
mlink_json_pack(&handle_data.resp_data, "status_msg", mdf_err_to_name(ret));
handle_data.resp_size = mlink_json_pack(&handle_data.resp_data, "status_code", -ret);
}
Thanks
Samuel