Finish off the UDP Controller and more clean-ups.

This commit is contained in:
Jonathan Naylor 2021-02-17 19:35:28 +00:00
parent 8ace65b86d
commit 279afb75f3
19 changed files with 154 additions and 209 deletions

View File

@ -43,7 +43,7 @@ File=NXDN.csv
Time=24
[Modem]
# Valid values are "uart", "udp", and (on Linux) "i2c"
# Valid values are "null", "uart", "udp", and (on Linux) "i2c"
Protocol=uart
# The port and speed used for a UART connection
# UARTPort=\\.\COM4

View File

@ -22,10 +22,13 @@
#include "NXDNKenwoodNetwork.h"
#include "NXDNIcomNetwork.h"
#include "RSSIInterpolator.h"
#include "NullController.h"
#include "UARTController.h"
#if defined(__linux__)
#include "I2CController.h"
#endif
#include "UDPController.h"
#include "MMDVMModem.h"
#include "NullModem.h"
#include "Version.h"
#include "StopWatch.h"
#include "Defines.h"
@ -1404,10 +1407,7 @@ bool CMMDVMHost::createModem()
LogInfo(" TX Frequency: %uHz (%uHz)", txFrequency, txFrequency + txOffset);
LogInfo(" Use COS as Lockout: %s", useCOSAsLockout ? "yes" : "no");
if (protocol == "null")
m_modem = new CNullModem;
else
m_modem = new CMMDVMModem(m_duplex, rxInvert, txInvert, pttInvert, txDelay, dmrDelay, useCOSAsLockout, trace, debug);
m_modem = new CMMDVMModem(m_duplex, rxInvert, txInvert, pttInvert, txDelay, dmrDelay, useCOSAsLockout, trace, debug);
IMMDVMModemPort* modem = NULL;
if (protocol == "uart")
@ -1418,6 +1418,8 @@ bool CMMDVMHost::createModem()
else if (protocol == "i2c")
modem = new CI2CController(i2cPort, i2cAddress);
#endif
else if (protocol == "null")
modem = new CNullController;
else
return false;

View File

@ -209,8 +209,8 @@
<ClInclude Include="Mutex.h" />
<ClInclude Include="NetworkInfo.h" />
<ClInclude Include="Nextion.h" />
<ClInclude Include="NullController.h" />
<ClInclude Include="NullDisplay.h" />
<ClInclude Include="NullModem.h" />
<ClInclude Include="NXDNAudio.h" />
<ClInclude Include="NXDNControl.h" />
<ClInclude Include="NXDNConvolution.h" />
@ -319,8 +319,8 @@
<ClCompile Include="Mutex.cpp" />
<ClCompile Include="NetworkInfo.cpp" />
<ClCompile Include="Nextion.cpp" />
<ClCompile Include="NullController.cpp" />
<ClCompile Include="NullDisplay.cpp" />
<ClCompile Include="NullModem.cpp" />
<ClCompile Include="NXDNAudio.cpp" />
<ClCompile Include="NXDNControl.cpp" />
<ClCompile Include="NXDNConvolution.cpp" />

View File

@ -263,9 +263,6 @@
<ClInclude Include="POCSAGDefines.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="NullModem.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="DMRTA.h">
<Filter>Header Files</Filter>
</ClInclude>
@ -350,6 +347,9 @@
<ClInclude Include="UDPController.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="NullController.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="BPTC19696.cpp">
@ -577,9 +577,6 @@
<ClCompile Include="POCSAGControl.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="NullModem.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="DMRTA.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -658,5 +655,8 @@
<ClCompile Include="UDPController.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="NullController.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -16,10 +16,6 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "UARTController.h"
#if defined(__linux__)
#include "I2CController.h"
#endif
#include "DStarDefines.h"
#include "DMRDefines.h"
#include "YSFDefines.h"
@ -30,7 +26,6 @@
#include "M17Defines.h"
#include "Thread.h"
#include "MMDVMModem.h"
#include "NullModem.h"
#include "Utils.h"
#include "Log.h"

View File

@ -11,7 +11,7 @@ OBJECTS = \
DMRDirectNetwork.o DMREMB.o DMREmbeddedData.o DMRFullLC.o DMRGatewayNetwork.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 FMControl.o FMNetwork.o Golay2087.o Golay24128.o \
Hamming.o I2CController.o IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LICH.o M17Network.o M17Utils.o MMDVMHost.o \
MMDVMModem.o MMDVMModemPort.o Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o \
MMDVMModem.o MMDVMModemPort.o Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullController.o NullDisplay.o NXDNAudio.o NXDNControl.o \
NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.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 PseudoTTYController.o POCSAGControl.o \
POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o RSSIInterpolator.o SerialPort.o StopWatch.o Sync.o SHA256.o TFTSurenoo.o Thread.o Timer.o \

View File

@ -11,7 +11,7 @@ OBJECTS = \
DMRDirectNetwork.o DMREMB.o DMREmbeddedData.o DMRFullLC.o DMRGatewayNetwork.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 FMControl.o FMNetwork.o Golay2087.o Golay24128.o \
Hamming.o I2CController.o IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LICH.o M17Network.o M17Utils.o MMDVMHost.o \
MMDVMModem.o MMDVMModemPort.o Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o \
MMDVMModem.o MMDVMModemPort.o Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullController.o NullDisplay.o NXDNAudio.o NXDNControl.o \
NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.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 PseudoTTYController.o POCSAGControl.o \
POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o RSSIInterpolator.o SerialPort.o StopWatch.o Sync.o SHA256.o TFTSurenoo.o Thread.o Timer.o \

View File

@ -12,11 +12,12 @@ OBJECTS = \
DMRDirectNetwork.o DMREMB.o DMREmbeddedData.o DMRFullLC.o DMRGatewayNetwork.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 FMControl.o FMNetwork.o Golay2087.o Golay24128.o \
Hamming.o HD44780.o I2CController.o IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LICH.o M17Network.o M17Utils.o \
MMDVMHost.o MMDVMModem.o MMDVMModemPort.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 NXDNIcomNetwork.o NXDNKenwoodNetwork.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 PseudoTTYController.o POCSAGControl.o \
POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o RSSIInterpolator.o SerialPort.o StopWatch.o Sync.o SHA256.o TFTSurenoo.o Thread.o Timer.o \
UARTController.o UDPController.o UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
MMDVMHost.o MMDVMModem.o MMDVMModemPort.o Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullController.o NullDisplay.o NXDNAudio.o \
NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.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 PseudoTTYController.o \
POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o RSSIInterpolator.o SerialPort.o StopWatch.o Sync.o SHA256.o TFTSurenoo.o \
Thread.o Timer.o UARTController.o UDPController.o UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o \
YSFPayload.o
all: MMDVMHost RemoteCommand

View File

@ -11,11 +11,12 @@ OBJECTS = \
DMRDirectNetwork.o DMREMB.o DMREmbeddedData.o DMRFullLC.o DMRGatewayNetwork.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 FMControl.o FMNetwork.o Golay2087.o Golay24128.o \
Hamming.o HD44780.o I2CController.o IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LICH.o M17Network.o M17Utils.o \
MMDVMHost.o MMDVMModem.o MMDVMModemPort.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 NXDNIcomNetwork.o NXDNKenwoodNetwork.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 PseudoTTYController.o POCSAGControl.o \
POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o RSSIInterpolator.o SerialPort.o StopWatch.o Sync.o SHA256.o TFTSurenoo.o Thread.o Timer.o \
UARTController.o UDPController.o UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
MMDVMHost.o MMDVMModem.o MMDVMModemPort.o Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullController.o NullDisplay.o NXDNAudio.o \
NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.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 PseudoTTYController.o \
POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o RSSIInterpolator.o SerialPort.o StopWatch.o Sync.o SHA256.o TFTSurenoo.o \
Thread.o Timer.o UARTController.o UDPController.o UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o \
YSFPayload.o
all: MMDVMHost RemoteCommand

View File

@ -15,7 +15,7 @@ OBJECTS = \
DMRDirectNetwork.o DMREMB.o DMREmbeddedData.o DMRFullLC.o DMRGatewayNetwork.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 FMControl.o FMNetwork.o Golay2087.o Golay24128.o \
Hamming.o I2CController.o IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LICH.o M17Network.o M17Utils.o MMDVMHost.o \
MMDVMModem.o MMDVMModemPort.o Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o \
MMDVMModem.o MMDVMModemPort.o Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullController.o NullDisplay.o NXDNAudio.o NXDNControl.o \
NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o \
NXDNUDCH.o OLED.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o \
POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o RSSIInterpolator.o SerialPort.o StopWatch.o Sync.o SHA256.o TFTSurenoo.o \

View File

@ -12,11 +12,12 @@ OBJECTS = \
DMRDirectNetwork.o DMREMB.o DMREmbeddedData.o DMRFullLC.o DMRGatewayNetwork.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 FMControl.o FMNetwork.o Golay2087.o Golay24128.o \
Hamming.o HD44780.o I2CController.o IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LICH.o M17Network.o M17Utils.o \
MMDVMHost.o MMDVMModem.o MMDVMModemPort.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 NXDNIcomNetwork.o NXDNKenwoodNetwork.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 PseudoTTYController.o POCSAGControl.o \
POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o RSSIInterpolator.o SerialPort.o StopWatch.o Sync.o SHA256.o TFTSurenoo.o Thread.o Timer.o \
UARTController.o UDPController.o UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
MMDVMHost.o MMDVMModem.o MMDVMModemPort.o Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullController.o NullDisplay.o NXDNAudio.o \
NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.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 PseudoTTYController.o \
POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o RSSIInterpolator.o SerialPort.o StopWatch.o Sync.o SHA256.o TFTSurenoo.o \
Thread.o Timer.o UARTController.o UDPController.o UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o \
YSFPayload.o
all: MMDVMHost RemoteCommand

47
NullController.cpp Normal file
View File

@ -0,0 +1,47 @@
/*
* Copyright (C) 2021 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 "NullController.h"
CNullController::CNullController()
{
}
CNullController::~CNullController()
{
}
bool CNullController::open()
{
return true;
}
int CNullController::read(unsigned char* buffer, unsigned int length)
{
return 0;
}
int CNullController::write(const unsigned char* buffer, unsigned int length)
{
return length;
}
void CNullController::close()
{
}

40
NullController.h Normal file
View File

@ -0,0 +1,40 @@
/*
* Copyright (C) 2021 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 NullController_H
#define NullController_H
#include "MMDVMModemPort.h"
class CNullController : public IMMDVMModemPort {
public:
CNullController();
virtual ~CNullController();
virtual bool open();
virtual int read(unsigned char* buffer, unsigned int length);
virtual int write(const unsigned char* buffer, unsigned int length);
virtual void close();
private:
};
#endif

View File

@ -1,35 +0,0 @@
/*
* Copyright (C) 2011-2018,2020 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()
{
}
CNullModem::~CNullModem()
{
}
bool CNullModem::open()
{
::LogMessage("Opening the MMDVM Null Modem");
return true;
}

View File

@ -1,123 +0,0 @@
/*
* Copyright (C) 2011-2018,2020,2021 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 <string>
class CNullModem : public IModem {
public:
CNullModem();
virtual ~CNullModem();
virtual void setModem(IMMDVMModemPort* port) {};
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 m17Enabled, bool pocsagEnabled, bool fmEnabled, bool ax25Enabled) {};
virtual void setLevels(float rxLevel, float cwIdTXLevel, float dstarTXLevel, float dmrTXLevel, float ysfTXLevel, float p25TXLevel, float nxdnTXLevel, float m17TXLevel, float pocsagLevel, float fmTXLevel, float ax25TXLevel) {};
virtual void setDMRParams(unsigned int colorCode) {};
virtual void setYSFParams(bool loDev, unsigned int txHang) {};
virtual void setP25Params(unsigned int txHang) {};
virtual void setNXDNParams(unsigned int txHang) {};
virtual void setM17Params(unsigned int txHang) {};
virtual void setAX25Params(int rxTwist, unsigned int txDelay, unsigned int slotTime, unsigned int pPersist) {};
virtual void setTransparentDataParams(unsigned int sendFrameType) {};
virtual void setFMCallsignParams(const std::string& callsign, unsigned int callsignSpeed, unsigned int callsignFrequency, unsigned int callsignTime, unsigned int callsignHoldoff, float callsignHighLevel, float callsignLowLevel, bool callsignAtStart, bool callsignAtEnd, bool callsignAtLatch) {};
virtual void setFMAckParams(const std::string& rfAck, unsigned int ackSpeed, unsigned int ackFrequency, unsigned int ackMinTime, unsigned int ackDelay, float ackLevel) {};
virtual void setFMMiscParams(unsigned int timeout, float timeoutLevel, float ctcssFrequency, unsigned int ctcssHighThreshold, unsigned int ctcssLowThreshold, float ctcssLevel, unsigned int kerchunkTime, unsigned int hangTime, unsigned int accessMode, bool cosInvert, bool noiseSquelch, unsigned int squelchHighThreshold, unsigned int squelchLowThreshold, unsigned int rfAudioBoost, float maxDevLevel) {};
virtual void setFMExtParams(const std::string& ack, unsigned int audioBoost) {};
virtual bool open();
virtual unsigned int readDStarData(unsigned char* data) { return 0U; };
virtual unsigned int readDMRData1(unsigned char* data) { return 0U; };
virtual unsigned int readDMRData2(unsigned char* data) { return 0U; };
virtual unsigned int readYSFData(unsigned char* data) { return 0U; };
virtual unsigned int readP25Data(unsigned char* data) { return 0U; };
virtual unsigned int readNXDNData(unsigned char* data) { return 0U; };
virtual unsigned int readM17Data(unsigned char* data) { return 0U; };
virtual unsigned int readFMData(unsigned char* data) { return 0U; };
virtual unsigned int readAX25Data(unsigned char* data) { return 0U; };
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 hasM17Space() const { return true; };
virtual bool hasPOCSAGSpace() const { return true; };
virtual unsigned int getFMSpace() const { return true; };
virtual bool hasAX25Space() 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 writeM17Data(const unsigned char* data, unsigned int length) { return true; };
virtual bool writePOCSAGData(const unsigned char* data, unsigned int length) { return true; };
virtual bool writeFMData(const unsigned char* data, unsigned int length) { return true; };
virtual bool writeAX25Data(const unsigned char* data, unsigned int length) { return true; };
virtual bool writeConfig() { 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, unsigned char dgid, 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 writeM17Info(const char* source, const char* 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 writeTransparentData(const unsigned char* data, unsigned int length) { return true; };
virtual unsigned int readTransparentData(unsigned char* data) { return 0U; };
virtual bool writeSerial(const unsigned char* data, unsigned int length) { return true; };
virtual unsigned int readSerial(unsigned char* data, unsigned int length) { return 0U; };
virtual unsigned char getMode() const { return MODE_IDLE; };
virtual bool setMode(unsigned char mode) { return true; };
virtual bool sendCWId(const std::string& callsign) { return true; };
virtual HW_TYPE getHWType() const { return HWT_MMDVM; };
virtual void clock(unsigned int ms) {};
virtual void close() {};
private:
};
#endif

View File

@ -5,7 +5,7 @@ POCSAG, FM, and AX.25 on the MMDVM, and D-Star, DMR, and System Fusion on the DV
On the D-Star side the MMDVMHost interfaces with the ircDDB Gateway, on DMR it
connects to the DMR Gateway to allow for connection to multiple DMR networks,
on System Fusion it connects to the YSF Gateway to allow
or a single network directly. on System Fusion it connects to the YSF Gateway to allow
access to the FCS and YSF networks. On P25 it connects to the P25 Gateway. On
NXDN it connects to the NXDN Gateway which provides access to the NXDN and
NXCore talk groups. On M17 it uses the M17 Gateway to access the M17 reflector system.

View File

@ -28,9 +28,7 @@ CUDPController::CUDPController(const std::string& modemAddress, unsigned int mod
m_socket(localPort),
m_addr(),
m_addrLen(0U),
m_buffer(NULL),
m_length(0U),
m_offset(0U)
m_buffer(2000U, "UDP Controller Ring Buffer")
{
assert(!modemAddress.empty());
assert(modemPort > 0U);
@ -38,13 +36,10 @@ m_offset(0U)
if (CUDPSocket::lookup(modemAddress, modemPort, m_addr, m_addrLen) != 0)
m_addrLen = 0U;
m_buffer = new unsigned char[BUFFER_LENGTH];
}
CUDPController::~CUDPController()
{
delete[] m_buffer;
}
bool CUDPController::open()
@ -59,10 +54,32 @@ bool CUDPController::open()
int CUDPController::read(unsigned char* buffer, unsigned int length)
{
assert(buffer != NULL);
assert(length > 0U);
assert(buffer != NULL);
assert(length > 0U);
return 0;
unsigned char data[BUFFER_LENGTH];
sockaddr_storage addr;
unsigned int addrLen;
int ret = m_socket.read(data, BUFFER_LENGTH, addr, addrLen);
// An error occurred on the socket
if (ret < 0)
return ret;
// Add new data to the ring buffer
if (ret > 0) {
if (CUDPSocket::match(addr, m_addr))
m_buffer.addData(data, ret);
}
// Get required data from the ring buffer
unsigned int avail = m_buffer.dataSize();
if (avail < length)
length = avail;
m_buffer.getData(buffer, length);
return int(length);
}
int CUDPController::write(const unsigned char* buffer, unsigned int length)

View File

@ -20,6 +20,7 @@
#define UDPController_H
#include "MMDVMModemPort.h"
#include "RingBuffer.h"
#include "UDPSocket.h"
#include <string>
@ -41,9 +42,7 @@ protected:
CUDPSocket m_socket;
sockaddr_storage m_addr;
unsigned int m_addrLen;
unsigned char* m_buffer;
unsigned int m_length;
unsigned int m_offset;
CRingBuffer<unsigned char> m_buffer;
};
#endif

View File

@ -19,6 +19,6 @@
#if !defined(VERSION_H)
#define VERSION_H
const char* VERSION = "20210216";
const char* VERSION = "20210217";
#endif