mco_iot_replicator_get_level
此函数返回指定复制器的级别:服务器为 1,设备为 65535。
MCO_RET mco_iot_replicator_get_level(
mco_iot_replicator_h repl,
uint2 *level
);
有关概述,请参阅主动复制结构页面。
参数
repl
mco_iot_replicator_h
复制器对象。
level
uint2
要返回的层级地址。
返回
MCO_S_OK
已成功返回agent_id
。
MCO_E_IOT_INVALID_HANDLE
无效的复制器句柄 repl
。
MCO_E_IOT_NOT_INITIALIZED
物联网运行时未初始化,或者数据库模式中未声明物联网。
MCO_E_ILLEGAL_PARAM
level
为NULL
。
示例
{
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));
...
}
文件
- 头文件:
mcoiot.h
- 源文件:
mcoiotrepl.c
- 库:
libmcoiotrepl.a