EtherNet/IP™ Adapter3.09.00
 
Loading...
Searching...
No Matches

◆ 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);
ETHIP_API T * EI_API_ADP_new(uint8_t numInterfaces_p)
Create a new EtherNet/IP adapter.
Definition EI_API_ADP_stub.c:231
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:5145
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:4312
@ EI_API_CIP_eAPP_TYPE_IO
Input Only.
Definition EI_API_def.h:137
@ EI_API_CIP_eAR_GET_AND_SET
Definition EI_API_def.h:124
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:81
uint16_t maxInstanceNum
Definition EI_API_CIP_define.h:162
Initialization parameters to create new CIP Node.
Definition EI_API_CIP_define.h:161
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