mirror of
https://github.com/craigerl/aprsd.git
synced 2024-12-19 08:05:56 -05:00
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.
This commit is contained in:
parent
bdeaf6348a
commit
90c4c6c59d
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user