Commit a66444c7 authored by Ivan Tyagov's avatar Ivan Tyagov

Support all couplers current coupler depend on, not just the first one.

parent 33fe6425
......@@ -177,6 +177,7 @@ void handleCLI(int argc, char **argv) {
printf("Heart beat interval=%d ms\n", arguments.heart_beat_interval);
printf("Heart beat timeout interval=%d ms\n", arguments.heart_beat_timeout_interval);
printf("Heart beat ID list=%s\n", arguments.heart_beat_id_list);
printf("Heart beat ID list count=%d\n", HEART_BEAT_ID_LIST_COUNT);
printf("Network address URL data type=%s\n", arguments.network_address_url_data_type);
printf("Network interface=%s\n", arguments.network_interface);
......@@ -219,6 +220,8 @@ void handleCLI(int argc, char **argv) {
// from CLI we get a comma separated list on INTs representing coupler' ID
result = strtol(tk, &eptr, 16);
HEART_BEAT_ID_LIST[i++] = result;
// add to counter
HEART_BEAT_ID_LIST_COUNT += 1;
// enable heart beat checks
ENABLE_HEART_BEAT_CHECK = true;
tk = strtok(NULL, ",");
......
......@@ -59,6 +59,9 @@ static int HEART_BEAT_TIMEOUT_INTERVAL = DEFAULT_HEART_BEAT_TIMEOUT_INTERVAL;
// assume maximum of 127 couplers!
unsigned int HEART_BEAT_ID_LIST[127] = {0};
// the count of all couplers we depend on.
unsigned int HEART_BEAT_ID_LIST_COUNT = 0;
// the interval for publishing messages
static int PUBLISHING_INTERVAL = 10;
......
......@@ -65,7 +65,15 @@ static void dataChangeNotificationCallback(UA_Server *server, UA_UInt32 monitore
coupler_id = (int) heart_beat;
// it is completely normal to have same multicast group keep alive
// messages from different couplers thus filter and leave ones we care for
bool is_coupler_id_interesting = (coupler_id == HEART_BEAT_ID_LIST[0]);
bool is_coupler_id_interesting = false;
for (int i = 0; i < HEART_BEAT_ID_LIST_COUNT; i++) {
if (coupler_id == HEART_BEAT_ID_LIST[i]){
// we care for this ID
is_coupler_id_interesting = true;
break;
}
}
if ((coupler_id!=(unsigned int)COUPLER_ID) && (is_coupler_id_interesting)){
/*UA_LOG_INFO(UA_Log_Stdout,
UA_LOGCATEGORY_USERLAND,
......
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