Merge pull request #26 from phl0/NextionFormatting

Change other variables to references as well
This commit is contained in:
Jonathan Naylor 2016-04-21 15:16:34 +01:00
commit 32cbdee533
10 changed files with 28 additions and 37 deletions

View file

@ -178,7 +178,7 @@ void CDMRSlot::writeModem(unsigned char *data)
if (m_netState == RS_NET_IDLE) {
setShortLC(m_slotNo, m_rfLC->getDstId(), m_rfLC->getFLCO(), true);
m_display->writeDMR(m_slotNo, src.c_str(), m_rfLC->getFLCO() == FLCO_GROUP, dst.c_str(), "R");
m_display->writeDMR(m_slotNo, src, m_rfLC->getFLCO() == FLCO_GROUP, dst, "R");
}
LogMessage("DMR Slot %u, received RF voice header from %s to %s%s", m_slotNo, src.c_str(), m_rfLC->getFLCO() == FLCO_GROUP ? "TG " : "", dst.c_str());
@ -288,7 +288,7 @@ void CDMRSlot::writeModem(unsigned char *data)
if (m_netState == RS_NET_IDLE) {
setShortLC(m_slotNo, dstId, gi ? FLCO_GROUP : FLCO_USER_USER, false);
m_display->writeDMR(m_slotNo, src.c_str(), gi, dst.c_str(), "R");
m_display->writeDMR(m_slotNo, src, gi, dst, "R");
}
LogMessage("DMR Slot %u, received RF data header from %s to %s%s, %u blocks", m_slotNo, src.c_str(), gi ? "TG ": "", dst.c_str(), m_rfFrames);
@ -550,7 +550,7 @@ void CDMRSlot::writeModem(unsigned char *data)
if (m_netState == RS_NET_IDLE) {
setShortLC(m_slotNo, m_rfLC->getDstId(), m_rfLC->getFLCO(), true);
m_display->writeDMR(m_slotNo, src.c_str(), m_rfLC->getFLCO() == FLCO_GROUP, dst.c_str(), "R");
m_display->writeDMR(m_slotNo, src, m_rfLC->getFLCO() == FLCO_GROUP, dst, "R");
}
LogMessage("DMR Slot %u, received RF late entry from %s to %s%s", m_slotNo, src.c_str(), m_rfLC->getFLCO() == FLCO_GROUP ? "TG " : "", dst.c_str());

View file

@ -36,7 +36,7 @@ public:
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;
virtual void writeDMR(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type) = 0;
virtual void clearDMR(unsigned int slotNo) = 0;
virtual void writeFusion(const char* source, const char* dest) = 0;

View file

@ -44,7 +44,6 @@ m_dmr(false)
{
assert(rows > 1U);
assert(cols > 15U);
assert(callsign.c_str() != NULL);
}
CHD44780::~CHD44780()
@ -210,10 +209,8 @@ void CHD44780::clearDStar()
}
}
void CHD44780::writeDMR(unsigned int slotNo, const char* src, bool group, const char* dst, const char* type)
void CHD44780::writeDMR(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type)
{
assert(src != NULL);
assert(dst != NULL);
assert(type != NULL);
if (!m_dmr) {
@ -262,44 +259,44 @@ void CHD44780::writeDMR(unsigned int slotNo, const char* src, bool group, const
if (m_rows == 2U && m_cols == 16U) {
char buffer[16U];
if (slotNo == 1U) {
::sprintf(buffer, "%s > %s%s", src, group ? "TG" : "", dst);
::sprintf(buffer, "%s > %s%s", src.c_str(), group ? "TG" : "", dst.c_str());
::lcdPosition(m_fd, 0, 0);
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, buffer);
} else {
::sprintf(buffer, "%s > %s%s", src, group ? "TG" : "", dst);
::sprintf(buffer, "%s > %s%s", src.c_str(), group ? "TG" : "", dst.c_str());
::lcdPosition(m_fd, 0, 1);
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, buffer);
}
} else if (m_rows == 4U && m_cols == 16U) {
char buffer[16U];
if (slotNo == 1U) {
::sprintf(buffer, "%s %s > %s%s", type, src, group ? "TG" : "", dst);
::sprintf(buffer, "%s %s > %s%s", type, src.c_str(), group ? "TG" : "", dst.c_str());
::lcdPosition(m_fd, 0, 1);
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, buffer);
} else {
::sprintf(buffer, "%s %s > %s%s", type, src, group ? "TG" : "", dst);
::sprintf(buffer, "%s %s > %s%s", type, src.c_str(), group ? "TG" : "", dst.c_str());
::lcdPosition(m_fd, 0, 2);
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, buffer);
}
} else if (m_rows == 4U && m_cols == 20U) {
char buffer[20U];
if (slotNo == 1U) {
::sprintf(buffer, "%s %s > %s%s", type, src, group ? "TG" : "", dst);
::sprintf(buffer, "%s %s > %s%s", type, src.c_str(), group ? "TG" : "", dst.c_str());
::lcdPosition(m_fd, 0, 1);
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, buffer);
} else {
::sprintf(buffer, "%s %s > %s%s", type, src, group ? "TG" : "", dst);
::sprintf(buffer, "%s %s > %s%s", type, src.c_str(), group ? "TG" : "", dst.c_str());
::lcdPosition(m_fd, 0, 2);
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, buffer);
}
} else if (m_rows == 2U && m_cols == 40U) {
char buffer[40U];
if (slotNo == 1U) {
::sprintf(buffer, "%s %s > %s%s", type, src, group ? "TG" : "", dst);
::sprintf(buffer, "%s %s > %s%s", type, src.c_str(), group ? "TG" : "", dst.c_str());
::lcdPosition(m_fd, 0, 0);
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, buffer);
} else {
::sprintf(buffer, "%s %s > %s%s", type, src, group ? "TG" : "", dst);
::sprintf(buffer, "%s %s > %s%s", type, src.c_str(), group ? "TG" : "", dst.c_str());
::lcdPosition(m_fd, 0, 1);
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, buffer);
}

View file

@ -50,7 +50,7 @@ public:
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);
virtual void writeDMR(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type);
virtual void clearDMR(unsigned int slotNo);
virtual void writeFusion(const char* source, const char* dest);

View file

@ -30,7 +30,6 @@ m_serial(port, SERIAL_9600),
m_brightness(brightness),
m_mode(MODE_IDLE)
{
assert(callsign.c_str() != NULL);
assert(brightness >= 0U && brightness <= 100U);
}
@ -125,10 +124,8 @@ void CNextion::clearDStar()
sendCommand("t1.txt=\"\"");
}
void CNextion::writeDMR(unsigned int slotNo, const char* src, bool group, const char* dst, const char* type)
void CNextion::writeDMR(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type)
{
assert(src != NULL);
assert(dst != NULL);
assert(type != NULL);
if (m_mode != MODE_DMR) {
@ -143,18 +140,18 @@ void CNextion::writeDMR(unsigned int slotNo, const char* src, bool group, const
if (slotNo == 1U) {
char text[30U];
::sprintf(text, "t0.txt=\"1 %s %s\"", type, src);
::sprintf(text, "t0.txt=\"1 %s %s\"", type, src.c_str());
sendCommand(text);
::sprintf(text, "t1.txt=\"%s%s\"", group ? "TG" : "", dst);
::sprintf(text, "t1.txt=\"%s%s\"", group ? "TG" : "", dst.c_str());
sendCommand(text);
} else {
char text[30U];
::sprintf(text, "t2.txt=\"2 %s %s\"", type, src);
::sprintf(text, "t2.txt=\"2 %s %s\"", type, src.c_str());
sendCommand(text);
::sprintf(text, "t3.txt=\"%s%s\"", group ? "TG" : "", dst);
::sprintf(text, "t3.txt=\"%s%s\"", group ? "TG" : "", dst.c_str());
sendCommand(text);
}

View file

@ -41,7 +41,7 @@ public:
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);
virtual void writeDMR(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type);
virtual void clearDMR(unsigned int slotNo);
virtual void writeFusion(const char* source, const char* dest);

View file

@ -51,7 +51,7 @@ void CNullDisplay::clearDStar()
{
}
void CNullDisplay::writeDMR(unsigned int slotNo, const char* src, bool group, const char* dst, const char* type)
void CNullDisplay::writeDMR(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type)
{
}

View file

@ -39,7 +39,7 @@ public:
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);
virtual void writeDMR(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type);
virtual void clearDMR(unsigned int slotNo);
virtual void writeFusion(const char* source, const char* dest);

View file

@ -51,7 +51,6 @@ m_serial(port, SERIAL_9600),
m_brightness(brightness),
m_mode(MODE_IDLE)
{
assert(callsign.c_str() != NULL);
assert(brightness >= 0U && brightness <= 100U);
}
@ -188,10 +187,8 @@ void CTFTSerial::clearDStar()
displayText(" ");
}
void CTFTSerial::writeDMR(unsigned int slotNo, const char* src, bool group, const char* dst, const char* type)
void CTFTSerial::writeDMR(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type)
{
assert(src != NULL);
assert(dst != NULL);
assert(type != NULL);
if (m_mode != MODE_DMR) {
@ -215,21 +212,21 @@ void CTFTSerial::writeDMR(unsigned int slotNo, const char* src, bool group, cons
if (slotNo == 1U) {
char text[30U];
::sprintf(text, "1 %s %s", type, src);
::sprintf(text, "1 %s %s", type, src.c_str());
gotoPosPixel(5U, 55U);
displayText(text);
::sprintf(text, "%s%s", group ? "TG" : "", dst);
::sprintf(text, "%s%s", group ? "TG" : "", dst.c_str());
gotoPosPixel(65U, 72U);
displayText(text);
} else {
char text[30U];
::sprintf(text, "2 %s %s", type, src);
::sprintf(text, "2 %s %s", type, src.c_str());
gotoPosPixel(5U, 90U);
displayText(text);
::sprintf(text, "%s%s", group ? "TG" : "", dst);
::sprintf(text, "%s%s", group ? "TG" : "", dst.c_str());
gotoPosPixel(65U, 107U);
displayText(text);
}

View file

@ -41,7 +41,7 @@ public:
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);
virtual void writeDMR(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type);
virtual void clearDMR(unsigned int slotNo);
virtual void writeFusion(const char* source, const char* dest);