Commit 91d48e12 authored by Ivan Tyagov's avatar Ivan Tyagov

Do not subscribe to Pub/Sub in case we actually do not explicitly have...

Do not subscribe to Pub/Sub in case we actually do not explicitly have configured so. Printouts for better traceability.
parent 1b41b88f
......@@ -184,5 +184,7 @@ void handleCLI(int argc, char **argv) {
ENABLE_HEART_BEAT_CHECK = true;
tk = strtok(NULL, ",");
}
printf("Heart beat check=%d\n", ENABLE_HEART_BEAT_CHECK);
}
......@@ -138,7 +138,7 @@ void callbackTicHeartBeat()
{
/* Increase periodically heart beats of the server */
HEART_BEATS += 1;
//UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_USERLAND, "heart_beat %d", HEART_BEATS);
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_USERLAND, "\theart_beat %d", HEART_BEATS);
// set OPC UA's heat_beat node value
UA_NodeId myFloatNodeId = UA_NODEID_STRING(1, "heart_beat");
......@@ -158,7 +158,6 @@ void callbackTicHeartBeat()
char * end_ptr;
float final_result = strtof(result2, &end_ptr );
//printf( "final_result: %f\n", final_result );
UA_Float myFloat = final_result;
UA_Variant myVar;
......
......@@ -60,7 +60,7 @@ static void dataChangeNotificationCallback(UA_Server *server, UA_UInt32 monitore
if (coupler_id!=COUPLER_ID) {
UA_LOG_INFO(UA_Log_Stdout, \
UA_LOGCATEGORY_USERLAND, \
"HEART BEAT: %d", coupler_id);
"HEART BEAT: %d (%ld)", coupler_id, milli_seconds_now);
// convert coupler_id to str
char* coupler_id_str = convertInt2Str(coupler_id);
......
......@@ -178,7 +178,9 @@ int main(int argc, char **argv)
}
// enable subscribe to keep-alive messages
enableSubscribeToHeartBeat(server, config);
if (ENABLE_HEART_BEAT_CHECK) {
enableSubscribeToHeartBeat(server, config);
}
// run server
UA_StatusCode retval = UA_Server_run(server, &running);
......@@ -194,4 +196,4 @@ int main(int argc, char **argv)
return retval == UA_STATUSCODE_GOOD ? EXIT_SUCCESS : EXIT_FAILURE;
}
#endif
\ No newline at end of file
#endif
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