Renaame classes SGS -> SGSXL

feature/IndividualCalls
Geoffrey Merck 6 years ago
parent ba35bb1fce
commit 0640072cf0

@ -23,8 +23,8 @@
#include <string>
#include <iostream>
#include "SGSConfig.h"
#include "SGSApp.h"
#include "SGSXLConfig.h"
#include "SGSXLApp.h"
#include "Version.h"
#include "IRCDDBMultiClient.h"
#include "IRCDDBClient.h"
@ -49,7 +49,7 @@ int main(int argc, char *argv[])
std::string cfgFile(argv[1]);
CSGSApp gateway(cfgFile);
CSGSXLApp gateway(cfgFile);
if (!gateway.init()) {
return 1;
@ -60,34 +60,34 @@ int main(int argc, char *argv[])
return 0;
}
CSGSApp::CSGSApp(const std::string &configFile) : m_configFile(configFile), m_thread(NULL)
CSGSXLApp::CSGSXLApp(const std::string &configFile) : m_configFile(configFile), m_thread(NULL)
{
}
CSGSApp::~CSGSApp()
CSGSXLApp::~CSGSXLApp()
{
}
bool CSGSApp::init()
bool CSGSXLApp::init()
{
return createThread();
}
void CSGSApp::run()
void CSGSXLApp::run()
{
m_thread->run();
printf("exiting\n");
}
bool CSGSApp::createThread()
bool CSGSXLApp::createThread()
{
printf("\nSmart Group Server Version %s (GitID #%.7s) Copyright (C) %s\n", VERSION.c_str(), gitversion, VENDOR_NAME.c_str());
printf("Smart Group Server comes with ABSOLUTELY NO WARRANTY; see the LICENSE for details.\n");
printf("This is free software, and you are welcome to distribute it\nunder certain conditions that are discussed in the LICENSE file.\n\n");
CSGSConfig config(m_configFile);
m_thread = new CSGSThread(config.getLinkCount("XRF"), config.getLinkCount("DCS"));
CSGSXLConfig config(m_configFile);
m_thread = new CSGSXLThread(config.getLinkCount("XRF"), config.getLinkCount("DCS"));
std::string CallSign, address;
config.getGateway(CallSign, address);

@ -19,18 +19,18 @@
#pragma once
#include "SGSThread.h"
#include "SGSXLThread.h"
class CSGSApp
class CSGSXLApp
{
private:
std::string m_configFile;
CSGSThread *m_thread;
CSGSXLThread *m_thread;
bool createThread();
public:
CSGSApp(const std::string &configFile);
~CSGSApp();
CSGSXLApp(const std::string &configFile);
~CSGSXLApp();
bool init();
void run();

@ -22,10 +22,10 @@
#include <iostream>
#include "Utils.h"
#include "SGSConfig.h"
#include "SGSXLConfig.h"
CSGSConfig::CSGSConfig(const std::string &pathname)
CSGSXLConfig::CSGSXLConfig(const std::string &pathname)
{
if (pathname.size() < 1) {
@ -217,7 +217,7 @@ CSGSConfig::CSGSConfig(const std::string &pathname)
}
}
CSGSConfig::~CSGSConfig()
CSGSXLConfig::~CSGSXLConfig()
{
while (m_module.size()) {
delete m_module.back();
@ -230,17 +230,17 @@ CSGSConfig::~CSGSConfig()
}
}
unsigned int CSGSConfig::getModCount()
unsigned int CSGSXLConfig::getModCount()
{
return m_module.size();
}
unsigned int CSGSConfig::getIrcDDBCount()
unsigned int CSGSXLConfig::getIrcDDBCount()
{
return m_ircDDB.size();
}
unsigned int CSGSConfig::getLinkCount(const char *type)
unsigned int CSGSXLConfig::getLinkCount(const char *type)
{
unsigned int count = 0;
for (unsigned int i=0; i<getModCount(); i++)
@ -249,7 +249,7 @@ unsigned int CSGSConfig::getLinkCount(const char *type)
return count;
}
bool CSGSConfig::get_value(const Config &cfg, const std::string &path, int &value, int min, int max, int default_value)
bool CSGSXLConfig::get_value(const Config &cfg, const std::string &path, int &value, int min, int max, int default_value)
{
if (cfg.lookupValue(path, value)) {
if (value < min || value > max)
@ -259,14 +259,14 @@ bool CSGSConfig::get_value(const Config &cfg, const std::string &path, int &valu
return true;
}
bool CSGSConfig::get_value(const Config &cfg, const std::string &path, bool &value, bool default_value)
bool CSGSXLConfig::get_value(const Config &cfg, const std::string &path, bool &value, bool default_value)
{
if (! cfg.lookupValue(path, value))
value = default_value;
return true;
}
bool CSGSConfig::get_value(const Config &cfg, const std::string &path, std::string &value, int min, int max, const std::string &default_value)
bool CSGSXLConfig::get_value(const Config &cfg, const std::string &path, std::string &value, int min, int max, const std::string &default_value)
{
if (cfg.lookupValue(path, value)) {
int l = value.length();
@ -279,13 +279,13 @@ bool CSGSConfig::get_value(const Config &cfg, const std::string &path, std::stri
return true;
}
void CSGSConfig::getGateway(std::string& callsign, std::string& address) const
void CSGSXLConfig::getGateway(std::string& callsign, std::string& address) const
{
callsign = m_callsign;
address = m_address;
}
void CSGSConfig::getIrcDDB(unsigned int ircddb, std::string& hostname, std::string& username, std::string& password, bool &isQuadNet) const
void CSGSXLConfig::getIrcDDB(unsigned int ircddb, std::string& hostname, std::string& username, std::string& password, bool &isQuadNet) const
{
hostname = m_ircDDB[ircddb]->hostname;
username = m_ircDDB[ircddb]->username;
@ -293,7 +293,7 @@ void CSGSConfig::getIrcDDB(unsigned int ircddb, std::string& hostname, std::stri
isQuadNet = m_ircDDB[ircddb]->isQuadNet;
}
void CSGSConfig::getGroup(unsigned int mod, std::string& band, std::string& callsign, std::string& logoff, std::string& info, std::string& permanent, unsigned int& userTimeout, CALLSIGN_SWITCH& callsignSwitch, bool& txMsgSwitch, std::string& reflector) const
void CSGSXLConfig::getGroup(unsigned int mod, std::string& band, std::string& callsign, std::string& logoff, std::string& info, std::string& permanent, unsigned int& userTimeout, CALLSIGN_SWITCH& callsignSwitch, bool& txMsgSwitch, std::string& reflector) const
{
band = m_module[mod]->band;
callsign = m_module[mod]->callsign;
@ -306,7 +306,7 @@ void CSGSConfig::getGroup(unsigned int mod, std::string& band, std::string& call
reflector = m_module[mod]->reflector;
}
void CSGSConfig::getRemote(bool& enabled, std::string& password, unsigned int& port) const
void CSGSXLConfig::getRemote(bool& enabled, std::string& password, unsigned int& port) const
{
enabled = m_remoteEnabled;
password = m_remotePassword;

@ -43,10 +43,10 @@ struct SircDDB {
bool isQuadNet;
};
class CSGSConfig {
class CSGSXLConfig {
public:
CSGSConfig(const std::string &pathname);
~CSGSConfig();
CSGSXLConfig(const std::string &pathname);
~CSGSXLConfig();
void getGateway(std::string &callsign, std::string &address) const;

@ -28,7 +28,7 @@
#include <cstring>
#include <cassert>
#include "SGSThread.h"
#include "SGSXLThread.h"
#include "GroupHandler.h"
#include "DExtraHandler.h" // DEXTRA LINK
#include "DCSHandler.h" // DCS LINK
@ -39,7 +39,7 @@
const unsigned int REMOTE_DUMMY_PORT = 65015U;
CSGSThread::CSGSThread(unsigned int countDExtra, unsigned int countDCS) :
CSGSXLThread::CSGSXLThread(unsigned int countDExtra, unsigned int countDCS) :
m_countDExtra(countDExtra),
m_countDCS(countDCS),
m_killed(false),
@ -62,7 +62,7 @@ m_remote(NULL)
printf("SGSThread created. DExtra channels: %d, DCS Channels: %d\n", countDExtra, countDCS);
}
CSGSThread::~CSGSThread()
CSGSXLThread::~CSGSXLThread()
{
CHeaderData::finalise();
CG2Handler::finalise();
@ -73,7 +73,7 @@ CSGSThread::~CSGSThread()
printf("SGSThread destroyed\n");
}
void CSGSThread::run()
void CSGSXLThread::run()
{
m_g2Handler = new CG2ProtocolHandler(G2_DV_PORT, m_address);
bool ret = m_g2Handler->open();
@ -180,12 +180,12 @@ void CSGSThread::run()
}
}
void CSGSThread::kill()
void CSGSXLThread::kill()
{
m_killed = true;
}
void CSGSThread::setCallsign(const std::string& callsign)
void CSGSXLThread::setCallsign(const std::string& callsign)
{
if (!m_stopped)
return;
@ -193,24 +193,24 @@ void CSGSThread::setCallsign(const std::string& callsign)
m_callsign = callsign;
}
void CSGSThread::setAddress(const std::string& address)
void CSGSXLThread::setAddress(const std::string& address)
{
m_address = address;
}
void CSGSThread::addGroup(const std::string& callsign, const std::string& logoff, const std::string& repeater, const std::string& infoText, const std::string& permanent, unsigned int userTimeout, CALLSIGN_SWITCH callsignSwitch, bool txMsgSwitch, const std::string& reflector)
void CSGSXLThread::addGroup(const std::string& callsign, const std::string& logoff, const std::string& repeater, const std::string& infoText, const std::string& permanent, unsigned int userTimeout, CALLSIGN_SWITCH callsignSwitch, bool txMsgSwitch, const std::string& reflector)
{
CGroupHandler::add(callsign, logoff, repeater, infoText, permanent, userTimeout, callsignSwitch, txMsgSwitch, reflector);
}
void CSGSThread::setIRC(CIRCDDB* irc)
void CSGSXLThread::setIRC(CIRCDDB* irc)
{
assert(irc != NULL);
m_irc = irc;
}
void CSGSThread::setRemote(bool enabled, const std::string& password, unsigned int port)
void CSGSXLThread::setRemote(bool enabled, const std::string& password, unsigned int port)
{
if (enabled) {
m_remoteEnabled = true;
@ -223,7 +223,7 @@ void CSGSThread::setRemote(bool enabled, const std::string& password, unsigned i
}
}
void CSGSThread::processIrcDDB()
void CSGSXLThread::processIrcDDB()
{
// Once per second
if (m_statusTimer.hasExpired()) {
@ -313,7 +313,7 @@ void CSGSThread::processIrcDDB()
}
}
void CSGSThread::processDExtra(CDExtraProtocolHandlerPool *dextraPool)
void CSGSXLThread::processDExtra(CDExtraProtocolHandlerPool *dextraPool)
{
for (;;) {
DEXTRA_TYPE type = dextraPool->read();
@ -362,7 +362,7 @@ void CSGSThread::processDExtra(CDExtraProtocolHandlerPool *dextraPool)
}
}
void CSGSThread::processDCS(CDCSProtocolHandlerPool *dcsPool)
void CSGSXLThread::processDCS(CDCSProtocolHandlerPool *dcsPool)
{
for (;;) {
DCS_TYPE type = dcsPool->read();
@ -402,7 +402,7 @@ void CSGSThread::processDCS(CDCSProtocolHandlerPool *dcsPool)
}
}
void CSGSThread::processG2()
void CSGSXLThread::processG2()
{
for (;;) {
G2_TYPE type = m_g2Handler->read();
@ -433,7 +433,7 @@ void CSGSThread::processG2()
}
}
void CSGSThread::loadReflectors(const std::string fname, DSTAR_PROTOCOL dstarProtocol)
void CSGSXLThread::loadReflectors(const std::string fname, DSTAR_PROTOCOL dstarProtocol)
{
std::string filepath(CFG_DIR);
filepath += std::string("/") + fname;

@ -30,10 +30,10 @@
#include "Timer.h"
#include "Defs.h"
class CSGSThread {
class CSGSXLThread {
public:
CSGSThread(unsigned int countDExtra, unsigned int countDCS);
virtual ~CSGSThread();
CSGSXLThread(unsigned int countDExtra, unsigned int countDCS);
virtual ~CSGSXLThread();
virtual void setCallsign(const std::string& callsign);
virtual void setAddress(const std::string& address);
Loading…
Cancel
Save

Powered by TurnKey Linux.