Sfoglia il codice sorgente

Add internal UA_Server_writeWithSession

Julius Pfrommer 6 anni fa
parent
commit
c4d7f1285b
2 ha cambiato i file con 15 aggiunte e 0 eliminazioni
  1. 6 0
      src/server/ua_server_internal.h
  2. 9 0
      src/server/ua_services_attribute.c

+ 6 - 0
src/server/ua_server_internal.h

@@ -265,6 +265,12 @@ getTypeHierarchy(UA_Nodestore *ns, const UA_NodeId *leafType,
  * on the stack and returned. */
 const UA_Node * getNodeType(UA_Server *server, const UA_Node *node);
 
+/* Write a node attribute with a defined session */
+UA_StatusCode
+UA_Server_writeWithSession(UA_Server *server, UA_Session *session,
+                           const UA_WriteValue *value);
+
+
 /* Many services come as an array of operations. This function generalizes the
  * processing of the operations. */
 typedef void (*UA_ServiceOperation)(UA_Server *server, UA_Session *session,

+ 9 - 0
src/server/ua_services_attribute.c

@@ -1342,6 +1342,15 @@ Service_Write(UA_Server *server, UA_Session *session,
                                            &response->resultsSize, &UA_TYPES[UA_TYPES_STATUSCODE]);
 }
 
+UA_StatusCode
+UA_Server_writeWithSession(UA_Server *server, UA_Session *session,
+                           const UA_WriteValue *value) {
+    return UA_Server_editNode(server, session, &value->nodeId,
+                              (UA_EditNodeCallback)copyAttributeIntoNode,
+                              /* casting away const qualifier because callback uses const anyway */
+                              (UA_WriteValue *)(uintptr_t)value);
+}
+
 UA_StatusCode
 UA_Server_write(UA_Server *server, const UA_WriteValue *value) {
     UA_StatusCode retval =