1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-23 00:18:37 -05:00

Add basic APRS support to ChirpChatDemod

This commit is contained in:
Jon Beniston 2021-03-25 22:15:41 +00:00
parent ed50c8ed91
commit 039c4d032e
2 changed files with 42 additions and 1 deletions

View File

@ -34,6 +34,7 @@
#include "dsp/dspcommands.h" #include "dsp/dspcommands.h"
#include "device/deviceapi.h" #include "device/deviceapi.h"
#include "feature/feature.h" #include "feature/feature.h"
#include "util/ax25.h"
#include "util/db.h" #include "util/db.h"
#include "maincore.h" #include "maincore.h"
@ -188,6 +189,44 @@ bool ChirpChatDemod::handleMessage(const Message& cmd)
getMessageQueueToGUI()->push(msgToGUI); 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<MessageQueue*> *packetMessageQueues = messagePipes.getMessageQueues(this, "packets");
if (packetMessageQueues)
{
QList<MessageQueue*>::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) if (m_settings.m_autoNbSymbolsMax)
{ {
ChirpChatDemodSettings settings = m_settings; ChirpChatDemodSettings settings = m_settings;

View File

@ -24,11 +24,13 @@
#include "aprssettings.h" #include "aprssettings.h"
const QStringList APRSSettings::m_pipeTypes = { const QStringList APRSSettings::m_pipeTypes = {
QStringLiteral("PacketDemod") QStringLiteral("PacketDemod"),
QStringLiteral("ChirpChatDemod")
}; };
const QStringList APRSSettings::m_pipeURIs = { const QStringList APRSSettings::m_pipeURIs = {
QStringLiteral("sdrangel.channel.packetdemod"), QStringLiteral("sdrangel.channel.packetdemod"),
QStringLiteral("sdrangel.channel.chirpchatdemod")
}; };
APRSSettings::APRSSettings() APRSSettings::APRSSettings()