Sfoglia il codice sorgente

further tries to fixup namespaceArray -> returned error: "Read NamespaceArray failed with status code BadNodeIdUnknown for item 0". A bytwise compare with connection to a working server is needed

Stasik0 10 anni fa
parent
commit
f46132f43d
1 ha cambiato i file con 7 aggiunte e 5 eliminazioni
  1. 7 5
      src/ua_application.c

+ 7 - 5
src/ua_application.c

@@ -163,13 +163,15 @@ void appMockup_init() {
 	namespaceArray->displayName = (UA_LocalizedText){{2,"EN"},{13, "NamespaceArray"}};
 	namespaceArray->description = (UA_LocalizedText){{2,"EN"},{13, "NamespaceArray"}};
 	//FIXME: can we avoid new here?
-	UA_Array_new((void**)&namespaceArray->value.data, 1, &UA_.types[UA_STRING]);
+	UA_Array_new((void**)&namespaceArray->value.data, 2, &UA_.types[UA_STRING]);
 	namespaceArray->value.vt = &UA_.types[UA_STRING];
-	namespaceArray->value.arrayLength = 1;
+	namespaceArray->value.arrayLength = 2;
 	UA_String_copycstring("http://opcfoundation.org/UA/",&((UA_String *)((namespaceArray->value).data))[0]);
-	//UA_String_copycstring("http://localhost:16664/open62541/",&((UA_String *)(((namespaceArray)->value).data))[1]);
-	namespaceArray->dataType.encodingByte = UA_NODEIDTYPE_FOURBYTE;
-	namespaceArray->dataType.identifier.numeric = UA_STRING_NS0;
+	UA_String_copycstring("http://localhost:16664/open62541/",&((UA_String *)(((namespaceArray)->value).data))[1]);
+	namespaceArray->arrayDimensionsSize = 1;
+	UA_Int32 dimensions = 2;
+	namespaceArray->arrayDimensions = &dimensions;
+	namespaceArray->dataType = NS0NODEID(UA_STRING_NS0);
 	namespaceArray->valueRank = 1;
 	namespaceArray->minimumSamplingInterval = 1.0;
 	namespaceArray->historizing = UA_FALSE;