Browse Source

added several variables into ns0 and fixed bugs in addNodes implementation. references are now named in ns0

FlorianPalm 10 years ago
parent
commit
8c4f2a2cff

+ 1 - 0
examples/opcuaServer.c

@@ -71,6 +71,7 @@ int main(int argc, char** argv) {
 	UA_NodeStore_registerReadNodesOperation(&newNodeStore,open62541NodeStore_ReadNodes);
 	UA_NodeStore_registerBrowseNodesOperation(&newNodeStore,open62541NodeStore_BrowseNodes);
 	UA_NodeStore_registerAddNodesOperation(&newNodeStore,open62541NodeStore_AddNodes);
+	//register more operations/ services
 	//UA_NodeStore_registerWriteNodesOperation(&newNodeStore,writeNodes);
 	UA_Server_init(&server, &endpointUrl);
 

+ 1 - 0
include/ua_server.h

@@ -48,6 +48,7 @@ typedef struct open62541NodeStore open62541NodeStore;
 typedef struct UA_Namespace
 {
 	UA_UInt16 index;
+	UA_String url;
 	UA_NodeStore *nodeStore;
 }UA_Namespace;
 

+ 6 - 3
src/server/nodestore/open62541_nodestore_nodemanagement.c

@@ -210,7 +210,7 @@ UA_Int32 open62541NodeStore_AddNodes(UA_AddNodesItem *nodesToAdd,UA_UInt32 *indi
 		//todo what if node is in another namespace, readrequest to test, if it exists?
 		open62541NodeStore *ns = open62541NodeStore_getNodeStore();
 		if (open62541NodeStore_get(ns, &nodesToAdd->parentNodeId.nodeId,
-				&parent) != UA_STATUSCODE_GOOD && !isRootNode(&nodesToAdd->parentNodeId.nodeId)) {
+				&parent) != UA_STATUSCODE_GOOD && !isRootNode(&nodesToAdd->requestedNewNodeId.nodeId)) {
 			addNodesResults[indices[i]].statusCode = UA_STATUSCODE_BADPARENTNODEIDINVALID;
 			continue;
 		}
@@ -263,8 +263,11 @@ UA_Int32 open62541NodeStore_AddNodes(UA_AddNodesItem *nodesToAdd,UA_UInt32 *indi
 			}
 			case UA_NODECLASS_VARIABLE:
 			{
-				addNodesResults[indices[i]].statusCode = UA_STATUSCODE_BADNOTIMPLEMENTED;
-				continue;
+				UA_VariableAttributes attributes;
+				UA_VariableNode_new((UA_VariableNode**)&newNode);
+				newNode->nodeClass = UA_NODECLASS_VARIABLE;
+				UA_VariableAttributes_decodeBinary(&nodesToAdd[indices[i]].nodeAttributes.body,&offset,&attributes);
+				UA_VariableNode_setAttributes((UA_VariableAttributes*)&attributes,(UA_VariableNode*)newNode);
 				break;
 			}
 			case UA_NODECLASS_VARIABLETYPE:

File diff suppressed because it is too large
+ 862 - 689
src/server/ua_server.c