Merge pull request #15 from phl0/add_reflector_info

Add reflector info
This commit is contained in:
Jonathan Naylor 2016-04-16 21:46:28 +01:00
commit fdb807a130
10 changed files with 46 additions and 17 deletions

View file

@ -203,7 +203,7 @@ bool CDStarControl::writeModem(unsigned char *data)
m_rfState = RS_RF_AUDIO; m_rfState = RS_RF_AUDIO;
if (m_netState == RS_NET_IDLE) 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); LogMessage("D-Star, received RF header from %8.8s/%4.4s to %8.8s", my1, my2, your);
} else if (type == TAG_EOT) { } else if (type == TAG_EOT) {
@ -374,7 +374,7 @@ bool CDStarControl::writeModem(unsigned char *data)
m_rfN = (m_rfN + 1U) % 21U; m_rfN = (m_rfN + 1U) % 21U;
if (m_netState == RS_NET_IDLE) 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); 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 #endif
m_netState = RS_NET_AUDIO; 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((char*) 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) { } else if (type == TAG_EOT) {
if (m_netState != RS_NET_AUDIO) if (m_netState != RS_NET_AUDIO)
return; return;

View file

@ -33,7 +33,7 @@ public:
virtual void setLockout() = 0; virtual void setLockout() = 0;
virtual void setError(const char* text) = 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 clearDStar() = 0;
virtual void writeDMR(unsigned int slotNo, const char* src, bool group, const char* dst, const char* type) = 0; virtual void writeDMR(unsigned int slotNo, const char* src, bool group, const char* dst, const char* type) = 0;

View file

@ -24,6 +24,7 @@
#include <cstdio> #include <cstdio>
#include <cassert> #include <cassert>
#include <cstring>
const char* LISTENING = "Listening "; const char* LISTENING = "Listening ";
@ -107,12 +108,13 @@ void CHD44780::setLockout()
m_dmr = false; 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(my1 != NULL);
assert(my2 != NULL); assert(my2 != NULL);
assert(your != NULL); assert(your != NULL);
assert(type != NULL); assert(type != NULL);
assert(reflector != NULL);
::lcdClear(m_fd); ::lcdClear(m_fd);
@ -130,12 +132,20 @@ void CHD44780::writeDStar(const char* my1, const char* my2, const char* your, co
::lcdPosition(m_fd, 0, 1); ::lcdPosition(m_fd, 0, 1);
::lcdPrintf(m_fd, "%.*s", m_cols, buffer); ::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); ::lcdPosition(m_fd, 0, 2);
::lcdPrintf(m_fd, "%.*s", m_cols, buffer); ::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
} else if (m_rows == 2 && m_cols == 40U) { } else if (m_rows == 2 && m_cols == 40U) {
char buffer[40U]; char buffer[40U];
::sprintf(buffer, "%s %.8s/%.4s > %.8s", type, my1, my2, your); if (strcmp(reflector, " ") == 0) {
::sprintf(buffer, "%s %.8s/%.4s > %.8s", type, my1, my2, your);
} else {
::sprintf(buffer, "%s %.8s/%.4s > %.8s via %.8s", type, my1, my2, your, reflector);
}
::lcdPosition(m_fd, 0, 1); ::lcdPosition(m_fd, 0, 1);
::lcdPrintf(m_fd, "%.*s", m_cols, buffer); ::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
} }

View file

@ -37,7 +37,7 @@ public:
virtual void setError(const char* text); virtual void setError(const char* text);
virtual void setLockout(); 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 clearDStar();
virtual void writeDMR(unsigned int slotNo, const char* src, bool group, const char* dst, const char* type); virtual void writeDMR(unsigned int slotNo, const char* src, bool group, const char* dst, const char* type);

View file

@ -93,12 +93,13 @@ void CNextion::setLockout()
m_mode = MODE_LOCKOUT; 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(my1 != NULL);
assert(my2 != NULL); assert(my2 != NULL);
assert(your != NULL); assert(your != NULL);
assert(type != NULL); assert(type != NULL);
assert(reflector != NULL);
if (m_mode != MODE_DSTAR) if (m_mode != MODE_DSTAR)
sendCommand("page DStar"); sendCommand("page DStar");
@ -107,7 +108,11 @@ void CNextion::writeDStar(const char* my1, const char* my2, const char* your, co
::sprintf(text, "t0.txt=\"%s %.8s/%4.4s\"", type, my1, my2); ::sprintf(text, "t0.txt=\"%s %.8s/%4.4s\"", type, my1, my2);
sendCommand(text); sendCommand(text);
::sprintf(text, "t1.txt=\"%.8s\"", your); if (strcmp(reflector, " ") == 0) {
::sprintf(text, "t1.txt=\"%.8s\"", your);
} else {
::sprintf(text, "t1.txt=\"%.8s <- %-8s\"", your, reflector);
}
sendCommand(text); sendCommand(text);
m_mode = MODE_DSTAR; m_mode = MODE_DSTAR;

View file

@ -38,7 +38,7 @@ public:
virtual void setError(const char* text); virtual void setError(const char* text);
virtual void setLockout(); 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 clearDStar();
virtual void writeDMR(unsigned int slotNo, const char* src, bool group, const char* dst, const char* type); virtual void writeDMR(unsigned int slotNo, const char* src, bool group, const char* dst, const char* type);

View file

@ -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)
{ {
} }

View file

@ -36,7 +36,7 @@ public:
virtual void setError(const char* text); virtual void setError(const char* text);
virtual void setLockout(); 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 clearDStar();
virtual void writeDMR(unsigned int slotNo, const char* src, bool group, const char* dst, const char* type); virtual void writeDMR(unsigned int slotNo, const char* src, bool group, const char* dst, const char* type);

View file

@ -142,12 +142,13 @@ void CTFTSerial::setLockout()
m_mode = MODE_LOCKOUT; 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(my1 != NULL);
assert(my2 != NULL); assert(my2 != NULL);
assert(your != NULL); assert(your != NULL);
assert(type != NULL); assert(type != NULL);
assert(reflector != NULL);
if (m_mode != MODE_DSTAR) { if (m_mode != MODE_DSTAR) {
// Clear the screen // Clear the screen
@ -165,7 +166,11 @@ void CTFTSerial::writeDStar(const char* my1, const char* my2, const char* your,
gotoPosPixel(5U, 80U); gotoPosPixel(5U, 80U);
displayText(text); displayText(text);
::sprintf(text, "%.8s", your); if (strcmp(reflector, " ") == 0) {
::sprintf(text, "%.8s", your);
} else {
::sprintf(text, "%.8s <- %.8s", your, reflector);
}
gotoPosPixel(5U, 100U); gotoPosPixel(5U, 100U);
displayText(text); displayText(text);

View file

@ -38,7 +38,7 @@ public:
virtual void setError(const char* text); virtual void setError(const char* text);
virtual void setLockout(); 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 clearDStar();
virtual void writeDMR(unsigned int slotNo, const char* src, bool group, const char* dst, const char* type); virtual void writeDMR(unsigned int slotNo, const char* src, bool group, const char* dst, const char* type);