Add visual or audible alert support on connect/disconnect

The feature is detailed via the following option:

 --alert none|bell|blink

     Set alert action on connect/disconnect.

     It will sound the bell once or blink once on successful connect.
     Likewise it will sound the bell twice or blink twice on disconnect.

     Default value is "none" for no alert.
This commit is contained in:
Martin Lund 2022-09-10 22:27:31 +02:00
parent 68fc159654
commit dbc9a8e82d
12 changed files with 195 additions and 7 deletions

View file

@ -51,6 +51,8 @@
#include "socket.h"
#include "setspeed.h"
#include "rs485.h"
#include "alert.h"
#include "misc.h"
#ifdef __APPLE__
#define PATH_SERIAL_DEVICES "/dev/"
@ -950,6 +952,9 @@ void tty_disconnect(void)
flock(fd, LOCK_UN);
close(fd);
connected = false;
/* Fire alert action */
alert_disconnect();
}
}
@ -1066,6 +1071,9 @@ int tty_connect(void)
connected = true;
print_tainted = false;
/* Fire alert action */
alert_connect();
if (option.timestamp)
{
next_timestamp = true;