Browse Source

adapt the example in the readme; fix a macro redefinition edge-case

Julius Pfrommer 8 years ago
parent
commit
755a9a2f8f
2 changed files with 5 additions and 3 deletions
  1. 3 3
      README.md
  2. 2 0
      include/ua_config.h.in

+ 3 - 3
README.md

@@ -72,7 +72,7 @@ int main(int argc, char** argv)
 
     /* 3) add the variable */
     UA_Server_addVariableNode(server, newNodeId, parentNodeId, parentReferenceNodeId,
-                              browseName, variableType, attr, NULL);
+                              browseName, variableType, attr, NULL, NULL);
 
     /* run the server loop */
     UA_StatusCode retval = UA_Server_run(server, &running);
@@ -94,7 +94,7 @@ int main(int argc, char *argv[])
     UA_StatusCode retval = UA_Client_connect(client, "opc.tcp://localhost:16664");
     if(retval != UA_STATUSCODE_GOOD) {
         UA_Client_delete(client);
-    	return retval;
+        return retval;
     }
 
     /* create a readrequest with one entry */
@@ -102,7 +102,7 @@ int main(int argc, char *argv[])
     UA_ReadRequest_init(&req);
     req.nodesToRead = UA_Array_new(1, &UA_TYPES[UA_TYPES_READVALUEID]);
     req.nodesToReadSize = 1;
-    
+
     /* define the node and attribute to be read */
     req.nodesToRead[0].nodeId = UA_NODEID_STRING_ALLOC(1, "the.answer");
     req.nodesToRead[0].attributeId = UA_ATTRIBUTEID_VALUE;

+ 2 - 0
include/ua_config.h.in

@@ -22,6 +22,8 @@ extern "C" {
 
 #ifndef _XOPEN_SOURCE
 # define _XOPEN_SOURCE 500
+#endif
+#ifndef _DEFAULT_SOURCE
 # define _DEFAULT_SOURCE
 #endif