diff --git a/DMRSlot.cpp b/DMRSlot.cpp index 124bdf15c..a26da2dd3 100644 --- a/DMRSlot.cpp +++ b/DMRSlot.cpp @@ -80,7 +80,7 @@ m_rfEmbeddedData(NULL), m_rfEmbeddedReadN(0U), m_rfEmbeddedWriteN(1U), m_rfTalkerId(TALKER_ID_NONE), -m_rfTalkerAlias(NULL), +m_rfTalkerAlias(), m_netEmbeddedLC(), m_netEmbeddedData(NULL), m_netEmbeddedReadN(0U), @@ -117,8 +117,6 @@ m_aveRSSI(0U), m_rssiCount(0U), m_fp(NULL) { - m_rfTalkerAlias = new unsigned char[32U]; - m_lastFrame = new unsigned char[DMR_FRAME_LENGTH_BYTES + 2U]; m_rfEmbeddedData = new CDMREmbeddedData[2U]; @@ -132,7 +130,6 @@ CDMRSlot::~CDMRSlot() delete[] m_rfEmbeddedData; delete[] m_netEmbeddedData; delete[] m_lastFrame; - delete[] m_rfTalkerAlias; } bool CDMRSlot::writeModem(unsigned char *data, unsigned int len) @@ -632,9 +629,9 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len) if (!(m_rfTalkerId & TALKER_ID_HEADER)) { if (m_rfTalkerId == TALKER_ID_NONE) - ::memset(m_rfTalkerAlias, '\0', 32U); - ::memcpy(m_rfTalkerAlias, data, 6U); - m_display->writeDMRTA(m_slotNo, m_rfTalkerAlias, "R"); + m_rfTalkerAlias.reset(); + m_rfTalkerAlias.add(0, data, 7U); + m_display->writeDMRTA(m_slotNo, (unsigned char*)m_rfTalkerAlias.get(), "R"); if (m_dumpTAData) { ::sprintf(text, "DMR Slot %u, Embedded Talker Alias Header", m_slotNo); @@ -651,9 +648,9 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len) if (!(m_rfTalkerId & TALKER_ID_BLOCK1)) { if (m_rfTalkerId == TALKER_ID_NONE) - ::memset(m_rfTalkerAlias, '\0', 32U); - ::memcpy(m_rfTalkerAlias + 6U, data, 7U); - m_display->writeDMRTA(m_slotNo, m_rfTalkerAlias, "R"); + m_rfTalkerAlias.reset(); + m_rfTalkerAlias.add(1, data, 7U); + m_display->writeDMRTA(m_slotNo, (unsigned char*)m_rfTalkerAlias.get(), "R"); if (m_dumpTAData) { ::sprintf(text, "DMR Slot %u, Embedded Talker Alias Block 1", m_slotNo); @@ -670,9 +667,9 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len) if (!(m_rfTalkerId & TALKER_ID_BLOCK2)) { if (m_rfTalkerId == TALKER_ID_NONE) - ::memset(m_rfTalkerAlias, 0, 32U); - ::memcpy(m_rfTalkerAlias + 6U + 7U, data, 7U); - m_display->writeDMRTA(m_slotNo, m_rfTalkerAlias, "R"); + m_rfTalkerAlias.reset(); + m_rfTalkerAlias.add(2, data, 7U); + m_display->writeDMRTA(m_slotNo, (unsigned char*)m_rfTalkerAlias.get(), "R"); if (m_dumpTAData) { ::sprintf(text, "DMR Slot %u, Embedded Talker Alias Block 2", m_slotNo); @@ -689,9 +686,9 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len) if (!(m_rfTalkerId & TALKER_ID_BLOCK3)) { if (m_rfTalkerId == TALKER_ID_NONE) - ::memset(m_rfTalkerAlias, '\0', 32U); - ::memcpy(m_rfTalkerAlias + 6U + 7U + 7U, data, 7U); - m_display->writeDMRTA(m_slotNo, m_rfTalkerAlias, "R"); + m_rfTalkerAlias.reset(); + m_rfTalkerAlias.add(3, data, 7U); + m_display->writeDMRTA(m_slotNo, (unsigned char*)m_rfTalkerAlias.get(), "R"); if (m_dumpTAData) { ::sprintf(text, "DMR Slot %u, Embedded Talker Alias Block 3", m_slotNo); @@ -1426,9 +1423,9 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData) case FLCO_TALKER_ALIAS_HEADER: if (!(m_netTalkerId & TALKER_ID_HEADER)) { if (!m_netTalkerId) - ::memset(m_rfTalkerAlias, '\0', 32U); - ::memcpy(m_rfTalkerAlias, data + 2U, 7U); - m_display->writeDMRTA(m_slotNo, m_rfTalkerAlias, "N"); + m_rfTalkerAlias.reset(); + m_rfTalkerAlias.add(0, data + 2U, 7U); + m_display->writeDMRTA(m_slotNo, (unsigned char*)m_rfTalkerAlias.get(), "N"); if (m_dumpTAData) { ::sprintf(text, "DMR Slot %u, Embedded Talker Alias Header", m_slotNo); @@ -1441,9 +1438,9 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData) case FLCO_TALKER_ALIAS_BLOCK1: if (!(m_netTalkerId & TALKER_ID_BLOCK1)) { if (!m_netTalkerId) - ::memset(m_rfTalkerAlias, '\0', 32U); - ::memcpy(m_rfTalkerAlias + 7U, data + 2U, 7U); - m_display->writeDMRTA(m_slotNo, m_rfTalkerAlias, "N"); + m_rfTalkerAlias.reset(); + m_rfTalkerAlias.add(1, data + 2U, 7U); + m_display->writeDMRTA(m_slotNo, (unsigned char*)m_rfTalkerAlias.get(), "N"); if (m_dumpTAData) { ::sprintf(text, "DMR Slot %u, Embedded Talker Alias Block 1", m_slotNo); @@ -1456,9 +1453,9 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData) case FLCO_TALKER_ALIAS_BLOCK2: if (!(m_netTalkerId & TALKER_ID_BLOCK2)) { if (!m_netTalkerId) - ::memset(m_rfTalkerAlias, '\0', 32U); - ::memcpy(m_rfTalkerAlias + 7U + 7U, data + 2U, 7U); - m_display->writeDMRTA(m_slotNo, m_rfTalkerAlias, "N"); + m_rfTalkerAlias.reset(); + m_rfTalkerAlias.add(2, data + 2U, 7U); + m_display->writeDMRTA(m_slotNo, (unsigned char*)m_rfTalkerAlias.get(), "N"); if (m_dumpTAData) { ::sprintf(text, "DMR Slot %u, Embedded Talker Alias Block 2", m_slotNo); @@ -1471,9 +1468,9 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData) case FLCO_TALKER_ALIAS_BLOCK3: if (!(m_netTalkerId & TALKER_ID_BLOCK3)) { if (!m_netTalkerId) - ::memset(m_rfTalkerAlias, '\0', 32U); - ::memcpy(m_rfTalkerAlias + 7U + 7U + 7U, data+2U, 7U); - m_display->writeDMRTA(m_slotNo, m_rfTalkerAlias, "N"); + m_rfTalkerAlias.reset(); + m_rfTalkerAlias.add(3, data+2U, 7U); + m_display->writeDMRTA(m_slotNo, (unsigned char*)m_rfTalkerAlias.get(), "N"); if (m_dumpTAData) { ::sprintf(text, "DMR Slot %u, Embedded Talker Alias Block 3", m_slotNo); diff --git a/DMRSlot.h b/DMRSlot.h index ff00617f7..fc01e61ac 100644 --- a/DMRSlot.h +++ b/DMRSlot.h @@ -22,6 +22,7 @@ #include "RSSIInterpolator.h" #include "DMREmbeddedData.h" #include "DMRNetwork.h" +#include "DMRTA.h" #include "RingBuffer.h" #include "StopWatch.h" #include "DMRLookup.h" @@ -69,7 +70,7 @@ class CDMRSlot { unsigned int m_rfEmbeddedReadN; unsigned int m_rfEmbeddedWriteN; unsigned char m_rfTalkerId; - unsigned char* m_rfTalkerAlias; + CDMRTA m_rfTalkerAlias; CDMREmbeddedData m_netEmbeddedLC; CDMREmbeddedData* m_netEmbeddedData; unsigned int m_netEmbeddedReadN; diff --git a/DMRTA.cpp b/DMRTA.cpp new file mode 100644 index 000000000..bf074aa17 --- /dev/null +++ b/DMRTA.cpp @@ -0,0 +1,126 @@ +/* +* Copyright (C) 2015,2016,2017,2018 Jonathan Naylor, G4KLX +* Copyright (C) 2018 by Shawn Chain, BG5HHP +* +* 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; version 2 of the License. +* +* 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. +*/ + +#include "DMRTA.h" +#include "Log.h" + +#include +#include + +CDMRTA::CDMRTA() : +m_TA(), +m_buf() +{ +} + +CDMRTA::~CDMRTA() +{ +} + +bool CDMRTA::add(unsigned int blockId, const unsigned char* data, unsigned int len) +{ + assert(data != NULL); + if (blockId > 3) { + // invalid block id + reset(); + return false; + } + + unsigned int offset = blockId * 7; + + if (offset + len >= sizeof(m_buf)) { + // buffer overflow + reset(); + return false; + } + + ::memcpy(m_buf + offset, data, len); + + return decodeTA(); +} + +const unsigned char* CDMRTA::get() +{ + return (unsigned char*)m_TA; +} + +void CDMRTA::reset() +{ + ::memset(m_TA, 0, sizeof(m_TA)); + ::memset(m_buf, 0, sizeof(m_buf)); +} + +bool CDMRTA::decodeTA() +{ + unsigned char *b; + unsigned char c; + int j; + unsigned int i, t1, t2; + + unsigned char* talkerAlias = m_buf; + + unsigned int TAformat = (talkerAlias[0] >> 6U) & 0x03U; + unsigned int TAsize = (talkerAlias[0] >> 1U) & 0x1FU; + ::strncpy(m_TA, "(could not decode)", sizeof(m_TA)); + + switch (TAformat) { + case 0U: // 7 bit + ::memset(m_TA, 0, sizeof(m_TA)); + b = &talkerAlias[0]; + t1 = 0U; t2 = 0U; c = 0U; + for (i = 0U; (i < 32U) && (t2 < TAsize); i++) { + for (j = 7; j >= 0; j--) { + c = (c << 1U) | (b[i] >> j); + if (++t1 == 7U) { + if (i > 0U) + m_TA[t2++] = c & 0x7FU; + + t1 = 0U; + c = 0U; + } + } + } + m_TA[TAsize] = 0; + break; + + case 1U: // ISO 8 bit + case 2U: // UTF8 + ::strncpy(m_TA, (char*)talkerAlias + 1U, sizeof(m_TA)); + break; + + case 3U: // UTF16 poor man's conversion + t2=0; + ::memset(&m_TA, 0, sizeof(m_TA)); + for (i = 0U; (i < 15U) && (t2 < TAsize); i++) { + if (talkerAlias[2U * i + 1U] == 0) + m_TA[t2++] = talkerAlias[2U * i + 2U]; + else + m_TA[t2++] = '?'; + } + m_TA[TAsize] = 0; + break; + } + + size_t TAlen = ::strlen(m_TA); + LogMessage("DMR Talker Alias (Data Format %u, Received %u/%u char): '%s'", TAformat, TAlen, TAsize, m_TA); + + if (TAlen > TAsize) { + if (TAlen < 29U) + strcat(m_TA," ?"); + else + strcpy(m_TA + 28U," ?"); + } + + return TAlen >= TAsize; +} diff --git a/DMRTA.h b/DMRTA.h new file mode 100644 index 000000000..d53f93f5b --- /dev/null +++ b/DMRTA.h @@ -0,0 +1,35 @@ +/* +* Copyright (C) 2015,2016,2017,2018 Jonathan Naylor, G4KLX +* Copyright (C) 2018 by Shawn Chain, BG5HHP +* +* 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; version 2 of the License. +* +* 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. +*/ + +#ifndef DMRTA_H +#define DMRTA_H + +class CDMRTA { +public: + CDMRTA(); + ~CDMRTA(); + + bool add(unsigned int blockId, const unsigned char* data, unsigned int len); + const unsigned char* get(); + void reset(); + +protected: + bool decodeTA(); + +private: + char m_TA[32]; + unsigned char m_buf[32]; +}; + +#endif diff --git a/Display.cpp b/Display.cpp index 1ee9b647c..24f62f3a2 100644 --- a/Display.cpp +++ b/Display.cpp @@ -157,47 +157,8 @@ void CDisplay::writeDMRRSSI(unsigned int slotNo, unsigned char rssi) void CDisplay::writeDMRTA(unsigned int slotNo, unsigned char* talkerAlias, const char* type) { - char TA[32U]; - unsigned char *b; - unsigned char c; - int j; - unsigned int i,t1,t2, TAsize, TAformat; - - if (strcmp(type," ")==0) { writeDMRTAInt(slotNo, (unsigned char*)TA, type); return; } - - TAformat=(talkerAlias[0]>>6U) & 0x03U; - TAsize = (talkerAlias[0]>>1U) & 0x1FU; - ::strcpy(TA,"(could not decode)"); - switch (TAformat) { - case 0U: // 7 bit - ::memset (&TA,0,32U); - b=&talkerAlias[0]; - t1=0; t2=0; c=0; - for (i=0;(i<32U)&&(t2=0;j--) { - c = (c<<1U) | (b[i] >> j); - if (++t1==7U) { if (i>0) {TA[t2++]=c & 0x7FU; } t1=0; c=0; } - } - } - break; - case 1U: // ISO 8 bit - case 2U: // UTF8 - ::strcpy(TA,(char*)talkerAlias+1U); - break; - case 3U: // UTF16 poor man's conversion - t2=0; - ::memset (&TA,0,32U); - for(i=0;(i<15)&&(t2TAsize) { if (strlen(TA)<29U) strcat(TA," ?"); else strcpy(TA+28U," ?"); } - if (strlen((char*)TA)>=4U) writeDMRTAInt(slotNo, (unsigned char*)TA, type); - + if (strcmp(type," ")==0) { writeDMRTAInt(slotNo, (unsigned char*)"", type); return; } + if (strlen((char*)talkerAlias)>=4U) writeDMRTAInt(slotNo, (unsigned char*)talkerAlias, type); } void CDisplay::writeDMRBER(unsigned int slotNo, float ber) diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index 98272e227..07df0295a 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -1119,7 +1119,7 @@ bool CMMDVMHost::createModem() LogInfo(" RX Frequency: %uHz (%uHz)", rxFrequency, rxFrequency + rxOffset); LogInfo(" TX Frequency: %uHz (%uHz)", txFrequency, txFrequency + txOffset); - m_modem = new CModem(port, m_duplex, rxInvert, txInvert, pttInvert, txDelay, dmrDelay, trace, debug); + m_modem = CModem::createModem(port, m_duplex, rxInvert, txInvert, pttInvert, txDelay, dmrDelay, trace, debug); m_modem->setSerialParams(protocol,address); m_modem->setModeParams(m_dstarEnabled, m_dmrEnabled, m_ysfEnabled, m_p25Enabled, m_nxdnEnabled, m_pocsagEnabled); m_modem->setLevels(rxLevel, cwIdTXLevel, dstarTXLevel, dmrTXLevel, ysfTXLevel, p25TXLevel, nxdnTXLevel, pocsagTXLevel); diff --git a/MMDVMHost.vcxproj b/MMDVMHost.vcxproj index 83cba81f5..90923687d 100644 --- a/MMDVMHost.vcxproj +++ b/MMDVMHost.vcxproj @@ -173,6 +173,7 @@ + @@ -194,6 +195,7 @@ + @@ -263,6 +265,7 @@ + @@ -282,6 +285,7 @@ + @@ -327,4 +331,4 @@ - + \ No newline at end of file diff --git a/MMDVMHost.vcxproj.filters b/MMDVMHost.vcxproj.filters index 200ee2371..0c595bff6 100644 --- a/MMDVMHost.vcxproj.filters +++ b/MMDVMHost.vcxproj.filters @@ -278,6 +278,12 @@ Header Files + + Header Files + + + Header Files + @@ -520,5 +526,11 @@ Source Files + + Source Files + + + Source Files + - + \ No newline at end of file diff --git a/Makefile b/Makefile index c4d22d500..537fa2e6f 100644 --- a/Makefile +++ b/Makefile @@ -8,12 +8,12 @@ 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 \ - DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.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 NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o \ - NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o POCSAGControl.o \ - POCSAGNetwork.o QR1676.o RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialPort.o SHA256.o StopWatch.o Sync.o TFTSerial.o Thread.o \ - Timer.o UDPSocket.o UMP.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.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 NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o \ + POCSAGControl.o POCSAGNetwork.o QR1676.o RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialPort.o SHA256.o StopWatch.o Sync.o TFTSerial.o \ + Thread.o Timer.o UDPSocket.o UMP.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o all: MMDVMHost diff --git a/Makefile.Pi b/Makefile.Pi index dc8e1aa4e..2f5de8f93 100644 --- a/Makefile.Pi +++ b/Makefile.Pi @@ -8,12 +8,12 @@ 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 \ - DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.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 NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o \ - NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o POCSAGControl.o POCSAGNetwork.o \ - QR1676.o RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialPort.o SHA256.o StopWatch.o Sync.o TFTSerial.o Thread.o Timer.o UDPSocket.o \ - UMP.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.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 \ + NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o POCSAGControl.o \ + POCSAGNetwork.o QR1676.o RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialPort.o SHA256.o StopWatch.o Sync.o TFTSerial.o Thread.o Timer.o \ + UDPSocket.o UMP.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o all: MMDVMHost diff --git a/Makefile.Pi.Adafruit b/Makefile.Pi.Adafruit index 1065ed3c2..fc6df1669 100644 --- a/Makefile.Pi.Adafruit +++ b/Makefile.Pi.Adafruit @@ -8,10 +8,10 @@ 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 \ - DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.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 NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o \ - NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o POCSAGControl.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 \ + NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o POCSAGControl.o \ POCSAGNetwork.o QR1676.o RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialPort.o SHA256.o StopWatch.o Sync.o TFTSerial.o Thread.o \ Timer.o UDPSocket.o UMP.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o diff --git a/Makefile.Pi.HD44780 b/Makefile.Pi.HD44780 index fd3c32f0e..124629777 100644 --- a/Makefile.Pi.HD44780 +++ b/Makefile.Pi.HD44780 @@ -8,10 +8,10 @@ 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 \ - DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.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 NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o \ - NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o POCSAGControl.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 \ + NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o POCSAGControl.o \ POCSAGNetwork.o QR1676.o RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialPort.o SHA256.o StopWatch.o Sync.o TFTSerial.o Thread.o \ Timer.o UDPSocket.o UMP.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o diff --git a/Makefile.Pi.OLED b/Makefile.Pi.OLED index 9c17f0660..2c4516573 100644 --- a/Makefile.Pi.OLED +++ b/Makefile.Pi.OLED @@ -8,10 +8,10 @@ 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 \ - DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.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 NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o \ - NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o POCSAGControl.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 \ + NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o POCSAGControl.o \ POCSAGNetwork.o QR1676.o RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialPort.o SHA256.o StopWatch.o Sync.o TFTSerial.o Thread.o \ Timer.o UDPSocket.o UMP.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o diff --git a/Makefile.Pi.PCF8574 b/Makefile.Pi.PCF8574 index 29dba7c2d..30aaf248d 100644 --- a/Makefile.Pi.PCF8574 +++ b/Makefile.Pi.PCF8574 @@ -8,10 +8,10 @@ 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 \ - DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.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 NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o \ - NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o POCSAGControl.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 \ + NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o POCSAGControl.o \ POCSAGNetwork.o QR1676.o RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialPort.o SHA256.o StopWatch.o Sync.o TFTSerial.o Thread.o \ Timer.o UDPSocket.o UMP.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o diff --git a/Makefile.Solaris b/Makefile.Solaris index b82ee32f8..b701271d0 100644 --- a/Makefile.Solaris +++ b/Makefile.Solaris @@ -8,10 +8,10 @@ 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 \ - DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.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 NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o \ - NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o POCSAGControl.o POCSAGNetwork.o \ + NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o \ + NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o POCSAGControl.o POCSAGNetwork.o \ QR1676.o RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialPort.o SHA256.o StopWatch.o Sync.o TFTSerial.o Thread.o Timer.o UDPSocket.o \ UMP.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o diff --git a/Modem.cpp b/Modem.cpp index ae7ca762c..7fe5ae172 100644 --- a/Modem.cpp +++ b/Modem.cpp @@ -25,6 +25,7 @@ #include "POCSAGDefines.h" #include "Thread.h" #include "Modem.h" +#include "NullModem.h" #include "Utils.h" #include "Log.h" @@ -1830,3 +1831,10 @@ void CModem::printDebug() LogMessage("Debug: %.*s %d %d %d %d", m_length - 11U, m_buffer + 3U, val1, val2, val3, val4); } } + +CModem* CModem::createModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool trace, bool debug){ + if (port == "NullModem") + return new CNullModem(port, duplex, rxInvert, txInvert, pttInvert, txDelay, dmrDelay, trace, debug); + else + return new CModem(port, duplex, rxInvert, txInvert, pttInvert, txDelay, dmrDelay, trace, debug); +} \ No newline at end of file diff --git a/Modem.h b/Modem.h index 9c8b6c0dc..30af40183 100644 --- a/Modem.h +++ b/Modem.h @@ -35,75 +35,77 @@ enum RESP_TYPE_MMDVM { class CModem { public: CModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool trace, bool debug); - ~CModem(); + virtual ~CModem(); - void setSerialParams(const std::string& protocol, unsigned int address); - void setRFParams(unsigned int rxFrequency, int rxOffset, unsigned int txFrequency, int txOffset, int txDCOffset, int rxDCOffset, float rfLevel, unsigned int pocsagFrequency); - void setModeParams(bool dstarEnabled, bool dmrEnabled, bool ysfEnabled, bool p25Enabled, bool nxdnEnabled, bool pocsagEnabled); - void setLevels(float rxLevel, float cwIdTXLevel, float dstarTXLevel, float dmrTXLevel, float ysfTXLevel, float p25TXLevel, float nxdnTXLevel, float pocsagLevel); - void setDMRParams(unsigned int colorCode); - void setYSFParams(bool loDev, unsigned int txHang); - void setTransparentDataParams(unsigned int sendFrameType); + virtual void setSerialParams(const std::string& protocol, unsigned int address); + virtual void setRFParams(unsigned int rxFrequency, int rxOffset, unsigned int txFrequency, int txOffset, int txDCOffset, int rxDCOffset, float rfLevel, unsigned int pocsagFrequency); + virtual void setModeParams(bool dstarEnabled, bool dmrEnabled, bool ysfEnabled, bool p25Enabled, bool nxdnEnabled, bool pocsagEnabled); + virtual void setLevels(float rxLevel, float cwIdTXLevel, float dstarTXLevel, float dmrTXLevel, float ysfTXLevel, float p25TXLevel, float nxdnTXLevel, float pocsagLevel); + virtual void setDMRParams(unsigned int colorCode); + virtual void setYSFParams(bool loDev, unsigned int txHang); + virtual void setTransparentDataParams(unsigned int sendFrameType); - bool open(); + virtual bool open(); - unsigned int readDStarData(unsigned char* data); - unsigned int readDMRData1(unsigned char* data); - unsigned int readDMRData2(unsigned char* data); - unsigned int readYSFData(unsigned char* data); - unsigned int readP25Data(unsigned char* data); - unsigned int readNXDNData(unsigned char* data); - unsigned int readTransparentData(unsigned char* data); + virtual unsigned int readDStarData(unsigned char* data); + virtual unsigned int readDMRData1(unsigned char* data); + virtual unsigned int readDMRData2(unsigned char* data); + virtual unsigned int readYSFData(unsigned char* data); + virtual unsigned int readP25Data(unsigned char* data); + virtual unsigned int readNXDNData(unsigned char* data); + virtual unsigned int readTransparentData(unsigned char* data); - unsigned int readSerial(unsigned char* data, unsigned int length); + virtual unsigned int readSerial(unsigned char* data, unsigned int length); - bool hasDStarSpace() const; - bool hasDMRSpace1() const; - bool hasDMRSpace2() const; - bool hasYSFSpace() const; - bool hasP25Space() const; - bool hasNXDNSpace() const; - bool hasPOCSAGSpace() const; + virtual bool hasDStarSpace() const; + virtual bool hasDMRSpace1() const; + virtual bool hasDMRSpace2() const; + virtual bool hasYSFSpace() const; + virtual bool hasP25Space() const; + virtual bool hasNXDNSpace() const; + virtual bool hasPOCSAGSpace() const; - bool hasTX() const; - bool hasCD() const; + virtual bool hasTX() const; + virtual bool hasCD() const; - bool hasLockout() const; - bool hasError() const; + virtual bool hasLockout() const; + virtual bool hasError() const; - bool writeDStarData(const unsigned char* data, unsigned int length); - bool writeDMRData1(const unsigned char* data, unsigned int length); - bool writeDMRData2(const unsigned char* data, unsigned int length); - bool writeYSFData(const unsigned char* data, unsigned int length); - bool writeP25Data(const unsigned char* data, unsigned int length); - bool writeNXDNData(const unsigned char* data, unsigned int length); - bool writePOCSAGData(const unsigned char* data, unsigned int length); + virtual bool writeDStarData(const unsigned char* data, unsigned int length); + virtual bool writeDMRData1(const unsigned char* data, unsigned int length); + virtual bool writeDMRData2(const unsigned char* data, unsigned int length); + virtual bool writeYSFData(const unsigned char* data, unsigned int length); + virtual bool writeP25Data(const unsigned char* data, unsigned int length); + virtual bool writeNXDNData(const unsigned char* data, unsigned int length); + virtual bool writePOCSAGData(const unsigned char* data, unsigned int length); - bool writeTransparentData(const unsigned char* data, unsigned int length); + virtual bool writeTransparentData(const unsigned char* data, unsigned int length); - bool writeDStarInfo(const char* my1, const char* my2, const char* your, const char* type, const char* reflector); - bool writeDMRInfo(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type); - bool writeYSFInfo(const char* source, const char* dest, const char* type, const char* origin); - bool writeP25Info(const char* source, bool group, unsigned int dest, const char* type); - bool writeNXDNInfo(const char* source, bool group, unsigned int dest, const char* type); - bool writePOCSAGInfo(unsigned int ric, const std::string& message); - bool writeIPInfo(const std::string& address); + virtual bool writeDStarInfo(const char* my1, const char* my2, const char* your, const char* type, const char* reflector); + virtual bool writeDMRInfo(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type); + virtual bool writeYSFInfo(const char* source, const char* dest, const char* type, const char* origin); + virtual bool writeP25Info(const char* source, bool group, unsigned int dest, const char* type); + virtual bool writeNXDNInfo(const char* source, bool group, unsigned int dest, const char* type); + virtual bool writePOCSAGInfo(unsigned int ric, const std::string& message); + virtual bool writeIPInfo(const std::string& address); - bool writeDMRStart(bool tx); - bool writeDMRShortLC(const unsigned char* lc); - bool writeDMRAbort(unsigned int slotNo); + virtual bool writeDMRStart(bool tx); + virtual bool writeDMRShortLC(const unsigned char* lc); + virtual bool writeDMRAbort(unsigned int slotNo); - bool writeSerial(const unsigned char* data, unsigned int length); + virtual bool writeSerial(const unsigned char* data, unsigned int length); - bool setMode(unsigned char mode); + virtual bool setMode(unsigned char mode); - bool sendCWId(const std::string& callsign); + virtual bool sendCWId(const std::string& callsign); - HW_TYPE getHWType() const; + virtual HW_TYPE getHWType() const; - void clock(unsigned int ms); + virtual void clock(unsigned int ms); - void close(); + virtual void close(); + + static CModem* createModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool trace, bool debug); private: std::string m_port; diff --git a/NullModem.cpp b/NullModem.cpp new file mode 100644 index 000000000..8539f1b6b --- /dev/null +++ b/NullModem.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2011-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 "NullModem.h" +#include "Log.h" + +CNullModem::CNullModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool trace, bool debug) : +CModem(port, duplex,rxInvert, txInvert,pttInvert,txDelay, dmrDelay, trace, debug), +m_hwType(HWT_MMDVM) +{ +} + +CNullModem::~CNullModem() +{ +} + +bool CNullModem::open(){ + ::LogMessage("Opening the MMDVM Null Modem"); + return true; +} \ No newline at end of file diff --git a/NullModem.h b/NullModem.h new file mode 100644 index 000000000..2698f47f6 --- /dev/null +++ b/NullModem.h @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2011-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. + */ + +#ifndef NULLMODEM_H +#define NULLMODEM_H + +#include "Modem.h" +#include "Defines.h" + +#include + + +class CNullModem : public CModem { +public: + CNullModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool trace, bool debug); + virtual ~CNullModem(); + + virtual void setSerialParams(const std::string& protocol, unsigned int address){}; + virtual void setRFParams(unsigned int rxFrequency, int rxOffset, unsigned int txFrequency, int txOffset, int txDCOffset, int rxDCOffset, float rfLevel, unsigned int pocsagFrequency){}; + virtual void setModeParams(bool dstarEnabled, bool dmrEnabled, bool ysfEnabled, bool p25Enabled, bool nxdnEnabled, bool pocsagEnabled){}; + virtual void setLevels(float rxLevel, float cwIdTXLevel, float dstarTXLevel, float dmrTXLevel, float ysfTXLevel, float p25TXLevel, float nxdnTXLevel, float pocsagLevel){}; + virtual void setDMRParams(unsigned int colorCode){}; + virtual void setYSFParams(bool loDev, unsigned int txHang){}; + virtual void setTransparentDataParams(unsigned int sendFrameType){}; + + virtual bool open(); + + virtual unsigned int readDStarData(unsigned char* data){return 0;}; + virtual unsigned int readDMRData1(unsigned char* data){return 0;}; + virtual unsigned int readDMRData2(unsigned char* data){return 0;}; + virtual unsigned int readYSFData(unsigned char* data){return 0;}; + virtual unsigned int readP25Data(unsigned char* data){return 0;}; + virtual unsigned int readNXDNData(unsigned char* data){return 0;}; + virtual unsigned int readTransparentData(unsigned char* data){return 0;}; + + virtual unsigned int readSerial(unsigned char* data, unsigned int length){return 0;}; + + virtual bool hasDStarSpace()const {return true;}; + virtual bool hasDMRSpace1() const {return true;}; + virtual bool hasDMRSpace2() const {return true;}; + virtual bool hasYSFSpace() const {return true;}; + virtual bool hasP25Space() const {return true;}; + virtual bool hasNXDNSpace() const {return true;}; + virtual bool hasPOCSAGSpace() const{return true;}; + + virtual bool hasTX() const {return false;}; + virtual bool hasCD() const {return false;}; + + virtual bool hasLockout() const {return false;}; + virtual bool hasError() const {return false;}; + + virtual bool writeDStarData(const unsigned char* data, unsigned int length){return true;}; + virtual bool writeDMRData1(const unsigned char* data, unsigned int length){return true;}; + virtual bool writeDMRData2(const unsigned char* data, unsigned int length){return true;}; + virtual bool writeYSFData(const unsigned char* data, unsigned int length){return true;}; + virtual bool writeP25Data(const unsigned char* data, unsigned int length){return true;}; + virtual bool writeNXDNData(const unsigned char* data, unsigned int length){return true;}; + virtual bool writePOCSAGData(const unsigned char* data, unsigned int length){return true;}; + + virtual bool writeTransparentData(const unsigned char* data, unsigned int length){return true;}; + + virtual bool writeDStarInfo(const char* my1, const char* my2, const char* your, const char* type, const char* reflector){return true;}; + virtual bool writeDMRInfo(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type){return true;}; + virtual bool writeYSFInfo(const char* source, const char* dest, const char* type, const char* origin){return true;}; + virtual bool writeP25Info(const char* source, bool group, unsigned int dest, const char* type){return true;}; + virtual bool writeNXDNInfo(const char* source, bool group, unsigned int dest, const char* type){return true;}; + virtual bool writePOCSAGInfo(unsigned int ric, const std::string& message){return true;}; + virtual bool writeIPInfo(const std::string& address){return true;}; + + virtual bool writeDMRStart(bool tx){return true;}; + virtual bool writeDMRShortLC(const unsigned char* lc){return true;}; + virtual bool writeDMRAbort(unsigned int slotNo){return true;}; + + virtual bool writeSerial(const unsigned char* data, unsigned int length){return true;}; + + virtual bool setMode(unsigned char mode){return true;}; + + virtual bool sendCWId(const std::string& callsign){return true;}; + + virtual HW_TYPE getHWType() const {return m_hwType;}; + + virtual void clock(unsigned int ms){}; + + virtual void close(){}; + +private: + HW_TYPE m_hwType; +}; + +#endif diff --git a/YSFControl.cpp b/YSFControl.cpp index fdd0c961e..79237a061 100644 --- a/YSFControl.cpp +++ b/YSFControl.cpp @@ -182,6 +182,7 @@ bool CYSFControl::writeModem(unsigned char *data, unsigned int len) } } +#ifdef notdef // Stop repeater packets coming through, unless we're acting as a remote gateway if (m_remoteGateway) { unsigned char mr = m_lastFICH.getMR(); @@ -192,6 +193,7 @@ bool CYSFControl::writeModem(unsigned char *data, unsigned int len) if (mr == YSF_MR_BUSY) return false; } +#endif unsigned char dt = m_lastFICH.getDT();