Updates to support the YSF Reflector.

This commit is contained in:
Jonathan Naylor 2016-06-07 21:17:57 +01:00
parent 1ef55c46e2
commit 5a2c569887
6 changed files with 53 additions and 27 deletions

View file

@ -107,8 +107,10 @@ m_dmrNetworkDebug(false),
m_dmrNetworkSlot1(true),
m_dmrNetworkSlot2(true),
m_fusionNetworkEnabled(false),
m_fusionNetworkAddress(),
m_fusionNetworkPort(0U),
m_fusionNetworkMyAddress(),
m_fusionNetworkMyPort(0U),
m_fusionNetworkGwyAddress(),
m_fusionNetworkGwyPort(0U),
m_fusionNetworkDebug(false),
m_tftSerialPort("/dev/ttyAMA0"),
m_tftSerialBrightness(50U),
@ -350,10 +352,14 @@ bool CConf::read()
} else if (section == SECTION_FUSION_NETWORK) {
if (::strcmp(key, "Enable") == 0)
m_fusionNetworkEnabled = ::atoi(value) == 1;
else if (::strcmp(key, "Address") == 0)
m_fusionNetworkAddress = value;
else if (::strcmp(key, "Port") == 0)
m_fusionNetworkPort = (unsigned int)::atoi(value);
else if (::strcmp(key, "MyAddress") == 0)
m_fusionNetworkMyAddress = value;
else if (::strcmp(key, "MyPort") == 0)
m_fusionNetworkMyPort = (unsigned int)::atoi(value);
else if (::strcmp(key, "GwyAddress") == 0)
m_fusionNetworkGwyAddress = value;
else if (::strcmp(key, "GwyPort") == 0)
m_fusionNetworkGwyPort = (unsigned int)::atoi(value);
else if (::strcmp(key, "Debug") == 0)
m_fusionNetworkDebug = ::atoi(value) == 1;
} else if (section == SECTION_TFTSERIAL) {
@ -706,14 +712,24 @@ bool CConf::getFusionNetworkEnabled() const
return m_fusionNetworkEnabled;
}
std::string CConf::getFusionNetworkAddress() const
std::string CConf::getFusionNetworkMyAddress() const
{
return m_fusionNetworkAddress;
return m_fusionNetworkMyAddress;
}
unsigned int CConf::getFusionNetworkPort() const
unsigned int CConf::getFusionNetworkMyPort() const
{
return m_fusionNetworkPort;
return m_fusionNetworkMyPort;
}
std::string CConf::getFusionNetworkGwyAddress() const
{
return m_fusionNetworkGwyAddress;
}
unsigned int CConf::getFusionNetworkGwyPort() const
{
return m_fusionNetworkGwyPort;
}
bool CConf::getFusionNetworkDebug() const

12
Conf.h
View file

@ -110,8 +110,10 @@ public:
// The System Fusion Network section
bool getFusionNetworkEnabled() const;
std::string getFusionNetworkAddress() const;
unsigned int getFusionNetworkPort() const;
std::string getFusionNetworkMyAddress() const;
unsigned int getFusionNetworkMyPort() const;
std::string getFusionNetworkGwyAddress() const;
unsigned int getFusionNetworkGwyPort() const;
bool getFusionNetworkDebug() const;
// The TFTSERIAL section
@ -211,8 +213,10 @@ private:
bool m_dmrNetworkSlot2;
bool m_fusionNetworkEnabled;
std::string m_fusionNetworkAddress;
unsigned int m_fusionNetworkPort;
std::string m_fusionNetworkMyAddress;
unsigned int m_fusionNetworkMyPort;
std::string m_fusionNetworkGwyAddress;
unsigned int m_fusionNetworkGwyPort;
bool m_fusionNetworkDebug;
std::string m_tftSerialPort;

View file

@ -78,8 +78,10 @@ Debug=0
[System Fusion Network]
Enable=1
Address=c4fm.duckdns.org
Port=42000
MyAddress=127.0.0.1
MyPort=3200
GwyAddress=c4fm.duckdns.org
GwyPort=4200
Debug=0
[TFT Serial]

View file

@ -737,15 +737,19 @@ bool CMMDVMHost::createDMRNetwork()
bool CMMDVMHost::createYSFNetwork()
{
std::string address = m_conf.getFusionNetworkAddress();
unsigned int port = m_conf.getFusionNetworkPort();
bool debug = m_conf.getFusionNetworkDebug();
std::string myAddress = m_conf.getFusionNetworkMyAddress();
unsigned int myPort = m_conf.getFusionNetworkMyPort();
std::string gwyAddress = m_conf.getFusionNetworkGwyAddress();
unsigned int gwyPort = m_conf.getFusionNetworkGwyPort();
bool debug = m_conf.getFusionNetworkDebug();
LogInfo("System Fusion Network Parameters");
LogInfo(" Reflector Address: %s", address.c_str());
LogInfo(" Reflector Port: %u", port);
LogInfo(" Local Address: %s", myAddress.c_str());
LogInfo(" Local Port: %u", myPort);
LogInfo(" Gateway Address: %s", gwyAddress.c_str());
LogInfo(" Gateway Port: %u", gwyPort);
m_ysfNetwork = new CYSFNetwork(address, port, m_callsign, debug);
m_ysfNetwork = new CYSFNetwork(myAddress, myPort, gwyAddress, gwyPort, m_callsign, debug);
bool ret = m_ysfNetwork->open();
if (!ret) {

View file

@ -28,10 +28,10 @@
const unsigned int BUFFER_LENGTH = 200U;
CYSFNetwork::CYSFNetwork(const std::string& address, unsigned int port, const std::string& callsign, bool debug) :
m_socket(),
CYSFNetwork::CYSFNetwork(const std::string& myAddress, unsigned int myPort, const std::string& gwyAddress, unsigned int gwyPort, const std::string& callsign, bool debug) :
m_socket(myAddress, myPort),
m_address(),
m_port(port),
m_port(gwyPort),
m_callsign(),
m_debug(debug),
m_enabled(false),
@ -42,7 +42,7 @@ m_tag(NULL)
m_callsign = callsign;
m_callsign.resize(YSF_CALLSIGN_LENGTH, ' ');
m_address = CUDPSocket::lookup(address);
m_address = CUDPSocket::lookup(gwyAddress);
m_tag = new unsigned char[YSF_CALLSIGN_LENGTH];
::memset(m_tag, ' ', YSF_CALLSIGN_LENGTH);

View file

@ -29,7 +29,7 @@
class CYSFNetwork {
public:
CYSFNetwork(const std::string& address, unsigned int port, const std::string& callsign, bool debug);
CYSFNetwork(const std::string& myAddress, unsigned int myPort, const std::string& gwyAddress, unsigned int gwyPort, const std::string& callsign, bool debug);
~CYSFNetwork();
bool open();