Return the connection found by agentId.
iot_connection_h mco_iot_comm_find_conn(mco_iot_comm_h comm,
mco_iot_agent_id_t agent_id);
| comm | The communicator object |
| agent_id | The device_id to find |
This function returns the connection found by agentId. Note that the mco_iot_comm_find_conn() and mco_iot_comm_next_conn() APIs “lock/pin” the connection handle to protect the handle from being destroyed. When the handle is no longer needed, the “pin” should be removed by calling mco_iot_conn_release(). The safer way to enumeration active connections (from the "pin/unpin" standpoint) is to use the mco_iot_replicator_enum_agents() API.
| mco_iot_connection_h | The connection for this agent_id or NULL if none found |
{
...
mco_iot_connection_h conn = mco_iot_comm_find_conn(comm, agent_id);
if (conn)
{
// Do something with connection conn
mco_iot_conn_release(conn);
}
}