More sane modem port protocol handling.
This commit is contained in:
parent
ff9712b36a
commit
8ace65b86d
72
Conf.cpp
72
Conf.cpp
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015-2020 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015-2021 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -93,10 +93,14 @@ m_dmrIdLookupFile(),
|
||||||
m_dmrIdLookupTime(0U),
|
m_dmrIdLookupTime(0U),
|
||||||
m_nxdnIdLookupFile(),
|
m_nxdnIdLookupFile(),
|
||||||
m_nxdnIdLookupTime(0U),
|
m_nxdnIdLookupTime(0U),
|
||||||
m_modemPort(),
|
|
||||||
m_modemProtocol("uart"),
|
m_modemProtocol("uart"),
|
||||||
m_modemSpeed(115200U),
|
m_modemUARTPort(),
|
||||||
m_modemAddress(0x22),
|
m_modemUARTSpeed(115200U),
|
||||||
|
m_modemI2CPort(),
|
||||||
|
m_modemI2CAddress(0x22U),
|
||||||
|
m_modemModemAddress(),
|
||||||
|
m_modemModemPort(0U),
|
||||||
|
m_modemLocalPort(0U),
|
||||||
m_modemRXInvert(false),
|
m_modemRXInvert(false),
|
||||||
m_modemTXInvert(false),
|
m_modemTXInvert(false),
|
||||||
m_modemPTTInvert(false),
|
m_modemPTTInvert(false),
|
||||||
|
@ -514,14 +518,22 @@ bool CConf::read()
|
||||||
else if (::strcmp(key, "Time") == 0)
|
else if (::strcmp(key, "Time") == 0)
|
||||||
m_nxdnIdLookupTime = (unsigned int)::atoi(value);
|
m_nxdnIdLookupTime = (unsigned int)::atoi(value);
|
||||||
} else if (section == SECTION_MODEM) {
|
} else if (section == SECTION_MODEM) {
|
||||||
if (::strcmp(key, "Port") == 0)
|
if (::strcmp(key, "Protocol") == 0)
|
||||||
m_modemPort = value;
|
|
||||||
else if (::strcmp(key, "Protocol") == 0)
|
|
||||||
m_modemProtocol = value;
|
m_modemProtocol = value;
|
||||||
else if (::strcmp(key, "Speed") == 0)
|
else if (::strcmp(key, "UARTPort") == 0)
|
||||||
m_modemSpeed = (unsigned int)::atoi(value);
|
m_modemUARTPort = value;
|
||||||
else if (::strcmp(key, "Address") == 0)
|
else if (::strcmp(key, "UARTSpeed") == 0)
|
||||||
m_modemAddress = (unsigned int)::strtoul(value, NULL, 16);
|
m_modemUARTSpeed = (unsigned int)::atoi(value);
|
||||||
|
else if (::strcmp(key, "I2CPort") == 0)
|
||||||
|
m_modemI2CPort = value;
|
||||||
|
else if (::strcmp(key, "I2CAddress") == 0)
|
||||||
|
m_modemI2CAddress = (unsigned int)::strtoul(value, NULL, 16);
|
||||||
|
else if (::strcmp(key, "ModemAddress") == 0)
|
||||||
|
m_modemModemAddress = value;
|
||||||
|
else if (::strcmp(key, "ModemPort") == 0)
|
||||||
|
m_modemModemPort = (unsigned int)::atoi(value);
|
||||||
|
else if (::strcmp(key, "LocalPort") == 0)
|
||||||
|
m_modemLocalPort = (unsigned int)::atoi(value);
|
||||||
else if (::strcmp(key, "RXInvert") == 0)
|
else if (::strcmp(key, "RXInvert") == 0)
|
||||||
m_modemRXInvert = ::atoi(value) == 1;
|
m_modemRXInvert = ::atoi(value) == 1;
|
||||||
else if (::strcmp(key, "TXInvert") == 0)
|
else if (::strcmp(key, "TXInvert") == 0)
|
||||||
|
@ -1232,24 +1244,44 @@ unsigned int CConf::getNXDNIdLookupTime() const
|
||||||
return m_nxdnIdLookupTime;
|
return m_nxdnIdLookupTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CConf::getModemPort() const
|
|
||||||
{
|
|
||||||
return m_modemPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string CConf::getModemProtocol() const
|
std::string CConf::getModemProtocol() const
|
||||||
{
|
{
|
||||||
return m_modemProtocol;
|
return m_modemProtocol;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CConf::getModemSpeed() const
|
std::string CConf::getModemUARTPort() const
|
||||||
{
|
{
|
||||||
return m_modemSpeed;
|
return m_modemUARTPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CConf::getModemAddress() const
|
unsigned int CConf::getModemUARTSpeed() const
|
||||||
{
|
{
|
||||||
return m_modemAddress;
|
return m_modemUARTSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CConf::getModemI2CPort() const
|
||||||
|
{
|
||||||
|
return m_modemI2CPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int CConf::getModemI2CAddress() const
|
||||||
|
{
|
||||||
|
return m_modemI2CAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CConf::getModemModemAddress() const
|
||||||
|
{
|
||||||
|
return m_modemModemAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int CConf::getModemModemPort() const
|
||||||
|
{
|
||||||
|
return m_modemModemPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int CConf::getModemLocalPort() const
|
||||||
|
{
|
||||||
|
return m_modemLocalPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CConf::getModemRXInvert() const
|
bool CConf::getModemRXInvert() const
|
||||||
|
|
22
Conf.h
22
Conf.h
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015-2020 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015-2021 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -70,10 +70,14 @@ public:
|
||||||
unsigned int getNXDNIdLookupTime() const;
|
unsigned int getNXDNIdLookupTime() const;
|
||||||
|
|
||||||
// The Modem section
|
// The Modem section
|
||||||
std::string getModemPort() const;
|
|
||||||
std::string getModemProtocol() const;
|
std::string getModemProtocol() const;
|
||||||
unsigned int getModemSpeed() const;
|
std::string getModemUARTPort() const;
|
||||||
unsigned int getModemAddress() const;
|
unsigned int getModemUARTSpeed() const;
|
||||||
|
std::string getModemI2CPort() const;
|
||||||
|
unsigned int getModemI2CAddress() const;
|
||||||
|
std::string getModemModemAddress() const;
|
||||||
|
unsigned int getModemModemPort() const;
|
||||||
|
unsigned int getModemLocalPort() const;
|
||||||
bool getModemRXInvert() const;
|
bool getModemRXInvert() const;
|
||||||
bool getModemTXInvert() const;
|
bool getModemTXInvert() const;
|
||||||
bool getModemPTTInvert() const;
|
bool getModemPTTInvert() const;
|
||||||
|
@ -391,10 +395,14 @@ private:
|
||||||
std::string m_nxdnIdLookupFile;
|
std::string m_nxdnIdLookupFile;
|
||||||
unsigned int m_nxdnIdLookupTime;
|
unsigned int m_nxdnIdLookupTime;
|
||||||
|
|
||||||
std::string m_modemPort;
|
|
||||||
std::string m_modemProtocol;
|
std::string m_modemProtocol;
|
||||||
unsigned int m_modemSpeed;
|
std::string m_modemUARTPort;
|
||||||
unsigned int m_modemAddress;
|
unsigned int m_modemUARTSpeed;
|
||||||
|
std::string m_modemI2CPort;
|
||||||
|
unsigned int m_modemI2CAddress;
|
||||||
|
std::string m_modemModemAddress;
|
||||||
|
unsigned int m_modemModemPort;
|
||||||
|
unsigned int m_modemLocalPort;
|
||||||
bool m_modemRXInvert;
|
bool m_modemRXInvert;
|
||||||
bool m_modemTXInvert;
|
bool m_modemTXInvert;
|
||||||
bool m_modemPTTInvert;
|
bool m_modemPTTInvert;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2002-2004,2007-2009,2011-2013,2015-2017,2020 by Jonathan Naylor G4KLX
|
* Copyright (C) 2002-2004,2007-2009,2011-2013,2015-2017,2020,2021 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 1999-2001 by Thomas Sailor HB9JNX
|
* Copyright (C) 1999-2001 by Thomas Sailor HB9JNX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -22,11 +22,12 @@
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
|
|
||||||
|
#include "MMDVMModemPort.h"
|
||||||
#include "SerialPort.h"
|
#include "SerialPort.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class CI2CController : public ISerialPort {
|
class CI2CController : public ISerialPort, public IMMDVMModemPort {
|
||||||
public:
|
public:
|
||||||
CI2CController(const std::string& device, unsigned int address = 0x22U);
|
CI2CController(const std::string& device, unsigned int address = 0x22U);
|
||||||
virtual ~CI2CController();
|
virtual ~CI2CController();
|
||||||
|
|
16
MMDVM.ini
16
MMDVM.ini
|
@ -43,12 +43,18 @@ File=NXDN.csv
|
||||||
Time=24
|
Time=24
|
||||||
|
|
||||||
[Modem]
|
[Modem]
|
||||||
# Port=/dev/ttyACM0
|
# Valid values are "uart", "udp", and (on Linux) "i2c"
|
||||||
Port=/dev/ttyAMA0
|
|
||||||
# Port=\\.\COM4
|
|
||||||
Protocol=uart
|
Protocol=uart
|
||||||
Speed=460800
|
# The port and speed used for a UART connection
|
||||||
# Address=0x22
|
# UARTPort=\\.\COM4
|
||||||
|
# UARTPort=/dev/ttyACM0
|
||||||
|
UARTPort=/dev/ttyAMA0
|
||||||
|
UARTSpeed=460800
|
||||||
|
# The port and address for an I2C connection
|
||||||
|
I2CPort=/dev/i2c
|
||||||
|
I2CAddress=0x22
|
||||||
|
# IP parameters for UDP connection
|
||||||
|
|
||||||
TXInvert=1
|
TXInvert=1
|
||||||
RXInvert=0
|
RXInvert=0
|
||||||
PTTInvert=0
|
PTTInvert=0
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "NXDNIcomNetwork.h"
|
#include "NXDNIcomNetwork.h"
|
||||||
#include "RSSIInterpolator.h"
|
#include "RSSIInterpolator.h"
|
||||||
#include "UARTController.h"
|
#include "UARTController.h"
|
||||||
|
#include "UDPController.h"
|
||||||
#include "MMDVMModem.h"
|
#include "MMDVMModem.h"
|
||||||
#include "NullModem.h"
|
#include "NullModem.h"
|
||||||
#include "Version.h"
|
#include "Version.h"
|
||||||
|
@ -1315,10 +1316,14 @@ int CMMDVMHost::run()
|
||||||
|
|
||||||
bool CMMDVMHost::createModem()
|
bool CMMDVMHost::createModem()
|
||||||
{
|
{
|
||||||
std::string port = m_conf.getModemPort();
|
std::string protocol = m_conf.getModemProtocol();
|
||||||
std::string protocol = m_conf.getModemProtocol();
|
std::string uartPort = m_conf.getModemUARTPort();
|
||||||
unsigned int speed = m_conf.getModemSpeed();
|
unsigned int uartSpeed = m_conf.getModemUARTSpeed();
|
||||||
unsigned int address = m_conf.getModemAddress();
|
std::string i2cPort = m_conf.getModemI2CPort();
|
||||||
|
unsigned int i2cAddress = m_conf.getModemI2CAddress();
|
||||||
|
std::string modemAddress = m_conf.getModemModemAddress();
|
||||||
|
unsigned int modemPort = m_conf.getModemModemPort();
|
||||||
|
unsigned int localPort = m_conf.getModemLocalPort();
|
||||||
bool rxInvert = m_conf.getModemRXInvert();
|
bool rxInvert = m_conf.getModemRXInvert();
|
||||||
bool txInvert = m_conf.getModemTXInvert();
|
bool txInvert = m_conf.getModemTXInvert();
|
||||||
bool pttInvert = m_conf.getModemPTTInvert();
|
bool pttInvert = m_conf.getModemPTTInvert();
|
||||||
|
@ -1358,14 +1363,23 @@ bool CMMDVMHost::createModem()
|
||||||
bool useCOSAsLockout = m_conf.getModemUseCOSAsLockout();
|
bool useCOSAsLockout = m_conf.getModemUseCOSAsLockout();
|
||||||
|
|
||||||
LogInfo("Modem Parameters");
|
LogInfo("Modem Parameters");
|
||||||
LogInfo(" Port: %s", port.c_str());
|
|
||||||
#if defined(__linux__)
|
|
||||||
LogInfo(" Protocol: %s", protocol.c_str());
|
LogInfo(" Protocol: %s", protocol.c_str());
|
||||||
if (protocol == "i2c")
|
|
||||||
LogInfo(" I2C Address: %02X", address);
|
if (protocol == "uart") {
|
||||||
else
|
LogInfo(" UART Port: %s", uartPort.c_str());
|
||||||
|
LogInfo(" UART Speed: %u", uartSpeed);
|
||||||
|
} else if (protocol == "udp") {
|
||||||
|
LogInfo(" Modem Address: %s", modemAddress.c_str());
|
||||||
|
LogInfo(" Modem Port: %u", modemPort);
|
||||||
|
LogInfo(" Local Port: %u", localPort);
|
||||||
|
}
|
||||||
|
#if defined(__linux__)
|
||||||
|
else if (protocol == "i2c") {
|
||||||
|
LogInfo(" I2C Port: %s", i2cPort.c_str());
|
||||||
|
LogInfo(" I2C Address: %02X", i2cAddress);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
LogInfo(" Speed: %u", speed);
|
|
||||||
LogInfo(" RX Invert: %s", rxInvert ? "yes" : "no");
|
LogInfo(" RX Invert: %s", rxInvert ? "yes" : "no");
|
||||||
LogInfo(" TX Invert: %s", txInvert ? "yes" : "no");
|
LogInfo(" TX Invert: %s", txInvert ? "yes" : "no");
|
||||||
LogInfo(" PTT Invert: %s", pttInvert ? "yes" : "no");
|
LogInfo(" PTT Invert: %s", pttInvert ? "yes" : "no");
|
||||||
|
@ -1390,11 +1404,24 @@ bool CMMDVMHost::createModem()
|
||||||
LogInfo(" TX Frequency: %uHz (%uHz)", txFrequency, txFrequency + txOffset);
|
LogInfo(" TX Frequency: %uHz (%uHz)", txFrequency, txFrequency + txOffset);
|
||||||
LogInfo(" Use COS as Lockout: %s", useCOSAsLockout ? "yes" : "no");
|
LogInfo(" Use COS as Lockout: %s", useCOSAsLockout ? "yes" : "no");
|
||||||
|
|
||||||
if (port == "NullModem")
|
if (protocol == "null")
|
||||||
m_modem = new CNullModem;
|
m_modem = new CNullModem;
|
||||||
else
|
else
|
||||||
m_modem = new CMMDVMModem(port, m_duplex, rxInvert, txInvert, pttInvert, txDelay, dmrDelay, useCOSAsLockout, trace, debug);
|
m_modem = new CMMDVMModem(m_duplex, rxInvert, txInvert, pttInvert, txDelay, dmrDelay, useCOSAsLockout, trace, debug);
|
||||||
m_modem->setSerialParams(protocol, address, speed);
|
|
||||||
|
IMMDVMModemPort* modem = NULL;
|
||||||
|
if (protocol == "uart")
|
||||||
|
modem = new CUARTController(uartPort, uartSpeed, true);
|
||||||
|
else if (protocol == "udp")
|
||||||
|
modem = new CUDPController(modemAddress, modemPort, localPort);
|
||||||
|
#if defined(__linux__)
|
||||||
|
else if (protocol == "i2c")
|
||||||
|
modem = new CI2CController(i2cPort, i2cAddress);
|
||||||
|
#endif
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
|
||||||
|
m_modem->setModem(modem);
|
||||||
m_modem->setModeParams(m_dstarEnabled, m_dmrEnabled, m_ysfEnabled, m_p25Enabled, m_nxdnEnabled, m_m17Enabled, m_pocsagEnabled, m_fmEnabled, m_ax25Enabled);
|
m_modem->setModeParams(m_dstarEnabled, m_dmrEnabled, m_ysfEnabled, m_p25Enabled, m_nxdnEnabled, m_m17Enabled, m_pocsagEnabled, m_fmEnabled, m_ax25Enabled);
|
||||||
m_modem->setLevels(rxLevel, cwIdTXLevel, dstarTXLevel, dmrTXLevel, ysfTXLevel, p25TXLevel, nxdnTXLevel, m17TXLevel, pocsagTXLevel, fmTXLevel, ax25TXLevel);
|
m_modem->setLevels(rxLevel, cwIdTXLevel, dstarTXLevel, dmrTXLevel, ysfTXLevel, p25TXLevel, nxdnTXLevel, m17TXLevel, pocsagTXLevel, fmTXLevel, ax25TXLevel);
|
||||||
m_modem->setRFParams(rxFrequency, rxOffset, txFrequency, txOffset, txDCOffset, rxDCOffset, rfLevel, pocsagFrequency);
|
m_modem->setRFParams(rxFrequency, rxOffset, txFrequency, txOffset, txDCOffset, rxDCOffset, rfLevel, pocsagFrequency);
|
||||||
|
|
|
@ -203,6 +203,7 @@
|
||||||
<ClInclude Include="M17Network.h" />
|
<ClInclude Include="M17Network.h" />
|
||||||
<ClInclude Include="M17Utils.h" />
|
<ClInclude Include="M17Utils.h" />
|
||||||
<ClInclude Include="MMDVMHost.h" />
|
<ClInclude Include="MMDVMHost.h" />
|
||||||
|
<ClInclude Include="MMDVMModemPort.h" />
|
||||||
<ClInclude Include="Modem.h" />
|
<ClInclude Include="Modem.h" />
|
||||||
<ClInclude Include="ModemSerialPort.h" />
|
<ClInclude Include="ModemSerialPort.h" />
|
||||||
<ClInclude Include="Mutex.h" />
|
<ClInclude Include="Mutex.h" />
|
||||||
|
@ -252,6 +253,7 @@
|
||||||
<ClInclude Include="TFTSurenoo.h" />
|
<ClInclude Include="TFTSurenoo.h" />
|
||||||
<ClInclude Include="Thread.h" />
|
<ClInclude Include="Thread.h" />
|
||||||
<ClInclude Include="Timer.h" />
|
<ClInclude Include="Timer.h" />
|
||||||
|
<ClInclude Include="UDPController.h" />
|
||||||
<ClInclude Include="UDPSocket.h" />
|
<ClInclude Include="UDPSocket.h" />
|
||||||
<ClInclude Include="UserDB.h" />
|
<ClInclude Include="UserDB.h" />
|
||||||
<ClInclude Include="UserDBentry.h" />
|
<ClInclude Include="UserDBentry.h" />
|
||||||
|
@ -311,6 +313,7 @@
|
||||||
<ClCompile Include="M17Network.cpp" />
|
<ClCompile Include="M17Network.cpp" />
|
||||||
<ClCompile Include="M17Utils.cpp" />
|
<ClCompile Include="M17Utils.cpp" />
|
||||||
<ClCompile Include="MMDVMHost.cpp" />
|
<ClCompile Include="MMDVMHost.cpp" />
|
||||||
|
<ClCompile Include="MMDVMModemPort.cpp" />
|
||||||
<ClCompile Include="Modem.cpp" />
|
<ClCompile Include="Modem.cpp" />
|
||||||
<ClCompile Include="ModemSerialPort.cpp" />
|
<ClCompile Include="ModemSerialPort.cpp" />
|
||||||
<ClCompile Include="Mutex.cpp" />
|
<ClCompile Include="Mutex.cpp" />
|
||||||
|
@ -356,6 +359,7 @@
|
||||||
<ClCompile Include="TFTSurenoo.cpp" />
|
<ClCompile Include="TFTSurenoo.cpp" />
|
||||||
<ClCompile Include="Thread.cpp" />
|
<ClCompile Include="Thread.cpp" />
|
||||||
<ClCompile Include="Timer.cpp" />
|
<ClCompile Include="Timer.cpp" />
|
||||||
|
<ClCompile Include="UDPController.cpp" />
|
||||||
<ClCompile Include="UDPSocket.cpp" />
|
<ClCompile Include="UDPSocket.cpp" />
|
||||||
<ClCompile Include="UserDB.cpp" />
|
<ClCompile Include="UserDB.cpp" />
|
||||||
<ClCompile Include="UserDBentry.cpp" />
|
<ClCompile Include="UserDBentry.cpp" />
|
||||||
|
|
|
@ -344,6 +344,12 @@
|
||||||
<ClInclude Include="UARTController.h">
|
<ClInclude Include="UARTController.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="MMDVMModemPort.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="UDPController.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="BPTC19696.cpp">
|
<ClCompile Include="BPTC19696.cpp">
|
||||||
|
@ -646,5 +652,11 @@
|
||||||
<ClCompile Include="UARTController.cpp">
|
<ClCompile Include="UARTController.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="MMDVMModemPort.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="UDPController.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
199
MMDVMModem.cpp
199
MMDVMModem.cpp
|
@ -114,8 +114,7 @@ const unsigned int MAX_RESPONSES = 30U;
|
||||||
const unsigned int BUFFER_LENGTH = 2000U;
|
const unsigned int BUFFER_LENGTH = 2000U;
|
||||||
|
|
||||||
|
|
||||||
CMMDVMModem::CMMDVMModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool useCOSAsLockout, bool trace, bool debug) :
|
CMMDVMModem::CMMDVMModem(bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool useCOSAsLockout, bool trace, bool debug) :
|
||||||
m_port(port),
|
|
||||||
m_protocolVersion(0U),
|
m_protocolVersion(0U),
|
||||||
m_dmrColorCode(0U),
|
m_dmrColorCode(0U),
|
||||||
m_ysfLoDev(false),
|
m_ysfLoDev(false),
|
||||||
|
@ -158,7 +157,7 @@ m_fmEnabled(false),
|
||||||
m_ax25Enabled(false),
|
m_ax25Enabled(false),
|
||||||
m_rxDCOffset(0),
|
m_rxDCOffset(0),
|
||||||
m_txDCOffset(0),
|
m_txDCOffset(0),
|
||||||
m_serial(NULL),
|
m_port(NULL),
|
||||||
m_buffer(NULL),
|
m_buffer(NULL),
|
||||||
m_length(0U),
|
m_length(0U),
|
||||||
m_offset(0U),
|
m_offset(0U),
|
||||||
|
@ -247,25 +246,19 @@ m_fmMaxDevLevel(90.0F),
|
||||||
m_fmExtEnable(false)
|
m_fmExtEnable(false)
|
||||||
{
|
{
|
||||||
m_buffer = new unsigned char[BUFFER_LENGTH];
|
m_buffer = new unsigned char[BUFFER_LENGTH];
|
||||||
|
|
||||||
assert(!port.empty());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CMMDVMModem::~CMMDVMModem()
|
CMMDVMModem::~CMMDVMModem()
|
||||||
{
|
{
|
||||||
delete m_serial;
|
delete m_port;
|
||||||
delete[] m_buffer;
|
delete[] m_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMMDVMModem::setSerialParams(const std::string& protocol, unsigned int address, unsigned int speed)
|
void CMMDVMModem::setModem(IMMDVMModemPort* port)
|
||||||
{
|
{
|
||||||
// Create the serial controller instance according the protocol specified in conf.
|
assert(port != NULL);
|
||||||
#if defined(__linux__)
|
|
||||||
if (protocol == "i2c")
|
m_port = port;
|
||||||
m_serial = new CI2CController(m_port, address);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
m_serial = new CUARTController(m_port, speed, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMMDVMModem::setRFParams(unsigned int rxFrequency, int rxOffset, unsigned int txFrequency, int txOffset, int txDCOffset, int rxDCOffset, float rfLevel, unsigned int pocsagFrequency)
|
void CMMDVMModem::setRFParams(unsigned int rxFrequency, int rxOffset, unsigned int txFrequency, int txOffset, int txDCOffset, int rxDCOffset, float rfLevel, unsigned int pocsagFrequency)
|
||||||
|
@ -351,15 +344,15 @@ bool CMMDVMModem::open()
|
||||||
{
|
{
|
||||||
::LogMessage("Opening the MMDVM");
|
::LogMessage("Opening the MMDVM");
|
||||||
|
|
||||||
bool ret = m_serial->open();
|
bool ret = m_port->open();
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ret = readVersion();
|
ret = readVersion();
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
m_serial->close();
|
m_port->close();
|
||||||
delete m_serial;
|
delete m_port;
|
||||||
m_serial = NULL;
|
m_port = NULL;
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
/* Stopping the inactivity timer here when a firmware version has been
|
/* Stopping the inactivity timer here when a firmware version has been
|
||||||
|
@ -369,51 +362,51 @@ bool CMMDVMModem::open()
|
||||||
|
|
||||||
ret = setFrequency();
|
ret = setFrequency();
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
m_serial->close();
|
m_port->close();
|
||||||
delete m_serial;
|
delete m_port;
|
||||||
m_serial = NULL;
|
m_port = NULL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = writeConfig();
|
ret = writeConfig();
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
m_serial->close();
|
m_port->close();
|
||||||
delete m_serial;
|
delete m_port;
|
||||||
m_serial = NULL;
|
m_port = NULL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_fmEnabled && m_duplex) {
|
if (m_fmEnabled && m_duplex) {
|
||||||
ret = setFMCallsignParams();
|
ret = setFMCallsignParams();
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
m_serial->close();
|
m_port->close();
|
||||||
delete m_serial;
|
delete m_port;
|
||||||
m_serial = NULL;
|
m_port = NULL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = setFMAckParams();
|
ret = setFMAckParams();
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
m_serial->close();
|
m_port->close();
|
||||||
delete m_serial;
|
delete m_port;
|
||||||
m_serial = NULL;
|
m_port = NULL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = setFMMiscParams();
|
ret = setFMMiscParams();
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
m_serial->close();
|
m_port->close();
|
||||||
delete m_serial;
|
delete m_port;
|
||||||
m_serial = NULL;
|
m_port = NULL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_fmExtEnable) {
|
if (m_fmExtEnable) {
|
||||||
ret = setFMExtParams();
|
ret = setFMExtParams();
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
m_serial->close();
|
m_port->close();
|
||||||
delete m_serial;
|
delete m_port;
|
||||||
m_serial = NULL;
|
m_port = NULL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -429,7 +422,7 @@ bool CMMDVMModem::open()
|
||||||
|
|
||||||
void CMMDVMModem::clock(unsigned int ms)
|
void CMMDVMModem::clock(unsigned int ms)
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
|
|
||||||
// Poll the modem status every 250ms
|
// Poll the modem status every 250ms
|
||||||
m_statusTimer.clock(ms);
|
m_statusTimer.clock(ms);
|
||||||
|
@ -928,7 +921,7 @@ void CMMDVMModem::clock(unsigned int ms)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret = m_serial->write(m_buffer, len);
|
int ret = m_port->write(m_buffer, len);
|
||||||
if (ret != int(len))
|
if (ret != int(len))
|
||||||
LogWarning("Error when writing D-Star data to the MMDVM");
|
LogWarning("Error when writing D-Star data to the MMDVM");
|
||||||
|
|
||||||
|
@ -944,7 +937,7 @@ void CMMDVMModem::clock(unsigned int ms)
|
||||||
if (m_trace)
|
if (m_trace)
|
||||||
CUtils::dump(1U, "TX DMR Data 1", m_buffer, len);
|
CUtils::dump(1U, "TX DMR Data 1", m_buffer, len);
|
||||||
|
|
||||||
int ret = m_serial->write(m_buffer, len);
|
int ret = m_port->write(m_buffer, len);
|
||||||
if (ret != int(len))
|
if (ret != int(len))
|
||||||
LogWarning("Error when writing DMR data to the MMDVM");
|
LogWarning("Error when writing DMR data to the MMDVM");
|
||||||
|
|
||||||
|
@ -961,7 +954,7 @@ void CMMDVMModem::clock(unsigned int ms)
|
||||||
if (m_trace)
|
if (m_trace)
|
||||||
CUtils::dump(1U, "TX DMR Data 2", m_buffer, len);
|
CUtils::dump(1U, "TX DMR Data 2", m_buffer, len);
|
||||||
|
|
||||||
int ret = m_serial->write(m_buffer, len);
|
int ret = m_port->write(m_buffer, len);
|
||||||
if (ret != int(len))
|
if (ret != int(len))
|
||||||
LogWarning("Error when writing DMR data to the MMDVM");
|
LogWarning("Error when writing DMR data to the MMDVM");
|
||||||
|
|
||||||
|
@ -978,7 +971,7 @@ void CMMDVMModem::clock(unsigned int ms)
|
||||||
if (m_trace)
|
if (m_trace)
|
||||||
CUtils::dump(1U, "TX YSF Data", m_buffer, len);
|
CUtils::dump(1U, "TX YSF Data", m_buffer, len);
|
||||||
|
|
||||||
int ret = m_serial->write(m_buffer, len);
|
int ret = m_port->write(m_buffer, len);
|
||||||
if (ret != int(len))
|
if (ret != int(len))
|
||||||
LogWarning("Error when writing YSF data to the MMDVM");
|
LogWarning("Error when writing YSF data to the MMDVM");
|
||||||
|
|
||||||
|
@ -999,7 +992,7 @@ void CMMDVMModem::clock(unsigned int ms)
|
||||||
CUtils::dump(1U, "TX P25 LDU", m_buffer, len);
|
CUtils::dump(1U, "TX P25 LDU", m_buffer, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret = m_serial->write(m_buffer, len);
|
int ret = m_port->write(m_buffer, len);
|
||||||
if (ret != int(len))
|
if (ret != int(len))
|
||||||
LogWarning("Error when writing P25 data to the MMDVM");
|
LogWarning("Error when writing P25 data to the MMDVM");
|
||||||
|
|
||||||
|
@ -1016,7 +1009,7 @@ void CMMDVMModem::clock(unsigned int ms)
|
||||||
if (m_trace)
|
if (m_trace)
|
||||||
CUtils::dump(1U, "TX NXDN Data", m_buffer, len);
|
CUtils::dump(1U, "TX NXDN Data", m_buffer, len);
|
||||||
|
|
||||||
int ret = m_serial->write(m_buffer, len);
|
int ret = m_port->write(m_buffer, len);
|
||||||
if (ret != int(len))
|
if (ret != int(len))
|
||||||
LogWarning("Error when writing NXDN data to the MMDVM");
|
LogWarning("Error when writing NXDN data to the MMDVM");
|
||||||
|
|
||||||
|
@ -1037,7 +1030,7 @@ void CMMDVMModem::clock(unsigned int ms)
|
||||||
CUtils::dump(1U, "TX M17 Data", m_buffer, len);
|
CUtils::dump(1U, "TX M17 Data", m_buffer, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret = m_serial->write(m_buffer, len);
|
int ret = m_port->write(m_buffer, len);
|
||||||
if (ret != int(len))
|
if (ret != int(len))
|
||||||
LogWarning("Error when writing M17 data to the MMDVM");
|
LogWarning("Error when writing M17 data to the MMDVM");
|
||||||
|
|
||||||
|
@ -1054,7 +1047,7 @@ void CMMDVMModem::clock(unsigned int ms)
|
||||||
if (m_trace)
|
if (m_trace)
|
||||||
CUtils::dump(1U, "TX POCSAG Data", m_buffer, len);
|
CUtils::dump(1U, "TX POCSAG Data", m_buffer, len);
|
||||||
|
|
||||||
int ret = m_serial->write(m_buffer, len);
|
int ret = m_port->write(m_buffer, len);
|
||||||
if (ret != int(len))
|
if (ret != int(len))
|
||||||
LogWarning("Error when writing POCSAG data to the MMDVM");
|
LogWarning("Error when writing POCSAG data to the MMDVM");
|
||||||
|
|
||||||
|
@ -1071,7 +1064,7 @@ void CMMDVMModem::clock(unsigned int ms)
|
||||||
if (m_trace)
|
if (m_trace)
|
||||||
CUtils::dump(1U, "TX FM Data", m_buffer, len);
|
CUtils::dump(1U, "TX FM Data", m_buffer, len);
|
||||||
|
|
||||||
int ret = m_serial->write(m_buffer, len);
|
int ret = m_port->write(m_buffer, len);
|
||||||
if (ret != int(len))
|
if (ret != int(len))
|
||||||
LogWarning("Error when writing FM data to the MMDVM");
|
LogWarning("Error when writing FM data to the MMDVM");
|
||||||
|
|
||||||
|
@ -1088,7 +1081,7 @@ void CMMDVMModem::clock(unsigned int ms)
|
||||||
if (m_trace)
|
if (m_trace)
|
||||||
CUtils::dump(1U, "TX AX.25 Data", m_buffer, len);
|
CUtils::dump(1U, "TX AX.25 Data", m_buffer, len);
|
||||||
|
|
||||||
int ret = m_serial->write(m_buffer, len);
|
int ret = m_port->write(m_buffer, len);
|
||||||
if (ret != int(len))
|
if (ret != int(len))
|
||||||
LogWarning("Error when writing AX.25 data to the MMDVM");
|
LogWarning("Error when writing AX.25 data to the MMDVM");
|
||||||
|
|
||||||
|
@ -1105,7 +1098,7 @@ void CMMDVMModem::clock(unsigned int ms)
|
||||||
if (m_trace)
|
if (m_trace)
|
||||||
CUtils::dump(1U, "TX Transparent Data", m_buffer, len);
|
CUtils::dump(1U, "TX Transparent Data", m_buffer, len);
|
||||||
|
|
||||||
int ret = m_serial->write(m_buffer, len);
|
int ret = m_port->write(m_buffer, len);
|
||||||
if (ret != int(len))
|
if (ret != int(len))
|
||||||
LogWarning("Error when writing Transparent data to the MMDVM");
|
LogWarning("Error when writing Transparent data to the MMDVM");
|
||||||
}
|
}
|
||||||
|
@ -1118,7 +1111,7 @@ void CMMDVMModem::clock(unsigned int ms)
|
||||||
if (m_trace)
|
if (m_trace)
|
||||||
CUtils::dump(1U, "TX Serial Data", m_buffer, len);
|
CUtils::dump(1U, "TX Serial Data", m_buffer, len);
|
||||||
|
|
||||||
int ret = m_serial->write(m_buffer, len);
|
int ret = m_port->write(m_buffer, len);
|
||||||
if (ret != int(len))
|
if (ret != int(len))
|
||||||
LogWarning("Error when writing Serial data to the MMDVM");
|
LogWarning("Error when writing Serial data to the MMDVM");
|
||||||
}
|
}
|
||||||
|
@ -1126,11 +1119,11 @@ void CMMDVMModem::clock(unsigned int ms)
|
||||||
|
|
||||||
void CMMDVMModem::close()
|
void CMMDVMModem::close()
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
|
|
||||||
::LogMessage("Closing the MMDVM");
|
::LogMessage("Closing the MMDVM");
|
||||||
|
|
||||||
m_serial->close();
|
m_port->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CMMDVMModem::readDStarData(unsigned char* data)
|
unsigned int CMMDVMModem::readDStarData(unsigned char* data)
|
||||||
|
@ -1645,7 +1638,7 @@ bool CMMDVMModem::writeTransparentData(const unsigned char* data, unsigned int l
|
||||||
|
|
||||||
bool CMMDVMModem::writeDStarInfo(const char* my1, const char* my2, const char* your, const char* type, const char* reflector)
|
bool CMMDVMModem::writeDStarInfo(const char* my1, const char* my2, const char* your, const char* type, const char* reflector)
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
assert(my1 != NULL);
|
assert(my1 != NULL);
|
||||||
assert(my2 != NULL);
|
assert(my2 != NULL);
|
||||||
assert(your != NULL);
|
assert(your != NULL);
|
||||||
|
@ -1669,12 +1662,12 @@ bool CMMDVMModem::writeDStarInfo(const char* my1, const char* my2, const char* y
|
||||||
|
|
||||||
::memcpy(buffer + 25U, reflector, DSTAR_LONG_CALLSIGN_LENGTH);
|
::memcpy(buffer + 25U, reflector, DSTAR_LONG_CALLSIGN_LENGTH);
|
||||||
|
|
||||||
return m_serial->write(buffer, 33U) != 33;
|
return m_port->write(buffer, 33U) != 33;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMMDVMModem::writeDMRInfo(unsigned int slotNo, const std::string& src, bool group, const std::string& dest, const char* type)
|
bool CMMDVMModem::writeDMRInfo(unsigned int slotNo, const std::string& src, bool group, const std::string& dest, const char* type)
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
assert(type != NULL);
|
assert(type != NULL);
|
||||||
|
|
||||||
unsigned char buffer[50U];
|
unsigned char buffer[50U];
|
||||||
|
@ -1695,12 +1688,12 @@ bool CMMDVMModem::writeDMRInfo(unsigned int slotNo, const std::string& src, bool
|
||||||
|
|
||||||
::memcpy(buffer + 46U, type, 1U);
|
::memcpy(buffer + 46U, type, 1U);
|
||||||
|
|
||||||
return m_serial->write(buffer, 47U) != 47;
|
return m_port->write(buffer, 47U) != 47;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMMDVMModem::writeYSFInfo(const char* source, const char* dest, unsigned char dgid, const char* type, const char* origin)
|
bool CMMDVMModem::writeYSFInfo(const char* source, const char* dest, unsigned char dgid, const char* type, const char* origin)
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
assert(source != NULL);
|
assert(source != NULL);
|
||||||
assert(dest != NULL);
|
assert(dest != NULL);
|
||||||
assert(type != NULL);
|
assert(type != NULL);
|
||||||
|
@ -1723,12 +1716,12 @@ bool CMMDVMModem::writeYSFInfo(const char* source, const char* dest, unsigned ch
|
||||||
|
|
||||||
buffer[35U] = dgid;
|
buffer[35U] = dgid;
|
||||||
|
|
||||||
return m_serial->write(buffer, 36U) != 36;
|
return m_port->write(buffer, 36U) != 36;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMMDVMModem::writeP25Info(const char* source, bool group, unsigned int dest, const char* type)
|
bool CMMDVMModem::writeP25Info(const char* source, bool group, unsigned int dest, const char* type)
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
assert(source != NULL);
|
assert(source != NULL);
|
||||||
assert(type != NULL);
|
assert(type != NULL);
|
||||||
|
|
||||||
|
@ -1748,12 +1741,12 @@ bool CMMDVMModem::writeP25Info(const char* source, bool group, unsigned int dest
|
||||||
|
|
||||||
::memcpy(buffer + 30U, type, 1U);
|
::memcpy(buffer + 30U, type, 1U);
|
||||||
|
|
||||||
return m_serial->write(buffer, 31U) != 31;
|
return m_port->write(buffer, 31U) != 31;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMMDVMModem::writeNXDNInfo(const char* source, bool group, unsigned int dest, const char* type)
|
bool CMMDVMModem::writeNXDNInfo(const char* source, bool group, unsigned int dest, const char* type)
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
assert(source != NULL);
|
assert(source != NULL);
|
||||||
assert(type != NULL);
|
assert(type != NULL);
|
||||||
|
|
||||||
|
@ -1773,12 +1766,12 @@ bool CMMDVMModem::writeNXDNInfo(const char* source, bool group, unsigned int des
|
||||||
|
|
||||||
::memcpy(buffer + 30U, type, 1U);
|
::memcpy(buffer + 30U, type, 1U);
|
||||||
|
|
||||||
return m_serial->write(buffer, 31U) != 31;
|
return m_port->write(buffer, 31U) != 31;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMMDVMModem::writeM17Info(const char* source, const char* dest, const char* type)
|
bool CMMDVMModem::writeM17Info(const char* source, const char* dest, const char* type)
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
assert(source != NULL);
|
assert(source != NULL);
|
||||||
assert(dest != NULL);
|
assert(dest != NULL);
|
||||||
assert(type != NULL);
|
assert(type != NULL);
|
||||||
|
@ -1797,12 +1790,12 @@ bool CMMDVMModem::writeM17Info(const char* source, const char* dest, const char*
|
||||||
|
|
||||||
::memcpy(buffer + 22U, type, 1U);
|
::memcpy(buffer + 22U, type, 1U);
|
||||||
|
|
||||||
return m_serial->write(buffer, 23U) != 23;
|
return m_port->write(buffer, 23U) != 23;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMMDVMModem::writePOCSAGInfo(unsigned int ric, const std::string& message)
|
bool CMMDVMModem::writePOCSAGInfo(unsigned int ric, const std::string& message)
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
|
|
||||||
size_t length = message.size();
|
size_t length = message.size();
|
||||||
|
|
||||||
|
@ -1818,14 +1811,14 @@ bool CMMDVMModem::writePOCSAGInfo(unsigned int ric, const std::string& message)
|
||||||
|
|
||||||
::memcpy(buffer + 11U, message.c_str(), length);
|
::memcpy(buffer + 11U, message.c_str(), length);
|
||||||
|
|
||||||
int ret = m_serial->write(buffer, length + 11U);
|
int ret = m_port->write(buffer, length + 11U);
|
||||||
|
|
||||||
return ret != int(length + 11U);
|
return ret != int(length + 11U);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMMDVMModem::writeIPInfo(const std::string& address)
|
bool CMMDVMModem::writeIPInfo(const std::string& address)
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
|
|
||||||
size_t length = address.size();
|
size_t length = address.size();
|
||||||
|
|
||||||
|
@ -1839,14 +1832,14 @@ bool CMMDVMModem::writeIPInfo(const std::string& address)
|
||||||
|
|
||||||
::memcpy(buffer + 4U, address.c_str(), length);
|
::memcpy(buffer + 4U, address.c_str(), length);
|
||||||
|
|
||||||
int ret = m_serial->write(buffer, length + 4U);
|
int ret = m_port->write(buffer, length + 4U);
|
||||||
|
|
||||||
return ret != int(length + 4U);
|
return ret != int(length + 4U);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMMDVMModem::writeSerial(const unsigned char* data, unsigned int length)
|
bool CMMDVMModem::writeSerial(const unsigned char* data, unsigned int length)
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
assert(data != NULL);
|
assert(data != NULL);
|
||||||
assert(length > 0U);
|
assert(length > 0U);
|
||||||
|
|
||||||
|
@ -1887,7 +1880,7 @@ bool CMMDVMModem::hasError() const
|
||||||
|
|
||||||
bool CMMDVMModem::readVersion()
|
bool CMMDVMModem::readVersion()
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
|
|
||||||
CThread::sleep(2000U); // 2s
|
CThread::sleep(2000U); // 2s
|
||||||
|
|
||||||
|
@ -1900,12 +1893,12 @@ bool CMMDVMModem::readVersion()
|
||||||
|
|
||||||
// CUtils::dump(1U, "Written", buffer, 3U);
|
// CUtils::dump(1U, "Written", buffer, 3U);
|
||||||
|
|
||||||
int ret = m_serial->write(buffer, 3U);
|
int ret = m_port->write(buffer, 3U);
|
||||||
if (ret != 3)
|
if (ret != 3)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
m_serial->setNonblock(true);
|
m_port->setNonblock(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (unsigned int count = 0U; count < MAX_RESPONSES; count++) {
|
for (unsigned int count = 0U; count < MAX_RESPONSES; count++) {
|
||||||
|
@ -2000,7 +1993,7 @@ bool CMMDVMModem::readVersion()
|
||||||
|
|
||||||
bool CMMDVMModem::readStatus()
|
bool CMMDVMModem::readStatus()
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
|
|
||||||
unsigned char buffer[3U];
|
unsigned char buffer[3U];
|
||||||
|
|
||||||
|
@ -2010,7 +2003,7 @@ bool CMMDVMModem::readStatus()
|
||||||
|
|
||||||
// CUtils::dump(1U, "Written", buffer, 3U);
|
// CUtils::dump(1U, "Written", buffer, 3U);
|
||||||
|
|
||||||
return m_serial->write(buffer, 3U) == 3;
|
return m_port->write(buffer, 3U) == 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMMDVMModem::writeConfig()
|
bool CMMDVMModem::writeConfig()
|
||||||
|
@ -2027,7 +2020,7 @@ bool CMMDVMModem::writeConfig()
|
||||||
|
|
||||||
bool CMMDVMModem::setConfig1()
|
bool CMMDVMModem::setConfig1()
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
|
|
||||||
unsigned char buffer[30U];
|
unsigned char buffer[30U];
|
||||||
|
|
||||||
|
@ -2109,7 +2102,7 @@ bool CMMDVMModem::setConfig1()
|
||||||
|
|
||||||
// CUtils::dump(1U, "Written", buffer, 26U);
|
// CUtils::dump(1U, "Written", buffer, 26U);
|
||||||
|
|
||||||
int ret = m_serial->write(buffer, 26U);
|
int ret = m_port->write(buffer, 26U);
|
||||||
if (ret != 26)
|
if (ret != 26)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -2142,7 +2135,7 @@ bool CMMDVMModem::setConfig1()
|
||||||
|
|
||||||
bool CMMDVMModem::setConfig2()
|
bool CMMDVMModem::setConfig2()
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
|
|
||||||
unsigned char buffer[50U];
|
unsigned char buffer[50U];
|
||||||
|
|
||||||
|
@ -2235,7 +2228,7 @@ bool CMMDVMModem::setConfig2()
|
||||||
|
|
||||||
// CUtils::dump(1U, "Written", buffer, 40U);
|
// CUtils::dump(1U, "Written", buffer, 40U);
|
||||||
|
|
||||||
int ret = m_serial->write(buffer, 40U);
|
int ret = m_port->write(buffer, 40U);
|
||||||
if (ret != 40)
|
if (ret != 40)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -2268,7 +2261,7 @@ bool CMMDVMModem::setConfig2()
|
||||||
|
|
||||||
bool CMMDVMModem::setFrequency()
|
bool CMMDVMModem::setFrequency()
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
|
|
||||||
unsigned char buffer[20U];
|
unsigned char buffer[20U];
|
||||||
unsigned char len;
|
unsigned char len;
|
||||||
|
@ -2310,7 +2303,7 @@ bool CMMDVMModem::setFrequency()
|
||||||
|
|
||||||
// CUtils::dump(1U, "Written", buffer, len);
|
// CUtils::dump(1U, "Written", buffer, len);
|
||||||
|
|
||||||
int ret = m_serial->write(buffer, len);
|
int ret = m_port->write(buffer, len);
|
||||||
if (ret != len)
|
if (ret != len)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -2341,11 +2334,11 @@ bool CMMDVMModem::setFrequency()
|
||||||
|
|
||||||
RESP_TYPE_MMDVM CMMDVMModem::getResponse()
|
RESP_TYPE_MMDVM CMMDVMModem::getResponse()
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
|
|
||||||
if (m_state == SS_START) {
|
if (m_state == SS_START) {
|
||||||
// Get the start of the frame or nothing at all
|
// Get the start of the frame or nothing at all
|
||||||
int ret = m_serial->read(m_buffer + 0U, 1U);
|
int ret = m_port->read(m_buffer + 0U, 1U);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
LogError("Error when reading from the modem");
|
LogError("Error when reading from the modem");
|
||||||
return RTM_ERROR;
|
return RTM_ERROR;
|
||||||
|
@ -2363,7 +2356,7 @@ RESP_TYPE_MMDVM CMMDVMModem::getResponse()
|
||||||
|
|
||||||
if (m_state == SS_LENGTH1) {
|
if (m_state == SS_LENGTH1) {
|
||||||
// Get the length of the frame, 1/2
|
// Get the length of the frame, 1/2
|
||||||
int ret = m_serial->read(m_buffer + 1U, 1U);
|
int ret = m_port->read(m_buffer + 1U, 1U);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
LogError("Error when reading from the modem");
|
LogError("Error when reading from the modem");
|
||||||
m_state = SS_START;
|
m_state = SS_START;
|
||||||
|
@ -2384,7 +2377,7 @@ RESP_TYPE_MMDVM CMMDVMModem::getResponse()
|
||||||
|
|
||||||
if (m_state == SS_LENGTH2) {
|
if (m_state == SS_LENGTH2) {
|
||||||
// Get the length of the frane, 2/2
|
// Get the length of the frane, 2/2
|
||||||
int ret = m_serial->read(m_buffer + 2U, 1U);
|
int ret = m_port->read(m_buffer + 2U, 1U);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
LogError("Error when reading from the modem");
|
LogError("Error when reading from the modem");
|
||||||
m_state = SS_START;
|
m_state = SS_START;
|
||||||
|
@ -2401,7 +2394,7 @@ RESP_TYPE_MMDVM CMMDVMModem::getResponse()
|
||||||
|
|
||||||
if (m_state == SS_TYPE) {
|
if (m_state == SS_TYPE) {
|
||||||
// Get the frame type
|
// Get the frame type
|
||||||
int ret = m_serial->read(&m_type, 1U);
|
int ret = m_port->read(&m_type, 1U);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
LogError("Error when reading from the modem");
|
LogError("Error when reading from the modem");
|
||||||
m_state = SS_START;
|
m_state = SS_START;
|
||||||
|
@ -2418,7 +2411,7 @@ RESP_TYPE_MMDVM CMMDVMModem::getResponse()
|
||||||
|
|
||||||
if (m_state == SS_DATA) {
|
if (m_state == SS_DATA) {
|
||||||
while (m_offset < m_length) {
|
while (m_offset < m_length) {
|
||||||
int ret = m_serial->read(m_buffer + m_offset, m_length - m_offset);
|
int ret = m_port->read(m_buffer + m_offset, m_length - m_offset);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
LogError("Error when reading from the modem");
|
LogError("Error when reading from the modem");
|
||||||
m_state = SS_START;
|
m_state = SS_START;
|
||||||
|
@ -2453,7 +2446,7 @@ unsigned char CMMDVMModem::getMode() const
|
||||||
|
|
||||||
bool CMMDVMModem::setMode(unsigned char mode)
|
bool CMMDVMModem::setMode(unsigned char mode)
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
|
|
||||||
unsigned char buffer[4U];
|
unsigned char buffer[4U];
|
||||||
|
|
||||||
|
@ -2464,12 +2457,12 @@ bool CMMDVMModem::setMode(unsigned char mode)
|
||||||
|
|
||||||
// CUtils::dump(1U, "Written", buffer, 4U);
|
// CUtils::dump(1U, "Written", buffer, 4U);
|
||||||
|
|
||||||
return m_serial->write(buffer, 4U) == 4;
|
return m_port->write(buffer, 4U) == 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMMDVMModem::sendCWId(const std::string& callsign)
|
bool CMMDVMModem::sendCWId(const std::string& callsign)
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
|
|
||||||
unsigned int length = callsign.length();
|
unsigned int length = callsign.length();
|
||||||
if (length > 200U)
|
if (length > 200U)
|
||||||
|
@ -2486,12 +2479,12 @@ bool CMMDVMModem::sendCWId(const std::string& callsign)
|
||||||
|
|
||||||
// CUtils::dump(1U, "Written", buffer, length + 3U);
|
// CUtils::dump(1U, "Written", buffer, length + 3U);
|
||||||
|
|
||||||
return m_serial->write(buffer, length + 3U) == int(length + 3U);
|
return m_port->write(buffer, length + 3U) == int(length + 3U);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMMDVMModem::writeDMRStart(bool tx)
|
bool CMMDVMModem::writeDMRStart(bool tx)
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
|
|
||||||
if (tx && m_tx)
|
if (tx && m_tx)
|
||||||
return true;
|
return true;
|
||||||
|
@ -2507,12 +2500,12 @@ bool CMMDVMModem::writeDMRStart(bool tx)
|
||||||
|
|
||||||
// CUtils::dump(1U, "Written", buffer, 4U);
|
// CUtils::dump(1U, "Written", buffer, 4U);
|
||||||
|
|
||||||
return m_serial->write(buffer, 4U) == 4;
|
return m_port->write(buffer, 4U) == 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMMDVMModem::writeDMRAbort(unsigned int slotNo)
|
bool CMMDVMModem::writeDMRAbort(unsigned int slotNo)
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
|
|
||||||
if (slotNo == 1U)
|
if (slotNo == 1U)
|
||||||
m_txDMRData1.clear();
|
m_txDMRData1.clear();
|
||||||
|
@ -2528,12 +2521,12 @@ bool CMMDVMModem::writeDMRAbort(unsigned int slotNo)
|
||||||
|
|
||||||
// CUtils::dump(1U, "Written", buffer, 4U);
|
// CUtils::dump(1U, "Written", buffer, 4U);
|
||||||
|
|
||||||
return m_serial->write(buffer, 4U) == 4;
|
return m_port->write(buffer, 4U) == 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMMDVMModem::writeDMRShortLC(const unsigned char* lc)
|
bool CMMDVMModem::writeDMRShortLC(const unsigned char* lc)
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
assert(lc != NULL);
|
assert(lc != NULL);
|
||||||
|
|
||||||
unsigned char buffer[12U];
|
unsigned char buffer[12U];
|
||||||
|
@ -2553,7 +2546,7 @@ bool CMMDVMModem::writeDMRShortLC(const unsigned char* lc)
|
||||||
|
|
||||||
// CUtils::dump(1U, "Written", buffer, 12U);
|
// CUtils::dump(1U, "Written", buffer, 12U);
|
||||||
|
|
||||||
return m_serial->write(buffer, 12U) == 12;
|
return m_port->write(buffer, 12U) == 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMMDVMModem::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)
|
void CMMDVMModem::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)
|
||||||
|
@ -2614,7 +2607,7 @@ void CMMDVMModem::setFMExtParams(const std::string& ack, unsigned int audioBoost
|
||||||
|
|
||||||
bool CMMDVMModem::setFMCallsignParams()
|
bool CMMDVMModem::setFMCallsignParams()
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
|
|
||||||
unsigned char buffer[80U];
|
unsigned char buffer[80U];
|
||||||
unsigned char len = 10U + m_fmCallsign.size();
|
unsigned char len = 10U + m_fmCallsign.size();
|
||||||
|
@ -2644,7 +2637,7 @@ bool CMMDVMModem::setFMCallsignParams()
|
||||||
|
|
||||||
// CUtils::dump(1U, "Written", buffer, len);
|
// CUtils::dump(1U, "Written", buffer, len);
|
||||||
|
|
||||||
int ret = m_serial->write(buffer, len);
|
int ret = m_port->write(buffer, len);
|
||||||
if (ret != len)
|
if (ret != len)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -2675,7 +2668,7 @@ bool CMMDVMModem::setFMCallsignParams()
|
||||||
|
|
||||||
bool CMMDVMModem::setFMAckParams()
|
bool CMMDVMModem::setFMAckParams()
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
|
|
||||||
unsigned char buffer[80U];
|
unsigned char buffer[80U];
|
||||||
unsigned char len = 8U + m_fmRfAck.size();
|
unsigned char len = 8U + m_fmRfAck.size();
|
||||||
|
@ -2696,7 +2689,7 @@ bool CMMDVMModem::setFMAckParams()
|
||||||
|
|
||||||
// CUtils::dump(1U, "Written", buffer, len);
|
// CUtils::dump(1U, "Written", buffer, len);
|
||||||
|
|
||||||
int ret = m_serial->write(buffer, len);
|
int ret = m_port->write(buffer, len);
|
||||||
if (ret != len)
|
if (ret != len)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -2727,7 +2720,7 @@ bool CMMDVMModem::setFMAckParams()
|
||||||
|
|
||||||
bool CMMDVMModem::setFMMiscParams()
|
bool CMMDVMModem::setFMMiscParams()
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
|
|
||||||
unsigned char buffer[20U];
|
unsigned char buffer[20U];
|
||||||
|
|
||||||
|
@ -2763,7 +2756,7 @@ bool CMMDVMModem::setFMMiscParams()
|
||||||
|
|
||||||
// CUtils::dump(1U, "Written", buffer, 17U);
|
// CUtils::dump(1U, "Written", buffer, 17U);
|
||||||
|
|
||||||
int ret = m_serial->write(buffer, 17U);
|
int ret = m_port->write(buffer, 17U);
|
||||||
if (ret != 17)
|
if (ret != 17)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -2794,7 +2787,7 @@ bool CMMDVMModem::setFMMiscParams()
|
||||||
|
|
||||||
bool CMMDVMModem::setFMExtParams()
|
bool CMMDVMModem::setFMExtParams()
|
||||||
{
|
{
|
||||||
assert(m_serial != NULL);
|
assert(m_port != NULL);
|
||||||
|
|
||||||
unsigned char buffer[80U];
|
unsigned char buffer[80U];
|
||||||
unsigned char len = 7U + m_fmExtAck.size();
|
unsigned char len = 7U + m_fmExtAck.size();
|
||||||
|
@ -2814,7 +2807,7 @@ bool CMMDVMModem::setFMExtParams()
|
||||||
|
|
||||||
// CUtils::dump(1U, "Written", buffer, len);
|
// CUtils::dump(1U, "Written", buffer, len);
|
||||||
|
|
||||||
int ret = m_serial->write(buffer, len);
|
int ret = m_port->write(buffer, len);
|
||||||
if (ret != len)
|
if (ret != len)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include "Modem.h"
|
#include "Modem.h"
|
||||||
|
|
||||||
#include "SerialPort.h"
|
#include "MMDVMModemPort.h"
|
||||||
#include "RingBuffer.h"
|
#include "RingBuffer.h"
|
||||||
#include "Defines.h"
|
#include "Defines.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
|
@ -44,10 +44,10 @@ enum SERIAL_STATE {
|
||||||
|
|
||||||
class CMMDVMModem : public IModem {
|
class CMMDVMModem : public IModem {
|
||||||
public:
|
public:
|
||||||
CMMDVMModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool useCOSAsLockout, bool trace, bool debug);
|
CMMDVMModem(bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool useCOSAsLockout, bool trace, bool debug);
|
||||||
virtual ~CMMDVMModem();
|
virtual ~CMMDVMModem();
|
||||||
|
|
||||||
virtual void setSerialParams(const std::string& protocol, unsigned int address, unsigned int speed);
|
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 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 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 setLevels(float rxLevel, float cwIdTXLevel, float dstarTXLevel, float dmrTXLevel, float ysfTXLevel, float p25TXLevel, float nxdnTXLevel, float m17TXLevel, float pocsagLevel, float fmTXLevel, float ax25TXLevel);
|
||||||
|
@ -136,7 +136,6 @@ public:
|
||||||
virtual void close();
|
virtual void close();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_port;
|
|
||||||
unsigned int m_protocolVersion;
|
unsigned int m_protocolVersion;
|
||||||
unsigned int m_dmrColorCode;
|
unsigned int m_dmrColorCode;
|
||||||
bool m_ysfLoDev;
|
bool m_ysfLoDev;
|
||||||
|
@ -179,7 +178,7 @@ private:
|
||||||
bool m_ax25Enabled;
|
bool m_ax25Enabled;
|
||||||
int m_rxDCOffset;
|
int m_rxDCOffset;
|
||||||
int m_txDCOffset;
|
int m_txDCOffset;
|
||||||
ISerialPort* m_serial;
|
IMMDVMModemPort* m_port;
|
||||||
unsigned char* m_buffer;
|
unsigned char* m_buffer;
|
||||||
unsigned int m_length;
|
unsigned int m_length;
|
||||||
unsigned int m_offset;
|
unsigned int m_offset;
|
||||||
|
|
23
MMDVMModemPort.cpp
Normal file
23
MMDVMModemPort.cpp
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016,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 "MMDVMModemPort.h"
|
||||||
|
|
||||||
|
IMMDVMModemPort::~IMMDVMModemPort()
|
||||||
|
{
|
||||||
|
}
|
37
MMDVMModemPort.h
Normal file
37
MMDVMModemPort.h
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016,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 MMDVMModemPort_H
|
||||||
|
#define MMDVMModemPort_H
|
||||||
|
|
||||||
|
class IMMDVMModemPort {
|
||||||
|
public:
|
||||||
|
virtual ~IMMDVMModemPort() = 0;
|
||||||
|
|
||||||
|
virtual bool open() = 0;
|
||||||
|
|
||||||
|
virtual int read(unsigned char* buffer, unsigned int length) = 0;
|
||||||
|
|
||||||
|
virtual int write(const unsigned char* buffer, unsigned int length) = 0;
|
||||||
|
|
||||||
|
virtual void close() = 0;
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
10
Makefile
10
Makefile
|
@ -11,11 +11,11 @@ OBJECTS = \
|
||||||
DMRDirectNetwork.o DMREMB.o DMREmbeddedData.o DMRFullLC.o DMRGatewayNetwork.o DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o \
|
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 \
|
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 \
|
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 Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o \
|
MMDVMModem.o MMDVMModemPort.o Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o \
|
||||||
NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o \
|
NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o \
|
||||||
P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o \
|
NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.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 \
|
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 \
|
||||||
UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.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
|
all: MMDVMHost RemoteCommand
|
||||||
|
|
||||||
|
|
10
Makefile.Pi
10
Makefile.Pi
|
@ -11,11 +11,11 @@ OBJECTS = \
|
||||||
DMRDirectNetwork.o DMREMB.o DMREmbeddedData.o DMRFullLC.o DMRGatewayNetwork.o DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o \
|
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 \
|
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 \
|
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 Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o \
|
MMDVMModem.o MMDVMModemPort.o Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o \
|
||||||
NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o \
|
NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o \
|
||||||
P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o \
|
NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.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 \
|
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 \
|
||||||
UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.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
|
all: MMDVMHost RemoteCommand
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,11 @@ OBJECTS = \
|
||||||
DMRDirectNetwork.o DMREMB.o DMREmbeddedData.o DMRFullLC.o DMRGatewayNetwork.o DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o \
|
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 \
|
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 \
|
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 Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.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 \
|
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 \
|
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 \
|
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 UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.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
|
all: MMDVMHost RemoteCommand
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,11 @@ OBJECTS = \
|
||||||
DMRDirectNetwork.o DMREMB.o DMREmbeddedData.o DMRFullLC.o DMRGatewayNetwork.o DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o \
|
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 \
|
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 \
|
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 Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.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 \
|
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 \
|
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 \
|
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 UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.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
|
all: MMDVMHost RemoteCommand
|
||||||
|
|
||||||
|
|
|
@ -15,11 +15,12 @@ OBJECTS = \
|
||||||
DMRDirectNetwork.o DMREMB.o DMREmbeddedData.o DMRFullLC.o DMRGatewayNetwork.o DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o \
|
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 \
|
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 \
|
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 Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o \
|
MMDVMModem.o MMDVMModemPort.o Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o \
|
||||||
NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o OLED.o P25Audio.o \
|
NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o \
|
||||||
P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o \
|
NXDNUDCH.o OLED.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.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 \
|
POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o RSSIInterpolator.o SerialPort.o StopWatch.o Sync.o SHA256.o TFTSurenoo.o \
|
||||||
UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.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
|
all: MMDVMHost RemoteCommand
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,11 @@ OBJECTS = \
|
||||||
DMRDirectNetwork.o DMREMB.o DMREmbeddedData.o DMRFullLC.o DMRGatewayNetwork.o DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o \
|
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 \
|
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 \
|
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 Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.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 \
|
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 \
|
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 \
|
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 UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.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
|
all: MMDVMHost RemoteCommand
|
||||||
|
|
||||||
|
|
5
Modem.h
5
Modem.h
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2011-2018,2020 by Jonathan Naylor G4KLX
|
* Copyright (C) 2011-2018,2020,2021 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -20,6 +20,7 @@
|
||||||
#define MODEM_H
|
#define MODEM_H
|
||||||
|
|
||||||
#include "Defines.h"
|
#include "Defines.h"
|
||||||
|
#include "MMDVMModemPort.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -27,7 +28,7 @@ class IModem {
|
||||||
public:
|
public:
|
||||||
virtual ~IModem() = 0;
|
virtual ~IModem() = 0;
|
||||||
|
|
||||||
virtual void setSerialParams(const std::string& protocol, unsigned int address, unsigned int speed) = 0;
|
virtual void setModem(IMMDVMModemPort* port) = 0;
|
||||||
virtual void setRFParams(unsigned int rxFrequency, int rxOffset, unsigned int txFrequency, int txOffset, int txDCOffset, int rxDCOffset, float rfLevel, unsigned int pocsagFrequency) = 0;
|
virtual void setRFParams(unsigned int rxFrequency, int rxOffset, unsigned int txFrequency, int txOffset, int txDCOffset, int rxDCOffset, float rfLevel, unsigned int pocsagFrequency) = 0;
|
||||||
virtual void setModeParams(bool dstarEnabled, bool dmrEnabled, bool ysfEnabled, bool p25Enabled, bool nxdnEnabled, bool m17ENabled, bool pocsagEnabled, bool fmEnabled, bool ax25Enabled) = 0;
|
virtual void setModeParams(bool dstarEnabled, bool dmrEnabled, bool ysfEnabled, bool p25Enabled, bool nxdnEnabled, bool m17ENabled, bool pocsagEnabled, bool fmEnabled, bool ax25Enabled) = 0;
|
||||||
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) = 0;
|
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) = 0;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2011-2018,2020 by Jonathan Naylor G4KLX
|
* Copyright (C) 2011-2018,2020,2021 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -29,7 +29,7 @@ public:
|
||||||
CNullModem();
|
CNullModem();
|
||||||
virtual ~CNullModem();
|
virtual ~CNullModem();
|
||||||
|
|
||||||
virtual void setSerialParams(const std::string& protocol, unsigned int address, unsigned int speed) {};
|
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 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 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 setLevels(float rxLevel, float cwIdTXLevel, float dstarTXLevel, float dmrTXLevel, float ysfTXLevel, float p25TXLevel, float nxdnTXLevel, float m17TXLevel, float pocsagLevel, float fmTXLevel, float ax25TXLevel) {};
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#ifndef UARTController_H
|
#ifndef UARTController_H
|
||||||
#define UARTController_H
|
#define UARTController_H
|
||||||
|
|
||||||
|
#include "MMDVMModemPort.h"
|
||||||
#include "SerialPort.h"
|
#include "SerialPort.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -28,7 +29,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class CUARTController : public ISerialPort {
|
class CUARTController : public ISerialPort, public IMMDVMModemPort {
|
||||||
public:
|
public:
|
||||||
CUARTController(const std::string& device, unsigned int speed, bool assertRTS = false);
|
CUARTController(const std::string& device, unsigned int speed, bool assertRTS = false);
|
||||||
virtual ~CUARTController();
|
virtual ~CUARTController();
|
||||||
|
|
79
UDPController.cpp
Normal file
79
UDPController.cpp
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
/*
|
||||||
|
* 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 "UDPController.h"
|
||||||
|
#include "Log.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
const unsigned int BUFFER_LENGTH = 600U;
|
||||||
|
|
||||||
|
CUDPController::CUDPController(const std::string& modemAddress, unsigned int modemPort, unsigned int localPort) :
|
||||||
|
m_socket(localPort),
|
||||||
|
m_addr(),
|
||||||
|
m_addrLen(0U),
|
||||||
|
m_buffer(NULL),
|
||||||
|
m_length(0U),
|
||||||
|
m_offset(0U)
|
||||||
|
{
|
||||||
|
assert(!modemAddress.empty());
|
||||||
|
assert(modemPort > 0U);
|
||||||
|
assert(localPort > 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()
|
||||||
|
{
|
||||||
|
if (m_addrLen == 0U) {
|
||||||
|
LogError("Unable to resolve the address of the modem");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_socket.open(m_addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CUDPController::read(unsigned char* buffer, unsigned int length)
|
||||||
|
{
|
||||||
|
assert(buffer != NULL);
|
||||||
|
assert(length > 0U);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CUDPController::write(const unsigned char* buffer, unsigned int length)
|
||||||
|
{
|
||||||
|
assert(buffer != NULL);
|
||||||
|
assert(length > 0U);
|
||||||
|
|
||||||
|
return m_socket.write(buffer, length, m_addr, m_addrLen) ? int(length) : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CUDPController::close()
|
||||||
|
{
|
||||||
|
m_socket.close();
|
||||||
|
}
|
49
UDPController.h
Normal file
49
UDPController.h
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* 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 UDPController_H
|
||||||
|
#define UDPController_H
|
||||||
|
|
||||||
|
#include "MMDVMModemPort.h"
|
||||||
|
#include "UDPSocket.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
class CUDPController : public IMMDVMModemPort {
|
||||||
|
public:
|
||||||
|
CUDPController(const std::string& modemAddress, unsigned int modemPort, unsigned int localPort);
|
||||||
|
virtual ~CUDPController();
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
CUDPSocket m_socket;
|
||||||
|
sockaddr_storage m_addr;
|
||||||
|
unsigned int m_addrLen;
|
||||||
|
unsigned char* m_buffer;
|
||||||
|
unsigned int m_length;
|
||||||
|
unsigned int m_offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in a new issue