mirror of
https://github.com/craigerl/aprsd.git
synced 2025-09-03 05:37:52 -04: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,
|
show_envvar=True,
|
||||||
help="the APRS-IS password for APRS_LOGIN",
|
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("tocallsign")
|
||||||
@click.argument("command", nargs=-1)
|
@click.argument("command", nargs=-1)
|
||||||
def send_message(
|
def send_message(
|
||||||
@ -234,6 +242,7 @@ def send_message(
|
|||||||
config_file,
|
config_file,
|
||||||
aprs_login,
|
aprs_login,
|
||||||
aprs_password,
|
aprs_password,
|
||||||
|
no_ack,
|
||||||
tocallsign,
|
tocallsign,
|
||||||
command,
|
command,
|
||||||
):
|
):
|
||||||
@ -297,7 +306,11 @@ def send_message(
|
|||||||
if got_ack and got_response:
|
if got_ack and got_response:
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
try:
|
||||||
cl = client.Client(config)
|
cl = client.Client(config)
|
||||||
|
cl.setup_connection()
|
||||||
|
except LoginError:
|
||||||
|
sys.exit(-1)
|
||||||
|
|
||||||
# Send a message
|
# Send a message
|
||||||
# then we setup a consumer to rx messages
|
# then we setup a consumer to rx messages
|
||||||
@ -307,6 +320,9 @@ def send_message(
|
|||||||
msg = messaging.TextMessage(aprs_login, tocallsign, command)
|
msg = messaging.TextMessage(aprs_login, tocallsign, command)
|
||||||
msg.send_direct()
|
msg.send_direct()
|
||||||
|
|
||||||
|
if no_ack:
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# This will register a packet consumer with aprslib
|
# This will register a packet consumer with aprslib
|
||||||
# When new packets come in the consumer will process
|
# When new packets come in the consumer will process
|
||||||
|
Loading…
x
Reference in New Issue
Block a user