Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "open62541.h"
- # include "open62541.h"
- # include <string.h>
- # include <stdlib.h>
- #include <stdio.h>
- #include <mach/clock_types.h>
- #include <unistd.h>
- # define UA_sleep_ms(X) usleep(X * 1000)
- int main(int argc, char** argv) {
- UA_Client *client = UA_Client_new(UA_ClientConfig_default);
- UA_StatusCode retval = UA_Client_connect(client, "opc.tcp://192.168.5.4:4840");
- printf("Retval: %s\n", UA_StatusCode_name(retval));
- // UA_sleep_ms(UA_ClientConfig_default.secureChannelLifeTime+1);
- UA_Variant val;
- UA_Variant_init(&val);
- UA_NodeId nodeId = UA_NODEID_NUMERIC(0, 2256);
- retval = UA_Client_readValueAttribute(client, nodeId, &val);
- printf("Retval: %s\n", UA_StatusCode_name(retval));
- UA_Client_disconnect(client);
- UA_Client_delete(client);
- return (int) UA_STATUSCODE_GOOD;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement