DMRGateway/Conf.h

260 lines
7.8 KiB
C
Raw Normal View History

2017-04-20 21:51:30 +02:00
/*
2020-04-01 23:22:12 +02:00
* Copyright (C) 2015,2016,2017,2019,2020 by Jonathan Naylor G4KLX
2017-04-20 21:51:30 +02:00
*
* 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.
*/
#if !defined(CONF_H)
#define CONF_H
#include <string>
#include <vector>
2017-05-14 19:14:09 +02:00
struct CTGRewriteStruct {
unsigned int m_fromSlot;
unsigned int m_fromTG;
unsigned int m_toSlot;
unsigned int m_toTG;
2017-05-15 22:16:52 +02:00
unsigned int m_range;
};
2017-05-14 19:14:09 +02:00
struct CPCRewriteStruct {
unsigned int m_fromSlot;
unsigned int m_fromId;
unsigned int m_toSlot;
unsigned int m_toId;
unsigned int m_range;
};
2017-05-15 22:16:52 +02:00
struct CTypeRewriteStruct {
unsigned int m_fromSlot;
2017-05-24 18:46:07 +02:00
unsigned int m_fromTG;
2017-05-15 22:16:52 +02:00
unsigned int m_toSlot;
2017-05-24 18:46:07 +02:00
unsigned int m_toId;
2020-04-08 09:21:35 +02:00
unsigned int m_range;
2017-05-15 22:16:52 +02:00
};
struct CSrcRewriteStruct {
unsigned int m_fromSlot;
unsigned int m_fromId;
unsigned int m_toSlot;
unsigned int m_toTG;
unsigned int m_range;
2017-05-15 22:16:52 +02:00
};
2020-04-01 23:22:12 +02:00
struct CTGDynRewriteStruct {
unsigned int m_slot;
unsigned int m_fromTG;
unsigned int m_discPC;
unsigned int m_statusPC;
2020-04-01 23:22:12 +02:00
unsigned int m_toTG;
unsigned int m_range;
2020-04-08 00:03:27 +02:00
std::vector<unsigned int> m_exclTGs;
2020-04-01 23:22:12 +02:00
};
struct CIdRewriteStruct {
unsigned int m_rfId;
unsigned int m_netId;
};
2025-06-01 16:43:06 +02:00
struct CDMRNetConfStruct {
bool m_Enabled;
std::string m_Name;
unsigned int m_Id;
std::string m_Address;
unsigned short m_Port;
unsigned short m_Local;
std::string m_Password;
std::string m_Options;
bool m_Location;
bool m_Debug;
std::vector<CTGRewriteStruct> m_TGRewrites;
std::vector<CPCRewriteStruct> m_PCRewrites;
std::vector<CTypeRewriteStruct> m_TypeRewrites;
std::vector<CSrcRewriteStruct> m_SrcRewrites;
std::vector<CTGDynRewriteStruct> m_TGDynRewrites;
std::vector<CIdRewriteStruct> m_IdRewrites;
std::vector<unsigned int> m_PassAllPC;
std::vector<unsigned int> m_PassAllTG;
};
2017-04-20 21:51:30 +02:00
class CConf
{
public:
2017-04-23 21:17:25 +02:00
CConf(const std::string& file);
~CConf();
2017-04-20 21:51:30 +02:00
2017-04-23 21:17:25 +02:00
bool read();
2017-04-20 21:51:30 +02:00
2017-04-23 21:17:25 +02:00
// The General section
bool getDaemon() const;
unsigned int getRFTimeout() const;
unsigned int getNetTimeout() const;
2017-04-23 21:17:25 +02:00
std::string getRptAddress() const;
unsigned short getRptPort() const;
2017-04-23 21:17:25 +02:00
std::string getLocalAddress() const;
unsigned short getLocalPort() const;
2017-06-04 16:17:43 +02:00
bool getRuleTrace() const;
2017-04-23 21:17:25 +02:00
bool getDebug() const;
2017-04-20 21:51:30 +02:00
2017-04-23 21:17:25 +02:00
// The Log section
unsigned int getLogDisplayLevel() const;
unsigned int getLogFileLevel() const;
std::string getLogFilePath() const;
std::string getLogFileRoot() const;
bool getLogFileRotate() const;
2017-04-20 21:51:30 +02:00
2017-05-01 15:46:43 +02:00
// The Voice section
bool getVoiceEnabled() const;
std::string getVoiceLanguage() const;
2017-05-01 21:05:41 +02:00
std::string getVoiceDirectory() const;
2017-05-01 15:46:43 +02:00
2017-10-08 15:13:52 +02:00
// The Info section
float getInfoLatitude() const;
float getInfoLongitude() const;
int getInfoHeight() const;
std::string getInfoLocation() const;
2017-10-08 15:13:52 +02:00
std::string getInfoDescription() const;
std::string getInfoURL() const;
2025-06-01 16:43:06 +02:00
// DMR Network sections
unsigned int getDMRNetworksCount() const; // get [DMR Network X] sections count
bool getDMRNetworkEnabled(unsigned int index) const;
std::string getDMRNetworkName(unsigned int index) const;
unsigned int getDMRNetworkId(unsigned int index) const;
std::string getDMRNetworkAddress(unsigned int index) const;
unsigned short getDMRNetworkPort(unsigned int index) const;
unsigned short getDMRNetworkLocal(unsigned int index) const;
std::string getDMRNetworkPassword(unsigned int index) const;
std::string getDMRNetworkOptions(unsigned int index) const;
bool getDMRNetworkLocation(unsigned int index) const;
bool getDMRNetworkDebug(unsigned int index) const;
std::vector<CTGRewriteStruct> getDMRNetworkTGRewrites(unsigned int index) const;
std::vector<CPCRewriteStruct> getDMRNetworkPCRewrites(unsigned int index) const;
std::vector<CTypeRewriteStruct> getDMRNetworkTypeRewrites(unsigned int index) const;
std::vector<CSrcRewriteStruct> getDMRNetworkSrcRewrites(unsigned int index) const;
std::vector<CTGDynRewriteStruct> getDMRNetworkTGDynRewrites(unsigned int index) const;
std::vector<CIdRewriteStruct> getDMRNetworkIdRewrites(unsigned int index) const;
std::vector<unsigned int> getDMRNetworkPassAllPC(unsigned int index) const;
std::vector<unsigned int> getDMRNetworkPassAllTG(unsigned int index) const;
// The XLX Network section
bool getXLXNetworkEnabled() const;
unsigned int getXLXNetworkId() const;
std::string getXLXNetworkFile() const;
unsigned int getXLXNetworkReloadTime() const;
unsigned short getXLXNetworkPort() const;
std::string getXLXNetworkPassword() const;
unsigned short getXLXNetworkLocal() const;
unsigned int getXLXNetworkSlot() const;
unsigned int getXLXNetworkTG() const;
unsigned int getXLXNetworkBase() const;
std::string getXLXNetworkStartup() const;
unsigned int getXLXNetworkRelink() const;
bool getXLXNetworkDebug() const;
bool getXLXNetworkUserControl() const;
char getXLXNetworkModule() const;
2017-04-20 21:51:30 +02:00
// The GPSD section
bool getGPSDEnabled() const;
std::string getGPSDAddress() const;
std::string getGPSDPort() const;
// The APRS section
bool getAPRSEnabled() const;
std::string getAPRSAddress() const;
unsigned short getAPRSPort() const;
std::string getAPRSSuffix() const;
std::string getAPRSDescription() const;
std::string getAPRSSymbol() const;
// The Dynamic TG Control section
bool getDynamicTGControlEnabled() const;
unsigned short getDynamicTGControlPort() const;
// The Remote Control section
bool getRemoteControlEnabled() const;
std::string getRemoteControlAddress() const;
unsigned short getRemoteControlPort() const;
2017-04-20 21:51:30 +02:00
private:
2017-04-23 21:17:25 +02:00
std::string m_file;
bool m_daemon;
std::string m_rptAddress;
unsigned short m_rptPort;
2017-04-23 21:17:25 +02:00
std::string m_localAddress;
unsigned short m_localPort;
unsigned int m_rfTimeout;
unsigned int m_netTimeout;
2017-06-04 16:17:43 +02:00
bool m_ruleTrace;
2017-04-23 21:17:25 +02:00
bool m_debug;
2017-04-20 21:51:30 +02:00
2017-05-01 15:46:43 +02:00
bool m_voiceEnabled;
std::string m_voiceLanguage;
2017-05-01 21:05:41 +02:00
std::string m_voiceDirectory;
2017-05-01 15:46:43 +02:00
2017-04-23 21:17:25 +02:00
unsigned int m_logDisplayLevel;
unsigned int m_logFileLevel;
std::string m_logFilePath;
std::string m_logFileRoot;
bool m_logFileRotate;
2017-04-20 21:51:30 +02:00
2017-10-08 15:13:52 +02:00
float m_infoLatitude;
float m_infoLongitude;
int m_infoHeight;
std::string m_infoLocation;
2017-10-08 15:13:52 +02:00
std::string m_infoDescription;
std::string m_infoURL;
2025-06-01 16:43:06 +02:00
std::vector<CDMRNetConfStruct> m_dmrNetworks;
CDMRNetConfStruct *addDMRNetwork();
bool m_xlxNetworkEnabled;
unsigned int m_xlxNetworkId;
std::string m_xlxNetworkFile;
unsigned int m_xlxNetworkReloadTime;
unsigned short m_xlxNetworkPort;
std::string m_xlxNetworkPassword;
unsigned short m_xlxNetworkLocal;
unsigned int m_xlxNetworkSlot;
unsigned int m_xlxNetworkTG;
unsigned int m_xlxNetworkBase;
std::string m_xlxNetworkStartup;
unsigned int m_xlxNetworkRelink;
bool m_xlxNetworkDebug;
bool m_xlxNetworkUserControl;
char m_xlxNetworkModule;
2020-04-13 15:15:21 +02:00
bool m_gpsdEnabled;
std::string m_gpsdAddress;
std::string m_gpsdPort;
bool m_aprsEnabled;
std::string m_aprsAddress;
unsigned short m_aprsPort;
std::string m_aprsSuffix;
std::string m_aprsDescription;
std::string m_aprsSymbol;
bool m_dynamicTGControlEnabled;
unsigned short m_dynamicTGControlPort;
bool m_remoteControlEnabled;
std::string m_remoteControlAddress;
unsigned short m_remoteControlPort;
2017-04-20 21:51:30 +02:00
};
#endif