mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-21 06:55:52 +08:00
Add extra debugging for D-Star.
This commit is contained in:
@@ -100,15 +100,19 @@ bool CDStarControl::writeModem(unsigned char *data)
|
|||||||
CDStarHeader header(data + 1U);
|
CDStarHeader header(data + 1U);
|
||||||
|
|
||||||
// Is this a transmission destined for a repeater?
|
// Is this a transmission destined for a repeater?
|
||||||
if (!header.isRepeater())
|
if (!header.isRepeater()) {
|
||||||
|
LogMessage("D-Star, non repeater RF header received");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned char callsign[DSTAR_LONG_CALLSIGN_LENGTH];
|
unsigned char callsign[DSTAR_LONG_CALLSIGN_LENGTH];
|
||||||
header.getRPTCall1(callsign);
|
header.getRPTCall1(callsign);
|
||||||
|
|
||||||
// Is it for us?
|
// 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;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned char gateway[DSTAR_LONG_CALLSIGN_LENGTH];
|
unsigned char gateway[DSTAR_LONG_CALLSIGN_LENGTH];
|
||||||
header.getRPTCall2(gateway);
|
header.getRPTCall2(gateway);
|
||||||
@@ -205,7 +209,7 @@ bool CDStarControl::writeModem(unsigned char *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else if (type == TAG_DATA) {
|
||||||
if (m_state == RS_LISTENING) {
|
if (m_state == RS_LISTENING) {
|
||||||
// The sync is regenerated by the modem so can do exact match
|
// 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) {
|
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;
|
return false;
|
||||||
|
|
||||||
// Is this a transmission destined for a repeater?
|
// 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;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned char callsign[DSTAR_LONG_CALLSIGN_LENGTH];
|
unsigned char callsign[DSTAR_LONG_CALLSIGN_LENGTH];
|
||||||
header->getRPTCall1(callsign);
|
header->getRPTCall1(callsign);
|
||||||
|
|
||||||
// Is it for us?
|
// 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;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned char gateway[DSTAR_LONG_CALLSIGN_LENGTH];
|
unsigned char gateway[DSTAR_LONG_CALLSIGN_LENGTH];
|
||||||
header->getRPTCall2(gateway);
|
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);
|
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;
|
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));
|
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();
|
writeEndOfTransmission();
|
||||||
} else {
|
} else if (type == TAG_DATA) {
|
||||||
if (m_state != RS_RELAYING_NETWORK_AUDIO)
|
if (m_state != RS_RELAYING_NETWORK_AUDIO)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -486,6 +496,8 @@ void CDStarControl::writeNetwork()
|
|||||||
writeFile(data + 1U, length - 1U);
|
writeFile(data + 1U, length - 1U);
|
||||||
#endif
|
#endif
|
||||||
writeQueueData(data + 1U);
|
writeQueueData(data + 1U);
|
||||||
|
} else {
|
||||||
|
CUtils::dump("D-Star, unknown data from network", data, DSTAR_FRAME_LENGTH_BYTES + 1U);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "DStarSlowData.h"
|
#include "DStarSlowData.h"
|
||||||
#include "DStarDefines.h"
|
#include "DStarDefines.h"
|
||||||
#include "CRC.h"
|
#include "CRC.h"
|
||||||
|
#include "Log.h"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@@ -90,6 +91,8 @@ CDStarHeader* CDStarSlowData::add(const unsigned char* data)
|
|||||||
|
|
||||||
// Compare them
|
// Compare them
|
||||||
if (::memcmp(crc, m_header + 39U, 2U) != 0) {
|
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);
|
::memcpy(m_header + 39U, crc, 2U);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -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
|
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
|
$(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
|
$(CC) $(CFLAGS) -c DStarSlowData.cpp
|
||||||
|
|
||||||
EMB.o: EMB.cpp EMB.h
|
EMB.o: EMB.cpp EMB.h
|
||||||
|
|||||||
Reference in New Issue
Block a user