Fix dashboard conflict, add IP address to D-Star screen

Tag: Version "v20180328.3z"
This commit is contained in:
KD4Z 2018-04-10 18:08:48 -04:00
parent d833d4b055
commit 9d6bcb7ec8
4 changed files with 59 additions and 15 deletions

View File

@ -81,7 +81,7 @@ void CDMRLookup::stop()
wait();
}
std::string CDMRLookup::find(unsigned int id)
std::string CDMRLookup::findwithname(unsigned int id)
{
std::string callsign;
@ -92,6 +92,40 @@ std::string CDMRLookup::find(unsigned int id)
try {
callsign = m_table.at(id);
LogDebug("Findwithname Found =%s",callsign.c_str());
} catch (...) {
char text[10U];
::sprintf(text, "%u", id);
callsign = std::string(text);
}
m_mutex.unlock();
return callsign;
}
std::string CDMRLookup::find(unsigned int id)
{
std::string callsign;
std::string b;
if (id == 0xFFFFFFU)
return std::string("ALL");
m_mutex.lock();
try {
b = m_table.at(id);
size_t n = b.find(" ");
if (n > 0) {
callsign = b.substr(0,n);
} else {
LogDebug("b=%s",b.c_str());
callsign = b;
}
} catch (...) {
char text[10U];
::sprintf(text, "%u", id);
@ -133,13 +167,19 @@ bool CDMRLookup::load()
continue;
char* p1 = ::strtok(buffer, " \t\r\n");
char* p2 = ::strtok(NULL, " \t\r\n");
char* p2 = ::strtok(NULL, " \r\n"); // tokenize to eol to capture name as well
if (p1 != NULL && p2 != NULL) {
unsigned int id = (unsigned int)::atoi(p1);
for (char* p = p2; *p != 0x00U; p++)
*p = ::toupper(*p);
for (char* p = p2; *p != 0x00U; p++) {
if(*p == 0x09U)
*p = 0x20U;
else
*p = ::toupper(*p);
}
m_table[id] = std::string(p2);
}
}

View File

@ -35,6 +35,7 @@ public:
virtual void entry();
std::string find(unsigned int id);
std::string findwithname(unsigned int id);
bool exists(unsigned int id);

View File

@ -1067,16 +1067,16 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
m_netState = RS_NET_AUDIO;
setShortLC(m_slotNo, dstId, flco, ACTIVITY_VOICE);
std::string src = m_lookup->find(srcId);
std::string dst = m_lookup->find(dstId);
m_display->writeDMR(m_slotNo, src, flco == FLCO_GROUP, dst, "N");
std::string cn = m_lookup->findwithname(srcId);
m_display->writeDMR(m_slotNo, cn, flco == FLCO_GROUP, dst, "N");
#if defined(DUMP_DMR)
openFile();
writeFile(data);
#endif
LogMessage("DMR Slot %u, received network voice header from %s to %s%s", m_slotNo, src.c_str(), flco == FLCO_GROUP ? "TG " : "", dst.c_str());
} else if (dataType == DT_VOICE_PI_HEADER) {
if (m_netState != RS_NET_AUDIO) {

View File

@ -180,7 +180,7 @@ void COLED::setIdleInt()
networkInfoInitialized = false;
if (! networkInfoInitialized) {
LogMessage("Initialize CNetworkInfo");
//LogMessage("Initialize CNetworkInfo");
info[0]=0;
m_network = new CNetworkInfo;
m_network->getNetworkInterface(info);
@ -228,14 +228,17 @@ void COLED::writeDStarInt(const char* my1, const char* my2, const char* your, co
display.clearDisplay();
display.fillRect(0,OLED_LINE3,display.width(),display.height(),BLACK); //clear everything beneath logo
display.setCursor(0,OLED_LINE4);
display.setCursor(0,OLED_LINE3);
display.printf("%s %.8s/%4.4s",type,my1,my2);
display.setCursor(0,OLED_LINE5);
display.setCursor(0,OLED_LINE4);
display.printf("-> %.8s",your);
display.setCursor(0,OLED_LINE6);
display.setCursor(0,OLED_LINE5);
display.printf("via %.8s",reflector);
display.setCursor(0,OLED_LINE6);
display.printf("%s",m_ipaddress.c_str());
OLED_statusbar();
display.display();
@ -271,7 +274,7 @@ void COLED::writeDMRInt(unsigned int slotNo,const std::string& src,bool group,co
display.setCursor(0,OLED_LINE2);
display.printf("%s",src.c_str());
display.setCursor(0,OLED_LINE3);
display.printf("Slot: %i %s %s%s",slotNo,type,group ? "TG" : "",dst.c_str());
display.printf("Slot: %i %s %s%s",slotNo,type,group ? "TG: " : "",dst.c_str());
}
else
{
@ -279,7 +282,7 @@ void COLED::writeDMRInt(unsigned int slotNo,const std::string& src,bool group,co
display.setCursor(0,OLED_LINE4);
display.printf("%s",src.c_str());
display.setCursor(0,OLED_LINE5);
display.printf("Slot: %i %s %s%s",slotNo,type,group ? "TG" : "",dst.c_str());
display.printf("Slot: %i %s %s%s",slotNo,type,group ? "TG: " : "",dst.c_str());
}
}
@ -289,7 +292,7 @@ void COLED::writeDMRInt(unsigned int slotNo,const std::string& src,bool group,co
display.setCursor(0,OLED_LINE3);
display.printf("%s",src.c_str());
display.setCursor(0,OLED_LINE4);
display.printf("Slot: %i %s %s%s",slotNo,type,group ? "TG" : "",dst.c_str());
display.printf("Slot: %i %s %s%s",slotNo,type,group ? "TG: " : "",dst.c_str());
}
display.fillRect(0,OLED_LINE6,display.width(),20,BLACK);