Initial changes ready for FCS support.
This commit is contained in:
parent
42bb42380a
commit
c84df3db5e
12 changed files with 130 additions and 130 deletions
|
@ -4,8 +4,8 @@ CFLAGS = -g -O3 -Wall -std=c++0x -pthread
|
|||
LIBS = -lm -lpthread
|
||||
LDFLAGS = -g
|
||||
|
||||
OBJECTS = APRSWriterThread.o APRSWriter.o Conf.o CRC.o DTMF.o Golay24128.o GPS.o Log.o Network.o Reflectors.o StopWatch.o Sync.o TCPSocket.o Thread.o Timer.o \
|
||||
UDPSocket.o Utils.o WiresX.o YSFConvolution.o YSFFICH.o YSFGateway.o YSFPayload.o
|
||||
OBJECTS = APRSWriterThread.o APRSWriter.o Conf.o CRC.o DTMF.o Golay24128.o GPS.o Log.o StopWatch.o Sync.o TCPSocket.o Thread.o Timer.o \
|
||||
UDPSocket.o Utils.o WiresX.o YSFConvolution.o YSFFICH.o YSFGateway.o YSFNetwork.o YSFPayload.o YSFReflectors.o
|
||||
|
||||
all: YSFGateway
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ CFLAGS = -g -O3 -Wall -std=c++0x -pthread
|
|||
LIBS = -lm -lpthread -lsocket
|
||||
LDFLAGS = -g
|
||||
|
||||
OBJECTS = APRSWriterThread.o APRSWriter.o Conf.o CRC.o DTMF.o Golay24128.o GPS.o Log.o Network.o Reflectors.o StopWatch.o Sync.o TCPSocket.o Thread.o Timer.o \
|
||||
UDPSocket.o Utils.o WiresX.o YSFConvolution.o YSFFICH.o YSFGateway.o YSFPayload.o
|
||||
OBJECTS = APRSWriterThread.o APRSWriter.o Conf.o CRC.o DTMF.o Golay24128.o GPS.o Log.o StopWatch.o Sync.o TCPSocket.o Thread.o Timer.o \
|
||||
UDPSocket.o Utils.o WiresX.o YSFConvolution.o YSFFICH.o YSFGateway.o YSFNetwork.o YSFPayload.o YSFReflectors.o
|
||||
|
||||
all: YSFGateway
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2016,2017 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016,2017,2018 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -42,7 +42,7 @@ const unsigned char DEFAULT_FICH[] = {0x20U, 0x00U, 0x01U, 0x00U};
|
|||
|
||||
const unsigned char NET_HEADER[] = "YSFD ALL ";
|
||||
|
||||
CWiresX::CWiresX(const std::string& callsign, const std::string& suffix, CNetwork* network, const std::string& hostsFile, unsigned int reloadTime) :
|
||||
CWiresX::CWiresX(const std::string& callsign, const std::string& suffix, CYSFNetwork* network, const std::string& hostsFile, unsigned int reloadTime) :
|
||||
m_callsign(callsign),
|
||||
m_node(),
|
||||
m_network(network),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2016,2017 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016,2017,2018 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -19,8 +19,8 @@
|
|||
#if !defined(WIRESX_H)
|
||||
#define WIRESX_H
|
||||
|
||||
#include "Reflectors.h"
|
||||
#include "Network.h"
|
||||
#include "YSFReflectors.h"
|
||||
#include "YSFNetwork.h"
|
||||
#include "Timer.h"
|
||||
|
||||
#include <string>
|
||||
|
@ -42,7 +42,7 @@ enum WXSI_STATUS {
|
|||
|
||||
class CWiresX {
|
||||
public:
|
||||
CWiresX(const std::string& callsign, const std::string& suffix, CNetwork* network, const std::string& hostsFile, unsigned int reloadTime);
|
||||
CWiresX(const std::string& callsign, const std::string& suffix, CYSFNetwork* network, const std::string& hostsFile, unsigned int reloadTime);
|
||||
~CWiresX();
|
||||
|
||||
void setInfo(const std::string& name, unsigned int txFrequency, unsigned int rxFrequency);
|
||||
|
@ -64,8 +64,8 @@ public:
|
|||
private:
|
||||
std::string m_callsign;
|
||||
std::string m_node;
|
||||
CNetwork* m_network;
|
||||
CReflectors m_reflectors;
|
||||
CYSFNetwork* m_network;
|
||||
CYSFReflectors m_reflectors;
|
||||
CYSFReflector* m_reflector;
|
||||
std::string m_id;
|
||||
std::string m_name;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2016,2017 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016,2017,2018 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
|
||||
#include "YSFGateway.h"
|
||||
#include "Reflectors.h"
|
||||
#include "YSFReflectors.h"
|
||||
#include "UDPSocket.h"
|
||||
#include "StopWatch.h"
|
||||
#include "Version.h"
|
||||
|
@ -81,7 +81,7 @@ m_conf(configFile),
|
|||
m_gps(NULL),
|
||||
m_wiresX(NULL),
|
||||
m_dtmf(NULL),
|
||||
m_netNetwork(NULL),
|
||||
m_ysfNetwork(NULL),
|
||||
m_linked(false),
|
||||
m_exclude(false)
|
||||
{
|
||||
|
@ -174,7 +174,7 @@ int CYSFGateway::run()
|
|||
std::string myAddress = m_conf.getMyAddress();
|
||||
unsigned int myPort = m_conf.getMyPort();
|
||||
|
||||
CNetwork rptNetwork(myAddress, myPort, m_callsign, debug);
|
||||
CYSFNetwork rptNetwork(myAddress, myPort, m_callsign, debug);
|
||||
rptNetwork.setDestination(rptAddress, rptPort);
|
||||
|
||||
ret = rptNetwork.open();
|
||||
|
@ -186,10 +186,10 @@ int CYSFGateway::run()
|
|||
|
||||
unsigned int netPort = m_conf.getNetworkPort();
|
||||
|
||||
m_netNetwork = new CNetwork(netPort, m_callsign, debug);
|
||||
ret = m_netNetwork->open();
|
||||
m_ysfNetwork = new CYSFNetwork(netPort, m_callsign, debug);
|
||||
ret = m_ysfNetwork->open();
|
||||
if (!ret) {
|
||||
::LogError("Cannot open the reflector network port");
|
||||
::LogError("Cannot open the YSF reflector network port");
|
||||
::LogFinalise();
|
||||
return 1;
|
||||
}
|
||||
|
@ -234,10 +234,10 @@ int CYSFGateway::run()
|
|||
if (reflector != NULL) {
|
||||
LogMessage("Automatic connection to %5.5s - \"%s\"", reflector->m_id.c_str(), reflector->m_name.c_str());
|
||||
|
||||
m_netNetwork->setDestination(reflector->m_address, reflector->m_port);
|
||||
m_netNetwork->writePoll();
|
||||
m_netNetwork->writePoll();
|
||||
m_netNetwork->writePoll();
|
||||
m_ysfNetwork->setDestination(reflector->m_address, reflector->m_port);
|
||||
m_ysfNetwork->writePoll();
|
||||
m_ysfNetwork->writePoll();
|
||||
m_ysfNetwork->writePoll();
|
||||
|
||||
if (!revert)
|
||||
inactivityTimer.start();
|
||||
|
@ -276,17 +276,17 @@ int CYSFGateway::run()
|
|||
WX_STATUS status = m_wiresX->process(buffer + 35U, buffer + 14U, fi, dt, fn, ft);
|
||||
switch (status) {
|
||||
case WXS_CONNECT: {
|
||||
m_netNetwork->writeUnlink();
|
||||
m_netNetwork->writeUnlink();
|
||||
m_netNetwork->writeUnlink();
|
||||
m_ysfNetwork->writeUnlink();
|
||||
m_ysfNetwork->writeUnlink();
|
||||
m_ysfNetwork->writeUnlink();
|
||||
|
||||
CYSFReflector* reflector = m_wiresX->getReflector();
|
||||
LogMessage("Connect to %5.5s - \"%s\" has been requested by %10.10s", reflector->m_id.c_str(), reflector->m_name.c_str(), buffer + 14U);
|
||||
|
||||
m_netNetwork->setDestination(reflector->m_address, reflector->m_port);
|
||||
m_netNetwork->writePoll();
|
||||
m_netNetwork->writePoll();
|
||||
m_netNetwork->writePoll();
|
||||
m_ysfNetwork->setDestination(reflector->m_address, reflector->m_port);
|
||||
m_ysfNetwork->writePoll();
|
||||
m_ysfNetwork->writePoll();
|
||||
m_ysfNetwork->writePoll();
|
||||
|
||||
inactivityTimer.start();
|
||||
lostTimer.start();
|
||||
|
@ -298,10 +298,10 @@ int CYSFGateway::run()
|
|||
case WXS_DISCONNECT:
|
||||
LogMessage("Disconnect has been requested by %10.10s", buffer + 14U);
|
||||
|
||||
m_netNetwork->writeUnlink();
|
||||
m_netNetwork->writeUnlink();
|
||||
m_netNetwork->writeUnlink();
|
||||
m_netNetwork->clearDestination();
|
||||
m_ysfNetwork->writeUnlink();
|
||||
m_ysfNetwork->writeUnlink();
|
||||
m_ysfNetwork->writeUnlink();
|
||||
m_ysfNetwork->clearDestination();
|
||||
|
||||
inactivityTimer.stop();
|
||||
lostTimer.stop();
|
||||
|
@ -330,17 +330,17 @@ int CYSFGateway::run()
|
|||
m_wiresX->processConnect(reflector);
|
||||
|
||||
if (m_linked) {
|
||||
m_netNetwork->writeUnlink();
|
||||
m_netNetwork->writeUnlink();
|
||||
m_netNetwork->writeUnlink();
|
||||
m_ysfNetwork->writeUnlink();
|
||||
m_ysfNetwork->writeUnlink();
|
||||
m_ysfNetwork->writeUnlink();
|
||||
}
|
||||
|
||||
LogMessage("Connect via DTMF to %5.5s - \"%s\" has been requested by %10.10s", reflector->m_id.c_str(), reflector->m_name.c_str(), buffer + 14U);
|
||||
|
||||
m_netNetwork->setDestination(reflector->m_address, reflector->m_port);
|
||||
m_netNetwork->writePoll();
|
||||
m_netNetwork->writePoll();
|
||||
m_netNetwork->writePoll();
|
||||
m_ysfNetwork->setDestination(reflector->m_address, reflector->m_port);
|
||||
m_ysfNetwork->writePoll();
|
||||
m_ysfNetwork->writePoll();
|
||||
m_ysfNetwork->writePoll();
|
||||
|
||||
inactivityTimer.start();
|
||||
lostTimer.start();
|
||||
|
@ -356,10 +356,10 @@ int CYSFGateway::run()
|
|||
|
||||
LogMessage("Disconnect via DTMF has been requested by %10.10s", buffer + 14U);
|
||||
|
||||
m_netNetwork->writeUnlink();
|
||||
m_netNetwork->writeUnlink();
|
||||
m_netNetwork->writeUnlink();
|
||||
m_netNetwork->clearDestination();
|
||||
m_ysfNetwork->writeUnlink();
|
||||
m_ysfNetwork->writeUnlink();
|
||||
m_ysfNetwork->writeUnlink();
|
||||
m_ysfNetwork->clearDestination();
|
||||
|
||||
inactivityTimer.stop();
|
||||
lostTimer.stop();
|
||||
|
@ -378,7 +378,7 @@ int CYSFGateway::run()
|
|||
}
|
||||
|
||||
if (networkEnabled && m_linked && !m_exclude) {
|
||||
m_netNetwork->write(buffer);
|
||||
m_ysfNetwork->write(buffer);
|
||||
if (::memcmp(buffer + 0U, "YSFD", 4U) == 0)
|
||||
inactivityTimer.start();
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ int CYSFGateway::run()
|
|||
}
|
||||
}
|
||||
|
||||
while (m_netNetwork->read(buffer) > 0U) {
|
||||
while (m_ysfNetwork->read(buffer) > 0U) {
|
||||
if (networkEnabled && m_linked) {
|
||||
// Only pass through YSF data packets
|
||||
if (::memcmp(buffer + 0U, "YSFD", 4U) == 0)
|
||||
|
@ -406,7 +406,7 @@ int CYSFGateway::run()
|
|||
stopWatch.start();
|
||||
|
||||
rptNetwork.clock(ms);
|
||||
m_netNetwork->clock(ms);
|
||||
m_ysfNetwork->clock(ms);
|
||||
if (m_gps != NULL)
|
||||
m_gps->clock(ms);
|
||||
if (m_wiresX != NULL)
|
||||
|
@ -424,14 +424,14 @@ int CYSFGateway::run()
|
|||
|
||||
m_wiresX->processConnect(reflector);
|
||||
|
||||
m_netNetwork->writeUnlink();
|
||||
m_netNetwork->writeUnlink();
|
||||
m_netNetwork->writeUnlink();
|
||||
m_ysfNetwork->writeUnlink();
|
||||
m_ysfNetwork->writeUnlink();
|
||||
m_ysfNetwork->writeUnlink();
|
||||
|
||||
m_netNetwork->setDestination(reflector->m_address, reflector->m_port);
|
||||
m_netNetwork->writePoll();
|
||||
m_netNetwork->writePoll();
|
||||
m_netNetwork->writePoll();
|
||||
m_ysfNetwork->setDestination(reflector->m_address, reflector->m_port);
|
||||
m_ysfNetwork->writePoll();
|
||||
m_ysfNetwork->writePoll();
|
||||
m_ysfNetwork->writePoll();
|
||||
|
||||
lostTimer.start();
|
||||
pollTimer.start();
|
||||
|
@ -441,10 +441,10 @@ int CYSFGateway::run()
|
|||
if (m_wiresX != NULL)
|
||||
m_wiresX->processDisconnect();
|
||||
|
||||
m_netNetwork->writeUnlink();
|
||||
m_netNetwork->writeUnlink();
|
||||
m_netNetwork->writeUnlink();
|
||||
m_netNetwork->clearDestination();
|
||||
m_ysfNetwork->writeUnlink();
|
||||
m_ysfNetwork->writeUnlink();
|
||||
m_ysfNetwork->writeUnlink();
|
||||
m_ysfNetwork->clearDestination();
|
||||
|
||||
lostTimer.stop();
|
||||
pollTimer.stop();
|
||||
|
@ -463,7 +463,7 @@ int CYSFGateway::run()
|
|||
if (m_wiresX != NULL)
|
||||
m_wiresX->processDisconnect();
|
||||
|
||||
m_netNetwork->clearDestination();
|
||||
m_ysfNetwork->clearDestination();
|
||||
|
||||
inactivityTimer.stop();
|
||||
lostTimer.stop();
|
||||
|
@ -474,7 +474,7 @@ int CYSFGateway::run()
|
|||
|
||||
pollTimer.clock(ms);
|
||||
if (pollTimer.isRunning() && pollTimer.hasExpired()) {
|
||||
m_netNetwork->writePoll();
|
||||
m_ysfNetwork->writePoll();
|
||||
pollTimer.start();
|
||||
}
|
||||
|
||||
|
@ -483,14 +483,14 @@ int CYSFGateway::run()
|
|||
}
|
||||
|
||||
rptNetwork.close();
|
||||
m_netNetwork->close();
|
||||
m_ysfNetwork->close();
|
||||
|
||||
if (m_gps != NULL) {
|
||||
m_gps->close();
|
||||
delete m_gps;
|
||||
}
|
||||
|
||||
delete m_netNetwork;
|
||||
delete m_ysfNetwork;
|
||||
delete m_wiresX;
|
||||
delete m_dtmf;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2016,2017 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016,2017,2018 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -19,7 +19,7 @@
|
|||
#if !defined(YSFGateway_H)
|
||||
#define YSFGateway_H
|
||||
|
||||
#include "Network.h"
|
||||
#include "YSFNetwork.h"
|
||||
#include "WiresX.h"
|
||||
#include "Conf.h"
|
||||
#include "DTMF.h"
|
||||
|
@ -36,15 +36,15 @@ public:
|
|||
int run();
|
||||
|
||||
private:
|
||||
std::string m_callsign;
|
||||
std::string m_suffix;
|
||||
CConf m_conf;
|
||||
CGPS* m_gps;
|
||||
CWiresX* m_wiresX;
|
||||
CDTMF* m_dtmf;
|
||||
CNetwork* m_netNetwork;
|
||||
bool m_linked;
|
||||
bool m_exclude;
|
||||
std::string m_callsign;
|
||||
std::string m_suffix;
|
||||
CConf m_conf;
|
||||
CGPS* m_gps;
|
||||
CWiresX* m_wiresX;
|
||||
CDTMF* m_dtmf;
|
||||
CYSFNetwork* m_ysfNetwork;
|
||||
bool m_linked;
|
||||
bool m_exclude;
|
||||
|
||||
void createGPS();
|
||||
};
|
||||
|
|
|
@ -154,8 +154,6 @@
|
|||
<ClInclude Include="Golay24128.h" />
|
||||
<ClInclude Include="GPS.h" />
|
||||
<ClInclude Include="Log.h" />
|
||||
<ClInclude Include="Network.h" />
|
||||
<ClInclude Include="Reflectors.h" />
|
||||
<ClInclude Include="RingBuffer.h" />
|
||||
<ClInclude Include="StopWatch.h" />
|
||||
<ClInclude Include="Sync.h" />
|
||||
|
@ -170,7 +168,9 @@
|
|||
<ClInclude Include="YSFDefines.h" />
|
||||
<ClInclude Include="YSFFICH.h" />
|
||||
<ClInclude Include="YSFGateway.h" />
|
||||
<ClInclude Include="YSFNetwork.h" />
|
||||
<ClInclude Include="YSFPayload.h" />
|
||||
<ClInclude Include="YSFReflectors.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="APRSWriter.cpp" />
|
||||
|
@ -181,8 +181,6 @@
|
|||
<ClCompile Include="Golay24128.cpp" />
|
||||
<ClCompile Include="GPS.cpp" />
|
||||
<ClCompile Include="Log.cpp" />
|
||||
<ClCompile Include="Network.cpp" />
|
||||
<ClCompile Include="Reflectors.cpp" />
|
||||
<ClCompile Include="StopWatch.cpp" />
|
||||
<ClCompile Include="Sync.cpp" />
|
||||
<ClCompile Include="TCPSocket.cpp" />
|
||||
|
@ -194,7 +192,9 @@
|
|||
<ClCompile Include="YSFConvolution.cpp" />
|
||||
<ClCompile Include="YSFFICH.cpp" />
|
||||
<ClCompile Include="YSFGateway.cpp" />
|
||||
<ClCompile Include="YSFNetwork.cpp" />
|
||||
<ClCompile Include="YSFPayload.cpp" />
|
||||
<ClCompile Include="YSFReflectors.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
|
|
@ -11,9 +11,6 @@
|
|||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Network.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RingBuffer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -74,9 +71,6 @@
|
|||
<ClInclude Include="Sync.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Reflectors.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Utils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -86,11 +80,14 @@
|
|||
<ClInclude Include="DTMF.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="YSFNetwork.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="YSFReflectors.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Network.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StopWatch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -142,9 +139,6 @@
|
|||
<ClCompile Include="Sync.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Reflectors.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Utils.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -154,5 +148,11 @@
|
|||
<ClCompile Include="DTMF.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="YSFNetwork.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="YSFReflectors.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2014,2016,2017 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2009-2014,2016,2017,2018 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
|
||||
#include "YSFDefines.h"
|
||||
#include "Network.h"
|
||||
#include "YSFNetwork.h"
|
||||
#include "Utils.h"
|
||||
#include "Log.h"
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
|||
|
||||
const unsigned int BUFFER_LENGTH = 200U;
|
||||
|
||||
CNetwork::CNetwork(const std::string& address, unsigned int port, const std::string& callsign, bool debug) :
|
||||
CYSFNetwork::CYSFNetwork(const std::string& address, unsigned int port, const std::string& callsign, bool debug) :
|
||||
m_socket(address, port),
|
||||
m_debug(debug),
|
||||
m_address(),
|
||||
|
@ -51,7 +51,7 @@ m_buffer(1000U, "YSF Network Buffer")
|
|||
}
|
||||
}
|
||||
|
||||
CNetwork::CNetwork(unsigned int port, const std::string& callsign, bool debug) :
|
||||
CYSFNetwork::CYSFNetwork(unsigned int port, const std::string& callsign, bool debug) :
|
||||
m_socket(port),
|
||||
m_debug(debug),
|
||||
m_address(),
|
||||
|
@ -75,31 +75,31 @@ m_buffer(1000U, "YSF Network Buffer")
|
|||
}
|
||||
}
|
||||
|
||||
CNetwork::~CNetwork()
|
||||
CYSFNetwork::~CYSFNetwork()
|
||||
{
|
||||
delete[] m_poll;
|
||||
}
|
||||
|
||||
bool CNetwork::open()
|
||||
bool CYSFNetwork::open()
|
||||
{
|
||||
LogMessage("Opening YSF network connection");
|
||||
|
||||
return m_socket.open();
|
||||
}
|
||||
|
||||
void CNetwork::setDestination(const in_addr& address, unsigned int port)
|
||||
void CYSFNetwork::setDestination(const in_addr& address, unsigned int port)
|
||||
{
|
||||
m_address = address;
|
||||
m_port = port;
|
||||
}
|
||||
|
||||
void CNetwork::clearDestination()
|
||||
void CYSFNetwork::clearDestination()
|
||||
{
|
||||
m_address.s_addr = INADDR_NONE;
|
||||
m_port = 0U;
|
||||
}
|
||||
|
||||
bool CNetwork::write(const unsigned char* data)
|
||||
bool CYSFNetwork::write(const unsigned char* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
|
@ -112,7 +112,7 @@ bool CNetwork::write(const unsigned char* data)
|
|||
return m_socket.write(data, 155U, m_address, m_port);
|
||||
}
|
||||
|
||||
bool CNetwork::writePoll()
|
||||
bool CYSFNetwork::writePoll()
|
||||
{
|
||||
if (m_port == 0U)
|
||||
return true;
|
||||
|
@ -120,7 +120,7 @@ bool CNetwork::writePoll()
|
|||
return m_socket.write(m_poll, 14U, m_address, m_port);
|
||||
}
|
||||
|
||||
bool CNetwork::writeUnlink()
|
||||
bool CYSFNetwork::writeUnlink()
|
||||
{
|
||||
if (m_port == 0U)
|
||||
return true;
|
||||
|
@ -128,7 +128,7 @@ bool CNetwork::writeUnlink()
|
|||
return m_socket.write(m_unlink, 14U, m_address, m_port);
|
||||
}
|
||||
|
||||
void CNetwork::clock(unsigned int ms)
|
||||
void CYSFNetwork::clock(unsigned int ms)
|
||||
{
|
||||
if (m_port == 0U)
|
||||
return;
|
||||
|
@ -153,7 +153,7 @@ void CNetwork::clock(unsigned int ms)
|
|||
m_buffer.addData(buffer, length);
|
||||
}
|
||||
|
||||
unsigned int CNetwork::read(unsigned char* data)
|
||||
unsigned int CYSFNetwork::read(unsigned char* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
|
@ -168,7 +168,7 @@ unsigned int CNetwork::read(unsigned char* data)
|
|||
return len;
|
||||
}
|
||||
|
||||
void CNetwork::close()
|
||||
void CYSFNetwork::close()
|
||||
{
|
||||
m_socket.close();
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2014,2016,2017 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2009-2014,2016,2017,2018 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -16,8 +16,8 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef Network_H
|
||||
#define Network_H
|
||||
#ifndef YSFNetwork_H
|
||||
#define YSFNetwork_H
|
||||
|
||||
#include "YSFDefines.h"
|
||||
#include "UDPSocket.h"
|
||||
|
@ -26,11 +26,11 @@
|
|||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
class CNetwork {
|
||||
class CYSFNetwork {
|
||||
public:
|
||||
CNetwork(const std::string& address, unsigned int port, const std::string& callsign, bool debug);
|
||||
CNetwork(unsigned int port, const std::string& callsign, bool debug);
|
||||
~CNetwork();
|
||||
CYSFNetwork(const std::string& address, unsigned int port, const std::string& callsign, bool debug);
|
||||
CYSFNetwork(unsigned int port, const std::string& callsign, bool debug);
|
||||
~CYSFNetwork();
|
||||
|
||||
bool open();
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2016,2017 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016,2017,2018 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "Reflectors.h"
|
||||
#include "YSFReflectors.h"
|
||||
#include "Log.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -26,7 +26,7 @@
|
|||
#include <cstring>
|
||||
#include <cctype>
|
||||
|
||||
CReflectors::CReflectors(const std::string& hostsFile, unsigned int reloadTime) :
|
||||
CYSFReflectors::CYSFReflectors(const std::string& hostsFile, unsigned int reloadTime) :
|
||||
m_hostsFile(hostsFile),
|
||||
m_parrotAddress(),
|
||||
m_parrotPort(0U),
|
||||
|
@ -39,7 +39,7 @@ m_timer(1000U, reloadTime * 60U)
|
|||
m_timer.start();
|
||||
}
|
||||
|
||||
CReflectors::~CReflectors()
|
||||
CYSFReflectors::~CYSFReflectors()
|
||||
{
|
||||
for (std::vector<CYSFReflector*>::iterator it = m_newReflectors.begin(); it != m_newReflectors.end(); ++it)
|
||||
delete *it;
|
||||
|
@ -68,19 +68,19 @@ static bool refComparison(const CYSFReflector* r1, const CYSFReflector* r2)
|
|||
return false;
|
||||
}
|
||||
|
||||
void CReflectors::setParrot(const std::string& address, unsigned int port)
|
||||
void CYSFReflectors::setParrot(const std::string& address, unsigned int port)
|
||||
{
|
||||
m_parrotAddress = address;
|
||||
m_parrotPort = port;
|
||||
}
|
||||
|
||||
void CReflectors::setYSF2DMR(const std::string& address, unsigned int port)
|
||||
void CYSFReflectors::setYSF2DMR(const std::string& address, unsigned int port)
|
||||
{
|
||||
m_YSF2DMRAddress = address;
|
||||
m_YSF2DMRPort = port;
|
||||
}
|
||||
|
||||
bool CReflectors::load()
|
||||
bool CYSFReflectors::load()
|
||||
{
|
||||
for (std::vector<CYSFReflector*>::iterator it = m_newReflectors.begin(); it != m_newReflectors.end(); ++it)
|
||||
delete *it;
|
||||
|
@ -163,24 +163,24 @@ bool CReflectors::load()
|
|||
return true;
|
||||
}
|
||||
|
||||
CYSFReflector* CReflectors::find(const std::string& id)
|
||||
CYSFReflector* CYSFReflectors::find(const std::string& id)
|
||||
{
|
||||
for (std::vector<CYSFReflector*>::iterator it = m_currReflectors.begin(); it != m_currReflectors.end(); ++it) {
|
||||
if (id == (*it)->m_id)
|
||||
return *it;
|
||||
}
|
||||
|
||||
LogMessage("Trying to find non existent reflector with an id of %s", id.c_str());
|
||||
LogMessage("Trying to find non existent YSF reflector with an id of %s", id.c_str());
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::vector<CYSFReflector*>& CReflectors::current()
|
||||
std::vector<CYSFReflector*>& CYSFReflectors::current()
|
||||
{
|
||||
return m_currReflectors;
|
||||
}
|
||||
|
||||
std::vector<CYSFReflector*>& CReflectors::search(const std::string& name)
|
||||
std::vector<CYSFReflector*>& CYSFReflectors::search(const std::string& name)
|
||||
{
|
||||
m_search.clear();
|
||||
|
||||
|
@ -204,7 +204,7 @@ std::vector<CYSFReflector*>& CReflectors::search(const std::string& name)
|
|||
return m_search;
|
||||
}
|
||||
|
||||
bool CReflectors::reload()
|
||||
bool CYSFReflectors::reload()
|
||||
{
|
||||
if (m_newReflectors.empty())
|
||||
return false;
|
||||
|
@ -221,7 +221,7 @@ bool CReflectors::reload()
|
|||
return true;
|
||||
}
|
||||
|
||||
void CReflectors::clock(unsigned int ms)
|
||||
void CYSFReflectors::clock(unsigned int ms)
|
||||
{
|
||||
m_timer.clock(ms);
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2016,2017 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016,2017,2018 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -16,8 +16,8 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#if !defined(Reflectors_H)
|
||||
#define Reflectors_H
|
||||
#if !defined(YSFReflectors_H)
|
||||
#define YSFReflectors_H
|
||||
|
||||
#include "UDPSocket.h"
|
||||
#include "Timer.h"
|
||||
|
@ -45,10 +45,10 @@ public:
|
|||
unsigned int m_port;
|
||||
};
|
||||
|
||||
class CReflectors {
|
||||
class CYSFReflectors {
|
||||
public:
|
||||
CReflectors(const std::string& hostsFile, unsigned int reloadTime);
|
||||
~CReflectors();
|
||||
CYSFReflectors(const std::string& hostsFile, unsigned int reloadTime);
|
||||
~CYSFReflectors();
|
||||
|
||||
void setParrot(const std::string& address, unsigned int port);
|
||||
void setYSF2DMR(const std::string& address, unsigned int port);
|
Loading…
Reference in a new issue