EtherNet/IP™ Adapter  1.04.06
User Reference Manual

◆ EI_API_ADP_setModuleNetworkStatusFunc()

uint32_t EI_API_ADP_setModuleNetworkStatusFunc ( T pAdp_p,
EI_API_ADP_CBStatus  callback_p 
)

Handle module and network status changes.

This function is used to register a callback function which will be triggered if the adapter status (network or module) changes. The knowledge of the adapter status enables the user to set Network Status and Module Status indicators.

Parameters
[in]pAdp_pPointer to the adapter.
[in]callback_pCallback function of EI_API_ADP_CBStatus type.
Returns
EI_API_ADP_EError_t as uint32_t value.
Return values
EI_API_ADP_eERR_OKSuccess.
EI_API_ADP_eERR_GENERALGeneral error.
Example
#include <api/EI_API.h>
void cbStatus(EI_API_ADP_T* pAdp_p, EI_API_ADP_SModNetStatus_t status_p)
{
printf("Module status: %d\n", status_p.mod);
printf("Network status: %d\n", status_p.net);
}
void registerStatusCallback()
{
uint32_t errCode;
// Set callback for status replies
EI_API_ADP_CBStatus ptr_cb = cbStatus;
errCode = EI_API_ADP_setModuleNetworkStatusFunc(pEI_API_ADP, ptr_cb);
}
See also
EI_API_ADP_CBStatus EI_API_ADP_getModuleNetworkStatus EI_API_ADP_SModNetStatus_t EI_API_ADP_EError_t
EI_API_ADP_SModNetStatus::mod
EI_API_ADP_EStatus_t mod
Definition: EI_API_def.h:192
EI_API_ADP_CBStatus
void(* EI_API_ADP_CBStatus)(EI_API_ADP_T *pAdp_p, EI_API_ADP_SModNetStatus_t status_p)
Function prototype for adapter status (MS, NS) callback function.
Definition: EI_API_def.h:316
EI_API_ADP_SModNetStatus::net
EI_API_ADP_EStatus_t net
Definition: EI_API_def.h:193
EI_API_ADP_setModuleNetworkStatusFunc
ETHIP_API uint32_t EI_API_ADP_setModuleNetworkStatusFunc(T *pAdp_p, EI_API_ADP_CBStatus callback_p)
Handle module and network status changes.
Definition: EI_API_ADP_main.c:667
EI_API_ADP_SModNetStatus
General adapter status collection.
Definition: EI_API_def.h:191