ua_application.c 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. #include "ua_application.h"
  2. #include "ua_namespace.h"
  3. #include "ua_services_internal.h"
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. UA_indexedList_List nsMockup;
  7. Application appMockup = {
  8. ( UA_ApplicationDescription*) UA_NULL,
  9. &nsMockup
  10. };
  11. UA_Node* create_node_ns0(UA_Int32 class, UA_Int32 nodeClass, UA_Int32 const id, char const * qn, char const * dn, char const * desc) {
  12. UA_Node* n; UA_.types[class].new((void **)&n);
  13. n->nodeId.encodingByte = UA_NODEIDTYPE_FOURBYTE;
  14. n->nodeId.namespace = 0;
  15. n->nodeId.identifier.numeric = id;
  16. UA_String_copycstring(qn,&(n->browseName.name));
  17. UA_String_copycstring(dn,&n->displayName.text);
  18. UA_String_copycstring(desc,&n->description.text);
  19. n->nodeClass = nodeClass;
  20. return n;
  21. }
  22. void appMockup_init() {
  23. //fill the UA_borrowed_ table that has been declaed in ua_namespace.c
  24. for(UA_Int32 i=0;i<SIZE_UA_VTABLE;i++){
  25. UA_borrowed_.types[i] = UA_.types[i];
  26. UA_borrowed_.types[i].delete=(UA_Int32(*)(void *))phantom_delete;
  27. UA_borrowed_.types[i].deleteMembers=(UA_Int32(*)(void *))phantom_delete;
  28. }
  29. // create namespaces
  30. // TODO: A table that maps the namespaceUris to Ids
  31. Namespace* ns0;
  32. Namespace_new(&ns0, 0); //C2UA_STRING("http://opcfoundation.org/UA/"));
  33. Namespace* local;
  34. Namespace_new(&local, 1); //C2UA_STRING("http://localhost:16664/open62541/"));
  35. // add to list of namespaces
  36. UA_indexedList_init(appMockup.namespaces);
  37. UA_indexedList_addValueToFront(appMockup.namespaces,0,ns0);
  38. UA_indexedList_addValueToFront(appMockup.namespaces,1,local);
  39. /**************/
  40. /* References */
  41. /**************/
  42. // ReferenceType Ids
  43. UA_NodeId RefTypeId_References = NS0NODEID(31);
  44. UA_NodeId RefTypeId_NonHierarchicalReferences = NS0NODEID(32);
  45. UA_NodeId RefTypeId_HierarchicalReferences = NS0NODEID(33);
  46. UA_NodeId RefTypeId_HasChild = NS0NODEID(34);
  47. UA_NodeId RefTypeId_Organizes = NS0NODEID(35);
  48. UA_NodeId RefTypeId_HasEventSource = NS0NODEID(36);
  49. UA_NodeId RefTypeId_HasModellingRule = NS0NODEID(37);
  50. UA_NodeId RefTypeId_HasEncoding = NS0NODEID(38);
  51. UA_NodeId RefTypeId_HasDescription = NS0NODEID(39);
  52. UA_NodeId RefTypeId_HasTypeDefinition = NS0NODEID(40);
  53. UA_NodeId RefTypeId_GeneratesEvent = NS0NODEID(41);
  54. UA_NodeId RefTypeId_Aggregates = NS0NODEID(44);
  55. UA_NodeId RefTypeId_HasSubtype = NS0NODEID(45);
  56. UA_NodeId RefTypeId_HasProperty = NS0NODEID(46);
  57. UA_NodeId RefTypeId_HasComponent = NS0NODEID(47);
  58. UA_NodeId RefTypeId_HasNotifier = NS0NODEID(48);
  59. UA_NodeId RefTypeId_HasOrderedComponent = NS0NODEID(49);
  60. UA_NodeId RefTypeId_HasModelParent = NS0NODEID(50);
  61. UA_NodeId RefTypeId_FromState = NS0NODEID(51);
  62. UA_NodeId RefTypeId_ToState = NS0NODEID(52);
  63. UA_NodeId RefTypeId_HasCause = NS0NODEID(53);
  64. UA_NodeId RefTypeId_HasEffect = NS0NODEID(54);
  65. UA_NodeId RefTypeId_HasHistoricalConfiguration = NS0NODEID(56);
  66. UA_ReferenceTypeNode *references;
  67. UA_ReferenceTypeNode_new(&references);
  68. references->nodeId = RefTypeId_References;
  69. references->nodeClass = UA_NODECLASS_REFERENCETYPE;
  70. references->browseName = UA_QUALIFIEDNAME_STATIC("References");
  71. references->displayName = UA_LOCALIZEDTEXT_STATIC("References");
  72. references->description = UA_LOCALIZEDTEXT_STATIC("References");
  73. references->isAbstract = UA_TRUE;
  74. references->symmetric = UA_TRUE;
  75. Namespace_insert(ns0,(UA_Node**)&references, NAMESPACE_INSERT_UNIQUE);
  76. UA_ReferenceTypeNode *hierarchicalreferences;
  77. UA_ReferenceTypeNode_new(&hierarchicalreferences);
  78. hierarchicalreferences->nodeId = RefTypeId_HierarchicalReferences;
  79. hierarchicalreferences->nodeClass = UA_NODECLASS_REFERENCETYPE;
  80. hierarchicalreferences->browseName = UA_QUALIFIEDNAME_STATIC("HierarchicalReferences");
  81. hierarchicalreferences->displayName = UA_LOCALIZEDTEXT_STATIC("HierarchicalReferences");
  82. hierarchicalreferences->description = UA_LOCALIZEDTEXT_STATIC("HierarchicalReferences");
  83. hierarchicalreferences->isAbstract = UA_TRUE;
  84. hierarchicalreferences->symmetric = UA_FALSE;
  85. AddReference((UA_Node*)hierarchicalreferences, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
  86. (UA_ExpandedNodeId){RefTypeId_References, UA_STRING_NULL, 0}}, ns0);
  87. Namespace_insert(ns0,(UA_Node**)&hierarchicalreferences, NAMESPACE_INSERT_UNIQUE);
  88. UA_ReferenceTypeNode *nonhierarchicalreferences;
  89. UA_ReferenceTypeNode_new(&nonhierarchicalreferences);
  90. nonhierarchicalreferences->nodeId = RefTypeId_NonHierarchicalReferences;
  91. nonhierarchicalreferences->nodeClass = UA_NODECLASS_REFERENCETYPE;
  92. nonhierarchicalreferences->browseName = UA_QUALIFIEDNAME_STATIC("NonHierarchicalReferences");
  93. nonhierarchicalreferences->displayName = UA_LOCALIZEDTEXT_STATIC("NonHierarchicalReferences");
  94. nonhierarchicalreferences->description = UA_LOCALIZEDTEXT_STATIC("NonHierarchicalReferences");
  95. nonhierarchicalreferences->isAbstract = UA_TRUE;
  96. nonhierarchicalreferences->symmetric = UA_FALSE;
  97. AddReference((UA_Node*)nonhierarchicalreferences, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
  98. (UA_ExpandedNodeId){RefTypeId_References, UA_STRING_NULL, 0}}, ns0);
  99. Namespace_insert(ns0,(UA_Node**)&nonhierarchicalreferences, NAMESPACE_INSERT_UNIQUE);
  100. UA_ReferenceTypeNode *haschild;
  101. UA_ReferenceTypeNode_new(&haschild);
  102. haschild->nodeId = RefTypeId_HasChild;
  103. haschild->nodeClass = UA_NODECLASS_REFERENCETYPE;
  104. haschild->browseName = UA_QUALIFIEDNAME_STATIC("HasChild");
  105. haschild->displayName = UA_LOCALIZEDTEXT_STATIC("HasChild");
  106. haschild->description = UA_LOCALIZEDTEXT_STATIC("HasChild");
  107. haschild->isAbstract = UA_TRUE;
  108. haschild->symmetric = UA_FALSE;
  109. AddReference((UA_Node*)haschild, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
  110. (UA_ExpandedNodeId){RefTypeId_HierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
  111. Namespace_insert(ns0,(UA_Node**)&haschild, NAMESPACE_INSERT_UNIQUE);
  112. UA_ReferenceTypeNode *organizes;
  113. UA_ReferenceTypeNode_new(&organizes);
  114. organizes->nodeId = RefTypeId_Organizes;
  115. organizes->nodeClass = UA_NODECLASS_REFERENCETYPE;
  116. organizes->browseName = UA_QUALIFIEDNAME_STATIC("Organizes");
  117. organizes->displayName = UA_LOCALIZEDTEXT_STATIC("Organizes");
  118. organizes->description = UA_LOCALIZEDTEXT_STATIC("Organizes");
  119. organizes->isAbstract = UA_FALSE;
  120. organizes->symmetric = UA_FALSE;
  121. organizes->inverseName = UA_LOCALIZEDTEXT_STATIC("OrganizedBy");
  122. AddReference((UA_Node*)organizes, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
  123. (UA_ExpandedNodeId){RefTypeId_HierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
  124. Namespace_insert(ns0,(UA_Node**)&organizes, NAMESPACE_INSERT_UNIQUE);
  125. UA_ReferenceTypeNode *haseventsource;
  126. UA_ReferenceTypeNode_new(&haseventsource);
  127. haseventsource->nodeId = RefTypeId_HasEventSource;
  128. haseventsource->nodeClass = UA_NODECLASS_REFERENCETYPE;
  129. haseventsource->browseName = UA_QUALIFIEDNAME_STATIC("HasEventSource");
  130. haseventsource->displayName = UA_LOCALIZEDTEXT_STATIC("HasEventSource");
  131. haseventsource->description = UA_LOCALIZEDTEXT_STATIC("HasEventSource");
  132. haseventsource->isAbstract = UA_FALSE;
  133. haseventsource->symmetric = UA_FALSE;
  134. haseventsource->inverseName = UA_LOCALIZEDTEXT_STATIC("EventSourceOf");
  135. AddReference((UA_Node*)haseventsource, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
  136. (UA_ExpandedNodeId){RefTypeId_HierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
  137. Namespace_insert(ns0,(UA_Node**)&haseventsource, NAMESPACE_INSERT_UNIQUE);
  138. UA_ReferenceTypeNode *hasmodellingrule;
  139. UA_ReferenceTypeNode_new(&hasmodellingrule);
  140. hasmodellingrule->nodeId = RefTypeId_HasModellingRule;
  141. hasmodellingrule->nodeClass = UA_NODECLASS_REFERENCETYPE;
  142. hasmodellingrule->browseName = UA_QUALIFIEDNAME_STATIC("HasModellingRule");
  143. hasmodellingrule->displayName = UA_LOCALIZEDTEXT_STATIC("HasModellingRule");
  144. hasmodellingrule->description = UA_LOCALIZEDTEXT_STATIC("HasModellingRule");
  145. hasmodellingrule->isAbstract = UA_FALSE;
  146. hasmodellingrule->symmetric = UA_FALSE;
  147. hasmodellingrule->inverseName = UA_LOCALIZEDTEXT_STATIC("ModellingRuleOf");
  148. AddReference((UA_Node*)hasmodellingrule, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
  149. (UA_ExpandedNodeId){RefTypeId_NonHierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
  150. Namespace_insert(ns0,(UA_Node**)&hasmodellingrule, NAMESPACE_INSERT_UNIQUE);
  151. UA_ReferenceTypeNode *hasencoding;
  152. UA_ReferenceTypeNode_new(&hasencoding);
  153. hasencoding->nodeId = RefTypeId_HasEncoding;
  154. hasencoding->nodeClass = UA_NODECLASS_REFERENCETYPE;
  155. hasencoding->browseName = UA_QUALIFIEDNAME_STATIC("HasEncoding");
  156. hasencoding->displayName = UA_LOCALIZEDTEXT_STATIC("HasEncoding");
  157. hasencoding->description = UA_LOCALIZEDTEXT_STATIC("HasEncoding");
  158. hasencoding->isAbstract = UA_FALSE;
  159. hasencoding->symmetric = UA_FALSE;
  160. hasencoding->inverseName = UA_LOCALIZEDTEXT_STATIC("EncodingOf");
  161. AddReference((UA_Node*)hasencoding, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
  162. (UA_ExpandedNodeId){RefTypeId_NonHierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
  163. Namespace_insert(ns0,(UA_Node**)&hasencoding, NAMESPACE_INSERT_UNIQUE);
  164. UA_ReferenceTypeNode *hasdescription;
  165. UA_ReferenceTypeNode_new(&hasdescription);
  166. hasdescription->nodeId = RefTypeId_HasDescription;
  167. hasdescription->nodeClass = UA_NODECLASS_REFERENCETYPE;
  168. hasdescription->browseName = UA_QUALIFIEDNAME_STATIC("HasDescription");
  169. hasdescription->displayName = UA_LOCALIZEDTEXT_STATIC("HasDescription");
  170. hasdescription->description = UA_LOCALIZEDTEXT_STATIC("HasDescription");
  171. hasdescription->isAbstract = UA_FALSE;
  172. hasdescription->symmetric = UA_FALSE;
  173. hasdescription->inverseName = UA_LOCALIZEDTEXT_STATIC("DescriptionOf");
  174. AddReference((UA_Node*)hasdescription, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
  175. (UA_ExpandedNodeId){RefTypeId_NonHierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
  176. Namespace_insert(ns0,(UA_Node**)&hasdescription, NAMESPACE_INSERT_UNIQUE);
  177. UA_ReferenceTypeNode *hastypedefinition;
  178. UA_ReferenceTypeNode_new(&hastypedefinition);
  179. hastypedefinition->nodeId = RefTypeId_HasTypeDefinition;
  180. hastypedefinition->nodeClass = UA_NODECLASS_REFERENCETYPE;
  181. hastypedefinition->browseName = UA_QUALIFIEDNAME_STATIC("HasTypeDefinition");
  182. hastypedefinition->displayName = UA_LOCALIZEDTEXT_STATIC("HasTypeDefinition");
  183. hastypedefinition->description = UA_LOCALIZEDTEXT_STATIC("HasTypeDefinition");
  184. hastypedefinition->isAbstract = UA_FALSE;
  185. hastypedefinition->symmetric = UA_FALSE;
  186. hastypedefinition->inverseName = UA_LOCALIZEDTEXT_STATIC("TypeDefinitionOf");
  187. AddReference((UA_Node*)hastypedefinition, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
  188. (UA_ExpandedNodeId){RefTypeId_NonHierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
  189. Namespace_insert(ns0,(UA_Node**)&hastypedefinition, NAMESPACE_INSERT_UNIQUE);
  190. UA_ReferenceTypeNode *generatesevent;
  191. UA_ReferenceTypeNode_new(&generatesevent);
  192. generatesevent->nodeId = RefTypeId_GeneratesEvent;
  193. generatesevent->nodeClass = UA_NODECLASS_REFERENCETYPE;
  194. generatesevent->browseName = UA_QUALIFIEDNAME_STATIC("GeneratesEvent");
  195. generatesevent->displayName = UA_LOCALIZEDTEXT_STATIC("GeneratesEvent");
  196. generatesevent->description = UA_LOCALIZEDTEXT_STATIC("GeneratesEvent");
  197. generatesevent->isAbstract = UA_FALSE;
  198. generatesevent->symmetric = UA_FALSE;
  199. generatesevent->inverseName = UA_LOCALIZEDTEXT_STATIC("GeneratedBy");
  200. AddReference((UA_Node*)generatesevent, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
  201. (UA_ExpandedNodeId){RefTypeId_NonHierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
  202. Namespace_insert(ns0,(UA_Node**)&generatesevent, NAMESPACE_INSERT_UNIQUE);
  203. UA_ReferenceTypeNode *aggregates;
  204. UA_ReferenceTypeNode_new(&aggregates);
  205. aggregates->nodeId = RefTypeId_Aggregates;
  206. aggregates->nodeClass = UA_NODECLASS_REFERENCETYPE;
  207. aggregates->browseName = UA_QUALIFIEDNAME_STATIC("Aggregates");
  208. aggregates->displayName = UA_LOCALIZEDTEXT_STATIC("Aggregates");
  209. aggregates->description = UA_LOCALIZEDTEXT_STATIC("Aggregates");
  210. aggregates->isAbstract = UA_TRUE;
  211. aggregates->symmetric = UA_FALSE;
  212. AddReference((UA_Node*)aggregates, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
  213. (UA_ExpandedNodeId){RefTypeId_HasChild, UA_STRING_NULL, 0}}, ns0);
  214. Namespace_insert(ns0,(UA_Node**)&aggregates, NAMESPACE_INSERT_UNIQUE);
  215. UA_ReferenceTypeNode *hassubtype;
  216. UA_ReferenceTypeNode_new(&hassubtype);
  217. hassubtype->nodeId = RefTypeId_HasSubtype;
  218. hassubtype->nodeClass = UA_NODECLASS_REFERENCETYPE;
  219. hassubtype->browseName = UA_QUALIFIEDNAME_STATIC("HasSubtype");
  220. hassubtype->displayName = UA_LOCALIZEDTEXT_STATIC("HasSubtype");
  221. hassubtype->description = UA_LOCALIZEDTEXT_STATIC("HasSubtype");
  222. hassubtype->isAbstract = UA_FALSE;
  223. hassubtype->symmetric = UA_FALSE;
  224. hassubtype->inverseName = UA_LOCALIZEDTEXT_STATIC("SubtypeOf");
  225. AddReference((UA_Node*)hassubtype, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
  226. (UA_ExpandedNodeId){RefTypeId_HasChild, UA_STRING_NULL, 0}}, ns0);
  227. Namespace_insert(ns0,(UA_Node**)&hassubtype, NAMESPACE_INSERT_UNIQUE);
  228. UA_ReferenceTypeNode *hasproperty;
  229. UA_ReferenceTypeNode_new(&hasproperty);
  230. hasproperty->nodeId = RefTypeId_HasProperty;
  231. hasproperty->nodeClass = UA_NODECLASS_REFERENCETYPE;
  232. hasproperty->browseName = UA_QUALIFIEDNAME_STATIC("HasProperty");
  233. hasproperty->displayName = UA_LOCALIZEDTEXT_STATIC("HasProperty");
  234. hasproperty->description = UA_LOCALIZEDTEXT_STATIC("HasProperty");
  235. hasproperty->isAbstract = UA_FALSE;
  236. hasproperty->symmetric = UA_FALSE;
  237. hasproperty->inverseName = UA_LOCALIZEDTEXT_STATIC("PropertyOf");
  238. AddReference((UA_Node*)hasproperty, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
  239. (UA_ExpandedNodeId){RefTypeId_Aggregates, UA_STRING_NULL, 0}}, ns0);
  240. Namespace_insert(ns0,(UA_Node**)&hasproperty, NAMESPACE_INSERT_UNIQUE);
  241. UA_ReferenceTypeNode *hascomponent;
  242. UA_ReferenceTypeNode_new(&hascomponent);
  243. hascomponent->nodeId = RefTypeId_HasComponent;
  244. hascomponent->nodeClass = UA_NODECLASS_REFERENCETYPE;
  245. hascomponent->browseName = UA_QUALIFIEDNAME_STATIC("HasComponent");
  246. hascomponent->displayName = UA_LOCALIZEDTEXT_STATIC("HasComponent");
  247. hascomponent->description = UA_LOCALIZEDTEXT_STATIC("HasComponent");
  248. hascomponent->isAbstract = UA_FALSE;
  249. hascomponent->symmetric = UA_FALSE;
  250. hascomponent->inverseName = UA_LOCALIZEDTEXT_STATIC("ComponentOf");
  251. AddReference((UA_Node*)hascomponent, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
  252. (UA_ExpandedNodeId){RefTypeId_Aggregates, UA_STRING_NULL, 0}}, ns0);
  253. Namespace_insert(ns0,(UA_Node**)&hascomponent, NAMESPACE_INSERT_UNIQUE);
  254. UA_ReferenceTypeNode *hasnotifier;
  255. UA_ReferenceTypeNode_new(&hasnotifier);
  256. hasnotifier->nodeId = RefTypeId_HasNotifier;
  257. hasnotifier->nodeClass = UA_NODECLASS_REFERENCETYPE;
  258. hasnotifier->browseName = UA_QUALIFIEDNAME_STATIC("HasNotifier");
  259. hasnotifier->displayName = UA_LOCALIZEDTEXT_STATIC("HasNotifier");
  260. hasnotifier->description = UA_LOCALIZEDTEXT_STATIC("HasNotifier");
  261. hasnotifier->isAbstract = UA_FALSE;
  262. hasnotifier->symmetric = UA_FALSE;
  263. hasnotifier->inverseName = UA_LOCALIZEDTEXT_STATIC("NotifierOf");
  264. AddReference((UA_Node*)hasnotifier, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
  265. (UA_ExpandedNodeId){RefTypeId_HasEventSource, UA_STRING_NULL, 0}}, ns0);
  266. Namespace_insert(ns0,(UA_Node**)&hasnotifier, NAMESPACE_INSERT_UNIQUE);
  267. UA_ReferenceTypeNode *hasorderedcomponent;
  268. UA_ReferenceTypeNode_new(&hasorderedcomponent);
  269. hasorderedcomponent->nodeId = RefTypeId_HasOrderedComponent;
  270. hasorderedcomponent->nodeClass = UA_NODECLASS_REFERENCETYPE;
  271. hasorderedcomponent->browseName = UA_QUALIFIEDNAME_STATIC("HasOrderedComponent");
  272. hasorderedcomponent->displayName = UA_LOCALIZEDTEXT_STATIC("HasOrderedComponent");
  273. hasorderedcomponent->description = UA_LOCALIZEDTEXT_STATIC("HasOrderedComponent");
  274. hasorderedcomponent->isAbstract = UA_FALSE;
  275. hasorderedcomponent->symmetric = UA_FALSE;
  276. hasorderedcomponent->inverseName = UA_LOCALIZEDTEXT_STATIC("OrderedComponentOf");
  277. AddReference((UA_Node*)hasorderedcomponent, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
  278. (UA_ExpandedNodeId){RefTypeId_HasComponent, UA_STRING_NULL, 0}}, ns0);
  279. Namespace_insert(ns0,(UA_Node**)&hasorderedcomponent, NAMESPACE_INSERT_UNIQUE);
  280. UA_ReferenceTypeNode *hasmodelparent;
  281. UA_ReferenceTypeNode_new(&hasmodelparent);
  282. hasmodelparent->nodeId = RefTypeId_HasModelParent;
  283. hasmodelparent->nodeClass = UA_NODECLASS_REFERENCETYPE;
  284. hasmodelparent->browseName = UA_QUALIFIEDNAME_STATIC("HasModelParent");
  285. hasmodelparent->displayName = UA_LOCALIZEDTEXT_STATIC("HasModelParent");
  286. hasmodelparent->description = UA_LOCALIZEDTEXT_STATIC("HasModelParent");
  287. hasmodelparent->isAbstract = UA_FALSE;
  288. hasmodelparent->symmetric = UA_FALSE;
  289. hasmodelparent->inverseName = UA_LOCALIZEDTEXT_STATIC("ModelParentOf");
  290. AddReference((UA_Node*)hasmodelparent, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
  291. (UA_ExpandedNodeId){RefTypeId_NonHierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
  292. Namespace_insert(ns0,(UA_Node**)&hasmodelparent, NAMESPACE_INSERT_UNIQUE);
  293. UA_ReferenceTypeNode *fromstate;
  294. UA_ReferenceTypeNode_new(&fromstate);
  295. fromstate->nodeId = RefTypeId_FromState;
  296. fromstate->nodeClass = UA_NODECLASS_REFERENCETYPE;
  297. fromstate->browseName = UA_QUALIFIEDNAME_STATIC("FromState");
  298. fromstate->displayName = UA_LOCALIZEDTEXT_STATIC("FromState");
  299. fromstate->description = UA_LOCALIZEDTEXT_STATIC("FromState");
  300. fromstate->isAbstract = UA_FALSE;
  301. fromstate->symmetric = UA_FALSE;
  302. fromstate->inverseName = UA_LOCALIZEDTEXT_STATIC("ToTransition");
  303. AddReference((UA_Node*)fromstate, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
  304. (UA_ExpandedNodeId){RefTypeId_NonHierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
  305. Namespace_insert(ns0,(UA_Node**)&fromstate, NAMESPACE_INSERT_UNIQUE);
  306. UA_ReferenceTypeNode *tostate;
  307. UA_ReferenceTypeNode_new(&tostate);
  308. tostate->nodeId = RefTypeId_ToState;
  309. tostate->nodeClass = UA_NODECLASS_REFERENCETYPE;
  310. tostate->browseName = UA_QUALIFIEDNAME_STATIC("ToState");
  311. tostate->displayName = UA_LOCALIZEDTEXT_STATIC("ToState");
  312. tostate->description = UA_LOCALIZEDTEXT_STATIC("ToState");
  313. tostate->isAbstract = UA_FALSE;
  314. tostate->symmetric = UA_FALSE;
  315. tostate->inverseName = UA_LOCALIZEDTEXT_STATIC("FromTransition");
  316. AddReference((UA_Node*)tostate, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
  317. (UA_ExpandedNodeId){RefTypeId_NonHierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
  318. Namespace_insert(ns0,(UA_Node**)&tostate, NAMESPACE_INSERT_UNIQUE);
  319. UA_ReferenceTypeNode *hascause;
  320. UA_ReferenceTypeNode_new(&hascause);
  321. hascause->nodeId = RefTypeId_HasCause;
  322. hascause->nodeClass = UA_NODECLASS_REFERENCETYPE;
  323. hascause->browseName = UA_QUALIFIEDNAME_STATIC("HasCause");
  324. hascause->displayName = UA_LOCALIZEDTEXT_STATIC("HasCause");
  325. hascause->description = UA_LOCALIZEDTEXT_STATIC("HasCause");
  326. hascause->isAbstract = UA_FALSE;
  327. hascause->symmetric = UA_FALSE;
  328. hascause->inverseName = UA_LOCALIZEDTEXT_STATIC("MayBeCausedBy");
  329. AddReference((UA_Node*)hascause, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
  330. (UA_ExpandedNodeId){RefTypeId_NonHierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
  331. Namespace_insert(ns0,(UA_Node**)&hascause, NAMESPACE_INSERT_UNIQUE);
  332. UA_ReferenceTypeNode *haseffect;
  333. UA_ReferenceTypeNode_new(&haseffect);
  334. haseffect->nodeId = RefTypeId_HasEffect;
  335. haseffect->nodeClass = UA_NODECLASS_REFERENCETYPE;
  336. haseffect->browseName = UA_QUALIFIEDNAME_STATIC("HasEffect");
  337. haseffect->displayName = UA_LOCALIZEDTEXT_STATIC("HasEffect");
  338. haseffect->description = UA_LOCALIZEDTEXT_STATIC("HasEffect");
  339. haseffect->isAbstract = UA_FALSE;
  340. haseffect->symmetric = UA_FALSE;
  341. haseffect->inverseName = UA_LOCALIZEDTEXT_STATIC("MayBeEffectedBy");
  342. AddReference((UA_Node*)haseffect, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
  343. (UA_ExpandedNodeId){RefTypeId_NonHierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
  344. Namespace_insert(ns0,(UA_Node**)&haseffect, NAMESPACE_INSERT_UNIQUE);
  345. UA_ReferenceTypeNode *hashistoricalconfiguration;
  346. UA_ReferenceTypeNode_new(&hashistoricalconfiguration);
  347. hashistoricalconfiguration->nodeId = RefTypeId_HasHistoricalConfiguration;
  348. hashistoricalconfiguration->nodeClass = UA_NODECLASS_REFERENCETYPE;
  349. hashistoricalconfiguration->browseName = UA_QUALIFIEDNAME_STATIC("HasHistoricalConfiguration");
  350. hashistoricalconfiguration->displayName = UA_LOCALIZEDTEXT_STATIC("HasHistoricalConfiguration");
  351. hashistoricalconfiguration->description = UA_LOCALIZEDTEXT_STATIC("HasHistoricalConfiguration");
  352. hashistoricalconfiguration->isAbstract = UA_FALSE;
  353. hashistoricalconfiguration->symmetric = UA_FALSE;
  354. hashistoricalconfiguration->inverseName = UA_LOCALIZEDTEXT_STATIC("HistoricalConfigurationOf");
  355. AddReference((UA_Node*)hashistoricalconfiguration, &(UA_ReferenceNode){RefTypeId_HasSubtype,
  356. UA_TRUE, (UA_ExpandedNodeId){RefTypeId_Aggregates, UA_STRING_NULL, 0}}, ns0);
  357. Namespace_insert(ns0,(UA_Node**)&hashistoricalconfiguration, NAMESPACE_INSERT_UNIQUE);
  358. // ObjectTypes (Ids only)
  359. UA_ExpandedNodeId ObjTypeId_FolderType = NS0EXPANDEDNODEID(61);
  360. // Objects (Ids only)
  361. UA_ExpandedNodeId ObjId_ObjectsFolder = NS0EXPANDEDNODEID(85);
  362. UA_ExpandedNodeId ObjId_TypesFolder = NS0EXPANDEDNODEID(86);
  363. UA_ExpandedNodeId ObjId_ViewsFolder = NS0EXPANDEDNODEID(87);
  364. UA_ExpandedNodeId ObjId_Server = NS0EXPANDEDNODEID(2253);
  365. UA_ExpandedNodeId ObjId_ServerArray = NS0EXPANDEDNODEID(2254);
  366. UA_ExpandedNodeId ObjId_NamespaceArray = NS0EXPANDEDNODEID(2255);
  367. UA_ExpandedNodeId ObjId_ServerStatus = NS0EXPANDEDNODEID(2256);
  368. UA_ExpandedNodeId ObjId_ServerCapabilities = NS0EXPANDEDNODEID(2268);
  369. UA_ExpandedNodeId ObjId_State = NS0EXPANDEDNODEID(2259);
  370. // FolderType
  371. UA_ObjectNode *folderType;
  372. UA_ObjectNode_new(&folderType);
  373. folderType->nodeId = NS0NODEID(61);
  374. folderType->nodeClass = UA_NODECLASS_OBJECTTYPE; // I should not have to set this manually
  375. folderType->browseName = UA_QUALIFIEDNAME_STATIC("FolderType");
  376. folderType->displayName = UA_LOCALIZEDTEXT_STATIC("FolderType");
  377. folderType->description = UA_LOCALIZEDTEXT_STATIC("FolderType");
  378. Namespace_insert(ns0,(UA_Node**)&folderType, NAMESPACE_INSERT_UNIQUE);
  379. // Root
  380. UA_ObjectNode *root;
  381. UA_ObjectNode_new(&root);
  382. root->nodeId = NS0NODEID(84);
  383. root->nodeClass = UA_NODECLASS_OBJECT; // I should not have to set this manually
  384. root->browseName = UA_QUALIFIEDNAME_STATIC("Root");
  385. root->displayName = UA_LOCALIZEDTEXT_STATIC("Root");
  386. root->description = UA_LOCALIZEDTEXT_STATIC("Root");
  387. AddReference((UA_Node*)root, &(UA_ReferenceNode){RefTypeId_HasTypeDefinition, UA_FALSE, ObjTypeId_FolderType}, ns0);
  388. AddReference((UA_Node*)root, &(UA_ReferenceNode){RefTypeId_Organizes, UA_FALSE, ObjId_ObjectsFolder}, ns0);
  389. AddReference((UA_Node*)root, &(UA_ReferenceNode){RefTypeId_Organizes, UA_FALSE, ObjId_TypesFolder}, ns0);
  390. AddReference((UA_Node*)root, &(UA_ReferenceNode){RefTypeId_Organizes, UA_FALSE, ObjId_ViewsFolder}, ns0);
  391. /* root becomes a managed node. we need to release it at the end.*/
  392. Namespace_insert(ns0,(UA_Node**)&root, NAMESPACE_INSERT_UNIQUE | NAMESPACE_INSERT_GETMANAGED);
  393. // Objects
  394. UA_ObjectNode *objects;
  395. UA_ObjectNode_new(&objects);
  396. objects->nodeId = ObjId_ObjectsFolder.nodeId;
  397. objects->nodeClass = UA_NODECLASS_OBJECT;
  398. objects->browseName = UA_QUALIFIEDNAME_STATIC("Objects");
  399. objects->displayName = UA_LOCALIZEDTEXT_STATIC("Objects");
  400. objects->description = UA_LOCALIZEDTEXT_STATIC("Objects");
  401. AddReference((UA_Node*)objects, &(UA_ReferenceNode){RefTypeId_HasTypeDefinition, UA_FALSE, ObjTypeId_FolderType}, ns0);
  402. AddReference((UA_Node*)objects, &(UA_ReferenceNode){RefTypeId_Organizes, UA_FALSE, ObjId_Server}, ns0);
  403. Namespace_insert(ns0,(UA_Node**)&objects, NAMESPACE_INSERT_UNIQUE);
  404. // Types
  405. UA_ObjectNode *types;
  406. UA_ObjectNode_new(&types);
  407. types->nodeId = ObjId_TypesFolder.nodeId;
  408. types->nodeClass = UA_NODECLASS_OBJECT;
  409. types->browseName = UA_QUALIFIEDNAME_STATIC("Types");
  410. types->displayName = UA_LOCALIZEDTEXT_STATIC("Types");
  411. types->description = UA_LOCALIZEDTEXT_STATIC("Types");
  412. AddReference((UA_Node*)types, &(UA_ReferenceNode){RefTypeId_HasTypeDefinition, UA_FALSE, ObjTypeId_FolderType}, ns0);
  413. Namespace_insert(ns0,(UA_Node**)&types, NAMESPACE_INSERT_UNIQUE);
  414. // Views
  415. UA_ObjectNode *views;
  416. UA_ObjectNode_new(&views);
  417. views->nodeId = ObjId_ViewsFolder.nodeId;
  418. views->nodeClass = UA_NODECLASS_OBJECT;
  419. views->browseName = UA_QUALIFIEDNAME_STATIC("Views");
  420. views->displayName = UA_LOCALIZEDTEXT_STATIC("Views");
  421. views->description = UA_LOCALIZEDTEXT_STATIC("Views");
  422. AddReference((UA_Node*)views, &(UA_ReferenceNode){RefTypeId_HasTypeDefinition, UA_FALSE, ObjTypeId_FolderType}, ns0);
  423. Namespace_insert(ns0,(UA_Node**)&views, NAMESPACE_INSERT_UNIQUE);
  424. // Server
  425. UA_ObjectNode *server;
  426. UA_ObjectNode_new(&server);
  427. server->nodeId = ObjId_Server.nodeId;
  428. server->nodeClass = UA_NODECLASS_OBJECT;
  429. server->browseName = UA_QUALIFIEDNAME_STATIC("Server");
  430. server->displayName = UA_LOCALIZEDTEXT_STATIC("Server");
  431. server->description = UA_LOCALIZEDTEXT_STATIC("Server");
  432. AddReference((UA_Node*)server, &(UA_ReferenceNode){RefTypeId_HasComponent, UA_FALSE, ObjId_ServerCapabilities}, ns0);
  433. AddReference((UA_Node*)server, &(UA_ReferenceNode){RefTypeId_HasComponent, UA_FALSE, ObjId_NamespaceArray}, ns0);
  434. AddReference((UA_Node*)server, &(UA_ReferenceNode){RefTypeId_HasProperty, UA_FALSE, ObjId_ServerStatus}, ns0);
  435. AddReference((UA_Node*)server, &(UA_ReferenceNode){RefTypeId_HasProperty, UA_FALSE, ObjId_ServerArray}, ns0);
  436. Namespace_insert(ns0,(UA_Node**)&server, NAMESPACE_INSERT_UNIQUE);
  437. // NamespaceArray
  438. UA_VariableNode *namespaceArray;
  439. UA_VariableNode_new(&namespaceArray);
  440. namespaceArray->nodeId = ObjId_NamespaceArray.nodeId;
  441. namespaceArray->nodeClass = UA_NODECLASS_VARIABLE; //FIXME: this should go into _new?
  442. namespaceArray->browseName = UA_QUALIFIEDNAME_STATIC("NamespaceArray");
  443. namespaceArray->displayName = UA_LOCALIZEDTEXT_STATIC("NamespaceArray");
  444. namespaceArray->description = UA_LOCALIZEDTEXT_STATIC("NamespaceArray");
  445. UA_Array_new((void**)&namespaceArray->value.data, 2, &UA_.types[UA_STRING]);
  446. namespaceArray->value.vt = &UA_.types[UA_STRING];
  447. namespaceArray->value.arrayLength = 2;
  448. UA_String_copycstring("http://opcfoundation.org/UA/",&((UA_String *)((namespaceArray->value).data))[0]);
  449. UA_String_copycstring("http://localhost:16664/open62541/",&((UA_String *)(((namespaceArray)->value).data))[1]);
  450. namespaceArray->arrayDimensionsSize = 1;
  451. UA_UInt32* dimensions = UA_NULL;
  452. UA_alloc((void**)&dimensions, sizeof(UA_UInt32));
  453. *dimensions = 2;
  454. namespaceArray->arrayDimensions = dimensions;
  455. namespaceArray->dataType = NS0NODEID(UA_STRING_NS0);
  456. namespaceArray->valueRank = 1;
  457. namespaceArray->minimumSamplingInterval = 1.0;
  458. namespaceArray->historizing = UA_FALSE;
  459. Namespace_insert(ns0,(UA_Node**)&namespaceArray, NAMESPACE_INSERT_UNIQUE);
  460. // ServerStatus
  461. UA_VariableNode *serverstatus;
  462. UA_VariableNode_new(&serverstatus);
  463. serverstatus->nodeId = ObjId_ServerStatus.nodeId;
  464. serverstatus->nodeClass = UA_NODECLASS_VARIABLE;
  465. serverstatus->browseName = UA_QUALIFIEDNAME_STATIC("ServerStatus");
  466. serverstatus->displayName = UA_LOCALIZEDTEXT_STATIC("ServerStatus");
  467. serverstatus->description = UA_LOCALIZEDTEXT_STATIC("ServerStatus");
  468. UA_ServerStatusDataType *status;
  469. UA_ServerStatusDataType_new(&status);
  470. status->startTime = UA_DateTime_now();
  471. status->currentTime = UA_DateTime_now();
  472. status->state = UA_SERVERSTATE_RUNNING;
  473. status->buildInfo = (UA_BuildInfo){
  474. .productUri = UA_STRING_STATIC("open62541.org"),
  475. .manufacturerName = UA_STRING_STATIC("open62541"),
  476. .productName = UA_STRING_STATIC("open62541"),
  477. .softwareVersion = UA_STRING_STATIC("0.0"),
  478. .buildNumber = UA_STRING_STATIC("0.0"),
  479. .buildDate = UA_DateTime_now()};
  480. status->secondsTillShutdown = 99999999;
  481. status->shutdownReason = UA_LOCALIZEDTEXT_STATIC("because");
  482. serverstatus->value.vt = &UA_.types[UA_SERVERSTATUSDATATYPE]; // gets encoded as an extensionobject
  483. serverstatus->value.arrayLength = 1;
  484. serverstatus->value.data = status;
  485. Namespace_insert(ns0,(UA_Node**)&serverstatus, NAMESPACE_INSERT_UNIQUE);
  486. // State (Component of ServerStatus)
  487. UA_VariableNode *state;
  488. UA_VariableNode_new(&state);
  489. state->nodeId = ObjId_State.nodeId;
  490. state->nodeClass = UA_NODECLASS_VARIABLE;
  491. state->browseName = UA_QUALIFIEDNAME_STATIC("State");
  492. state->displayName = UA_LOCALIZEDTEXT_STATIC("State");
  493. state->description = UA_LOCALIZEDTEXT_STATIC("State");
  494. state->value.vt = &UA_borrowed_.types[UA_SERVERSTATE];
  495. state->value.arrayLength = 1;
  496. state->value.data = &status->state; // points into the other object.
  497. Namespace_insert(ns0,(UA_Node**)&state, NAMESPACE_INSERT_UNIQUE);
  498. //TODO: free(namespaceArray->value.data) later or forget it
  499. /* UA_VariableNode* v = (UA_VariableNode*)np; */
  500. /* UA_Array_new((void**)&v->value.data, 2, &UA_.types[UA_STRING]); */
  501. /* v->value.vt = &UA_.types[UA_STRING]; */
  502. /* v->value.arrayLength = 2; */
  503. /* UA_String_copycstring("http://opcfoundation.org/UA/",&((UA_String *)((v->value).data))[0]); */
  504. /* UA_String_copycstring("http://localhost:16664/open62541/",&((UA_String *)(((v)->value).data))[1]); */
  505. /* v->dataType.encodingByte = UA_NODEIDTYPE_FOURBYTE; */
  506. /* v->dataType.identifier.numeric = UA_STRING_NS0; */
  507. /* v->valueRank = 1; */
  508. /* v->minimumSamplingInterval = 1.0; */
  509. /* v->historizing = UA_FALSE; */
  510. /* Namespace_insert(ns0,np); */
  511. /*******************/
  512. /* Namespace local */
  513. /*******************/
  514. // WORKS
  515. UA_ExpandedNodeId ObjId_temperature1 = (UA_ExpandedNodeId){.nodeId = (UA_NodeId){.encodingByte = UA_NODEIDTYPE_TWOBYTE, .namespace = 0, .identifier.numeric = 108}, .namespaceUri = {-1, ((void *)0)}, .serverIndex = 0};
  516. // temperature sensor
  517. UA_VariableNode *temperature1;
  518. UA_VariableNode_new(&temperature1);
  519. temperature1->nodeId = ObjId_temperature1.nodeId;
  520. temperature1->nodeClass = UA_NODECLASS_VARIABLE;
  521. temperature1->browseName = UA_QUALIFIEDNAME_STATIC("temperature1");
  522. temperature1->displayName = UA_LOCALIZEDTEXT_STATIC("temperature1");
  523. temperature1->description = UA_LOCALIZEDTEXT_STATIC("temperature1");
  524. //Set node value
  525. UA_Variant *tmpNodeValue = &temperature1->value;
  526. UA_Variant_init(tmpNodeValue);
  527. UA_Float *tmpFloat;
  528. UA_Float_new(&tmpFloat);
  529. *tmpFloat = -273.15f;
  530. tmpNodeValue->arrayDimensionsLength = 0;
  531. tmpNodeValue->arrayLength = 1;
  532. tmpNodeValue->data = (void*)tmpFloat;
  533. tmpNodeValue->vt = &UA_.types[UA_FLOAT];
  534. AddReference((UA_Node*)root, &(UA_ReferenceNode){RefTypeId_Organizes, UA_FALSE, ObjId_temperature1}, ns0);
  535. Namespace_insert(ns0,(UA_Node**)&temperature1, NAMESPACE_INSERT_UNIQUE);
  536. UA_ExpandedNodeId ObjId_redLED = (UA_ExpandedNodeId){.nodeId = (UA_NodeId){.encodingByte = UA_NODEIDTYPE_TWOBYTE, .namespace = 0, .identifier.numeric = 109}, .namespaceUri = {-1, ((void *)0)}, .serverIndex = 0};
  537. // redLED sensor
  538. UA_VariableNode *redLED;
  539. UA_VariableNode_new(&redLED);
  540. redLED->nodeId = ObjId_redLED.nodeId;
  541. redLED->nodeClass = UA_NODECLASS_VARIABLE;
  542. redLED->browseName = UA_QUALIFIEDNAME_STATIC("redLED");
  543. redLED->displayName = UA_LOCALIZEDTEXT_STATIC("redLED");
  544. redLED->description = UA_LOCALIZEDTEXT_STATIC("redLED");
  545. //Set node value
  546. UA_Variant *tmpNodeValue1 = &redLED->value;
  547. UA_Variant_init(tmpNodeValue1);
  548. UA_Boolean *ledVal;
  549. UA_Boolean_new(&ledVal);
  550. *ledVal = UA_FALSE;
  551. tmpNodeValue1->arrayDimensionsLength = 0;
  552. tmpNodeValue1->arrayLength = 1;
  553. tmpNodeValue1->data = (void*)ledVal;
  554. tmpNodeValue1->vt = &UA_.types[UA_BOOLEAN];
  555. AddReference((UA_Node*)root, &(UA_ReferenceNode){RefTypeId_Organizes, UA_FALSE, ObjId_redLED}, ns0);
  556. Namespace_insert(ns0,(UA_Node**)&redLED, NAMESPACE_INSERT_UNIQUE);
  557. UA_ExpandedNodeId ObjId_yellowLED = (UA_ExpandedNodeId){.nodeId = (UA_NodeId){.encodingByte = UA_NODEIDTYPE_TWOBYTE, .namespace = 0, .identifier.numeric = 110}, .namespaceUri = {-1, ((void *)0)}, .serverIndex = 0};
  558. // yellowLED sensor
  559. UA_VariableNode *yellowLED;
  560. UA_VariableNode_new(&yellowLED);
  561. yellowLED->nodeId = ObjId_yellowLED.nodeId;
  562. yellowLED->nodeClass = UA_NODECLASS_VARIABLE;
  563. yellowLED->browseName = UA_QUALIFIEDNAME_STATIC("yellowLED");
  564. yellowLED->displayName = UA_LOCALIZEDTEXT_STATIC("yellowLED");
  565. yellowLED->description = UA_LOCALIZEDTEXT_STATIC("yellowLED");
  566. //Set node value
  567. UA_Variant *tmpNodeValue2 = &yellowLED->value;
  568. UA_Variant_init(tmpNodeValue2);
  569. UA_Boolean *ledVal1;
  570. UA_Boolean_new(&ledVal1);
  571. *ledVal1 = UA_FALSE;
  572. tmpNodeValue2->arrayDimensionsLength = 0;
  573. tmpNodeValue2->arrayLength = 1;
  574. tmpNodeValue2->data = (void*)ledVal1;
  575. tmpNodeValue2->vt = &UA_.types[UA_BOOLEAN];
  576. AddReference((UA_Node*)root, &(UA_ReferenceNode){RefTypeId_Organizes, UA_FALSE, ObjId_yellowLED}, ns0);
  577. Namespace_insert(ns0,(UA_Node**)&yellowLED, NAMESPACE_INSERT_UNIQUE);
  578. Namespace_releaseManagedNode((const UA_Node*)root);
  579. #if defined(DEBUG) && defined(VERBOSE)
  580. uint32_t i;
  581. for (i=0;i < ns0->size;i++) {
  582. if (ns0->entries[i].node != UA_NULL) {
  583. printf("appMockup_init - entries[%d]={",i);
  584. UA_Node_print(ns0->entries[i].node, stdout);
  585. printf("}\n");
  586. }
  587. }
  588. #endif
  589. }