1
0
mirror of https://github.com/craigerl/aprsd.git synced 2024-11-04 16:01:15 -05:00

Rebased from master

This commit is contained in:
Hemna 2021-08-30 13:34:25 -04:00
parent b53e2ba7fe
commit 54c9a6b55a
3 changed files with 13 additions and 8 deletions

View File

@ -5,8 +5,10 @@ from aioax25 import frame as axframe
from aioax25 import interface from aioax25 import interface
from aioax25 import kiss as kiss from aioax25 import kiss as kiss
from aioax25.aprs import APRSInterface from aioax25.aprs import APRSInterface
from aprsd import trace from aprsd import trace
LOG = logging.getLogger("APRSD") LOG = logging.getLogger("APRSD")

View File

@ -37,7 +37,8 @@ import click_completion
# local imports here # local imports here
import aprsd import aprsd
from aprsd import ( from aprsd import (
client, flask, kissclient, messaging, packets, plugin, stats, threads, trace, utils, client, flask, kissclient, messaging, packets, plugin, stats, threads,
trace, utils,
) )
@ -500,12 +501,12 @@ def server(
if kissclient.KISSClient.kiss_enabled(config): if kissclient.KISSClient.kiss_enabled(config):
kcl = kissclient.KISSClient(config=config) kcl = kissclient.KISSClient(config=config)
# This initializes the client object.
kcl.client kcl.client
kissrx_thread = threads.KISSRXThread(msg_queues=msg_queues, config=config) kissrx_thread = threads.KISSRXThread(msg_queues=threads.msg_queues, config=config)
kissrx_thread.start() kissrx_thread.start()
messaging.MsgTrack().restart() messaging.MsgTrack().restart()
keepalive = threads.KeepAliveThread(config=config) keepalive = threads.KeepAliveThread(config=config)

View File

@ -8,7 +8,9 @@ import tracemalloc
import aprslib import aprslib
from aprsd import client, kissclient, messaging, packets, plugin, stats, utils from aprsd import (
client, kissclient, messaging, packets, plugin, stats, trace, utils,
)
LOG = logging.getLogger("APRSD") LOG = logging.getLogger("APRSD")
@ -363,10 +365,10 @@ class KISSRXThread(APRSDThread):
def process_packet(self, interface, frame, match): def process_packet(self, interface, frame, match):
"""Process a packet recieved from aprs-is server.""" """Process a packet recieved from aprs-is server."""
LOG.debug("Got an APRS Frame '{}'".format(frame)) LOG.debug(f"Got an APRS Frame '{frame}'")
payload = str(frame.payload.decode()) payload = str(frame.payload.decode())
msg = "{}:{}".format(str(frame.header), payload) msg = f"{str(frame.header)}:{payload}"
packet = aprslib.parse(msg) packet = aprslib.parse(msg)
LOG.debug(packet) LOG.debug(packet)
@ -418,7 +420,7 @@ class KISSRXThread(APRSDThread):
# us that they processed the message correctly, but have # us that they processed the message correctly, but have
# nothing to reply with, so we avoid replying with a usage string # nothing to reply with, so we avoid replying with a usage string
if reply is not messaging.NULL_MESSAGE: if reply is not messaging.NULL_MESSAGE:
LOG.debug("Sending '{}'".format(reply)) LOG.debug(f"Sending '{reply}'")
msg = messaging.TextMessage( msg = messaging.TextMessage(
self.config["aprs"]["login"], self.config["aprs"]["login"],
@ -469,7 +471,7 @@ class KISSRXThread(APRSDThread):
def process_ack_packet(self, packet): def process_ack_packet(self, packet):
ack_num = packet.get("msgNo") ack_num = packet.get("msgNo")
LOG.info("Got ack for message {}".format(ack_num)) LOG.info(f"Got ack for message {ack_num}")
messaging.log_message( messaging.log_message(
"ACK", "ACK",
packet["raw"], packet["raw"],