vlvassilev / yuma123

The yuma123 repository
Other
24 stars 28 forks source link

How to customize the content of rpc-reply by yuma123 #138

Open 15234849189 opened 1 year ago

15234849189 commented 1 year ago

How to customize the content of rpc-reply by yuma123

yang module:

rpc start {
        input {
            leaf name {
                type string{
                  length "1..64";
                }
            }
        }
        output {
            leaf result {
            type action-result;
            description 
                "Result of the start operation success or fail";
            }  

            leaf index {         
            type uint32;
            description
                "result index";
            }   

            leaf msg{
            type string;
            description
                "when start fail, report error information";
            }
        }
    }

C code

static status_t y_test_start_invoke(
    ses_cb_t *scb,
    rpc_msg_t *msg,
    xml_node_t *methnode)
{
    status_t res = NO_ERR;
    val_value_t *name_val = NULL;
    const xmlChar *name;

    name_val = val_find_child(
        msg->rpc_input,
        y_test_M_test,
        y_test_N_name);
    if (name_val != NULL && name_val->res == NO_ERR)
    {
        name = VAL_STRING(name_val);
    }
    /* remove the next line if scb is used */
    (void)scb;

    /* remove the next line if methnode is used */
    (void)methnode;

    /* invoke your device instrumentation code here */
//How to customize the content of rpc-reply
    return res;
} 

I am a beginner and I can't find useful information for this question.