mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
Merge pull request #2039 from mxi-box/ax25
AX.25 Packet: packetmod supports multi Via; packetdemod fix H bit
This commit is contained in:
commit
0a5f8aa50f
@ -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;
|
||||
@ -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
|
||||
|
@ -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++;
|
||||
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user