# mco_iot_replicator_get_level

Return the level of the specified node.

### For an overview see page ARF Applications in C

### Prototype

        MCO_RET mco_iot_replicator_get_level(mco_iot_replicator_h repl,
                                uint2 *level);

### Arguments

repl | The replicator object
level | The address of the `level` to be returned

### Description

This function returns the level of the specified replicator: 1 for server, 65535 for a device

### 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 `level` 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;
            uint2 level;
            ...

            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));
            CHECK(mco_iot_replicator_get_level(repl, &level));
            ...
        }

### Files

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