mco_iot_replicator_enum_agents
该函数枚举此复制器的活动连接。
对于每个活动连接,它都会调用枚举器,传递复制器 repl
、当前活动连接和上下文。如果枚举器回调返回 MCO_NO
,则此函数停止连接的枚举(并返回 MCO_S_OK
)。
MCO_RET mco_iot_replicator_enum_agents(
mco_iot_replicator_h repl,
iot_agent_enumerator_t enumerator,
void *context
);
有关概述,请参阅主动复制结构页面。
参数
repl
mco_iot_replicator_h
复制器对象。
enumerator
iot_agent_enumerator_t
具有以下结构的 iot_agent_enumerator_t
回调函数:
typedef mco_bool
(*iot_agent_enumerator_t)
(mco_iot_replicator_h repl, iot_connection_h iotc, void *context);
context
void
用户定义的上下文(指向包含应用程序特定数据的结构的指针)。
返回
MCO_S_OK
已成功枚举连接。
MCO_E_IOT_INVALID_HANDLE
无效的复制器句柄 repl
。
示例
mco_bool print_iot_agent(mco_iot_replicator_h repl, mco_iot_connection_h iotc, void *context)
{
printf("Agent %llu is active\n", mco_iot_conn_get_agent_id(iotc));
return MCO_YES;
}
mco_iot_replicator_enum_agents(repl, &print_iot_agent, 0);
文件
- 头文件:
mcoiot.h
- 源文件:
mcoiotrepl.c
- 库:
libmcoiotrepl.a