This shows you the differences between two versions of the page.
sdk:scripts:opcua-read [2015/07/07 06:55] – created moll | sdk:scripts:opcua-read [2022/09/05 12:10] (current) – schmitt | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== SDK Script opcua-read.are ====== | ====== SDK Script opcua-read.are ====== | ||
<code c opcua-read.are> | <code c opcua-read.are> | ||
- | /* DESC: This script will read the Value from a Node at a OPC-UA-Server. | + | /* DESC: This script will read the node value at a OPC-UA |
- | * Copyright (C) 2012 NetModule AG | + | * Copyright (C) 2015 NetModule AG, Switzerland |
*/ | */ | ||
- | void usage () { | + | void usage () |
- | printf(" | + | { |
+ | printf(" | ||
exit(1); | exit(1); | ||
} | } | ||
Line 14: | Line 15: | ||
} | } | ||
- | opcuaserver | + | server |
- | nodeIndex | + | port = (int) argv[2]; |
- | nodeId | + | nindex |
+ | nid = (int) argv[4]; | ||
- | client_0 | + | url = sprintf(" |
- | if(client_0 >= 0) { | + | |
- | ret = nb_opcua_read(client_0, nodeIndex, nodeId); | + | client |
- | if(ret < 0) { | + | if (client |
- | printf(" | + | printf(" |
- | } else { | + | exit(0); |
- | printf(" | + | } |
- | } | + | |
- | nb_opcua_disconnect(client_0); | + | value = nb_opcua_read(client, |
+ | if (is_void(value)) | ||
+ | printf(" | ||
} else { | } else { | ||
- | printf("could not connect to server %s\n", opcuaserver); | + | dump(value); |
} | } | ||
+ | |||
+ | nb_opcua_disconnect(client); | ||
exit(0); | exit(0); |