From bf128e76f3fed5382bc152a55155995cddab53e0 Mon Sep 17 00:00:00 2001 From: phl0 Date: Sat, 16 Apr 2016 21:45:49 +0200 Subject: [PATCH] Add output of information about incoming reflector --- DStarControl.cpp | 17 +++++++++++++---- Display.h | 2 +- HD44780.cpp | 9 +++++++-- HD44780.h | 2 +- Nextion.cpp | 2 +- Nextion.h | 2 +- NullDisplay.cpp | 2 +- NullDisplay.h | 2 +- TFTSerial.cpp | 2 +- TFTSerial.h | 2 +- 10 files changed, 28 insertions(+), 14 deletions(-) diff --git a/DStarControl.cpp b/DStarControl.cpp index a95100d..f974461 100644 --- a/DStarControl.cpp +++ b/DStarControl.cpp @@ -203,7 +203,7 @@ bool CDStarControl::writeModem(unsigned char *data) m_rfState = RS_RF_AUDIO; if (m_netState == RS_NET_IDLE) - m_display->writeDStar((char*)my1, (char*)my2, (char*)your, "R"); + m_display->writeDStar((char*)my1, (char*)my2, (char*)your, "R", ""); LogMessage("D-Star, received RF header from %8.8s/%4.4s to %8.8s", my1, my2, your); } else if (type == TAG_EOT) { @@ -374,7 +374,7 @@ bool CDStarControl::writeModem(unsigned char *data) m_rfN = (m_rfN + 1U) % 21U; if (m_netState == RS_NET_IDLE) - m_display->writeDStar((char*)my1, (char*)my2, (char*)your, "R"); + m_display->writeDStar((char*)my1, (char*)my2, (char*)your, "R", ""); LogMessage("D-Star, received RF late entry from %8.8s/%4.4s to %8.8s", my1, my2, your); } @@ -491,9 +491,18 @@ void CDStarControl::writeNetwork() #endif m_netState = RS_NET_AUDIO; - m_display->writeDStar((char*)my1, (char*)my2, (char*)your, "N"); + LINK_STATUS status = LS_NONE; + unsigned char reflector[DSTAR_LONG_CALLSIGN_LENGTH]; + if (m_network != NULL) + m_network->getStatus(status, reflector); - LogMessage("D-Star, received network header from %8.8s/%4.4s to %8.8s", my1, my2, your); + m_display->writeDStar((char*)my1, (char*)my2, (char*)your, "N", (char*) reflector); + + if (strcmp(reflector, " ") == 0) { + LogMessage("D-Star, received network header from %8.8s/%4.4s to %8.8s", my1, my2, your); + } else { + LogMessage("D-Star, received network header from %8.8s/%4.4s to %8.8s via %8.8s", my1, my2, your, reflector); + } } else if (type == TAG_EOT) { if (m_netState != RS_NET_AUDIO) return; diff --git a/Display.h b/Display.h index 6baeefd..61dcb6e 100644 --- a/Display.h +++ b/Display.h @@ -33,7 +33,7 @@ public: virtual void setLockout() = 0; virtual void setError(const char* text) = 0; - virtual void writeDStar(const char* my1, const char* my2, const char* your, const char* type) = 0; + virtual void writeDStar(const char* my1, const char* my2, const char* your, const char* type, const char* reflector) = 0; virtual void clearDStar() = 0; virtual void writeDMR(unsigned int slotNo, const char* src, bool group, const char* dst, const char* type) = 0; diff --git a/HD44780.cpp b/HD44780.cpp index 80f5a45..874e927 100644 --- a/HD44780.cpp +++ b/HD44780.cpp @@ -107,12 +107,13 @@ void CHD44780::setLockout() m_dmr = false; } -void CHD44780::writeDStar(const char* my1, const char* my2, const char* your, const char* type) +void CHD44780::writeDStar(const char* my1, const char* my2, const char* your, const char* type, const char* reflector) { assert(my1 != NULL); assert(my2 != NULL); assert(your != NULL); assert(type != NULL); + assert(reflector != NULL); ::lcdClear(m_fd); @@ -130,7 +131,11 @@ void CHD44780::writeDStar(const char* my1, const char* my2, const char* your, co ::lcdPosition(m_fd, 0, 1); ::lcdPrintf(m_fd, "%.*s", m_cols, buffer); - ::sprintf(buffer, "%.8s", your); + if (strcmp(reflector, " ") == 0) { + ::sprintf(buffer, "%.8s", your); + } else { + ::sprintf(buffer, "%.8s <- %.8s", your, reflector); + } ::lcdPosition(m_fd, 0, 2); ::lcdPrintf(m_fd, "%.*s", m_cols, buffer); } else if (m_rows == 2 && m_cols == 40U) { diff --git a/HD44780.h b/HD44780.h index 1241d14..814b22a 100644 --- a/HD44780.h +++ b/HD44780.h @@ -37,7 +37,7 @@ public: virtual void setError(const char* text); virtual void setLockout(); - virtual void writeDStar(const char* my1, const char* my2, const char* your, const char* type); + virtual void writeDStar(const char* my1, const char* my2, const char* your, const char* type, const char* reflector); virtual void clearDStar(); virtual void writeDMR(unsigned int slotNo, const char* src, bool group, const char* dst, const char* type); diff --git a/Nextion.cpp b/Nextion.cpp index d4ef953..9c5d1c7 100644 --- a/Nextion.cpp +++ b/Nextion.cpp @@ -93,7 +93,7 @@ void CNextion::setLockout() m_mode = MODE_LOCKOUT; } -void CNextion::writeDStar(const char* my1, const char* my2, const char* your, const char* type) +void CNextion::writeDStar(const char* my1, const char* my2, const char* your, const char* type, const char* reflector) { assert(my1 != NULL); assert(my2 != NULL); diff --git a/Nextion.h b/Nextion.h index fafb37a..b8c3fce 100644 --- a/Nextion.h +++ b/Nextion.h @@ -38,7 +38,7 @@ public: virtual void setError(const char* text); virtual void setLockout(); - virtual void writeDStar(const char* my1, const char* my2, const char* your, const char* type); + virtual void writeDStar(const char* my1, const char* my2, const char* your, const char* type, const char* reflector); virtual void clearDStar(); virtual void writeDMR(unsigned int slotNo, const char* src, bool group, const char* dst, const char* type); diff --git a/NullDisplay.cpp b/NullDisplay.cpp index 2841110..b02fad4 100644 --- a/NullDisplay.cpp +++ b/NullDisplay.cpp @@ -43,7 +43,7 @@ void CNullDisplay::setLockout() { } -void CNullDisplay::writeDStar(const char* my1, const char* my2, const char* your, const char* type) +void CNullDisplay::writeDStar(const char* my1, const char* my2, const char* your, const char* type, const char* reflector) { } diff --git a/NullDisplay.h b/NullDisplay.h index 92acf58..27f6331 100644 --- a/NullDisplay.h +++ b/NullDisplay.h @@ -36,7 +36,7 @@ public: virtual void setError(const char* text); virtual void setLockout(); - virtual void writeDStar(const char* my1, const char* my2, const char* your, const char* type); + virtual void writeDStar(const char* my1, const char* my2, const char* your, const char* type, const char* reflector); virtual void clearDStar(); virtual void writeDMR(unsigned int slotNo, const char* src, bool group, const char* dst, const char* type); diff --git a/TFTSerial.cpp b/TFTSerial.cpp index 632e96b..749c089 100644 --- a/TFTSerial.cpp +++ b/TFTSerial.cpp @@ -142,7 +142,7 @@ void CTFTSerial::setLockout() m_mode = MODE_LOCKOUT; } -void CTFTSerial::writeDStar(const char* my1, const char* my2, const char* your, const char* type) +void CTFTSerial::writeDStar(const char* my1, const char* my2, const char* your, const char* type. const char* reflector) { assert(my1 != NULL); assert(my2 != NULL); diff --git a/TFTSerial.h b/TFTSerial.h index da54623..53f6479 100644 --- a/TFTSerial.h +++ b/TFTSerial.h @@ -38,7 +38,7 @@ public: virtual void setError(const char* text); virtual void setLockout(); - virtual void writeDStar(const char* my1, const char* my2, const char* your, const char* type); + virtual void writeDStar(const char* my1, const char* my2, const char* your, const char* type, const char* reflector); virtual void clearDStar(); virtual void writeDMR(unsigned int slotNo, const char* src, bool group, const char* dst, const char* type);