Commit 725eedf8 authored by Ivan Tyagov's avatar Ivan Tyagov

Define once, use N times.

parent 6f0a1c34
// a hard coded writer group, data set and publisher ID$
// (should be same for publisher / subscriber)$
const int WRITER_GROUP_ID = 100;
const int DATASET_WRITER_ID = 62541;
const int PUBLISHER_ID = 2234;
......@@ -2,6 +2,8 @@
Keep alive implementation for couplers based on OPC UA's pub/sub mechanism
*/
#include "keep_alive.h"
// global HEART BEATs of coupler$
static unsigned int HEART_BEATS = 0;
......@@ -15,12 +17,6 @@ unsigned int HEART_BEAT_ID_LIST[] = {0, 0, 0, 0, 0, 0, 0, 0};
// the interval for publishing messages
const int PUBLISHING_INTERVAL = 100;
// a hard coded writer group, data set and publisher ID
// (should be same for publisher / subscriber)
const int WRITER_GROUP_ID = 100;
const int DATASET_WRITER_ID = 62541;
const int PUBLISHER_ID = 2234;
UA_NodeId connectionIdent, publishedDataSetIdent, writerGroupIdent;
static void addPubSubConnection(UA_Server *server, UA_String *transportProfile,
......
......@@ -40,8 +40,7 @@ static void dataChangeNotificationCallback(UA_Server *server, UA_UInt32 monitore
// filter out heart_beat from Data Set
if(UA_Variant_hasScalarType(&var->value, &UA_TYPES[UA_TYPES_FLOAT])) {
float heart_beat = *(UA_Float*) var->value.data;
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_USERLAND,
"heart_beat = %f", heart_beat);
//UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_USERLAND, "heart_beat = %f", heart_beat);
}
}
......@@ -115,11 +114,11 @@ static UA_StatusCode addDataSetReader(UA_Server *server) {
/* The following parameters are used to show that the data published by
* tutorial_pubsub_publish.c is being subscribed and is being updated in
* the information model */
UA_UInt16 publisherIdentifier = 2234;
UA_UInt16 publisherIdentifier = PUBLISHER_ID;
readerConfig.publisherId.type = &UA_TYPES[UA_TYPES_UINT16];
readerConfig.publisherId.data = &publisherIdentifier;
readerConfig.writerGroupId = 100;
readerConfig.dataSetWriterId = 62541;
readerConfig.writerGroupId = WRITER_GROUP_ID;
readerConfig.dataSetWriterId = DATASET_WRITER_ID;
/* Setting up Meta data configuration in DataSetReader */
fillTestDataSetMetaData(&readerConfig.dataSetMetaData);
......
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