Question about the MDF light example

XiotSamuel
Posts: 52
Joined: Sun Aug 29, 2021 1:50 pm

Question about the MDF light example

Postby XiotSamuel » 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

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);
        }
3. If I need to modify the control message of this example for project development. Which part I should change?

Thanks
Samuel

XiotSamuel
Posts: 52
Joined: Sun Aug 29, 2021 1:50 pm

Re: Question about the MDF light example

Postby XiotSamuel » Thu Oct 21, 2021 6:22 am

Hi. I found the node handle task use the uint8_t as data type. Any reason for that?

Code: Select all

    uint8_t *data = NULL;

XiotSamuel
Posts: 52
Joined: Sun Aug 29, 2021 1:50 pm

Re: Question about the MDF light example

Postby XiotSamuel » Thu Oct 21, 2021 10:57 am

Is there have any way to make it into string and compare it? I found that the compare string cannot work with the uint8.

Who is online

Users browsing this forum: No registered users and 8 guests