Explorar el Código

allow local writing of datatype, valuerank, array dimensions

Julius Pfrommer hace 8 años
padre
commit
512a317922
Se han modificado 1 ficheros con 23 adiciones y 8 borrados
  1. 23 8
      include/ua_server.h

+ 23 - 8
include/ua_server.h

@@ -30,6 +30,8 @@ extern "C" {
 #include "ua_connection.h"
 
 /**
+ * .. _server:
+ *
  * Server
  * ======
  *
@@ -382,13 +384,6 @@ UA_Server_readExecutable(UA_Server *server, const UA_NodeId nodeId,
  * - UserAccessLevel
  * - UserExecutable
  *
- * The following attributes are currently taken from the value variant and not
- * stored separately in the nodes:
- *
- * - DataType
- * - ValueRank
- * - ArrayDimensions
- *
  * Historizing is currently unsupported */
 /* Overwrite an attribute of a node. The specialized functions below provide a
  * more concise syntax.
@@ -466,6 +461,27 @@ UA_Server_writeValue(UA_Server *server, const UA_NodeId nodeId,
                              &UA_TYPES[UA_TYPES_VARIANT], &value);
 }
 
+static UA_INLINE UA_StatusCode
+UA_Server_writeDataType(UA_Server *server, const UA_NodeId nodeId,
+                        const UA_NodeId dataType) {
+    return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_DATATYPE,
+                             &UA_TYPES[UA_TYPES_NODEID], &dataType);
+}
+
+static UA_INLINE UA_StatusCode
+UA_Server_writeValueRank(UA_Server *server, const UA_NodeId nodeId,
+                         const UA_Int32 valueRank) {
+    return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_VALUERANK,
+                             &UA_TYPES[UA_TYPES_INT32], &valueRank);
+}
+
+static UA_INLINE UA_StatusCode
+UA_Server_writeArrayDimensions(UA_Server *server, const UA_NodeId nodeId,
+                               const UA_Variant arrayDimensions) {
+    return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_VALUE,
+                             &UA_TYPES[UA_TYPES_VARIANT], &arrayDimensions);
+}
+
 static UA_INLINE UA_StatusCode
 UA_Server_writeAccessLevel(UA_Server *server, const UA_NodeId nodeId,
                            const UA_UInt32 accessLevel) {
@@ -655,7 +671,6 @@ UA_Server_setMethodNode_callback(UA_Server *server, const UA_NodeId methodNodeId
  * contain the nodeId of the new node. You may also pass NULL pointer if this
  * result is not relevant. The namespace index for nodes you create should never
  * be 0, as that index is reserved for OPC UA's self-description (namespace 0). */
-
 /* The instantiation callback is used to track the addition of new nodes. It is
  * also called for all sub-nodes contained in an object or variable type node
  * that is instantiated. */