From 8eb564ba37035ddd105bb38b0948a80e1ca24597 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Tue, 12 Apr 2016 18:26:13 +0100 Subject: [PATCH] Translate DMR Id to callsign from a file. --- Conf.cpp | 9 ++++++++- Conf.h | 2 ++ DMRControl.cpp | 24 +++++++++++++++--------- DMRControl.h | 4 +++- DMRIds.dat | 4 ++++ DMRSlot.cpp | 41 ++++++++++++++++++++++++++++------------- DMRSlot.h | 4 +++- Display.h | 2 +- HD44780.cpp | 11 ++++++----- HD44780.h | 2 +- MMDVM.ini | 1 + MMDVMHost.cpp | 4 +++- Nextion.cpp | 7 ++++--- Nextion.h | 2 +- NullDisplay.cpp | 2 +- NullDisplay.h | 2 +- TFTSerial.cpp | 7 ++++--- TFTSerial.h | 2 +- 18 files changed, 87 insertions(+), 43 deletions(-) create mode 100644 DMRIds.dat diff --git a/Conf.cpp b/Conf.cpp index 6342006..66d714c 100644 --- a/Conf.cpp +++ b/Conf.cpp @@ -85,6 +85,7 @@ m_dmrColorCode(2U), m_dmrSelfOnly(false), m_dmrPrefixes(), m_dmrBlackList(), +m_dmrLookupFile(), m_fusionEnabled(true), m_fusionParrotEnabled(false), m_dstarNetworkEnabled(true), @@ -278,7 +279,8 @@ bool CConf::read() m_dmrBlackList.push_back(id); p = ::strtok(NULL, ",\r\n"); } - } + } else if (::strcmp(key, "LookupFile") == 0) + m_dmrLookupFile = value; } else if (section == SECTION_FUSION) { if (::strcmp(key, "Enable") == 0) m_fusionEnabled = ::atoi(value) == 1; @@ -547,6 +549,11 @@ std::vector CConf::getDMRBlackList() const return m_dmrBlackList; } +std::string CConf::getDMRLookupFile() const +{ + return m_dmrLookupFile; +} + bool CConf::getFusionEnabled() const { return m_fusionEnabled; diff --git a/Conf.h b/Conf.h index 65ff3fd..d797583 100644 --- a/Conf.h +++ b/Conf.h @@ -80,6 +80,7 @@ public: bool getDMRSelfOnly() const; std::vector getDMRPrefixes() const; std::vector getDMRBlackList() const; + std::string getDMRLookupFile() const; // The System Fusion section bool getFusionEnabled() const; @@ -167,6 +168,7 @@ private: bool m_dmrSelfOnly; std::vector m_dmrPrefixes; std::vector m_dmrBlackList; + std::string m_dmrLookupFile; bool m_fusionEnabled; bool m_fusionParrotEnabled; diff --git a/DMRControl.cpp b/DMRControl.cpp index 466c249..5957250 100644 --- a/DMRControl.cpp +++ b/DMRControl.cpp @@ -20,7 +20,7 @@ #include #include -CDMRControl::CDMRControl(unsigned int id, unsigned int colorCode, bool selfOnly, const std::vector& prefixes, const std::vector& blackList, unsigned int timeout, CModem* modem, CDMRIPSC* network, IDisplay* display, bool duplex) : +CDMRControl::CDMRControl(unsigned int id, unsigned int colorCode, bool selfOnly, const std::vector& prefixes, const std::vector& blackList, unsigned int timeout, CModem* modem, CDMRIPSC* network, IDisplay* display, bool duplex, const std::string& lookupFile) : m_id(id), m_colorCode(colorCode), m_selfOnly(selfOnly), @@ -29,12 +29,16 @@ m_blackList(blackList), m_modem(modem), m_network(network), m_slot1(1U, timeout), -m_slot2(2U, timeout) +m_slot2(2U, timeout), +m_lookup(NULL) { assert(modem != NULL); assert(display != NULL); - CDMRSlot::init(id, colorCode, selfOnly, prefixes, blackList, modem, network, display, duplex); + m_lookup = new CDMRLookup(lookupFile); + m_lookup->read(); + + CDMRSlot::init(id, colorCode, selfOnly, prefixes, blackList, modem, network, display, duplex, m_lookup); } CDMRControl::~CDMRControl() @@ -61,36 +65,38 @@ bool CDMRControl::processWakeup(const unsigned char* data) unsigned int srcId = csbk.getSrcId(); unsigned int bsId = csbk.getBSId(); + std::string src = m_lookup->find(srcId); + if (m_selfOnly) { if (srcId != m_id) { - LogMessage("Invalid CSBK BS_Dwn_Act received from %u", srcId); + LogMessage("Invalid CSBK BS_Dwn_Act received from %s", src.c_str()); return false; } } else { if (std::find(m_blackList.begin(), m_blackList.end(), srcId) != m_blackList.end()) { - LogMessage("Invalid CSBK BS_Dwn_Act received from %u", srcId); + LogMessage("Invalid CSBK BS_Dwn_Act received from %s", src.c_str()); return false; } unsigned int prefix = srcId / 10000U; if (prefix == 0U || prefix > 999U) { - LogMessage("Invalid CSBK BS_Dwn_Act received from %u", srcId); + LogMessage("Invalid CSBK BS_Dwn_Act received from %s", src.c_str()); return false; } if (m_prefixes.size() > 0U) { if (std::find(m_prefixes.begin(), m_prefixes.end(), prefix) == m_prefixes.end()) { - LogMessage("Invalid CSBK BS_Dwn_Act received from %u", srcId); + LogMessage("Invalid CSBK BS_Dwn_Act received from %s", src.c_str()); return false; } } } if (bsId == 0xFFFFFFU) { - LogMessage("CSBK BS_Dwn_Act for ANY received from %u", srcId); + LogMessage("CSBK BS_Dwn_Act for ANY received from %s", src.c_str()); return true; } else if (bsId == m_id) { - LogMessage("CSBK BS_Dwn_Act for %u received from %u", bsId, srcId); + LogMessage("CSBK BS_Dwn_Act for %u received from %s", bsId, src.c_str()); return true; } diff --git a/DMRControl.h b/DMRControl.h index 888bb5b..3820e47 100644 --- a/DMRControl.h +++ b/DMRControl.h @@ -19,6 +19,7 @@ #if !defined(DMRControl_H) #define DMRControl_H +#include "DMRLookup.h" #include "DMRIPSC.h" #include "Display.h" #include "DMRSlot.h" @@ -29,7 +30,7 @@ class CDMRControl { public: - CDMRControl(unsigned int id, unsigned int colorCode, bool selfOnly, const std::vector& prefixes, const std::vector& blackList, unsigned int timeout, CModem* modem, CDMRIPSC* network, IDisplay* display, bool duplex); + CDMRControl(unsigned int id, unsigned int colorCode, bool selfOnly, const std::vector& prefixes, const std::vector& blackList, unsigned int timeout, CModem* modem, CDMRIPSC* network, IDisplay* display, bool duplex, const std::string& lookupFile); ~CDMRControl(); bool processWakeup(const unsigned char* data); @@ -52,6 +53,7 @@ private: CDMRIPSC* m_network; CDMRSlot m_slot1; CDMRSlot m_slot2; + CDMRLookup* m_lookup; }; #endif diff --git a/DMRIds.dat b/DMRIds.dat new file mode 100644 index 0000000..542a2a9 --- /dev/null +++ b/DMRIds.dat @@ -0,0 +1,4 @@ +# +# The format of the file is the DMR Id followed by the callsign +# +2351351 G4KLX diff --git a/DMRSlot.cpp b/DMRSlot.cpp index 94e1e30..3072f04 100644 --- a/DMRSlot.cpp +++ b/DMRSlot.cpp @@ -36,6 +36,7 @@ CModem* CDMRSlot::m_modem = NULL; CDMRIPSC* CDMRSlot::m_network = NULL; IDisplay* CDMRSlot::m_display = NULL; bool CDMRSlot::m_duplex = true; +CDMRLookup* CDMRSlot::m_lookup = NULL; unsigned char* CDMRSlot::m_idle = NULL; @@ -173,12 +174,14 @@ void CDMRSlot::writeModem(unsigned char *data) m_rfState = RS_RF_AUDIO; + std::string src = m_lookup->find(id); + if (m_netState == RS_NET_IDLE) { setShortLC(m_slotNo, m_rfLC->getDstId(), m_rfLC->getFLCO(), true); - m_display->writeDMR(m_slotNo, id, m_rfLC->getFLCO() == FLCO_GROUP, m_rfLC->getDstId(), "R"); + m_display->writeDMR(m_slotNo, src.c_str(), m_rfLC->getFLCO() == FLCO_GROUP, m_rfLC->getDstId(), "R"); } - LogMessage("DMR Slot %u, received RF voice header from %u to %s%u", m_slotNo, id, m_rfLC->getFLCO() == FLCO_GROUP ? "TG " : "", m_rfLC->getDstId()); + LogMessage("DMR Slot %u, received RF voice header from %s to %s%u", m_slotNo, src.c_str(), m_rfLC->getFLCO() == FLCO_GROUP ? "TG " : "", m_rfLC->getDstId()); } else if (dataType == DT_VOICE_PI_HEADER) { if (m_rfState != RS_RF_AUDIO) return; @@ -280,12 +283,14 @@ void CDMRSlot::writeModem(unsigned char *data) m_rfState = RS_RF_DATA; + std::string src = m_lookup->find(srcId); + if (m_netState == RS_NET_IDLE) { setShortLC(m_slotNo, dstId, gi ? FLCO_GROUP : FLCO_USER_USER, false); - m_display->writeDMR(m_slotNo, srcId, gi, dstId, "R"); + m_display->writeDMR(m_slotNo, src.c_str(), gi, dstId, "R"); } - LogMessage("DMR Slot %u, received RF data header from %u to %s%u, %u blocks", m_slotNo, srcId, gi ? "TG ": "", dstId, m_rfFrames); + LogMessage("DMR Slot %u, received RF data header from %s to %s%u, %u blocks", m_slotNo, src.c_str(), gi ? "TG ": "", dstId, m_rfFrames); } else if (dataType == DT_CSBK) { CDMRCSBK csbk; bool valid = csbk.put(data + 2U); @@ -553,12 +558,14 @@ void CDMRSlot::writeModem(unsigned char *data) m_rfState = RS_RF_AUDIO; + std::string src = m_lookup->find(m_rfLC->getSrcId()); + if (m_netState == RS_NET_IDLE) { setShortLC(m_slotNo, m_rfLC->getDstId(), m_rfLC->getFLCO(), true); - m_display->writeDMR(m_slotNo, m_rfLC->getSrcId(), m_rfLC->getFLCO() == FLCO_GROUP, m_rfLC->getDstId(), "R"); + m_display->writeDMR(m_slotNo, src.c_str(), m_rfLC->getFLCO() == FLCO_GROUP, m_rfLC->getDstId(), "R"); } - LogMessage("DMR Slot %u, received RF late entry from %u to %s%u", m_slotNo, m_rfLC->getSrcId(), m_rfLC->getFLCO() == FLCO_GROUP ? "TG " : "", m_rfLC->getDstId()); + LogMessage("DMR Slot %u, received RF late entry from %s to %s%u", m_slotNo, src.c_str(), m_rfLC->getFLCO() == FLCO_GROUP ? "TG " : "", m_rfLC->getDstId()); } } } @@ -730,13 +737,15 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData) setShortLC(m_slotNo, m_netLC->getDstId(), m_netLC->getFLCO(), true); - m_display->writeDMR(m_slotNo, m_netLC->getSrcId(), m_netLC->getFLCO() == FLCO_GROUP, m_netLC->getDstId(), "N"); + std::string src = m_lookup->find(m_netLC->getSrcId()); + + m_display->writeDMR(m_slotNo, src.c_str(), m_netLC->getFLCO() == FLCO_GROUP, m_netLC->getDstId(), "N"); #if defined(DUMP_DMR) openFile(); writeFile(data); #endif - LogMessage("DMR Slot %u, received network voice header from %u to %s%u", m_slotNo, m_netLC->getSrcId(), m_netLC->getFLCO() == FLCO_GROUP ? "TG " : "", m_netLC->getDstId()); + LogMessage("DMR Slot %u, received network voice header from %s to %s%u", m_slotNo, src.c_str(), m_netLC->getFLCO() == FLCO_GROUP ? "TG " : "", m_netLC->getDstId()); } else if (dataType == DT_VOICE_PI_HEADER) { if (m_netState != RS_NET_AUDIO) return; @@ -845,9 +854,11 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData) setShortLC(m_slotNo, dmrData.getDstId(), gi ? FLCO_GROUP : FLCO_USER_USER, false); - m_display->writeDMR(m_slotNo, dmrData.getSrcId(), gi, dmrData.getDstId(), "N"); + std::string src = m_lookup->find(dmrData.getSrcId()); - LogMessage("DMR Slot %u, received network data header from %u to %s%u, %u blocks", m_slotNo, dmrData.getSrcId(), gi ? "TG ": "", dmrData.getDstId(), m_netFrames); + m_display->writeDMR(m_slotNo, src.c_str(), gi, dmrData.getDstId(), "N"); + + LogMessage("DMR Slot %u, received network data header from %s to %s%u, %u blocks", m_slotNo, src.c_str(), gi ? "TG ": "", dmrData.getDstId(), m_netFrames); } else if (dataType == DT_VOICE_SYNC) { if (m_netState == RS_NET_IDLE) { m_netLC = new CDMRLC(dmrData.getFLCO(), dmrData.getSrcId(), dmrData.getDstId()); @@ -870,9 +881,11 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData) setShortLC(m_slotNo, m_netLC->getDstId(), m_netLC->getFLCO(), true); - m_display->writeDMR(m_slotNo, m_netLC->getSrcId(), m_netLC->getFLCO() == FLCO_GROUP, m_netLC->getDstId(), "N"); + std::string src = m_lookup->find(m_netLC->getSrcId()); - LogMessage("DMR Slot %u, received network late entry from %u to %s%u", m_slotNo, m_netLC->getSrcId(), m_netLC->getFLCO() == FLCO_GROUP ? "TG " : "", m_netLC->getDstId()); + m_display->writeDMR(m_slotNo, src.c_str(), m_netLC->getFLCO() == FLCO_GROUP, m_netLC->getDstId(), "N"); + + LogMessage("DMR Slot %u, received network late entry from %s to %s%u", m_slotNo, src.c_str(), m_netLC->getFLCO() == FLCO_GROUP ? "TG " : "", m_netLC->getDstId()); } if (m_netState == RS_NET_AUDIO) { @@ -1229,11 +1242,12 @@ void CDMRSlot::writeQueueNet(const unsigned char *data) m_queue.addData(data, len); } -void CDMRSlot::init(unsigned int id, unsigned int colorCode, bool selfOnly, const std::vector& prefixes, const std::vector& blackList, CModem* modem, CDMRIPSC* network, IDisplay* display, bool duplex) +void CDMRSlot::init(unsigned int id, unsigned int colorCode, bool selfOnly, const std::vector& prefixes, const std::vector& blackList, CModem* modem, CDMRIPSC* network, IDisplay* display, bool duplex, CDMRLookup* lookup) { assert(id != 0U); assert(modem != NULL); assert(display != NULL); + assert(lookup != NULL); m_id = id; m_colorCode = colorCode; @@ -1244,6 +1258,7 @@ void CDMRSlot::init(unsigned int id, unsigned int colorCode, bool selfOnly, cons m_network = network; m_display = display; m_duplex = duplex; + m_lookup = lookup; m_idle = new unsigned char[DMR_FRAME_LENGTH_BYTES + 2U]; diff --git a/DMRSlot.h b/DMRSlot.h index 481ee3d..accc9cd 100644 --- a/DMRSlot.h +++ b/DMRSlot.h @@ -23,6 +23,7 @@ #include "DMRDataHeader.h" #include "RingBuffer.h" #include "StopWatch.h" +#include "DMRLookup.h" #include "AMBEFEC.h" #include "DMRSlot.h" #include "DMRData.h" @@ -49,7 +50,7 @@ public: void clock(); - static void init(unsigned int id, unsigned int colorCode, bool selfOnly, const std::vector& prefixes, const std::vector& blackList, CModem* modem, CDMRIPSC* network, IDisplay* display, bool duplex); + static void init(unsigned int id, unsigned int colorCode, bool selfOnly, const std::vector& prefixes, const std::vector& blackList, CModem* modem, CDMRIPSC* network, IDisplay* display, bool duplex, CDMRLookup* lookup); private: unsigned int m_slotNo; @@ -93,6 +94,7 @@ private: static CDMRIPSC* m_network; static IDisplay* m_display; static bool m_duplex; + static CDMRLookup* m_lookup; static unsigned char* m_idle; diff --git a/Display.h b/Display.h index a161796..e63ece7 100644 --- a/Display.h +++ b/Display.h @@ -36,7 +36,7 @@ public: virtual void writeDStar(const char* my1, const char* my2, const char* your, const char* type) = 0; virtual void clearDStar() = 0; - virtual void writeDMR(unsigned int slotNo, unsigned int srdId, bool group, unsigned int dstId, const char* type) = 0; + virtual void writeDMR(unsigned int slotNo, const char* src, bool group, unsigned int dstId, const char* type) = 0; virtual void clearDMR(unsigned int slotNo) = 0; virtual void writeFusion(const char* source, const char* dest) = 0; diff --git a/HD44780.cpp b/HD44780.cpp index 7a5964c..88982f2 100644 --- a/HD44780.cpp +++ b/HD44780.cpp @@ -154,8 +154,9 @@ void CHD44780::clearDStar() } } -void CHD44780::writeDMR(unsigned int slotNo, unsigned int srcId, bool group, unsigned int dstId, const char* type) +void CHD44780::writeDMR(unsigned int slotNo, const char* src, bool group, unsigned int dstId, const char* type) { + assert(src != NULL); assert(type != NULL); if (!m_dmr) { @@ -178,18 +179,18 @@ void CHD44780::writeDMR(unsigned int slotNo, unsigned int srcId, bool group, uns if (slotNo == 1U) { char buffer[40U]; if (m_cols > 16U) - ::sprintf(buffer, "%s %u > %s%u", type, srcId, group ? "TG" : "", dstId); + ::sprintf(buffer, "%s %s > %s%u", type, src, group ? "TG" : "", dstId); else - ::sprintf(buffer, "%u > %s%u", srcId, group ? "TG" : "", dstId); + ::sprintf(buffer, "%s > %s%u", src, group ? "TG" : "", dstId); ::lcdPosition(m_fd, 0, m_rows > 2U ? 1 : 0); ::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, buffer); } else { char buffer[40U]; if (m_cols > 16U) - ::sprintf(buffer, "%s %u > %s%u", type, srcId, group ? "TG" : "", dstId); + ::sprintf(buffer, "%s %s > %s%u", type, src, group ? "TG" : "", dstId); else - ::sprintf(buffer, "%u > %s%u", srcId, group ? "TG" : "", dstId); + ::sprintf(buffer, "%s > %s%u", src, group ? "TG" : "", dstId); ::lcdPosition(m_fd, 0, m_rows > 2U ? 2 : 1); ::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, buffer); diff --git a/HD44780.h b/HD44780.h index bd20d47..550cc1b 100644 --- a/HD44780.h +++ b/HD44780.h @@ -40,7 +40,7 @@ public: virtual void writeDStar(const char* my1, const char* my2, const char* your, const char* type); virtual void clearDStar(); - virtual void writeDMR(unsigned int slotNo, unsigned int srdId, bool group, unsigned int dstId, const char* type); + virtual void writeDMR(unsigned int slotNo, const char* src, bool group, unsigned int dstId, const char* type); virtual void clearDMR(unsigned int slotNo); virtual void writeFusion(const char* source, const char* dest); diff --git a/MMDVM.ini b/MMDVM.ini index adb5faa..850e9ea 100644 --- a/MMDVM.ini +++ b/MMDVM.ini @@ -48,6 +48,7 @@ Id=123456 ColorCode=1 SelfOnly=0 # Prefixes=234,235 +LookupFile=DMRIds.dat [System Fusion] Enable=1 diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index e299e8e..3df2979 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -168,6 +168,7 @@ int CMMDVMHost::run() std::vector prefixes = m_conf.getDMRPrefixes(); std::vector blackList = m_conf.getDMRBlackList(); unsigned int timeout = m_conf.getTimeout(); + std::string lookupFile = m_conf.getDMRLookupFile(); LogInfo("DMR Parameters"); LogInfo(" Id: %u", id); @@ -177,8 +178,9 @@ int CMMDVMHost::run() if (blackList.size() > 0U) LogInfo(" Black List: %u", blackList.size()); LogInfo(" Timeout: %us", timeout); + LogInfo(" Lookup File: %s", lookupFile.length() > 0U ? lookupFile.c_str() : "None"); - dmr = new CDMRControl(id, colorCode, selfOnly, prefixes, blackList, timeout, m_modem, m_dmrNetwork, m_display, m_duplex); + dmr = new CDMRControl(id, colorCode, selfOnly, prefixes, blackList, timeout, m_modem, m_dmrNetwork, m_display, m_duplex, lookupFile); } CYSFControl* ysf = NULL; diff --git a/Nextion.cpp b/Nextion.cpp index 86b9ca5..c513eea 100644 --- a/Nextion.cpp +++ b/Nextion.cpp @@ -119,8 +119,9 @@ void CNextion::clearDStar() sendCommand("t1.txt=\"\""); } -void CNextion::writeDMR(unsigned int slotNo, unsigned int srcId, bool group, unsigned int dstId, const char* type) +void CNextion::writeDMR(unsigned int slotNo, const char* src, bool group, unsigned int dstId, const char* type) { + assert(src != NULL); assert(type != NULL); if (m_mode != MODE_DMR) { @@ -135,7 +136,7 @@ void CNextion::writeDMR(unsigned int slotNo, unsigned int srcId, bool group, uns if (slotNo == 1U) { char text[30U]; - ::sprintf(text, "t0.txt=\"1 %s %u\"", type, srcId); + ::sprintf(text, "t0.txt=\"1 %s %s\"", type, src); sendCommand(text); ::sprintf(text, "t1.txt=\"%s%u\"", group ? "TG" : "", dstId); @@ -143,7 +144,7 @@ void CNextion::writeDMR(unsigned int slotNo, unsigned int srcId, bool group, uns } else { char text[30U]; - ::sprintf(text, "t2.txt=\"2 %s %u\"", type, srcId); + ::sprintf(text, "t2.txt=\"2 %s %s\"", type, src); sendCommand(text); ::sprintf(text, "t3.txt=\"%s%u\"", group ? "TG" : "", dstId); diff --git a/Nextion.h b/Nextion.h index f13b633..f0a9108 100644 --- a/Nextion.h +++ b/Nextion.h @@ -41,7 +41,7 @@ public: virtual void writeDStar(const char* my1, const char* my2, const char* your, const char* type); virtual void clearDStar(); - virtual void writeDMR(unsigned int slotNo, unsigned int srdId, bool group, unsigned int dstId, const char* type); + virtual void writeDMR(unsigned int slotNo, const char* src, bool group, unsigned int dstId, const char* type); virtual void clearDMR(unsigned int slotNo); virtual void writeFusion(const char* source, const char* dest); diff --git a/NullDisplay.cpp b/NullDisplay.cpp index e6f31f4..7398946 100644 --- a/NullDisplay.cpp +++ b/NullDisplay.cpp @@ -51,7 +51,7 @@ void CNullDisplay::clearDStar() { } -void CNullDisplay::writeDMR(unsigned int slotNo, unsigned int srcId, bool group, unsigned int dstId, const char* type) +void CNullDisplay::writeDMR(unsigned int slotNo, const char* src, bool group, unsigned int dstId, const char* type) { } diff --git a/NullDisplay.h b/NullDisplay.h index bdcb8d0..aaa25c9 100644 --- a/NullDisplay.h +++ b/NullDisplay.h @@ -39,7 +39,7 @@ public: virtual void writeDStar(const char* my1, const char* my2, const char* your, const char* type); virtual void clearDStar(); - virtual void writeDMR(unsigned int slotNo, unsigned int srdId, bool group, unsigned int dstId, const char* type); + virtual void writeDMR(unsigned int slotNo, const char* src, bool group, unsigned int dstId, const char* type); virtual void clearDMR(unsigned int slotNo); virtual void writeFusion(const char* source, const char* dest); diff --git a/TFTSerial.cpp b/TFTSerial.cpp index ed1bfba..193300e 100644 --- a/TFTSerial.cpp +++ b/TFTSerial.cpp @@ -182,8 +182,9 @@ void CTFTSerial::clearDStar() displayText(" "); } -void CTFTSerial::writeDMR(unsigned int slotNo, unsigned int srcId, bool group, unsigned int dstId, const char* type) +void CTFTSerial::writeDMR(unsigned int slotNo, const char* src, bool group, unsigned int dstId, const char* type) { + assert(src != NULL); assert(type != NULL); if (m_mode != MODE_DMR) { @@ -207,7 +208,7 @@ void CTFTSerial::writeDMR(unsigned int slotNo, unsigned int srcId, bool group, u if (slotNo == 1U) { char text[30U]; - ::sprintf(text, "1 %s %u", type, srcId); + ::sprintf(text, "1 %s %s", type, src); gotoPosPixel(5U, 55U); displayText(text); @@ -217,7 +218,7 @@ void CTFTSerial::writeDMR(unsigned int slotNo, unsigned int srcId, bool group, u } else { char text[30U]; - ::sprintf(text, "2 %s %u", type, srcId); + ::sprintf(text, "2 %s %s", type, src); gotoPosPixel(5U, 90U); displayText(text); diff --git a/TFTSerial.h b/TFTSerial.h index 84f5075..1847815 100644 --- a/TFTSerial.h +++ b/TFTSerial.h @@ -41,7 +41,7 @@ public: virtual void writeDStar(const char* my1, const char* my2, const char* your, const char* type); virtual void clearDStar(); - virtual void writeDMR(unsigned int slotNo, unsigned int srdId, bool group, unsigned int dstId, const char* type); + virtual void writeDMR(unsigned int slotNo, const char* src, bool group, unsigned int dstId, const char* type); virtual void clearDMR(unsigned int slotNo); virtual void writeFusion(const char* source, const char* dest);