Skip to content

Commit

Permalink
Merge pull request #2039 from mxi-box/ax25
Browse files Browse the repository at this point in the history
AX.25 Packet: packetmod supports multi Via; packetdemod fix H bit
  • Loading branch information
f4exb authored Mar 30, 2024
2 parents 2a39ef5 + 1dddbd4 commit 0a5f8aa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
6 changes: 4 additions & 2 deletions plugins/channeltx/modpacket/packetmodsource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ void PacketModSource::addTXPacket(QString callsign, QString to, QString via, QSt
uint16_t crcValue;
int len;
int packet_length;
QStringList viaList = via.split(',', Qt::SkipEmptyParts);

// Create AX.25 packet
p = packet;
Expand All @@ -584,9 +585,10 @@ void PacketModSource::addTXPacket(QString callsign, QString to, QString via, QSt
// Dest
p = ax25_address(p, to, 0xe0);
// From
p = ax25_address(p, callsign, 0x60);
p = ax25_address(p, callsign, 0x60 | (viaList.empty() ? 0x01 : 0x00));
// Via
p = ax25_address(p, via, 0x61);
for (int i = 0; i < viaList.size(); i++)
p = ax25_address(p, std::move(viaList[i]), 0x60 | (i == viaList.size()-1 ? 0x01 : 0x00));
// Control
*p++ = m_settings.m_ax25Control;
// PID
Expand Down
15 changes: 11 additions & 4 deletions sdrbase/util/ax25.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ bool AX25Packet::decode(QByteArray packet)
// List of repeater addresses for via field
m_via = QString("");
i = 13;
int incomingViaStrIdx = -1;
while ((packet[i] & 1) == 0)
{
i++;
Expand All @@ -72,11 +73,17 @@ bool AX25Packet::decode(QByteArray packet)
ssid = (repeaterSSID >> 1) & 0xf;
QString repeater = QString(repeaterAddress).trimmed();
QString ssidString = (ssid != 0) ? QString("%2-%3").arg(repeater).arg(ssid) : QString(repeater);
if (m_via == "")
m_via = ssidString;
else
m_via = QString("%1,%2").arg(m_via).arg(ssidString);

if (!m_via.isEmpty())
m_via.append(',');
m_via.append(ssidString);

if (packet[i] & 0x80)
incomingViaStrIdx = m_via.length();
}
if (incomingViaStrIdx >= 0)
m_via.insert(incomingViaStrIdx, "*");

i++;
// Control can be 1 or 2 bytes - how to know if 2?
// I, U and S frames
Expand Down

0 comments on commit 0a5f8aa

Please sign in to comment.