From 6d83bfb8bce518dce1d77cb00076500993cb233b Mon Sep 17 00:00:00 2001 From: GuusvanDooren Date: Fri, 10 May 2019 20:44:01 +0200 Subject: [PATCH 1/2] QSO info removed from OLED. QSO info add via CASTInfo. --- CASTInfo.cpp | 149 +++++++++++++++++++++++++++++++++++++++++++++++++++ CASTInfo.h | 70 ++++++++++++++++++++++++ Conf.cpp | 7 --- Conf.h | 1 - Display.cpp | 6 ++- OLED.cpp | 15 ------ 6 files changed, 223 insertions(+), 25 deletions(-) create mode 100644 CASTInfo.cpp create mode 100644 CASTInfo.h diff --git a/CASTInfo.cpp b/CASTInfo.cpp new file mode 100644 index 0000000..b1bed7f --- /dev/null +++ b/CASTInfo.cpp @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2016,2018 by Jonathan Naylor G4KLX + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "CASTInfo.h" + +static bool networkInfoInitialized = false; +static unsigned char passCounter = 0; + +CCASTInfo::CCASTInfo(CModem* modem) : +CDisplay(), +m_modem(modem), +m_ipaddress() +{ +} + +CCASTInfo::~CCASTInfo() +{ +} + +bool CCASTInfo::open() +{ + return true; +} + +void CCASTInfo::setIdleInt() +{ + unsigned char info[100U]; + CNetworkInfo* m_network; + + passCounter ++; + if (passCounter > 253U) + networkInfoInitialized = false; + + if (! networkInfoInitialized) { + //LogMessage("Initialize CNetworkInfo"); + info[0]=0; + m_network = new CNetworkInfo; + m_network->getNetworkInterface(info); + m_ipaddress = (char*)info; + delete m_network; + + if (m_modem != NULL) + m_modem->writeIPInfo(m_ipaddress); + + networkInfoInitialized = true; + passCounter = 0; + } + + +} + +void CCASTInfo::setErrorInt(const char* text) +{ +} + +void CCASTInfo::setLockoutInt() +{ +} + +void CCASTInfo::setQuitInt() +{ +} + +void CCASTInfo::writeDStarInt(const char* my1, const char* my2, const char* your, const char* type, const char* reflector) +{ + if (m_modem != NULL) + m_modem->writeDStarInfo(my1, my2, your, type, reflector); +} + +void CCASTInfo::clearDStarInt() +{ +} + +void CCASTInfo::writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type) +{ + if (m_modem != NULL) + m_modem->writeDMRInfo(slotNo, src, group, dst, type); +} + +void CCASTInfo::clearDMRInt(unsigned int slotNo) +{ +} + +void CCASTInfo::writeFusionInt(const char* source, const char* dest, const char* type, const char* origin) +{ + if (m_modem != NULL) + m_modem->writeYSFInfo(source, dest, type, origin); +} + +void CCASTInfo::clearFusionInt() +{ +} + +void CCASTInfo::writeP25Int(const char* source, bool group, unsigned int dest, const char* type) +{ + if (m_modem != NULL) + m_modem->writeP25Info(source, group, dest, type); +} + +void CCASTInfo::clearP25Int() +{ +} + +void CCASTInfo::writeNXDNInt(const char* source, bool group, unsigned int dest, const char* type) +{ + if (m_modem != NULL) + m_modem->writeNXDNInfo(source, group, dest, type); +} + +void CCASTInfo::clearNXDNInt() +{ +} + +void CCASTInfo::writePOCSAGInt(uint32_t ric, const std::string& message) +{ + if (m_modem != NULL) + m_modem->writePOCSAGInfo(ric, message); +} + +void CCASTInfo::clearPOCSAGInt() +{ +} + +void CCASTInfo::writeCWInt() +{ +} + +void CCASTInfo::clearCWInt() +{ +} + +void CCASTInfo::close() +{ +} diff --git a/CASTInfo.h b/CASTInfo.h new file mode 100644 index 0000000..326ecad --- /dev/null +++ b/CASTInfo.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2016,2018 by Jonathan Naylor G4KLX + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#if !defined(CASTINFO_H) +#define CASTINFO_H + +#include "Display.h" + +#include + +#include "NetworkInfo.h" +#include "Modem.h" +class CCASTInfo : public CDisplay +{ +public: + CCASTInfo(CModem* modem); + virtual ~CCASTInfo(); + + virtual bool open(); + + virtual void close(); + +protected: + virtual void setIdleInt(); + virtual void setErrorInt(const char* text); + virtual void setLockoutInt(); + virtual void setQuitInt(); + + virtual void writeDStarInt(const char* my1, const char* my2, const char* your, const char* type, const char* reflector); + virtual void clearDStarInt(); + + virtual void writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type); + virtual void clearDMRInt(unsigned int slotNo); + + virtual void writeFusionInt(const char* source, const char* dest, const char* type, const char* origin); + virtual void clearFusionInt(); + + virtual void writeP25Int(const char* source, bool group, unsigned int dest, const char* type); + virtual void clearP25Int(); + + virtual void writeNXDNInt(const char* source, bool group, unsigned int dest, const char* type); + virtual void clearNXDNInt(); + + virtual void writePOCSAGInt(uint32_t ric, const std::string& message); + virtual void clearPOCSAGInt(); + + virtual void writeCWInt(); + virtual void clearCWInt(); + +private: + CModem* m_modem; + std::string m_ipaddress; +}; + +#endif diff --git a/Conf.cpp b/Conf.cpp index 6d63082..73d0433 100644 --- a/Conf.cpp +++ b/Conf.cpp @@ -237,7 +237,6 @@ m_oledBrightness(0U), m_oledInvert(false), m_oledScroll(false), m_oledRotate(false), -m_oledCast(false), m_lcdprocAddress(), m_lcdprocPort(0U), m_lcdprocLocalPort(0U), @@ -791,8 +790,6 @@ bool CConf::read() m_oledScroll = ::atoi(value) == 1; else if (::strcmp(key, "Rotate") == 0) m_oledRotate = ::atoi(value) == 1; - else if (::strcmp(key, "Cast") == 0) - m_oledCast = ::atoi(value) == 1; } else if (section == SECTION_LCDPROC) { if (::strcmp(key, "Address") == 0) m_lcdprocAddress = value; @@ -1701,10 +1698,6 @@ bool CConf::getOLEDRotate() const return m_oledRotate; } -bool CConf::getOLEDCast() const -{ - return m_oledCast; -} std::string CConf::getLCDprocAddress() const { diff --git a/Conf.h b/Conf.h index a5bd860..f481822 100644 --- a/Conf.h +++ b/Conf.h @@ -254,7 +254,6 @@ public: bool getOLEDInvert() const; bool getOLEDScroll() const; bool getOLEDRotate() const; - bool getOLEDCast() const; // The LCDproc section std::string getLCDprocAddress() const; diff --git a/Display.cpp b/Display.cpp index 24f62f3..0afcc77 100644 --- a/Display.cpp +++ b/Display.cpp @@ -24,6 +24,7 @@ #include "TFTSerial.h" #include "LCDproc.h" #include "Nextion.h" +#include "CASTInfo.h" #include "Conf.h" #include "Modem.h" #include "UMP.h" @@ -568,10 +569,11 @@ CDisplay* CDisplay::createDisplay(const CConf& conf, CUMP* ump, CModem* modem) bool invert = conf.getOLEDInvert(); bool scroll = conf.getOLEDScroll(); bool rotate = conf.getOLEDRotate(); - bool cast = conf.getOLEDCast(); - display = new COLED(type, brightness, invert, scroll, rotate, conf.getDMRNetworkSlot1(), conf.getDMRNetworkSlot2(), cast ? modem : NULL); + display = new COLED(type, brightness, invert, scroll, rotate, conf.getDMRNetworkSlot1(), conf.getDMRNetworkSlot2(), modem); #endif + } else if (type == "CAST") { + display = new CCASTInfo(modem); } else { LogWarning("No valid display found, disabling"); display = new CNullDisplay; diff --git a/OLED.cpp b/OLED.cpp index d0f5793..be4f4fd 100644 --- a/OLED.cpp +++ b/OLED.cpp @@ -258,9 +258,6 @@ void COLED::setIdleInt() m_ipaddress = (char*)info; delete m_network; - if (m_modem != NULL) - m_modem->writeIPInfo(m_ipaddress); - networkInfoInitialized = true; passCounter = 0; } @@ -331,8 +328,6 @@ void COLED::writeDStarInt(const char* my1, const char* my2, const char* your, co OLED_statusbar(); m_display.display(); - if (m_modem != NULL) - m_modem->writeDStarInfo(my1, my2, your, type, reflector); } void COLED::clearDStarInt() @@ -393,8 +388,6 @@ void COLED::writeDMRInt(unsigned int slotNo,const std::string& src,bool group,co OLED_statusbar(); m_display.display(); - if (m_modem != NULL) - m_modem->writeDMRInfo(slotNo, src, group, dst, type); } void COLED::clearDMRInt(unsigned int slotNo) @@ -442,8 +435,6 @@ void COLED::writeFusionInt(const char* source, const char* dest, const char* typ OLED_statusbar(); m_display.display(); - if (m_modem != NULL) - m_modem->writeYSFInfo(source, dest, type, origin); } void COLED::clearFusionInt() @@ -475,8 +466,6 @@ void COLED::writeP25Int(const char* source, bool group, unsigned int dest, const OLED_statusbar(); m_display.display(); - if (m_modem != NULL) - m_modem->writeP25Info(source, group, dest, type); } void COLED::clearP25Int() @@ -508,8 +497,6 @@ void COLED::writeNXDNInt(const char* source, bool group, unsigned int dest, cons OLED_statusbar(); m_display.display(); - if (m_modem != NULL) - m_modem->writeNXDNInfo(source, group, dest, type); } void COLED::clearNXDNInt() @@ -541,8 +528,6 @@ void COLED::writePOCSAGInt(uint32_t ric, const std::string& message) OLED_statusbar(); m_display.display(); - if (m_modem != NULL) - m_modem->writePOCSAGInfo(ric, message); } void COLED::clearPOCSAGInt() From 847652f8ce122093e7aacd76fc987d84b4d504a6 Mon Sep 17 00:00:00 2001 From: GuusvanDooren Date: Fri, 10 May 2019 22:54:14 +0200 Subject: [PATCH 2/2] Update make files. --- Makefile | 2 +- Makefile.Pi | 2 +- Makefile.Pi.Adafruit | 2 +- Makefile.Pi.HD44780 | 2 +- Makefile.Pi.OLED | 2 +- Makefile.Pi.PCF8574 | 2 +- Makefile.Solaris | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 45c3c9c..aaed744 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ LIBS = -lpthread LDFLAGS = -g OBJECTS = \ - AMBEFEC.o BCH.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedData.o DMRFullLC.o \ + AMBEFEC.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedData.o DMRFullLC.o \ DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o \ DStarSlowData.o Golay2087.o Golay24128.o Hamming.o I2CController.o LCDproc.o Log.o MMDVMHost.o MobileGPS.o Modem.o ModemSerialPort.o Mutex.o \ NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNLayer3.o NXDNLICH.o \ diff --git a/Makefile.Pi b/Makefile.Pi index 1904501..fe01ea6 100644 --- a/Makefile.Pi +++ b/Makefile.Pi @@ -7,7 +7,7 @@ LIBS = -lwiringPi -lwiringPiDev -lpthread LDFLAGS = -g -L/usr/local/lib OBJECTS = \ - AMBEFEC.o BCH.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedData.o DMRFullLC.o \ + AMBEFEC.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedData.o DMRFullLC.o \ DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o \ DStarSlowData.o Golay2087.o Golay24128.o Hamming.o I2CController.o LCDproc.o Log.o MMDVMHost.o MobileGPS.o Modem.o ModemSerialPort.o Mutex.o \ NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o \ diff --git a/Makefile.Pi.Adafruit b/Makefile.Pi.Adafruit index c2ef4c5..ecb0745 100644 --- a/Makefile.Pi.Adafruit +++ b/Makefile.Pi.Adafruit @@ -8,7 +8,7 @@ LIBS = -lwiringPi -lwiringPiDev -lpthread LDFLAGS = -g -L/usr/local/lib OBJECTS = \ - AMBEFEC.o BCH.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedData.o DMRFullLC.o \ + AMBEFEC.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedData.o DMRFullLC.o \ DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o \ DStarSlowData.o Golay2087.o Golay24128.o Hamming.o HD44780.o I2CController.o LCDproc.o Log.o MMDVMHost.o MobileGPS.o Modem.o ModemSerialPort.o Mutex.o \ NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o \ diff --git a/Makefile.Pi.HD44780 b/Makefile.Pi.HD44780 index 89c905e..b14cf90 100644 --- a/Makefile.Pi.HD44780 +++ b/Makefile.Pi.HD44780 @@ -7,7 +7,7 @@ LIBS = -lwiringPi -lwiringPiDev -lpthread LDFLAGS = -g -L/usr/local/lib OBJECTS = \ - AMBEFEC.o BCH.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedData.o DMRFullLC.o \ + AMBEFEC.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedData.o DMRFullLC.o \ DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o \ DStarSlowData.o Golay2087.o Golay24128.o Hamming.o HD44780.o I2CController.o LCDproc.o Log.o MMDVMHost.o MobileGPS.o Modem.o ModemSerialPort.o Mutex.o \ NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o \ diff --git a/Makefile.Pi.OLED b/Makefile.Pi.OLED index b21d2b6..0b08d5c 100644 --- a/Makefile.Pi.OLED +++ b/Makefile.Pi.OLED @@ -7,7 +7,7 @@ LIBS = -lArduiPi_OLED -lwiringPi -lpthread LDFLAGS = -g -L/usr/local/lib OBJECTS = \ - AMBEFEC.o BCH.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedData.o DMRFullLC.o \ + AMBEFEC.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedData.o DMRFullLC.o \ DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o \ DStarSlowData.o Golay2087.o Golay24128.o Hamming.o I2CController.o OLED.o LCDproc.o Log.o MMDVMHost.o MobileGPS.o Modem.o ModemSerialPort.o Mutex.o \ NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o \ diff --git a/Makefile.Pi.PCF8574 b/Makefile.Pi.PCF8574 index 761df4d..005c688 100644 --- a/Makefile.Pi.PCF8574 +++ b/Makefile.Pi.PCF8574 @@ -8,7 +8,7 @@ LIBS = -lwiringPi -lwiringPiDev -lpthread LDFLAGS = -g -L/usr/local/lib OBJECTS = \ - AMBEFEC.o BCH.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedData.o DMRFullLC.o \ + AMBEFEC.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedData.o DMRFullLC.o \ DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o \ DStarSlowData.o Golay2087.o Golay24128.o Hamming.o HD44780.o I2CController.o LCDproc.o Log.o MMDVMHost.o MobileGPS.o Modem.o ModemSerialPort.o Mutex.o \ NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o \ diff --git a/Makefile.Solaris b/Makefile.Solaris index d170958..f8319a3 100644 --- a/Makefile.Solaris +++ b/Makefile.Solaris @@ -7,7 +7,7 @@ LIBS = -lpthread -lsocket LDFLAGS = -g OBJECTS = \ - AMBEFEC.o BCH.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedData.o DMRFullLC.o \ + AMBEFEC.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedData.o DMRFullLC.o \ DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o \ DStarSlowData.o Golay2087.o Golay24128.o Hamming.o LCDproc.o Log.o MMDVMHost.o MobileGPS.o Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o \ NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o \