1
0
mirror of https://github.com/craigerl/aprsd.git synced 2026-08-16 00:23:34 -04:00

Compare commits

...

4 Commits

Author SHA1 Message Date
hemna 062f3caf83 3.0.1 2023-01-14 12:56:03 -05:00
hemna 9ac9835541 Merge pull request #109 from craigerl/reject_packet
Add support for Reject messages.
2023-01-14 12:53:19 -05:00
hemna c68b270ee2 Add support to Reject messages.
This patch adds support for receiving reject messages.
2023-01-14 12:41:22 -05:00
hemna 38725907f3 Update Docker builds for 3.0.0 2023-01-09 11:54:50 -05:00
5 changed files with 46 additions and 4 deletions
+7
View File
@@ -1,9 +1,16 @@
CHANGES
=======
v3.0.1
------
* Add support to Reject messages
* Update Docker builds for 3.0.0
v3.0.0
------
* Update Changelog for 3.0.0
* Ensure server command main thread doesn't exit
* Fixed save directory default
* Fixed pep8 failure
+21
View File
@@ -18,6 +18,7 @@ LOG = logging.getLogger("APRSD")
PACKET_TYPE_MESSAGE = "message"
PACKET_TYPE_ACK = "ack"
PACKET_TYPE_REJECT = "reject"
PACKET_TYPE_MICE = "mic-e"
PACKET_TYPE_WX = "weather"
PACKET_TYPE_OBJECT = "object"
@@ -209,6 +210,23 @@ class AckPacket(PathPacket):
)
@dataclass
class RejectPacket(PathPacket):
response: str = None
def __post__init__(self):
if self.response:
LOG.warning("Response set!")
def _build_raw(self):
"""Build the self.raw which is what is sent over the air."""
self.raw = "{}>APZ100::{} :rej{}".format(
self.from_call,
self.to_call.ljust(9),
self.msgNo,
)
@dataclass
class MessagePacket(PathPacket):
message_text: str = None
@@ -469,6 +487,7 @@ TYPE_LOOKUP = {
PACKET_TYPE_WX: WeatherPacket,
PACKET_TYPE_MESSAGE: MessagePacket,
PACKET_TYPE_ACK: AckPacket,
PACKET_TYPE_REJECT: RejectPacket,
PACKET_TYPE_MICE: MicEPacket,
PACKET_TYPE_OBJECT: ObjectPacket,
PACKET_TYPE_STATUS: StatusPacket,
@@ -485,6 +504,8 @@ def get_packet_type(packet: dict):
packet_type = "unknown"
if pkt_format == "message" and msg_response == "ack":
packet_type = PACKET_TYPE_ACK
elif pkt_format == "message" and msg_response == "rej":
packet_type = PACKET_TYPE_REJECT
elif pkt_format == "message":
packet_type = PACKET_TYPE_MESSAGE
elif pkt_format == "mic-e":
+13 -1
View File
@@ -87,11 +87,18 @@ class APRSDProcessPacketThread(APRSDThread):
self._loop_cnt = 1
def process_ack_packet(self, packet):
"""We got an ack for a message, no need to resend it."""
ack_num = packet.msgNo
LOG.info(f"Got ack for message {ack_num}")
pkt_tracker = packets.PacketTrack()
pkt_tracker.remove(ack_num)
return
def process_reject_packet(self, packet):
"""We got a reject message for a packet. Stop sending the message."""
ack_num = packet.msgNo
LOG.info(f"Got REJECT for message {ack_num}")
pkt_tracker = packets.PacketTrack()
pkt_tracker.remove(ack_num)
def loop(self):
try:
@@ -124,6 +131,11 @@ class APRSDProcessPacketThread(APRSDThread):
and packet.addresse.lower() == our_call
):
self.process_ack_packet(packet)
elif (
isinstance(packet, packets.RejectPacket)
and packet.addresse.lower() == our_call
):
self.process_reject_packet(packet)
else:
# Only ack messages that were sent directly to us
if isinstance(packet, packets.MessagePacket):
+4 -2
View File
@@ -6,7 +6,7 @@ FROM ubuntu:22.04 as aprsd
ARG UID
ARG GID
ARG TZ
ARG VERSION=2.6.0
ARG VERSION=3.0.0
ARG BUILDX_QEMU_ENV
ENV APRS_USER=aprs
ENV HOME=/home/aprs
@@ -24,6 +24,8 @@ RUN apt install -y git build-essential
RUN apt install -y libffi-dev python3-dev libssl-dev libxml2-dev libxslt-dev
RUN apt install -y python3 python3-pip python3-dev python3-lxml
RUN pip3 install -U pip
RUN addgroup --gid $GID $APRS_USER
RUN useradd -m -u $UID -g $APRS_USER $APRS_USER
@@ -36,7 +38,7 @@ RUN if [ "${BUILDX_QEMU_ENV}" = "true" -a "$(getconf LONG_BIT)" = "32" ]; then \
fi
# Install aprsd
RUN pip install aprsd==$APRSD_PIP_VERSION
RUN pip3 install aprsd==$APRSD_PIP_VERSION
# Ensure /config is there with a default config file
USER root
+1 -1
View File
@@ -25,7 +25,7 @@ DEV=0
REBUILD_BUILDX=0
TAG="latest"
BRANCH=${BRANCH:-master}
VERSION="2.6.0"
VERSION="3.0.0"
while getopts “hdart:b:v:” OPTION
do