1 #ifndef __UACONTROLNODE_H__ 2 #define __UACONTROLNODE_H__ 4 #include "uaobjecttypes.h" 5 #include "nodemanagerbase.h" 8 #include "opcua_propertytype.h" 52 OpcUa::BaseMethod* pMethodDeclaration = NULL;
53 OpcUa::BaseDataVariableType* pDataVariable = NULL;
54 OpcUa::PropertyType *pProperty;
58 UaVariant defaultValue;
68 UaReferenceLists *uaList = instance->getUaReferenceLists();
69 for (UaReference *pRef = (UaReference *)uaList->pTargetNodes(); pRef != 0; pRef = pRef->pNextForwardReference()) {
70 OpcUa_UInt32 refType = pRef->referenceTypeId().identifierNumeric();
72 ptNode = pRef->pTargetNode();
74 newName = ptNode->browseName().toString();
79 case OpcUaId_HasComponent:
80 switch (ptNode->nodeClass()) {
81 case OpcUa_NodeClass_VariableType:
82 pDataVariable =
new UaControlDeviceItem(newName, uaId, pNodeManager, defaultValue, static_cast<UaVariableType*>(ptNode),
conf, interf, m);
83 addStatus = pNodeManager->addNodeAndReference(cur, pDataVariable, OpcUaId_HasComponent);
84 UA_ASSERT(addStatus.isGood());
86 case OpcUa_NodeClass_Variable:
88 addStatus = pNodeManager->addNodeAndReference(cur, pDataVariable, OpcUaId_HasComponent);
89 UA_ASSERT(addStatus.isGood());
91 case OpcUa_NodeClass_ObjectType:
92 pDeclarationObject =
new UaControlDeviceGeneric(newName, uaId, pNodeManager, static_cast<UaObjectType *>(ptNode),
conf, interf);
93 addStatus = pNodeManager->addNodeAndReference(cur, pDeclarationObject, OpcUaId_HasComponent);
94 UA_ASSERT(addStatus.isGood());
96 case OpcUa_NodeClass_Object:
98 addStatus = pNodeManager->addNodeAndReference(cur, pDeclarationObject, OpcUaId_HasComponent);
99 UA_ASSERT(addStatus.isGood());
101 case OpcUa_NodeClass_Method:
102 pMethodDeclaration =
new UaDeviceMethod<T>(cur, pNodeManager,
static_cast<UaMethod *
>(ptNode), m);
103 addStatus = pNodeManager->addNodeAndReference(cur, pMethodDeclaration, OpcUaId_HasComponent);
104 UA_ASSERT(addStatus.isGood());
105 cur->addMethod(pMethodDeclaration);
110 case OpcUaId_HasSubtype:
112 UA_ASSERT(addStatus.isGood());
114 case OpcUaId_HasProperty:
117 UaDateTime sdt = UaDateTime::now();
120 udt.setDataValue(defaultValue, OpcUa_False, OpcUa_Good, sdt, sdt);
122 pProperty =
new OpcUa::PropertyType(uaId, newName, pNodeManager->getNameSpaceIndex(), defaultValue, Ua_AccessLevel_CurrentRead, pNodeManager, m);
123 pProperty->setValue(0, udt, OpcUa_False);
124 addStatus = pNodeManager->addNodeAndReference(cur, pProperty, OpcUaId_HasProperty);
125 if (!addStatus.isGood())
127 UA_ASSERT(addStatus.isGood());