Commit 1f2c1a59 authored by Ivan Tyagov's avatar Ivan Tyagov

Better defaults handling.

parent acd16fc5
......@@ -6,7 +6,8 @@ Keep alive implementation for couplers based on OPC UA's pub/sub mechanism
static unsigned int HEART_BEATS = 0;
// the heart beat interval$
static int HEART_BEAT_INTERVAL = 250;
const int DEFAULT_HEART_BEAT_INTERVAL = 250;
static int HEART_BEAT_INTERVAL = DEFAULT_HEART_BEAT_INTERVAL;
// the list of couplers onto which we depend for properly running
static char *HEART_BEAT_ID_LIST[20];
......
......@@ -120,7 +120,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
arguments->heart_beat = atoi (arg);
break;
case 't':
arguments->heart_beat_interval = atoi (arg);
arguments->heart_beat_interval = arg ? atoi (arg) : DEFAULT_HEART_BEAT_INTERVAL;
break;
case 'l':
arguments->heart_beat_id_list = arg;
......@@ -161,7 +161,8 @@ int main(int argc, char **argv)
arguments.password = "";
arguments.key = "";
arguments.certificate = "";
arguments.id = 0;
arguments.id = DEFAULT_ID;
arguments.heart_beat_interval = DEFAULT_HEART_BEAT_INTERVAL;
argp_parse(&argp, argc, argv, 0, 0, &arguments);
printf("Mode=%d\n", arguments.mode);
......
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