Commit 211bcc7a authored by Ivan Tyagov's avatar Ivan Tyagov

Use constants.

parent 223dc70f
...@@ -4,6 +4,12 @@ Keep alive implementation for couplers based on OPC UA's pub/sub mechanism ...@@ -4,6 +4,12 @@ Keep alive implementation for couplers based on OPC UA's pub/sub mechanism
// both publisher and subscriber should use same publisher id // both publisher and subscriber should use same publisher id
const int PUBLISHER_ID = 2234; const int PUBLISHER_ID = 2234;
// the interval for publishing messages
const int PUBLISHING_INTERVAL = 100;
// a hard coded writer group (should be same for publisher / subscriber)
const int WRITER_GROUP_ID = 100;
UA_NodeId connectionIdent, publishedDataSetIdent, writerGroupIdent; UA_NodeId connectionIdent, publishedDataSetIdent, writerGroupIdent;
static void addPubSubConnection(UA_Server *server, UA_String *transportProfile, static void addPubSubConnection(UA_Server *server, UA_String *transportProfile,
...@@ -52,9 +58,9 @@ static void addWriterGroup(UA_Server *server) { ...@@ -52,9 +58,9 @@ static void addWriterGroup(UA_Server *server) {
UA_WriterGroupConfig writerGroupConfig; UA_WriterGroupConfig writerGroupConfig;
memset(&writerGroupConfig, 0, sizeof(UA_WriterGroupConfig)); memset(&writerGroupConfig, 0, sizeof(UA_WriterGroupConfig));
writerGroupConfig.name = UA_STRING("Demo WriterGroup"); writerGroupConfig.name = UA_STRING("Demo WriterGroup");
writerGroupConfig.publishingInterval = 100; writerGroupConfig.publishingInterval = PUBLISHING_INTERVAL;
writerGroupConfig.enabled = UA_FALSE; writerGroupConfig.enabled = UA_FALSE;
writerGroupConfig.writerGroupId = 100; writerGroupConfig.writerGroupId = WRITER_GROUP_ID;
writerGroupConfig.encodingMimeType = UA_PUBSUB_ENCODING_UADP; writerGroupConfig.encodingMimeType = UA_PUBSUB_ENCODING_UADP;
writerGroupConfig.messageSettings.encoding = UA_EXTENSIONOBJECT_DECODED; writerGroupConfig.messageSettings.encoding = UA_EXTENSIONOBJECT_DECODED;
writerGroupConfig.messageSettings.content.decoded.type = &UA_TYPES[UA_TYPES_UADPWRITERGROUPMESSAGEDATATYPE]; writerGroupConfig.messageSettings.content.decoded.type = &UA_TYPES[UA_TYPES_UADPWRITERGROUPMESSAGEDATATYPE];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment