mirror of
https://github.com/craigerl/aprsd.git
synced 2026-08-16 00:23:34 -04:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 062f3caf83 | |||
| 9ac9835541 | |||
| c68b270ee2 | |||
| 38725907f3 |
@@ -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
|
||||
|
||||
@@ -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
@@ -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
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user