From 039c4d032e6bb3f3571cb85b262e4fb504ffcc91 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Thu, 25 Mar 2021 22:15:41 +0000 Subject: [PATCH 1/2] Add basic APRS support to ChirpChatDemod --- .../demodchirpchat/chirpchatdemod.cpp | 39 +++++++++++++++++++ plugins/feature/aprs/aprssettings.cpp | 4 +- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/plugins/channelrx/demodchirpchat/chirpchatdemod.cpp b/plugins/channelrx/demodchirpchat/chirpchatdemod.cpp index 51765c4e6..9c3f0c117 100644 --- a/plugins/channelrx/demodchirpchat/chirpchatdemod.cpp +++ b/plugins/channelrx/demodchirpchat/chirpchatdemod.cpp @@ -34,6 +34,7 @@ #include "dsp/dspcommands.h" #include "device/deviceapi.h" #include "feature/feature.h" +#include "util/ax25.h" #include "util/db.h" #include "maincore.h" @@ -188,6 +189,44 @@ bool ChirpChatDemod::handleMessage(const Message& cmd) getMessageQueueToGUI()->push(msgToGUI); } + // Is this an APRS packet? + // As per: https://github.com/oe3cjb/TTGO-T-Beam-LoRa-APRS/blob/master/lib/BG_RF95/BG_RF95.cpp + // There is a 3 byte header for LoRa APRS packets. Addressing follows in ASCII: srccall>dst: + // TODO: Should we check for valid CRC? + int colonIdx = m_lastMsgBytes.indexOf(':'); + int greaterThanIdx = m_lastMsgBytes.indexOf('>'); + if ((m_lastMsgBytes[0] == '<') && (greaterThanIdx != -1) && (colonIdx != -1)) + { + QByteArray packet; + + // Extract addresses + const char *d = m_lastMsgBytes.data(); + QString srcString = QString::fromLatin1(d + 3, greaterThanIdx - 3); + QString dstString = QString::fromLatin1(d + greaterThanIdx + 1, colonIdx - greaterThanIdx - 1); + + // Convert to AX.25 format + packet.append(AX25Packet::encodeAddress(dstString)); + packet.append(AX25Packet::encodeAddress(srcString, 1)); + packet.append(3); + packet.append(-16); // 0xf0 + packet.append(m_lastMsgBytes.mid(colonIdx+1)); + packet.append((char)0); // dummy crc + packet.append((char)0); + + // Forward to APRS and other packet features + MessagePipes& messagePipes = MainCore::instance()->getMessagePipes(); + QList *packetMessageQueues = messagePipes.getMessageQueues(this, "packets"); + if (packetMessageQueues) + { + QList::iterator it = packetMessageQueues->begin(); + for (; it != packetMessageQueues->end(); ++it) + { + MainCore::MsgPacket *msg = MainCore::MsgPacket::create(this, packet, QDateTime::currentDateTime()); + (*it)->push(msg); + } + } + } + if (m_settings.m_autoNbSymbolsMax) { ChirpChatDemodSettings settings = m_settings; diff --git a/plugins/feature/aprs/aprssettings.cpp b/plugins/feature/aprs/aprssettings.cpp index 368beca30..aa4d42654 100644 --- a/plugins/feature/aprs/aprssettings.cpp +++ b/plugins/feature/aprs/aprssettings.cpp @@ -24,11 +24,13 @@ #include "aprssettings.h" const QStringList APRSSettings::m_pipeTypes = { - QStringLiteral("PacketDemod") + QStringLiteral("PacketDemod"), + QStringLiteral("ChirpChatDemod") }; const QStringList APRSSettings::m_pipeURIs = { QStringLiteral("sdrangel.channel.packetdemod"), + QStringLiteral("sdrangel.channel.chirpchatdemod") }; APRSSettings::APRSSettings() From ae6bbe2614c7da515edbc1e227eb0dfc5245bb3b Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Thu, 25 Mar 2021 22:33:46 +0000 Subject: [PATCH 2/2] Update APRS docs to indicate ChirpChat support --- plugins/feature/aprs/readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/feature/aprs/readme.md b/plugins/feature/aprs/readme.md index 7271bbf8f..b7920a4e8 100644 --- a/plugins/feature/aprs/readme.md +++ b/plugins/feature/aprs/readme.md @@ -2,7 +2,7 @@

Introduction

-The APRS plugin displays APRS (Automatic Packet Reporting System) packets. APRS packets can be received over RF via one or more Packet Demodulator source channels or from the Internet via an APRS-IS IGate. +The APRS plugin displays APRS (Automatic Packet Reporting System) packets. APRS packets can be received over RF via one or more Packet Demodulator or ChirpChat Demodulator source channels or from the Internet via an APRS-IS IGate.

Interface

@@ -10,7 +10,7 @@ The APRS plugin displays APRS (Automatic Packet Reporting System) packets. APRS

1: Source channels

-This displays a list of the Packet Demodulator channels the APRS feature is receiving packets from. +This displays a list of the Packet Demodulator or ChirpChat Demodulator channels the APRS feature is receiving packets from.

2: Enable APRS-IS IGate