EtherNet/IP™ Adapter  1.04.06
User Reference Manual

◆ EI_API_CIP_addClassService()

uint32_t EI_API_CIP_addClassService ( T pCipNode_p,
uint16_t  classId_p,
EI_API_CIP_SService_t pService_p 
)

Add service/s to the class.

This Function that adds one or more service/s to the class specified by class identifier classId.

Parameters
[in]pCipNode_pPointer to the CIP node.
[in]classId_pClass identifier.
[in]pService_pService or services the class will support.
Returns
EI_API_CIP_EError_t as uint32_t value.
Return values
EI_API_CIP_eERR_OKSuccess.
EI_API_CIP_eERR_NODE_INVALIDCIP node is invalid, possibly EI_API_CIP_NODE_new() was not called.
EI_API_CIP_eERR_CLASS_BLACKLISTOperation on the CIP object with specified identifier (class ID) is not allowed.
EI_API_CIP_eERR_CLASS_DOES_NOT_EXISTClass does not exists in CIP node dictionary.
EI_API_CIP_eERR_SERVICE_ALREADY_EXISTService already exists.
EI_API_CIP_eERR_SERVICE_PARAMETERWrong or invalid service parameters.
EI_API_CIP_eERR_SERVICE_INVALIDService is invalid, possibly NULL pointer.
EI_API_CIP_eERR_MEMALLOCMemory allocation error.
EI_API_CIP_eERR_NOT_IMPLEMENTEDFunction not implemented.
EI_API_CIP_eERR_CLASS_UNKNOWN_STATEUnknown state during class operation reached.
Example
#include <api/EI_API.h>
EI_API_ADP_T* pEI_API_ADP = NULL;
EI_API_CIP_NODE_T* pEI_API_CIP_NODE = NULL;
uint32_t errCode;
uint8_t numInterfaces = 1;
// Create a new adapter first
pEI_API_ADP = EI_API_ADP_new(numInterfaces);
// Create a CIP node next
pEI_API_CIP_NODE = EI_API_CIP_NODE_new();
// Create a class, here with class ID in vendor specific range
errCode = EI_API_CIP_createClass(pEI_API_CIP_NODE, 0x0064);
// Finally add a service to the class with ID 0x64
// Example for Get_Attribute_Single
errCode = EI_API_CIP_addClassService(pEI_API_CIP_NODE, 0x0064, &srvc);
See also
EI_API_CIP_NODE_new EI_API_CIP_createClass EI_API_CIP_SService_t EI_API_CIP_EError_t
EI_API_CIP_SService::code
EI_API_CIP_ESc_t code
Definition: EI_API_CIP.h:181
EI_API_CIP_createClass
ETHIP_API uint32_t EI_API_CIP_createClass(T *pCipNode_p, uint16_t classId_p)
Create a CIP class.
Definition: EI_API_CIP_main.c:361
EI_API_CIP_addClassService
ETHIP_API uint32_t EI_API_CIP_addClassService(T *pCipNode_p, uint16_t classId_p, EI_API_CIP_SService_t *pService_p)
Add service/s to the class.
Definition: EI_API_CIP_main.c:435
EI_API_CIP_SService
General service parameter collection.
Definition: EI_API_CIP.h:180
EI_API_CIP_NODE_new
ETHIP_API T * EI_API_CIP_NODE_new(void)
Create a new CIP node.
Definition: EI_API_CIP_main.c:69
EI_API_CIP_eSC_GETATTRSINGLE
@ EI_API_CIP_eSC_GETATTRSINGLE
Definition: EI_API_def.h:116
EI_API_ADP_new
ETHIP_API T * EI_API_ADP_new(uint8_t numInterfaces_p)
Create a new EtherNet/IP adapter.
Definition: EI_API_ADP_main.c:235