EtherNet/IP™ Adapter3.07.03

◆ EI_API_CIP_createAssembly()

uint32_t EI_API_CIP_createAssembly ( T *  pCipNode_p,
uint16_t  assemblyInstanceId_p,
EI_API_CIP_EAr_t  accessRule_p 
)

Create a new assembly instance.

This function creates a new assembly instance with the given ID. Each instance has the default application type 'Exclusive Owner'. Except the instances 0xfe and 0xff have the default application type 'Input Only' and 'Listen Only'. The application type can be changed later (see EI_API_CIP_setAssemblyAppType()).

Parameters
[in]pCipNode_pPointer to the CIP node.
[in]assemblyInstanceId_pInstance identifier.
[in]accessRule_pParameter to define assembly access rule.
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_ASSEMBLY_ALREADY_EXISTSThe assembly with the given ID already exists.
EI_API_CIP_eERR_MEMALLOCMemory allocation error.
EI_API_CIP_eERR_GENERALGeneral CIP error.
Example
#include "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;
uint16_t assemblyInstanceId;
// Create a new adapter first
pEI_API_ADP = EI_API_ADP_new(numInterfaces);
// Create a CIP node next
initParams.maxInstanceNum = 256;
pEI_API_CIP_NODE = EI_API_CIP_NODE_new(&initParams);
...
// Under pEI_API_CIP_NODE, create assembly instance with ID = 193, with read-write access and application
// type 'Input Only'
assemblyInstanceId = 0xc1;
errCode = EI_API_CIP_createAssembly(pEI_API_CIP_NODE, assemblyInstanceId, EI_API_CIP_eAR_GET_AND_SET);
See also
EI_API_CIP_addAssemblyMember EI_API_CIP_setAssemblyAppType EI_API_CIP_getAssemblySize EI_API_CIP_getAssemblyData EI_API_CIP_setAssemblyData EI_API_CIP_EAr_t EI_API_CIP_EError_t
EI_API_CIP_NODE_new
ETHIP_API T * EI_API_CIP_NODE_new(EI_API_CIP_NODE_InitParams_t *pInitParams)
Create a new CIP node.
Definition: EI_API_CIP_stub.c:85
EI_API_CIP_NODE_InitParams
Initialization parameters to create new CIP Node.
Definition: EI_API_CIP_define.h:152
EI_API_CIP_createAssembly
ETHIP_API uint32_t EI_API_CIP_createAssembly(T *pCipNode_p, uint16_t assemblyInstanceId_p, EI_API_CIP_EAr_t accessRule_p)
Create a new assembly instance.
Definition: EI_API_CIP_stub.c:4171
EI_API_CIP_NODE_InitParams::maxInstanceNum
uint16_t maxInstanceNum
Definition: EI_API_CIP_define.h:154
EI_API_CIP_setAssemblyAppType
ETHIP_API uint32_t EI_API_CIP_setAssemblyAppType(T *pCipNode_p, uint16_t assemblyInstanceId_p, EI_API_CIP_EAPP_TYPE_t appType_p)
Apply an application type to an existing assembly instance.
Definition: EI_API_CIP_stub.c:4706
EI_API_CIP_eAR_GET_AND_SET
@ EI_API_CIP_eAR_GET_AND_SET
Definition: EI_API_def.h:120
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_stub.c:235
EI_API_CIP_eAPP_TYPE_IO
@ EI_API_CIP_eAPP_TYPE_IO
Input Only.
Definition: EI_API_def.h:133