Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1.  
  2. #include "open62541.h"
  3.  
  4.  
  5. # include "open62541.h"
  6. # include <string.h>
  7. # include <stdlib.h>
  8.  
  9. #include <stdio.h>
  10. #include <mach/clock_types.h>
  11. #include <unistd.h>
  12. # define UA_sleep_ms(X) usleep(X * 1000)
  13. int main(int argc, char** argv) {
  14. UA_Client *client = UA_Client_new(UA_ClientConfig_default);
  15. UA_StatusCode retval = UA_Client_connect(client, "opc.tcp://192.168.5.4:4840");
  16. printf("Retval: %s\n", UA_StatusCode_name(retval));
  17. // UA_sleep_ms(UA_ClientConfig_default.secureChannelLifeTime+1);
  18.  
  19. UA_Variant val;
  20. UA_Variant_init(&val);
  21. UA_NodeId nodeId = UA_NODEID_NUMERIC(0, 2256);
  22. retval = UA_Client_readValueAttribute(client, nodeId, &val);
  23. printf("Retval: %s\n", UA_StatusCode_name(retval));
  24.  
  25. UA_Client_disconnect(client);
  26. UA_Client_delete(client);
  27. return (int) UA_STATUSCODE_GOOD;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement