mco_iot_comm_find_conn

Return the connection found by agentId.

For an overview see page ARF Applications in C

Prototype

    iot_connection_h mco_iot_comm_find_conn(mco_iot_comm_h comm,
                            mco_iot_agent_id_t agent_id);

Arguments

comm
The communicator object.
agent_id
The device_id to find.

Description

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 enumerate active connections (from the "pin/unpin" standpoint) is to use the mco_iot_replicator_enum_agents() API.

Return Codes

mco_iot_connection_h
The connection for this agent_id or NULL if none found.

Example

    {
        ...
        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);
        }
    }

Files

Header file:
mcoiot.h
Source file:
mcoiotcomm.c
Library:
libmcoiotcomm.a