Add extra debugging for D-Star.

This commit is contained in:
Jonathan Naylor 2016-02-03 07:20:48 +00:00
parent c5e28c3941
commit 843f83611d
4 changed files with 23 additions and 8 deletions

View file

@ -100,15 +100,19 @@ bool CDStarControl::writeModem(unsigned char *data)
CDStarHeader header(data + 1U);
// Is this a transmission destined for a repeater?
if (!header.isRepeater())
if (!header.isRepeater()) {
LogMessage("D-Star, non repeater RF header received");
return false;
}
unsigned char callsign[DSTAR_LONG_CALLSIGN_LENGTH];
header.getRPTCall1(callsign);
// Is it for us?
if (::memcmp(callsign, m_callsign, DSTAR_LONG_CALLSIGN_LENGTH) != 0)
if (::memcmp(callsign, m_callsign, DSTAR_LONG_CALLSIGN_LENGTH) != 0) {
LogMessage("D-Star, received RF header for wrong repeater - %8.8s", callsign);
return false;
}
unsigned char gateway[DSTAR_LONG_CALLSIGN_LENGTH];
header.getRPTCall2(gateway);
@ -205,7 +209,7 @@ bool CDStarControl::writeModem(unsigned char *data)
}
return false;
} else {
} else if (type == TAG_DATA) {
if (m_state == RS_LISTENING) {
// The sync is regenerated by the modem so can do exact match
if (::memcmp(data + 1U + DSTAR_VOICE_FRAME_LENGTH_BYTES, DSTAR_SYNC_BYTES, DSTAR_DATA_FRAME_LENGTH_BYTES) == 0) {
@ -257,15 +261,19 @@ bool CDStarControl::writeModem(unsigned char *data)
return false;
// Is this a transmission destined for a repeater?
if (!header->isRepeater())
if (!header->isRepeater()) {
LogMessage("D-Star, non repeater RF late entry header received");
return false;
}
unsigned char callsign[DSTAR_LONG_CALLSIGN_LENGTH];
header->getRPTCall1(callsign);
// Is it for us?
if (::memcmp(callsign, m_callsign, DSTAR_LONG_CALLSIGN_LENGTH) != 0)
if (::memcmp(callsign, m_callsign, DSTAR_LONG_CALLSIGN_LENGTH) != 0) {
LogMessage("D-Star, received RF header for wrong repeater - %8.8s", callsign);
return false;
}
unsigned char gateway[DSTAR_LONG_CALLSIGN_LENGTH];
header->getRPTCall2(gateway);
@ -346,6 +354,8 @@ bool CDStarControl::writeModem(unsigned char *data)
LogMessage("D-Star, received RF late entry from %8.8s/%4.4s to %8.8s", my1, my2, your);
}
} else {
CUtils::dump("D-Star, unknown data from modem", data, DSTAR_FRAME_LENGTH_BYTES + 1U);
}
return true;
@ -458,7 +468,7 @@ void CDStarControl::writeNetwork()
LogMessage("D-Star, received network end of transmission, %.1f seconds, %u%% packet loss, BER: %.1f%%", float(m_frames) / 50.0F, (m_lost * 100U) / m_frames, float(m_errs * 100U) / float(m_bits));
writeEndOfTransmission();
} else {
} else if (type == TAG_DATA) {
if (m_state != RS_RELAYING_NETWORK_AUDIO)
return;
@ -486,6 +496,8 @@ void CDStarControl::writeNetwork()
writeFile(data + 1U, length - 1U);
#endif
writeQueueData(data + 1U);
} else {
CUtils::dump("D-Star, unknown data from network", data, DSTAR_FRAME_LENGTH_BYTES + 1U);
}
}

View file

@ -19,6 +19,7 @@
#include "DStarSlowData.h"
#include "DStarDefines.h"
#include "CRC.h"
#include "Log.h"
#include <cstdio>
#include <cassert>
@ -90,6 +91,8 @@ CDStarHeader* CDStarSlowData::add(const unsigned char* data)
// Compare them
if (::memcmp(crc, m_header + 39U, 2U) != 0) {
if (m_ptr == 45U)
LogMessage("D-Star, invalid slow data header");
::memcpy(m_header + 39U, crc, 2U);
return NULL;
}

View file

@ -57,7 +57,7 @@ DStarHeader.o: DStarHeader.cpp DStarHeader.h DStarDefines.h CRC.h
DStarNetwork.o: DStarNetwork.cpp DStarNetwork.h Log.h UDPSocket.h RingBuffer.h Utils.h StopWatch.h DStarDefines.h Defines.h Timer.h
$(CC) $(CFLAGS) -c DStarNetwork.cpp
DStarSlowData.o: DStarSlowData.cpp DStarSlowData.h DStarHeader.h DStarDefines.h CRC.h
DStarSlowData.o: DStarSlowData.cpp DStarSlowData.h DStarHeader.h DStarDefines.h CRC.h Log.h
$(CC) $(CFLAGS) -c DStarSlowData.cpp
EMB.o: EMB.cpp EMB.h

View file

@ -19,6 +19,6 @@
#if !defined(VERSION_H)
#define VERSION_H
const char* VERSION = "20160202";
const char* VERSION = "20160203";
#endif