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

Merge pull request #815 from srcejon/lora_aprs

Enable CRC checking for LoRa APRS packets
This commit is contained in:
Edouard Griffiths 2021-03-26 19:43:49 +01:00 committed by GitHub
commit f1c0301e11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -192,10 +192,13 @@ bool ChirpChatDemod::handleMessage(const Message& cmd)
// Is this an APRS packet? // Is this an APRS packet?
// As per: https://github.com/oe3cjb/TTGO-T-Beam-LoRa-APRS/blob/master/lib/BG_RF95/BG_RF95.cpp // 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: // 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 colonIdx = m_lastMsgBytes.indexOf(':');
int greaterThanIdx = m_lastMsgBytes.indexOf('>'); int greaterThanIdx = m_lastMsgBytes.indexOf('>');
if ((m_lastMsgBytes[0] == '<') && (greaterThanIdx != -1) && (colonIdx != -1)) if ( (m_lastMsgBytes[0] == '<')
&& (greaterThanIdx != -1)
&& (colonIdx != -1)
&& ((m_lastMsgHasCRC && m_lastMsgPayloadCRC) || !m_lastMsgHasCRC)
)
{ {
QByteArray packet; QByteArray packet;
@ -210,8 +213,11 @@ bool ChirpChatDemod::handleMessage(const Message& cmd)
packet.append(3); packet.append(3);
packet.append(-16); // 0xf0 packet.append(-16); // 0xf0
packet.append(m_lastMsgBytes.mid(colonIdx+1)); packet.append(m_lastMsgBytes.mid(colonIdx+1));
packet.append((char)0); // dummy crc if (!m_lastMsgHasCRC)
packet.append((char)0); {
packet.append((char)0); // dummy crc
packet.append((char)0);
}
// Forward to APRS and other packet features // Forward to APRS and other packet features
MessagePipes& messagePipes = MainCore::instance()->getMessagePipes(); MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();