mco_iot_replicator_get_agent_id

Return the agent_id of the specified node.

For an overview see page ARF Applications in C

Prototype

 
    MCO_RET mco_iot_replicator_get_agent_id(mco_iot_replicator_h repl, 
                            mco_iot_agent_id_t *agent_id);
 

Arguments

repl The replicator object
agent_id The address of the agent_id to be returned

Description

This function returns the agent_id of the specified replicator.

Return Codes

MCO_S_OK The agent_id was successfully returned
MCO_E_IOT_INVALID_HANDLE Invalid replicator handle repl
MCO_E_IOT_NOT_INITIALIZED The IoT runtime was not initialized or the database does not declare IoT in the schema
MCO_E_ILLEGAL_PARAM The agent_id is NULL

Example

     
    {
        mco_iot_comm_h comm;
        mco_iot_replicator_h repl;
        mco_iot_comm_params_t comm_params;
        mco_iot_replicator_params_t repl_params;
        iot_comm_callback_t device_cbs = {&on_connect, 0, 0, &on_disconnect, &on_destroy};
        mco_iot_agent_id_t agent_id;
        ...
         
        mco_iot_comm_params_init(&comm_params);
        CHECK(mco_iot_comm_create(&comm_params, &comm));
        CHECK(mco_iot_comm_register_callback(comm, &device_cbs, 0));
        mco_iot_replicator_params_init(&repl_params);
        CHECK(mco_iot_replicator_create(db, comm, &repl_params, &repl));
        CHECK(mco_iot_replicator_get_agent_id(repl, &agent_id));
        ...
    }
     

Files

Header file:
mcoiot.h
Source file:
mcoiotrepl.c
Library:
libmcoiotrepl.a