From 90c4c6c59dbfc773087111c1a6a73e04c9883d23 Mon Sep 17 00:00:00 2001 From: Hemna Date: Tue, 12 Jan 2021 11:18:17 -0500 Subject: [PATCH] Added send-message login checking and --no-ack This patch adds the login failure checking for the send-message command as well as a new command line option --no-ack. The new option enables sending the message directly to aprs-is servers and then exiting immediately. It doesn't wait for an ack to come back. --- aprsd/main.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/aprsd/main.py b/aprsd/main.py index 1b3fb89..c35849d 100644 --- a/aprsd/main.py +++ b/aprsd/main.py @@ -226,6 +226,14 @@ def sample_config(): show_envvar=True, help="the APRS-IS password for APRS_LOGIN", ) +@click.option( + "--no-ack", + "-n", + is_flag=True, + show_default=True, + default=False, + help="Don't wait for an ack, just sent it to APRS-IS and bail.", +) @click.argument("tocallsign") @click.argument("command", nargs=-1) def send_message( @@ -234,6 +242,7 @@ def send_message( config_file, aprs_login, aprs_password, + no_ack, tocallsign, command, ): @@ -297,7 +306,11 @@ def send_message( if got_ack and got_response: sys.exit(0) - cl = client.Client(config) + try: + cl = client.Client(config) + cl.setup_connection() + except LoginError: + sys.exit(-1) # Send a message # then we setup a consumer to rx messages @@ -307,6 +320,9 @@ def send_message( msg = messaging.TextMessage(aprs_login, tocallsign, command) msg.send_direct() + if no_ack: + sys.exit(0) + try: # This will register a packet consumer with aprslib # When new packets come in the consumer will process