21 #include "csa_config.h"
25 UA_VariableTypeAttributes attr;
26 UA_VariableTypeAttributes_init(&attr);
27 attr.displayName = UA_LOCALIZEDTEXT(
"en-US",
"ctkAdditionalVariable");
28 attr.description = UA_LOCALIZEDTEXT(
"en-US",
"ctkAdditionalVariable");
29 attr.valueRank = UA_VALUERANK_ANY;
30 attr.dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATATYPE);
31 UA_NodeId nodeId = UA_NODEID_NUMERIC(CSA_NSID, UA_NS2ID_CTKADDITIONALVARIABLE);
32 UA_NodeId parentNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE);
34 UA_NodeId parentReferenceNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
35 UA_QualifiedName nodeName = UA_QUALIFIEDNAME(1,
"ctkAdditionalVariable");
36 return UA_Server_addVariableTypeNode(
37 server, nodeId, parentNodeId, parentReferenceNodeId, nodeName, UA_NODEID_NULL, attr, NULL, NULL);
43 UA_StatusCode retVal = UA_STATUSCODE_GOOD;
44 UA_VariableAttributes attr = UA_VariableAttributes_default;
45 attr.minimumSamplingInterval = 0.000000;
46 attr.userAccessLevel = 1;
49 attr.arrayDimensionsSize = 1;
50 attr.arrayDimensions = (UA_UInt32*)UA_Array_new(1, &UA_TYPES[UA_TYPES_UINT32]);
51 if(!attr.arrayDimensions) {
52 return UA_STATUSCODE_BADOUTOFMEMORY;
54 attr.arrayDimensions[0] = 6;
55 attr.dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_LOCALIZEDTEXT);
57 UA_LocalizedText enumValues[6] = {UA_LOCALIZEDTEXT(
"",
"Trace"), UA_LOCALIZEDTEXT(
"",
"Debug"),
58 UA_LOCALIZEDTEXT(
"",
"Info"), UA_LOCALIZEDTEXT(
"",
"Warning"), UA_LOCALIZEDTEXT(
"",
"Error"),
59 UA_LOCALIZEDTEXT(
"",
"Fatal")};
60 UA_Variant_setArray(&attr.value, enumValues, 6, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
62 attr.displayName = UA_LOCALIZEDTEXT(
"",
"EnumStrings");
63 attr.description = UA_LOCALIZEDTEXT(
"",
"");
65 attr.userWriteMask = 0;
67 UA_Server_addNode_begin(server, UA_NODECLASS_VARIABLE, UA_NODEID_STRING(1,
"EnumStrings"),
68 UA_NODEID_STRING(1,
"LoggingLevels"), UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
69 UA_QUALIFIEDNAME(0,
"EnumStrings"), UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE), (
const UA_NodeAttributes*)&attr,
70 &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES], NULL, NULL);
72 UA_Array_delete(attr.arrayDimensions, 1, &UA_TYPES[UA_TYPES_UINT32]);
73 if(retVal != UA_STATUSCODE_GOOD) {
74 UA_ServerConfig* config = UA_Server_getConfig(server);
76 config->logging, UA_LOGCATEGORY_USERLAND,
"Failed adding variable reference. %s", UA_StatusCode_name(retVal));
82 UA_DataTypeAttributes attr = UA_DataTypeAttributes_default;
83 attr.description = UA_LOCALIZEDTEXT(
"", enumName);
84 attr.displayName = UA_LOCALIZEDTEXT(
"", enumName);
86 UA_Server_addDataTypeNode(server, UA_NODEID_STRING(1, enumName), UA_NODEID_NUMERIC(0, UA_NS0ID_ENUMERATION),
87 UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE), UA_QUALIFIEDNAME(1, enumName), attr, NULL, NULL);
88 if(st != UA_STATUSCODE_GOOD) {
89 UA_ServerConfig* config = UA_Server_getConfig(server);
90 UA_LOG_ERROR(config->logging, UA_LOGCATEGORY_USERLAND,
"Failed adding type node. %s", UA_StatusCode_name(st));
94 if(st != UA_STATUSCODE_GOOD) {
95 UA_ServerConfig* config = UA_Server_getConfig(server);
96 UA_LOG_ERROR(config->logging, UA_LOGCATEGORY_USERLAND,
"Failed adding LoggingLevels enum values. %s",
97 UA_StatusCode_name(st));
102 UA_StatusCode retval = UA_STATUSCODE_GOOD;
103 if(UA_Server_addNamespace(server,
"http://adapterIM/") != 2)
return UA_STATUSCODE_BADUNEXPECTEDERROR;
110 UA_ObjectTypeAttributes attr;
111 UA_ObjectTypeAttributes_init(&attr);
112 attr.displayName = UA_LOCALIZEDTEXT(
"",
"ctkModule");
113 attr.description = UA_LOCALIZEDTEXT(
"",
"");
114 UA_NodeId nodeId = UA_NODEID_NUMERIC(2, 1002);
115 UA_NodeId parentNodeId = UA_NODEID_NUMERIC(0, 58);
116 UA_NodeId parentReferenceNodeId = UA_NODEID_NUMERIC(0, 45);
117 UA_QualifiedName nodeName = UA_QUALIFIEDNAME(1,
"ctkModule");
118 UA_Server_addObjectTypeNode(server, nodeId, parentNodeId, parentReferenceNodeId, nodeName, attr, NULL, NULL);
124 UA_VariableTypeAttributes attr = UA_VariableTypeAttributes_default;
125 attr.displayName = UA_LOCALIZEDTEXT(
"",
"ctkProcessVariable");
126 attr.description = UA_LOCALIZEDTEXT(
"",
"");
127 attr.valueRank = UA_VALUERANK_ANY;
128 UA_NodeId nodeId = UA_NODEID_NUMERIC(2, 1001);
129 UA_NodeId parentNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE);
131 UA_NodeId parentReferenceNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
132 UA_QualifiedName nodeName = UA_QUALIFIEDNAME(1,
"ctkProcessVariable");
133 UA_Server_addVariableTypeNode(
134 server, nodeId, parentNodeId, parentReferenceNodeId, nodeName, UA_NODEID_NULL, attr, NULL, NULL);
144 UA_ObjectAttributes attr;
145 UA_ObjectAttributes_init(&attr);
146 attr.displayName = UA_LOCALIZEDTEXT(
"",
"Variables");
147 attr.description = UA_LOCALIZEDTEXT(
"",
"");
148 UA_NodeId nodeId = UA_NODEID_NUMERIC(2, 5001);
149 UA_NodeId typeDefinition = UA_NODEID_NUMERIC(0, 61);
150 UA_NodeId parentNodeId = UA_NODEID_NUMERIC(2, 1002);
151 UA_NodeId parentReferenceNodeId = UA_NODEID_NUMERIC(0, 47);
152 UA_QualifiedName nodeName = UA_QUALIFIEDNAME(1,
"Variables");
153 UA_Server_addObjectNode(
154 server, nodeId, parentNodeId, parentReferenceNodeId, nodeName, typeDefinition, attr, NULL, NULL);
155 UA_Server_deleteReference(server, nodeId, UA_NODEID_NUMERIC(0, 40),
true, UA_EXPANDEDNODEID_NUMERIC(0, 58),
158 UA_Server_addReference(
159 server, UA_NODEID_NUMERIC(2, 5001), UA_NODEID_NUMERIC(0, 40), UA_EXPANDEDNODEID_NUMERIC(0, 61),
true);
165 UA_VariableAttributes attr = UA_VariableAttributes_default;
166 attr.displayName = UA_LOCALIZEDTEXT(
"",
"Description");
167 attr.description = UA_LOCALIZEDTEXT(
"",
"");
168 attr.accessLevel = 3;
169 attr.userAccessLevel = 3;
170 attr.valueRank = UA_VALUERANK_SCALAR;
171 attr.dataType = UA_TYPES[UA_TYPES_STRING].typeId;
174 UA_String opcua_node_variable_t_ns_2_i_6001_variant_DataContents = UA_STRING_ALLOC(
"");
175 UA_Variant_setScalar(
176 &attr.value, &opcua_node_variable_t_ns_2_i_6001_variant_DataContents, &UA_TYPES[UA_TYPES_STRING]);
177 UA_NodeId nodeId = UA_NODEID_NUMERIC(2, 6001);
178 UA_NodeId typeDefinition = UA_NODEID_NUMERIC(0, 63);
179 UA_NodeId parentNodeId = UA_NODEID_NUMERIC(2, 1001);
180 UA_NodeId parentReferenceNodeId = UA_NODEID_NUMERIC(0, 47);
181 UA_QualifiedName nodeName = UA_QUALIFIEDNAME(1,
"Description");
182 UA_Server_addVariableNode(
183 server, nodeId, parentNodeId, parentReferenceNodeId, nodeName, typeDefinition, attr, NULL, NULL);
184 UA_Server_deleteReference(server, nodeId, UA_NODEID_NUMERIC(0, 40),
true, UA_EXPANDEDNODEID_NUMERIC(0, 62),
187 UA_Server_addReference(
188 server, UA_NODEID_NUMERIC(2, 6001), UA_NODEID_NUMERIC(0, 40), UA_EXPANDEDNODEID_NUMERIC(0, 63),
true);
194 UA_VariableAttributes attr = UA_VariableAttributes_default;
195 attr.displayName = UA_LOCALIZEDTEXT(
"",
"EngineeringUnit");
196 attr.description = UA_LOCALIZEDTEXT(
"",
"");
197 attr.accessLevel = 3;
198 attr.userAccessLevel = 3;
199 attr.valueRank = UA_VALUERANK_SCALAR;
200 attr.dataType = UA_TYPES[UA_TYPES_STRING].typeId;
203 UA_String opcua_node_variable_t_ns_2_i_6001_variant_DataContents = UA_STRING_ALLOC(
"");
204 UA_Variant_setScalar(
205 &attr.value, &opcua_node_variable_t_ns_2_i_6001_variant_DataContents, &UA_TYPES[UA_TYPES_STRING]);
206 UA_NodeId nodeId = UA_NODEID_NUMERIC(2, 6006);
207 UA_NodeId typeDefinition = UA_NODEID_NUMERIC(0, 63);
208 UA_NodeId parentNodeId = UA_NODEID_NUMERIC(2, 1001);
209 UA_NodeId parentReferenceNodeId = UA_NODEID_NUMERIC(0, 47);
210 UA_QualifiedName nodeName = UA_QUALIFIEDNAME(1,
"EngineeringUnit");
211 UA_Server_addVariableNode(
212 server, nodeId, parentNodeId, parentReferenceNodeId, nodeName, typeDefinition, attr, NULL, NULL);
213 UA_Server_deleteReference(server, nodeId, UA_NODEID_NUMERIC(0, 40),
true, UA_EXPANDEDNODEID_NUMERIC(0, 62),
216 UA_Server_addReference(
217 server, UA_NODEID_NUMERIC(2, 6006), UA_NODEID_NUMERIC(0, 40), UA_EXPANDEDNODEID_NUMERIC(0, 63),
true);
223 UA_VariableAttributes attr = UA_VariableAttributes_default;
224 attr.displayName = UA_LOCALIZEDTEXT(
"",
"Name");
225 attr.description = UA_LOCALIZEDTEXT(
"",
"");
226 attr.accessLevel = 3;
227 attr.userAccessLevel = 3;
228 attr.valueRank = UA_VALUERANK_SCALAR;
229 attr.dataType = UA_TYPES[UA_TYPES_STRING].typeId;
232 UA_String opcua_node_variable_t_ns_2_i_6004_variant_DataContents = UA_STRING_ALLOC(
"");
233 UA_Variant_setScalar(
234 &attr.value, &opcua_node_variable_t_ns_2_i_6004_variant_DataContents, &UA_TYPES[UA_TYPES_STRING]);
235 UA_NodeId nodeId = UA_NODEID_NUMERIC(2, 6004);
236 UA_NodeId typeDefinition = UA_NODEID_NUMERIC(0, 63);
237 UA_NodeId parentNodeId = UA_NODEID_NUMERIC(2, 1001);
238 UA_NodeId parentReferenceNodeId = UA_NODEID_NUMERIC(0, 47);
239 UA_QualifiedName nodeName = UA_QUALIFIEDNAME(1,
"Name");
240 UA_Server_addVariableNode(
241 server, nodeId, parentNodeId, parentReferenceNodeId, nodeName, typeDefinition, attr, NULL, NULL);
242 UA_Server_deleteReference(server, nodeId, UA_NODEID_NUMERIC(0, 40),
true, UA_EXPANDEDNODEID_NUMERIC(0, 62),
245 UA_Server_addReference(
246 server, UA_NODEID_NUMERIC(2, 6004), UA_NODEID_NUMERIC(0, 40), UA_EXPANDEDNODEID_NUMERIC(0, 63),
true);
252 UA_VariableAttributes attr = UA_VariableAttributes_default;
253 attr.displayName = UA_LOCALIZEDTEXT(
"",
"Type");
254 attr.description = UA_LOCALIZEDTEXT(
"",
"");
255 attr.accessLevel = 3;
256 attr.userAccessLevel = 3;
257 attr.valueRank = UA_VALUERANK_SCALAR;
258 attr.dataType = UA_TYPES[UA_TYPES_STRING].typeId;
261 UA_String opcua_node_variable_t_ns_2_i_6012_variant_DataContents = UA_STRING_ALLOC(
"");
262 UA_Variant_setScalar(
263 &attr.value, &opcua_node_variable_t_ns_2_i_6012_variant_DataContents, &UA_TYPES[UA_TYPES_STRING]);
264 UA_NodeId nodeId = UA_NODEID_NUMERIC(2, 6012);
265 UA_NodeId typeDefinition = UA_NODEID_NUMERIC(0, 63);
266 UA_NodeId parentNodeId = UA_NODEID_NUMERIC(2, 1001);
267 UA_NodeId parentReferenceNodeId = UA_NODEID_NUMERIC(0, 47);
268 UA_QualifiedName nodeName = UA_QUALIFIEDNAME(1,
"Type");
269 UA_Server_addVariableNode(
270 server, nodeId, parentNodeId, parentReferenceNodeId, nodeName, typeDefinition, attr, NULL, NULL);
271 UA_Server_deleteReference(server, nodeId, UA_NODEID_NUMERIC(0, 40),
true, UA_EXPANDEDNODEID_NUMERIC(0, 62),
274 UA_Server_addReference(
275 server, UA_NODEID_NUMERIC(2, 6012), UA_NODEID_NUMERIC(0, 40), UA_EXPANDEDNODEID_NUMERIC(0, 63),
true);
281 UA_VariableAttributes attr = UA_VariableAttributes_default;
282 attr.displayName = UA_LOCALIZEDTEXT(
"",
"Validity");
283 attr.description = UA_LOCALIZEDTEXT(
"",
"");
284 attr.accessLevel = 3;
285 attr.userAccessLevel = 3;
286 attr.valueRank = UA_VALUERANK_SCALAR;
287 attr.dataType = UA_TYPES[UA_TYPES_INT32].typeId;
290 UA_String opcua_node_variable_t_ns_2_i_6012_variant_DataContents = UA_STRING_ALLOC(
"");
291 UA_Variant_setScalar(
292 &attr.value, &opcua_node_variable_t_ns_2_i_6012_variant_DataContents, &UA_TYPES[UA_TYPES_INT32]);
293 UA_NodeId nodeId = UA_NODEID_NUMERIC(2, 6018);
294 UA_NodeId typeDefinition = UA_NODEID_NUMERIC(0, 63);
295 UA_NodeId parentNodeId = UA_NODEID_NUMERIC(2, 1001);
296 UA_NodeId parentReferenceNodeId = UA_NODEID_NUMERIC(0, 47);
297 UA_QualifiedName nodeName = UA_QUALIFIEDNAME(1,
"Validity");
298 UA_Server_addVariableNode(
299 server, nodeId, parentNodeId, parentReferenceNodeId, nodeName, typeDefinition, attr, NULL, NULL);
300 UA_Server_deleteReference(server, nodeId, UA_NODEID_NUMERIC(0, 40),
true, UA_EXPANDEDNODEID_NUMERIC(0, 62),
303 UA_Server_addReference(
304 server, UA_NODEID_NUMERIC(2, 6018), UA_NODEID_NUMERIC(0, 40), UA_EXPANDEDNODEID_NUMERIC(0, 63),
true);