mirror of
https://github.com/g4klx/DMRGateway
synced 2026-02-05 22:05:42 +08:00
Allow for switching between XLX reflectors.
This commit is contained in:
244
Conf.cpp
244
Conf.cpp
@@ -33,8 +33,7 @@ enum SECTION {
|
|||||||
SECTION_VOICE,
|
SECTION_VOICE,
|
||||||
SECTION_DMR_NETWORK_1,
|
SECTION_DMR_NETWORK_1,
|
||||||
SECTION_DMR_NETWORK_2,
|
SECTION_DMR_NETWORK_2,
|
||||||
SECTION_XLX_NETWORK_1,
|
SECTION_XLX_NETWORK
|
||||||
SECTION_XLX_NETWORK_2
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CConf::CConf(const std::string& file) :
|
CConf::CConf(const std::string& file) :
|
||||||
@@ -84,34 +83,16 @@ m_dmrNetwork2TypeRewrites(),
|
|||||||
m_dmrNetwork2SrcRewrites(),
|
m_dmrNetwork2SrcRewrites(),
|
||||||
m_dmrNetwork2PassAllPC(),
|
m_dmrNetwork2PassAllPC(),
|
||||||
m_dmrNetwork2PassAllTG(),
|
m_dmrNetwork2PassAllTG(),
|
||||||
m_xlxNetwork1Enabled(false),
|
m_xlxNetworkEnabled(false),
|
||||||
m_xlxNetwork1Name(),
|
m_xlxNetworkId(0U),
|
||||||
m_xlxNetwork1Id(0U),
|
m_xlxNetworkFile(),
|
||||||
m_xlxNetwork1Address(),
|
m_xlxNetworkLocal(0U),
|
||||||
m_xlxNetwork1Port(0U),
|
m_xlxNetworkSlot(1U),
|
||||||
m_xlxNetwork1Local(0U),
|
m_xlxNetworkTG(8U),
|
||||||
m_xlxNetwork1Password(),
|
m_xlxNetworkBase(84000U),
|
||||||
m_xlxNetwork1Slot(1U),
|
m_xlxNetworkStartup(4000U),
|
||||||
m_xlxNetwork1TG(8U),
|
m_xlxNetworkRelink(0U),
|
||||||
m_xlxNetwork1Base(84000U),
|
m_xlxNetworkDebug(false)
|
||||||
m_xlxNetwork1Startup(4000U),
|
|
||||||
m_xlxNetwork1Relink(0U),
|
|
||||||
m_xlxNetwork1Options(),
|
|
||||||
m_xlxNetwork1Debug(false),
|
|
||||||
m_xlxNetwork2Enabled(false),
|
|
||||||
m_xlxNetwork2Name(),
|
|
||||||
m_xlxNetwork2Id(0U),
|
|
||||||
m_xlxNetwork2Address(),
|
|
||||||
m_xlxNetwork2Port(0U),
|
|
||||||
m_xlxNetwork2Local(0U),
|
|
||||||
m_xlxNetwork2Password(),
|
|
||||||
m_xlxNetwork2Slot(1U),
|
|
||||||
m_xlxNetwork2TG(7U),
|
|
||||||
m_xlxNetwork2Base(74000U),
|
|
||||||
m_xlxNetwork2Startup(4000U),
|
|
||||||
m_xlxNetwork2Relink(0U),
|
|
||||||
m_xlxNetwork2Options(),
|
|
||||||
m_xlxNetwork2Debug(false)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,10 +122,8 @@ bool CConf::read()
|
|||||||
section = SECTION_LOG;
|
section = SECTION_LOG;
|
||||||
else if (::strncmp(buffer, "[Voice]", 7U) == 0)
|
else if (::strncmp(buffer, "[Voice]", 7U) == 0)
|
||||||
section = SECTION_VOICE;
|
section = SECTION_VOICE;
|
||||||
else if (::strncmp(buffer, "[XLX Network 1]", 15U) == 0)
|
else if (::strncmp(buffer, "[XLX Network]", 13U) == 0)
|
||||||
section = SECTION_XLX_NETWORK_1;
|
section = SECTION_XLX_NETWORK;
|
||||||
else if (::strncmp(buffer, "[XLX Network 2]", 15U) == 0)
|
|
||||||
section = SECTION_XLX_NETWORK_2;
|
|
||||||
else if (::strncmp(buffer, "[DMR Network 1]", 15U) == 0)
|
else if (::strncmp(buffer, "[DMR Network 1]", 15U) == 0)
|
||||||
section = SECTION_DMR_NETWORK_1;
|
section = SECTION_DMR_NETWORK_1;
|
||||||
else if (::strncmp(buffer, "[DMR Network 2]", 15U) == 0)
|
else if (::strncmp(buffer, "[DMR Network 2]", 15U) == 0)
|
||||||
@@ -196,64 +175,27 @@ bool CConf::read()
|
|||||||
m_voiceLanguage = value;
|
m_voiceLanguage = value;
|
||||||
else if (::strcmp(key, "Directory") == 0)
|
else if (::strcmp(key, "Directory") == 0)
|
||||||
m_voiceDirectory = value;
|
m_voiceDirectory = value;
|
||||||
} else if (section == SECTION_XLX_NETWORK_1) {
|
} else if (section == SECTION_XLX_NETWORK) {
|
||||||
if (::strcmp(key, "Enabled") == 0)
|
if (::strcmp(key, "Enabled") == 0)
|
||||||
m_xlxNetwork1Enabled = ::atoi(value) == 1;
|
m_xlxNetworkEnabled = ::atoi(value) == 1;
|
||||||
else if (::strcmp(key, "Name") == 0)
|
|
||||||
m_xlxNetwork1Name = value;
|
|
||||||
else if (::strcmp(key, "Id") == 0)
|
else if (::strcmp(key, "Id") == 0)
|
||||||
m_xlxNetwork1Id = (unsigned int)::atoi(value);
|
m_xlxNetworkId = (unsigned int)::atoi(value);
|
||||||
else if (::strcmp(key, "Address") == 0)
|
else if (::strcmp(key, "File") == 0)
|
||||||
m_xlxNetwork1Address = value;
|
m_xlxNetworkFile = value;
|
||||||
else if (::strcmp(key, "Port") == 0)
|
|
||||||
m_xlxNetwork1Port = (unsigned int)::atoi(value);
|
|
||||||
else if (::strcmp(key, "Local") == 0)
|
else if (::strcmp(key, "Local") == 0)
|
||||||
m_xlxNetwork1Local = (unsigned int)::atoi(value);
|
m_xlxNetworkLocal = (unsigned int)::atoi(value);
|
||||||
else if (::strcmp(key, "Password") == 0)
|
|
||||||
m_xlxNetwork1Password = value;
|
|
||||||
else if (::strcmp(key, "Slot") == 0)
|
else if (::strcmp(key, "Slot") == 0)
|
||||||
m_xlxNetwork1Slot = (unsigned int)::atoi(value);
|
m_xlxNetworkSlot = (unsigned int)::atoi(value);
|
||||||
else if (::strcmp(key, "TG") == 0)
|
else if (::strcmp(key, "TG") == 0)
|
||||||
m_xlxNetwork1TG = (unsigned int)::atoi(value);
|
m_xlxNetworkTG = (unsigned int)::atoi(value);
|
||||||
else if (::strcmp(key, "Base") == 0)
|
else if (::strcmp(key, "Base") == 0)
|
||||||
m_xlxNetwork1Base = (unsigned int)::atoi(value);
|
m_xlxNetworkBase = (unsigned int)::atoi(value);
|
||||||
else if (::strcmp(key, "Startup") == 0)
|
else if (::strcmp(key, "Startup") == 0)
|
||||||
m_xlxNetwork1Startup = (unsigned int)::atoi(value);
|
m_xlxNetworkStartup = (unsigned int)::atoi(value);
|
||||||
else if (::strcmp(key, "Relink") == 0)
|
else if (::strcmp(key, "Relink") == 0)
|
||||||
m_xlxNetwork1Relink = (unsigned int)::atoi(value);
|
m_xlxNetworkRelink = (unsigned int)::atoi(value);
|
||||||
else if (::strcmp(key, "Options") == 0)
|
|
||||||
m_xlxNetwork1Options = value;
|
|
||||||
else if (::strcmp(key, "Debug") == 0)
|
else if (::strcmp(key, "Debug") == 0)
|
||||||
m_xlxNetwork1Debug = ::atoi(value) == 1;
|
m_xlxNetworkDebug = ::atoi(value) == 1;
|
||||||
} else if (section == SECTION_XLX_NETWORK_2) {
|
|
||||||
if (::strcmp(key, "Enabled") == 0)
|
|
||||||
m_xlxNetwork2Enabled = ::atoi(value) == 1;
|
|
||||||
else if (::strcmp(key, "Name") == 0)
|
|
||||||
m_xlxNetwork2Name = value;
|
|
||||||
else if (::strcmp(key, "Id") == 0)
|
|
||||||
m_xlxNetwork2Id = (unsigned int)::atoi(value);
|
|
||||||
else if (::strcmp(key, "Address") == 0)
|
|
||||||
m_xlxNetwork2Address = value;
|
|
||||||
else if (::strcmp(key, "Port") == 0)
|
|
||||||
m_xlxNetwork2Port = (unsigned int)::atoi(value);
|
|
||||||
else if (::strcmp(key, "Local") == 0)
|
|
||||||
m_xlxNetwork2Local = (unsigned int)::atoi(value);
|
|
||||||
else if (::strcmp(key, "Password") == 0)
|
|
||||||
m_xlxNetwork2Password = value;
|
|
||||||
else if (::strcmp(key, "Slot") == 0)
|
|
||||||
m_xlxNetwork2Slot = (unsigned int)::atoi(value);
|
|
||||||
else if (::strcmp(key, "TG") == 0)
|
|
||||||
m_xlxNetwork2TG = (unsigned int)::atoi(value);
|
|
||||||
else if (::strcmp(key, "Base") == 0)
|
|
||||||
m_xlxNetwork2Base = (unsigned int)::atoi(value);
|
|
||||||
else if (::strcmp(key, "Startup") == 0)
|
|
||||||
m_xlxNetwork2Startup = (unsigned int)::atoi(value);
|
|
||||||
else if (::strcmp(key, "Relink") == 0)
|
|
||||||
m_xlxNetwork2Relink = (unsigned int)::atoi(value);
|
|
||||||
else if (::strcmp(key, "Options") == 0)
|
|
||||||
m_xlxNetwork2Options = value;
|
|
||||||
else if (::strcmp(key, "Debug") == 0)
|
|
||||||
m_xlxNetwork2Debug = ::atoi(value) == 1;
|
|
||||||
} else if (section == SECTION_DMR_NETWORK_1) {
|
} else if (section == SECTION_DMR_NETWORK_1) {
|
||||||
if (::strcmp(key, "Enabled") == 0)
|
if (::strcmp(key, "Enabled") == 0)
|
||||||
m_dmrNetwork1Enabled = ::atoi(value) == 1;
|
m_dmrNetwork1Enabled = ::atoi(value) == 1;
|
||||||
@@ -505,150 +447,54 @@ std::string CConf::getVoiceDirectory() const
|
|||||||
return m_voiceDirectory;
|
return m_voiceDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CConf::getXLXNetwork1Enabled() const
|
bool CConf::getXLXNetworkEnabled() const
|
||||||
{
|
{
|
||||||
return m_xlxNetwork1Enabled;
|
return m_xlxNetworkEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CConf::getXLXNetwork1Name() const
|
unsigned int CConf::getXLXNetworkId() const
|
||||||
{
|
{
|
||||||
if (m_xlxNetwork1Name.empty())
|
return m_xlxNetworkId;
|
||||||
return "XLX-1";
|
|
||||||
else
|
|
||||||
return m_xlxNetwork1Name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CConf::getXLXNetwork1Id() const
|
std::string CConf::getXLXNetworkFile() const
|
||||||
{
|
{
|
||||||
return m_xlxNetwork1Id;
|
return m_xlxNetworkFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CConf::getXLXNetwork1Address() const
|
unsigned int CConf::getXLXNetworkLocal() const
|
||||||
{
|
{
|
||||||
return m_xlxNetwork1Address;
|
return m_xlxNetworkLocal;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CConf::getXLXNetwork1Port() const
|
unsigned int CConf::getXLXNetworkSlot() const
|
||||||
{
|
{
|
||||||
return m_xlxNetwork1Port;
|
return m_xlxNetworkSlot;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CConf::getXLXNetwork1Local() const
|
unsigned int CConf::getXLXNetworkTG() const
|
||||||
{
|
{
|
||||||
return m_xlxNetwork1Local;
|
return m_xlxNetworkTG;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CConf::getXLXNetwork1Slot() const
|
unsigned int CConf::getXLXNetworkBase() const
|
||||||
{
|
{
|
||||||
return m_xlxNetwork1Slot;
|
return m_xlxNetworkBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CConf::getXLXNetwork1TG() const
|
unsigned int CConf::getXLXNetworkStartup() const
|
||||||
{
|
{
|
||||||
return m_xlxNetwork1TG;
|
return m_xlxNetworkStartup;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CConf::getXLXNetwork1Base() const
|
unsigned int CConf::getXLXNetworkRelink() const
|
||||||
{
|
{
|
||||||
return m_xlxNetwork1Base;
|
return m_xlxNetworkRelink;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CConf::getXLXNetwork1Startup() const
|
bool CConf::getXLXNetworkDebug() const
|
||||||
{
|
{
|
||||||
return m_xlxNetwork1Startup;
|
return m_xlxNetworkDebug;
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int CConf::getXLXNetwork1Relink() const
|
|
||||||
{
|
|
||||||
return m_xlxNetwork1Relink;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string CConf::getXLXNetwork1Password() const
|
|
||||||
{
|
|
||||||
return m_xlxNetwork1Password;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string CConf::getXLXNetwork1Options() const
|
|
||||||
{
|
|
||||||
return m_xlxNetwork1Options;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CConf::getXLXNetwork1Debug() const
|
|
||||||
{
|
|
||||||
return m_xlxNetwork1Debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CConf::getXLXNetwork2Enabled() const
|
|
||||||
{
|
|
||||||
return m_xlxNetwork2Enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string CConf::getXLXNetwork2Name() const
|
|
||||||
{
|
|
||||||
if (m_xlxNetwork2Name.empty())
|
|
||||||
return "XLX-2";
|
|
||||||
else
|
|
||||||
return m_xlxNetwork2Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int CConf::getXLXNetwork2Id() const
|
|
||||||
{
|
|
||||||
return m_xlxNetwork2Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string CConf::getXLXNetwork2Address() const
|
|
||||||
{
|
|
||||||
return m_xlxNetwork2Address;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int CConf::getXLXNetwork2Port() const
|
|
||||||
{
|
|
||||||
return m_xlxNetwork2Port;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int CConf::getXLXNetwork2Local() const
|
|
||||||
{
|
|
||||||
return m_xlxNetwork2Local;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int CConf::getXLXNetwork2Slot() const
|
|
||||||
{
|
|
||||||
return m_xlxNetwork2Slot;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int CConf::getXLXNetwork2TG() const
|
|
||||||
{
|
|
||||||
return m_xlxNetwork2TG;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int CConf::getXLXNetwork2Base() const
|
|
||||||
{
|
|
||||||
return m_xlxNetwork2Base;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int CConf::getXLXNetwork2Startup() const
|
|
||||||
{
|
|
||||||
return m_xlxNetwork2Startup;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int CConf::getXLXNetwork2Relink() const
|
|
||||||
{
|
|
||||||
return m_xlxNetwork2Relink;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string CConf::getXLXNetwork2Password() const
|
|
||||||
{
|
|
||||||
return m_xlxNetwork2Password;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string CConf::getXLXNetwork2Options() const
|
|
||||||
{
|
|
||||||
return m_xlxNetwork2Options;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CConf::getXLXNetwork2Debug() const
|
|
||||||
{
|
|
||||||
return m_xlxNetwork2Debug;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CConf::getDMRNetwork1Enabled() const
|
bool CConf::getDMRNetwork1Enabled() const
|
||||||
|
|||||||
81
Conf.h
81
Conf.h
@@ -116,37 +116,17 @@ public:
|
|||||||
std::vector<unsigned int> getDMRNetwork2PassAllPC() const;
|
std::vector<unsigned int> getDMRNetwork2PassAllPC() const;
|
||||||
std::vector<unsigned int> getDMRNetwork2PassAllTG() const;
|
std::vector<unsigned int> getDMRNetwork2PassAllTG() const;
|
||||||
|
|
||||||
// The XLX Network 1 section
|
// The XLX Network section
|
||||||
bool getXLXNetwork1Enabled() const;
|
bool getXLXNetworkEnabled() const;
|
||||||
std::string getXLXNetwork1Name() const;
|
unsigned int getXLXNetworkId() const;
|
||||||
unsigned int getXLXNetwork1Id() const;
|
std::string getXLXNetworkFile() const;
|
||||||
std::string getXLXNetwork1Address() const;
|
unsigned int getXLXNetworkLocal() const;
|
||||||
unsigned int getXLXNetwork1Port() const;
|
unsigned int getXLXNetworkSlot() const;
|
||||||
unsigned int getXLXNetwork1Local() const;
|
unsigned int getXLXNetworkTG() const;
|
||||||
std::string getXLXNetwork1Password() const;
|
unsigned int getXLXNetworkBase() const;
|
||||||
unsigned int getXLXNetwork1Slot() const;
|
unsigned int getXLXNetworkStartup() const;
|
||||||
unsigned int getXLXNetwork1TG() const;
|
unsigned int getXLXNetworkRelink() const;
|
||||||
unsigned int getXLXNetwork1Base() const;
|
bool getXLXNetworkDebug() const;
|
||||||
unsigned int getXLXNetwork1Startup() const;
|
|
||||||
unsigned int getXLXNetwork1Relink() const;
|
|
||||||
std::string getXLXNetwork1Options() const;
|
|
||||||
bool getXLXNetwork1Debug() const;
|
|
||||||
|
|
||||||
// The XLX Network 2 section
|
|
||||||
bool getXLXNetwork2Enabled() const;
|
|
||||||
std::string getXLXNetwork2Name() const;
|
|
||||||
unsigned int getXLXNetwork2Id() const;
|
|
||||||
std::string getXLXNetwork2Address() const;
|
|
||||||
unsigned int getXLXNetwork2Port() const;
|
|
||||||
unsigned int getXLXNetwork2Local() const;
|
|
||||||
std::string getXLXNetwork2Password() const;
|
|
||||||
unsigned int getXLXNetwork2Slot() const;
|
|
||||||
unsigned int getXLXNetwork2TG() const;
|
|
||||||
unsigned int getXLXNetwork2Base() const;
|
|
||||||
unsigned int getXLXNetwork2Startup() const;
|
|
||||||
unsigned int getXLXNetwork2Relink() const;
|
|
||||||
std::string getXLXNetwork2Options() const;
|
|
||||||
bool getXLXNetwork2Debug() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_file;
|
std::string m_file;
|
||||||
@@ -200,35 +180,16 @@ private:
|
|||||||
std::vector<unsigned int> m_dmrNetwork2PassAllPC;
|
std::vector<unsigned int> m_dmrNetwork2PassAllPC;
|
||||||
std::vector<unsigned int> m_dmrNetwork2PassAllTG;
|
std::vector<unsigned int> m_dmrNetwork2PassAllTG;
|
||||||
|
|
||||||
bool m_xlxNetwork1Enabled;
|
bool m_xlxNetworkEnabled;
|
||||||
std::string m_xlxNetwork1Name;
|
unsigned int m_xlxNetworkId;
|
||||||
unsigned int m_xlxNetwork1Id;
|
std::string m_xlxNetworkFile;
|
||||||
std::string m_xlxNetwork1Address;
|
unsigned int m_xlxNetworkLocal;
|
||||||
unsigned int m_xlxNetwork1Port;
|
unsigned int m_xlxNetworkSlot;
|
||||||
unsigned int m_xlxNetwork1Local;
|
unsigned int m_xlxNetworkTG;
|
||||||
std::string m_xlxNetwork1Password;
|
unsigned int m_xlxNetworkBase;
|
||||||
unsigned int m_xlxNetwork1Slot;
|
unsigned int m_xlxNetworkStartup;
|
||||||
unsigned int m_xlxNetwork1TG;
|
unsigned int m_xlxNetworkRelink;
|
||||||
unsigned int m_xlxNetwork1Base;
|
bool m_xlxNetworkDebug;
|
||||||
unsigned int m_xlxNetwork1Startup;
|
|
||||||
unsigned int m_xlxNetwork1Relink;
|
|
||||||
std::string m_xlxNetwork1Options;
|
|
||||||
bool m_xlxNetwork1Debug;
|
|
||||||
|
|
||||||
bool m_xlxNetwork2Enabled;
|
|
||||||
std::string m_xlxNetwork2Name;
|
|
||||||
unsigned int m_xlxNetwork2Id;
|
|
||||||
std::string m_xlxNetwork2Address;
|
|
||||||
unsigned int m_xlxNetwork2Port;
|
|
||||||
unsigned int m_xlxNetwork2Local;
|
|
||||||
std::string m_xlxNetwork2Password;
|
|
||||||
unsigned int m_xlxNetwork2Slot;
|
|
||||||
unsigned int m_xlxNetwork2TG;
|
|
||||||
unsigned int m_xlxNetwork2Base;
|
|
||||||
unsigned int m_xlxNetwork2Startup;
|
|
||||||
unsigned int m_xlxNetwork2Relink;
|
|
||||||
std::string m_xlxNetwork2Options;
|
|
||||||
bool m_xlxNetwork2Debug;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
560
DMRGateway.cpp
560
DMRGateway.cpp
@@ -70,8 +70,7 @@ enum DMRGW_STATUS {
|
|||||||
DMRGWS_NONE,
|
DMRGWS_NONE,
|
||||||
DMRGWS_DMRNETWORK1,
|
DMRGWS_DMRNETWORK1,
|
||||||
DMRGWS_DMRNETWORK2,
|
DMRGWS_DMRNETWORK2,
|
||||||
DMRGWS_XLXREFLECTOR1,
|
DMRGWS_XLXREFLECTOR
|
||||||
DMRGWS_XLXREFLECTOR2
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* HEADER1 = "This software is for use on amateur radio networks only,";
|
const char* HEADER1 = "This software is for use on amateur radio networks only,";
|
||||||
@@ -136,30 +135,22 @@ m_dmrNetwork1(NULL),
|
|||||||
m_dmr1Name(),
|
m_dmr1Name(),
|
||||||
m_dmrNetwork2(NULL),
|
m_dmrNetwork2(NULL),
|
||||||
m_dmr2Name(),
|
m_dmr2Name(),
|
||||||
m_xlxNetwork1(NULL),
|
m_xlxReflectors(NULL),
|
||||||
m_xlx1Name(),
|
m_xlxNetwork(NULL),
|
||||||
m_xlxNetwork2(NULL),
|
m_xlxId(0U),
|
||||||
m_xlx2Name(),
|
m_xlxNumber(0U),
|
||||||
m_xlx1Id(0U),
|
m_xlxReflector(4000U),
|
||||||
m_xlx1Reflector(4000U),
|
m_xlxSlot(0U),
|
||||||
m_xlx1Slot(0U),
|
m_xlxTG(0U),
|
||||||
m_xlx1TG(0U),
|
m_xlxBase(0U),
|
||||||
m_xlx1Base(0U),
|
m_xlxLocal(0U),
|
||||||
m_xlx1Startup(4000U),
|
m_xlxStartup(950U),
|
||||||
m_xlx1Relink(1000U),
|
m_xlxRoom(4000U),
|
||||||
m_xlx1Connected(false),
|
m_xlxRelink(1000U),
|
||||||
m_rpt1Rewrite(NULL),
|
m_xlxConnected(false),
|
||||||
m_xlx1Rewrite(NULL),
|
m_xlxDebug(false),
|
||||||
m_xlx2Id(0U),
|
m_rptRewrite(NULL),
|
||||||
m_xlx2Reflector(4000U),
|
m_xlxRewrite(NULL),
|
||||||
m_xlx2Slot(0U),
|
|
||||||
m_xlx2TG(0U),
|
|
||||||
m_xlx2Base(0U),
|
|
||||||
m_xlx2Startup(4000U),
|
|
||||||
m_xlx2Relink(1000U),
|
|
||||||
m_xlx2Connected(false),
|
|
||||||
m_rpt2Rewrite(NULL),
|
|
||||||
m_xlx2Rewrite(NULL),
|
|
||||||
m_dmr1NetRewrites(),
|
m_dmr1NetRewrites(),
|
||||||
m_dmr1RFRewrites(),
|
m_dmr1RFRewrites(),
|
||||||
m_dmr2NetRewrites(),
|
m_dmr2NetRewrites(),
|
||||||
@@ -189,10 +180,8 @@ CDMRGateway::~CDMRGateway()
|
|||||||
for (std::vector<CRewrite*>::iterator it = m_dmr2Passalls.begin(); it != m_dmr2Passalls.end(); ++it)
|
for (std::vector<CRewrite*>::iterator it = m_dmr2Passalls.begin(); it != m_dmr2Passalls.end(); ++it)
|
||||||
delete *it;
|
delete *it;
|
||||||
|
|
||||||
delete m_rpt1Rewrite;
|
delete m_rptRewrite;
|
||||||
delete m_xlx1Rewrite;
|
delete m_xlxRewrite;
|
||||||
delete m_rpt2Rewrite;
|
|
||||||
delete m_xlx2Rewrite;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CDMRGateway::run()
|
int CDMRGateway::run()
|
||||||
@@ -317,23 +306,16 @@ int CDMRGateway::run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (m_conf.getXLXNetwork1Enabled()) {
|
if (m_conf.getXLXNetworkEnabled()) {
|
||||||
ret = createXLXNetwork1();
|
ret = createXLXNetwork();
|
||||||
if (!ret)
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_conf.getXLXNetwork2Enabled()) {
|
|
||||||
ret = createXLXNetwork2();
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int timeout = m_conf.getTimeout();
|
unsigned int timeout = m_conf.getTimeout();
|
||||||
|
|
||||||
CVoice* voice1 = NULL;
|
CVoice* voice = NULL;
|
||||||
CVoice* voice2 = NULL;
|
if (m_conf.getVoiceEnabled() && m_xlxNetwork != NULL) {
|
||||||
if (m_conf.getVoiceEnabled() && (m_xlxNetwork1 != NULL || m_xlxNetwork2 != NULL)) {
|
|
||||||
std::string language = m_conf.getVoiceLanguage();
|
std::string language = m_conf.getVoiceLanguage();
|
||||||
std::string directory = m_conf.getVoiceDirectory();
|
std::string directory = m_conf.getVoiceDirectory();
|
||||||
|
|
||||||
@@ -342,22 +324,11 @@ int CDMRGateway::run()
|
|||||||
LogInfo(" Language: %s", language.c_str());
|
LogInfo(" Language: %s", language.c_str());
|
||||||
LogInfo(" Directory: %s", directory.c_str());
|
LogInfo(" Directory: %s", directory.c_str());
|
||||||
|
|
||||||
if (m_xlxNetwork1 != NULL) {
|
voice = new CVoice(directory, language, m_repeater->getId(), m_xlxSlot, m_xlxTG);
|
||||||
voice1 = new CVoice(directory, language, m_repeater->getId(), m_xlx1Slot, m_xlx1TG);
|
bool ret = voice->open();
|
||||||
bool ret = voice1->open();
|
if (!ret) {
|
||||||
if (!ret) {
|
delete voice;
|
||||||
delete voice1;
|
voice = NULL;
|
||||||
voice1 = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_xlxNetwork2 != NULL) {
|
|
||||||
voice2 = new CVoice(directory, language, m_repeater->getId(), m_xlx2Slot, m_xlx2TG);
|
|
||||||
bool ret = voice2->open();
|
|
||||||
if (!ret) {
|
|
||||||
delete voice2;
|
|
||||||
voice2 = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -389,86 +360,49 @@ int CDMRGateway::run()
|
|||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
while (!m_killed) {
|
while (!m_killed) {
|
||||||
if (m_xlxNetwork1 != NULL) {
|
if (m_xlxNetwork != NULL) {
|
||||||
bool connected = m_xlxNetwork1->isConnected();
|
bool connected = m_xlxNetwork->isConnected();
|
||||||
if (connected && !m_xlx1Connected) {
|
if (connected && !m_xlxConnected) {
|
||||||
if (m_xlx1Startup != 4000U) {
|
if (m_xlxRoom != 4000U) {
|
||||||
writeXLXLink(m_xlx1Id, m_xlx1Startup, m_xlxNetwork1);
|
writeXLXLink(m_xlxId, m_xlxRoom, m_xlxNetwork);
|
||||||
LogMessage("%s, Linking to reflector %u at startup", m_xlx1Name.c_str(), m_xlx1Startup);
|
LogMessage("XLX, Linking to reflector %u in XLX%03u", m_xlxRoom, m_xlxNumber);
|
||||||
if (voice1 != NULL)
|
if (voice != NULL)
|
||||||
voice1->linkedTo(m_xlx1Startup);
|
voice->linkedTo(m_xlxRoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_xlx1Reflector = m_xlx1Startup;
|
m_xlxReflector = m_xlxRoom;
|
||||||
m_xlx1Connected = true;
|
m_xlxConnected = true;
|
||||||
m_xlx1Relink.stop();
|
m_xlxRelink.stop();
|
||||||
} else if (!connected && m_xlx1Connected) {
|
} else if (!connected && m_xlxConnected) {
|
||||||
if (m_xlx1Reflector != 4000U) {
|
if (m_xlxReflector != 4000U) {
|
||||||
LogMessage("%s, Unlinking due to loss of connection", m_xlx1Name.c_str());
|
LogMessage("XLX, Unlinking from XLX%03u due to loss of connection", m_xlxNumber);
|
||||||
if (voice1 != NULL)
|
if (voice != NULL)
|
||||||
voice1->unlinked();
|
voice->unlinked();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_xlx1Reflector = 4000U;
|
m_xlxReflector = 4000U;
|
||||||
m_xlx1Connected = false;
|
m_xlxConnected = false;
|
||||||
m_xlx1Relink.stop();
|
m_xlxRelink.stop();
|
||||||
} else if (connected && m_xlx1Relink.isRunning() && m_xlx1Relink.hasExpired()) {
|
} else if (connected && m_xlxRelink.isRunning() && m_xlxRelink.hasExpired()) {
|
||||||
m_xlx1Relink.stop();
|
m_xlxRelink.stop();
|
||||||
|
|
||||||
if (m_xlx1Startup != 4000U)
|
if (m_xlxNumber != m_xlxStartup) {
|
||||||
writeXLXLink(m_xlx1Id, 4000U, m_xlxNetwork1);
|
LogMessage("XLX, Re-linking to startup reflector %u in XLX%03u due to RF inactivity timeout", m_xlxRoom, m_xlxNumber);
|
||||||
|
linkXLX(m_xlxStartup);
|
||||||
|
} else {
|
||||||
|
if (m_xlxRoom != 4000U)
|
||||||
|
writeXLXLink(m_xlxId, 4000U, m_xlxNetwork);
|
||||||
|
|
||||||
writeXLXLink(m_xlx1Id, m_xlx1Startup, m_xlxNetwork1);
|
writeXLXLink(m_xlxId, m_xlxRoom, m_xlxNetwork);
|
||||||
LogMessage("%s, Re-linking to startup reflector %u due to RF inactivity timeout", m_xlx1Name.c_str(), m_xlx1Startup);
|
LogMessage("XLX, Re-linking to startup reflector %u in XLX%03u due to RF inactivity timeout", m_xlxRoom, m_xlxNumber);
|
||||||
m_xlx1Reflector = m_xlx1Startup;
|
m_xlxReflector = m_xlxRoom;
|
||||||
|
|
||||||
if (voice1 != NULL) {
|
if (voice != NULL) {
|
||||||
if (m_xlx1Reflector == 4000U)
|
if (m_xlxReflector == 4000U)
|
||||||
voice1->unlinked();
|
voice->unlinked();
|
||||||
else
|
else
|
||||||
voice1->linkedTo(m_xlx1Startup);
|
voice->linkedTo(m_xlxStartup);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_xlxNetwork2 != NULL) {
|
|
||||||
bool connected = m_xlxNetwork2->isConnected();
|
|
||||||
if (connected && !m_xlx2Connected) {
|
|
||||||
if (m_xlx2Startup != 4000U) {
|
|
||||||
writeXLXLink(m_xlx2Id, m_xlx2Startup, m_xlxNetwork2);
|
|
||||||
LogMessage("%s, Linking to reflector %u at startup", m_xlx2Name.c_str(), m_xlx2Startup);
|
|
||||||
if (voice2 != NULL)
|
|
||||||
voice2->linkedTo(m_xlx2Startup);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_xlx2Reflector = m_xlx2Startup;
|
|
||||||
m_xlx2Connected = true;
|
|
||||||
m_xlx2Relink.stop();
|
|
||||||
} else if (!connected && m_xlx2Connected) {
|
|
||||||
if (m_xlx2Reflector != 4000U) {
|
|
||||||
LogMessage("%s, Unlinking due to loss of connection", m_xlx2Name.c_str());
|
|
||||||
if (voice2 != NULL)
|
|
||||||
voice2->unlinked();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_xlx2Reflector = 4000U;
|
|
||||||
m_xlx2Connected = false;
|
|
||||||
m_xlx2Relink.stop();
|
|
||||||
} else if (connected && m_xlx2Relink.isRunning() && m_xlx2Relink.hasExpired()) {
|
|
||||||
m_xlx2Relink.stop();
|
|
||||||
|
|
||||||
if (m_xlx2Startup != 4000U)
|
|
||||||
writeXLXLink(m_xlx2Id, 4000U, m_xlxNetwork2);
|
|
||||||
|
|
||||||
writeXLXLink(m_xlx2Id, m_xlx2Startup, m_xlxNetwork2);
|
|
||||||
LogMessage("%s, Re-linking to startup reflector %u due to RF inactivity timeout", m_xlx2Name.c_str(), m_xlx2Startup);
|
|
||||||
m_xlx2Reflector = m_xlx2Startup;
|
|
||||||
|
|
||||||
if (voice1 != NULL) {
|
|
||||||
if (m_xlx1Reflector == 4000U)
|
|
||||||
voice1->unlinked();
|
|
||||||
else
|
|
||||||
voice1->linkedTo(m_xlx2Startup);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -482,114 +416,64 @@ int CDMRGateway::run()
|
|||||||
unsigned int dstId = data.getDstId();
|
unsigned int dstId = data.getDstId();
|
||||||
FLCO flco = data.getFLCO();
|
FLCO flco = data.getFLCO();
|
||||||
|
|
||||||
if (flco == FLCO_GROUP && slotNo == m_xlx1Slot && dstId == m_xlx1TG) {
|
if (flco == FLCO_GROUP && slotNo == m_xlxSlot && dstId == m_xlxTG) {
|
||||||
if (m_xlx1Reflector != m_xlx1Startup)
|
if (m_xlxReflector != m_xlxRoom || m_xlxNumber != m_xlxStartup)
|
||||||
m_xlx1Relink.start();
|
m_xlxRelink.start();
|
||||||
|
|
||||||
m_xlx1Rewrite->process(data, false);
|
m_xlxRewrite->process(data, false);
|
||||||
m_xlxNetwork1->write(data);
|
m_xlxNetwork->write(data);
|
||||||
status[slotNo] = DMRGWS_XLXREFLECTOR1;
|
status[slotNo] = DMRGWS_XLXREFLECTOR;
|
||||||
timer[slotNo]->start();
|
timer[slotNo]->start();
|
||||||
} else if (flco == FLCO_GROUP && slotNo == m_xlx2Slot && dstId == m_xlx2TG) {
|
} else if ((dstId <= (m_xlxBase + 26U) || dstId == (m_xlxBase + 1000U)) && flco == FLCO_USER_USER && slotNo == m_xlxSlot && dstId >= m_xlxBase) {
|
||||||
if (m_xlx2Reflector != m_xlx2Startup)
|
|
||||||
m_xlx2Relink.start();
|
|
||||||
|
|
||||||
m_xlx2Rewrite->process(data, false);
|
|
||||||
m_xlxNetwork2->write(data);
|
|
||||||
status[slotNo] = DMRGWS_XLXREFLECTOR2;
|
|
||||||
timer[slotNo]->start();
|
|
||||||
} else if ((dstId <= (m_xlx1Base + 26U) || dstId == (m_xlx1Base + 1000U)) && flco == FLCO_USER_USER && slotNo == m_xlx1Slot && dstId >= m_xlx1Base) {
|
|
||||||
dstId += 4000U;
|
dstId += 4000U;
|
||||||
dstId -= m_xlx1Base;
|
dstId -= m_xlxBase;
|
||||||
|
|
||||||
if (dstId != m_xlx1Reflector) {
|
if (dstId != m_xlxReflector) {
|
||||||
if (dstId == 4000U) {
|
if (dstId == 4000U) {
|
||||||
LogMessage("%s, Unlinking", m_xlx1Name.c_str());
|
LogMessage("XLX, Unlinking from reflector %u in XLX%03u", m_xlxRoom, m_xlxNumber);
|
||||||
} else if (dstId == 5000U) {
|
} else if (dstId == 5000U) {
|
||||||
if (m_xlx1Reflector != 4000U)
|
if (m_xlxReflector != 4000U)
|
||||||
voice1->linkedTo(m_xlx1Reflector);
|
voice->linkedTo(m_xlxReflector);
|
||||||
else
|
else
|
||||||
voice1->unlinked();
|
voice->unlinked();
|
||||||
} else {
|
} else {
|
||||||
if (m_xlx1Reflector != 4000U)
|
if (m_xlxReflector != 4000U)
|
||||||
writeXLXLink(srcId, 4000U, m_xlxNetwork1);
|
writeXLXLink(srcId, 4000U, m_xlxNetwork);
|
||||||
|
|
||||||
LogMessage("%s, Linking to reflector %u", m_xlx1Name.c_str(), dstId);
|
LogMessage("XLX, Linking to reflector %u in XLX%03u", dstId, m_xlxNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dstId != 5000U ) {
|
if (dstId != 5000U ) {
|
||||||
writeXLXLink(srcId, dstId, m_xlxNetwork1);
|
writeXLXLink(srcId, dstId, m_xlxNetwork);
|
||||||
m_xlx1Reflector = dstId;
|
m_xlxReflector = dstId;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_xlx1Reflector != m_xlx1Startup)
|
if (m_xlxReflector != m_xlxRoom)
|
||||||
m_xlx1Relink.start();
|
m_xlxRelink.start();
|
||||||
else
|
else
|
||||||
m_xlx2Relink.stop();
|
m_xlxRelink.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
status[slotNo] = DMRGWS_XLXREFLECTOR1;
|
status[slotNo] = DMRGWS_XLXREFLECTOR;
|
||||||
timer[slotNo]->start();
|
timer[slotNo]->start();
|
||||||
|
|
||||||
if (voice1 != NULL) {
|
if (voice = NULL) {
|
||||||
unsigned char type = data.getDataType();
|
unsigned char type = data.getDataType();
|
||||||
if (type == DT_TERMINATOR_WITH_LC) {
|
if (type == DT_TERMINATOR_WITH_LC) {
|
||||||
if (changed) {
|
if (changed) {
|
||||||
if (m_xlx1Reflector == 4000U)
|
if (m_xlxReflector == 4000U)
|
||||||
voice1->unlinked();
|
voice->unlinked();
|
||||||
else
|
else
|
||||||
voice1->linkedTo(m_xlx1Reflector);
|
voice->linkedTo(m_xlxReflector);
|
||||||
changed = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if ((dstId <= (m_xlx2Base + 26U) || dstId == (m_xlx2Base + 1000U)) && flco == FLCO_USER_USER && slotNo == m_xlx2Slot && dstId >= m_xlx2Base) {
|
|
||||||
dstId += 4000U;
|
|
||||||
dstId -= m_xlx2Base;
|
|
||||||
|
|
||||||
if (dstId != m_xlx2Reflector) {
|
|
||||||
if (dstId == 4000U) {
|
|
||||||
LogMessage("%s, Unlinking", m_xlx2Name.c_str());
|
|
||||||
} else if (dstId == 5000U) {
|
|
||||||
if (m_xlx2Reflector != 4000U)
|
|
||||||
voice2->linkedTo(m_xlx2Reflector);
|
|
||||||
else
|
|
||||||
voice2->unlinked();
|
|
||||||
} else {
|
|
||||||
if (m_xlx2Reflector != 4000U)
|
|
||||||
writeXLXLink(srcId, 4000U, m_xlxNetwork2);
|
|
||||||
|
|
||||||
LogMessage("%s, Linking to reflector %u", m_xlx2Name.c_str(), dstId);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dstId != 5000U ) {
|
|
||||||
writeXLXLink(srcId, dstId, m_xlxNetwork2);
|
|
||||||
m_xlx2Reflector = dstId;
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_xlx2Reflector != m_xlx2Startup)
|
|
||||||
m_xlx2Relink.start();
|
|
||||||
else
|
|
||||||
m_xlx2Relink.stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
status[slotNo] = DMRGWS_XLXREFLECTOR2;
|
|
||||||
timer[slotNo]->start();
|
|
||||||
|
|
||||||
if (voice2 != NULL) {
|
|
||||||
unsigned char type = data.getDataType();
|
|
||||||
if (type == DT_TERMINATOR_WITH_LC) {
|
|
||||||
if (changed) {
|
|
||||||
if (m_xlx2Reflector == 4000U)
|
|
||||||
voice2->unlinked();
|
|
||||||
else
|
|
||||||
voice2->linkedTo(m_xlx2Reflector);
|
|
||||||
changed = false;
|
changed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (dstId > 8000U && dstId < 9000U && flco == FLCO_USER_USER && slotNo == m_xlxSlot) {
|
||||||
|
unsigned int number = dstId - 8000U;
|
||||||
|
if (number != m_xlxNumber)
|
||||||
|
linkXLX(number);
|
||||||
} else {
|
} else {
|
||||||
unsigned int slotNo = data.getSlotNo();
|
unsigned int slotNo = data.getSlotNo();
|
||||||
unsigned int srcId = data.getSrcId();
|
unsigned int srcId = data.getSrcId();
|
||||||
@@ -693,40 +577,20 @@ int CDMRGateway::run()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_xlxNetwork1 != NULL) {
|
if (m_xlxNetwork != NULL) {
|
||||||
ret = m_xlxNetwork1->read(data);
|
ret = m_xlxNetwork->read(data);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
if (status[m_xlx1Slot] == DMRGWS_NONE || status[m_xlx1Slot] == DMRGWS_XLXREFLECTOR1) {
|
if (status[m_xlxSlot] == DMRGWS_NONE || status[m_xlxSlot] == DMRGWS_XLXREFLECTOR) {
|
||||||
bool ret = m_rpt1Rewrite->process(data, false);
|
bool ret = m_rptRewrite->process(data, false);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
m_repeater->write(data);
|
m_repeater->write(data);
|
||||||
status[m_xlx1Slot] = DMRGWS_XLXREFLECTOR1;
|
status[m_xlxSlot] = DMRGWS_XLXREFLECTOR;
|
||||||
timer[m_xlx1Slot]->start();
|
timer[m_xlxSlot]->start();
|
||||||
} else {
|
} else {
|
||||||
unsigned int slotNo = data.getSlotNo();
|
unsigned int slotNo = data.getSlotNo();
|
||||||
unsigned int dstId = data.getDstId();
|
unsigned int dstId = data.getDstId();
|
||||||
FLCO flco = data.getFLCO();
|
FLCO flco = data.getFLCO();
|
||||||
LogWarning("%s, Unexpected data from slot %u %s%u", m_xlx1Name.c_str(), slotNo, flco == FLCO_GROUP ? "TG" : "", dstId);
|
LogWarning("XLX%03u, Unexpected data from slot %u %s%u", m_xlxNumber, slotNo, flco == FLCO_GROUP ? "TG" : "", dstId);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_xlxNetwork2 != NULL) {
|
|
||||||
ret = m_xlxNetwork2->read(data);
|
|
||||||
if (ret) {
|
|
||||||
if (status[m_xlx2Slot] == DMRGWS_NONE || status[m_xlx2Slot] == DMRGWS_XLXREFLECTOR2) {
|
|
||||||
bool ret = m_rpt2Rewrite->process(data, false);
|
|
||||||
if (ret) {
|
|
||||||
m_repeater->write(data);
|
|
||||||
status[m_xlx2Slot] = DMRGWS_XLXREFLECTOR2;
|
|
||||||
timer[m_xlx2Slot]->start();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
unsigned int slotNo = data.getSlotNo();
|
|
||||||
unsigned int dstId = data.getDstId();
|
|
||||||
FLCO flco = data.getFLCO();
|
|
||||||
LogWarning("%s, Unexpected data from slot %u %s%u", m_xlx2Name.c_str(), slotNo, flco == FLCO_GROUP ? "TG" : "", dstId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -826,10 +690,8 @@ int CDMRGateway::run()
|
|||||||
unsigned int length;
|
unsigned int length;
|
||||||
ret = m_repeater->readPosition(buffer, length);
|
ret = m_repeater->readPosition(buffer, length);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
if (m_xlxNetwork1 != NULL)
|
if (m_xlxNetwork != NULL)
|
||||||
m_xlxNetwork1->writePosition(buffer, length);
|
m_xlxNetwork->writePosition(buffer, length);
|
||||||
if (m_xlxNetwork2 != NULL)
|
|
||||||
m_xlxNetwork2->writePosition(buffer, length);
|
|
||||||
if (m_dmrNetwork1 != NULL)
|
if (m_dmrNetwork1 != NULL)
|
||||||
m_dmrNetwork1->writePosition(buffer, length);
|
m_dmrNetwork1->writePosition(buffer, length);
|
||||||
if (m_dmrNetwork2 != NULL)
|
if (m_dmrNetwork2 != NULL)
|
||||||
@@ -837,31 +699,20 @@ int CDMRGateway::run()
|
|||||||
}
|
}
|
||||||
ret = m_repeater->readTalkerAlias(buffer, length);
|
ret = m_repeater->readTalkerAlias(buffer, length);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
if (m_xlxNetwork1 != NULL)
|
if (m_xlxNetwork != NULL)
|
||||||
m_xlxNetwork1->writeTalkerAlias(buffer, length);
|
m_xlxNetwork->writeTalkerAlias(buffer, length);
|
||||||
if (m_xlxNetwork2 != NULL)
|
|
||||||
m_xlxNetwork2->writeTalkerAlias(buffer, length);
|
|
||||||
if (m_dmrNetwork1 != NULL)
|
if (m_dmrNetwork1 != NULL)
|
||||||
m_dmrNetwork1->writeTalkerAlias(buffer, length);
|
m_dmrNetwork1->writeTalkerAlias(buffer, length);
|
||||||
if (m_dmrNetwork2 != NULL)
|
if (m_dmrNetwork2 != NULL)
|
||||||
m_dmrNetwork2->writeTalkerAlias(buffer, length);
|
m_dmrNetwork2->writeTalkerAlias(buffer, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (voice1 != NULL) {
|
if (voice != NULL) {
|
||||||
ret = voice1->read(data);
|
ret = voice->read(data);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
m_repeater->write(data);
|
m_repeater->write(data);
|
||||||
status[m_xlx1Slot] = DMRGWS_XLXREFLECTOR1;
|
status[m_xlxSlot] = DMRGWS_XLXREFLECTOR;
|
||||||
timer[m_xlx1Slot]->start();
|
timer[m_xlxSlot]->start();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (voice2 != NULL) {
|
|
||||||
ret = voice2->read(data);
|
|
||||||
if (ret) {
|
|
||||||
m_repeater->write(data);
|
|
||||||
status[m_xlx2Slot] = DMRGWS_XLXREFLECTOR2;
|
|
||||||
timer[m_xlx2Slot]->start();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -870,8 +721,7 @@ int CDMRGateway::run()
|
|||||||
|
|
||||||
m_repeater->clock(ms);
|
m_repeater->clock(ms);
|
||||||
|
|
||||||
m_xlx1Relink.clock(ms);
|
m_xlxRelink.clock(ms);
|
||||||
m_xlx2Relink.clock(ms);
|
|
||||||
|
|
||||||
if (m_dmrNetwork1 != NULL)
|
if (m_dmrNetwork1 != NULL)
|
||||||
m_dmrNetwork1->clock(ms);
|
m_dmrNetwork1->clock(ms);
|
||||||
@@ -879,17 +729,11 @@ int CDMRGateway::run()
|
|||||||
if (m_dmrNetwork2 != NULL)
|
if (m_dmrNetwork2 != NULL)
|
||||||
m_dmrNetwork2->clock(ms);
|
m_dmrNetwork2->clock(ms);
|
||||||
|
|
||||||
if (m_xlxNetwork1 != NULL)
|
if (m_xlxNetwork != NULL)
|
||||||
m_xlxNetwork1->clock(ms);
|
m_xlxNetwork->clock(ms);
|
||||||
|
|
||||||
if (m_xlxNetwork2 != NULL)
|
if (voice != NULL)
|
||||||
m_xlxNetwork2->clock(ms);
|
voice->clock(ms);
|
||||||
|
|
||||||
if (voice1 != NULL)
|
|
||||||
voice1->clock(ms);
|
|
||||||
|
|
||||||
if (voice2 != NULL)
|
|
||||||
voice2->clock(ms);
|
|
||||||
|
|
||||||
for (unsigned int i = 1U; i < 3U; i++) {
|
for (unsigned int i = 1U; i < 3U; i++) {
|
||||||
timer[i]->clock(ms);
|
timer[i]->clock(ms);
|
||||||
@@ -903,8 +747,7 @@ int CDMRGateway::run()
|
|||||||
CThread::sleep(10U);
|
CThread::sleep(10U);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete voice1;
|
delete voice;
|
||||||
delete voice2;
|
|
||||||
|
|
||||||
m_repeater->close();
|
m_repeater->close();
|
||||||
delete m_repeater;
|
delete m_repeater;
|
||||||
@@ -919,19 +762,16 @@ int CDMRGateway::run()
|
|||||||
delete m_dmrNetwork2;
|
delete m_dmrNetwork2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_xlxNetwork1 != NULL) {
|
if (m_xlxNetwork != NULL) {
|
||||||
m_xlxNetwork1->close();
|
m_xlxNetwork->close();
|
||||||
delete m_xlxNetwork1;
|
delete m_xlxNetwork;
|
||||||
}
|
|
||||||
|
|
||||||
if (m_xlxNetwork2 != NULL) {
|
|
||||||
m_xlxNetwork2->close();
|
|
||||||
delete m_xlxNetwork2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete timer[1U];
|
delete timer[1U];
|
||||||
delete timer[2U];
|
delete timer[2U];
|
||||||
|
|
||||||
|
delete m_xlxReflectors;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1205,142 +1045,94 @@ bool CDMRGateway::createDMRNetwork2()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDMRGateway::createXLXNetwork1()
|
bool CDMRGateway::createXLXNetwork()
|
||||||
{
|
{
|
||||||
std::string address = m_conf.getXLXNetwork1Address();
|
std::string fileName = m_conf.getXLXNetworkFile();
|
||||||
unsigned int port = m_conf.getXLXNetwork1Port();
|
|
||||||
unsigned int local = m_conf.getXLXNetwork1Local();
|
|
||||||
m_xlx1Id = m_conf.getXLXNetwork1Id();
|
|
||||||
m_xlx1Name = m_conf.getXLXNetwork1Name();
|
|
||||||
std::string password = m_conf.getXLXNetwork1Password();
|
|
||||||
bool debug = m_conf.getXLXNetwork1Debug();
|
|
||||||
|
|
||||||
if (m_xlx1Id == 0U)
|
m_xlxReflectors = new CReflectors(fileName);
|
||||||
m_xlx1Id = m_repeater->getId();
|
|
||||||
|
|
||||||
LogInfo("XLX Network 1 Parameters");
|
bool ret = m_xlxReflectors->load();
|
||||||
LogInfo(" Name: %s", m_xlx1Name.c_str());
|
|
||||||
LogInfo(" Id: %u", m_xlx1Id);
|
|
||||||
LogInfo(" Address: %s", address.c_str());
|
|
||||||
LogInfo(" Port: %u", port);
|
|
||||||
if (local > 0U)
|
|
||||||
LogInfo(" Local: %u", local);
|
|
||||||
else
|
|
||||||
LogInfo(" Local: random");
|
|
||||||
|
|
||||||
m_xlxNetwork1 = new CDMRNetwork(address, port, local, m_xlx1Id, password, m_xlx1Name, debug);
|
|
||||||
|
|
||||||
std::string options = m_conf.getXLXNetwork1Options();
|
|
||||||
if (!options.empty()) {
|
|
||||||
LogInfo(" Options: %s", options.c_str());
|
|
||||||
m_xlxNetwork1->setOptions(options);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned char config[400U];
|
|
||||||
unsigned int len = m_repeater->getConfig(config);
|
|
||||||
|
|
||||||
m_xlxNetwork1->setConfig(config, len);
|
|
||||||
|
|
||||||
bool ret = m_xlxNetwork1->open();
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
delete m_xlxNetwork1;
|
delete m_xlxReflectors;
|
||||||
m_xlxNetwork1 = NULL;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_xlx1Slot = m_conf.getXLXNetwork1Slot();
|
m_xlxLocal = m_conf.getXLXNetworkLocal();
|
||||||
m_xlx1TG = m_conf.getXLXNetwork1TG();
|
m_xlxId = m_conf.getXLXNetworkId();
|
||||||
m_xlx1Base = m_conf.getXLXNetwork1Base();
|
m_xlxDebug = m_conf.getXLXNetworkDebug();
|
||||||
m_xlx1Startup = m_conf.getXLXNetwork1Startup();
|
|
||||||
|
|
||||||
unsigned int xlx1Relink = m_conf.getXLXNetwork1Relink();
|
if (m_xlxId == 0U)
|
||||||
|
m_xlxId = m_repeater->getId();
|
||||||
|
|
||||||
LogInfo(" Slot: %u", m_xlx1Slot);
|
m_xlxSlot = m_conf.getXLXNetworkSlot();
|
||||||
LogInfo(" TG: %u", m_xlx1TG);
|
m_xlxTG = m_conf.getXLXNetworkTG();
|
||||||
LogInfo(" Base: %u", m_xlx1Base);
|
m_xlxBase = m_conf.getXLXNetworkBase();
|
||||||
|
m_xlxStartup = m_conf.getXLXNetworkStartup();
|
||||||
|
|
||||||
if (m_xlx1Startup != 4000U)
|
unsigned int xlxRelink = m_conf.getXLXNetworkRelink();
|
||||||
LogInfo(" Startup: %u", m_xlx1Startup);
|
|
||||||
|
|
||||||
if (xlx1Relink > 0U) {
|
LogInfo("XLX Network Parameters");
|
||||||
LogInfo(" Relink: %u minutes", xlx1Relink);
|
LogInfo(" Id: %u", m_xlxId);
|
||||||
m_xlx1Relink.setTimeout(xlx1Relink * 60U);
|
LogInfo(" Hosts file: %s", fileName.c_str());
|
||||||
|
if (m_xlxLocal > 0U)
|
||||||
|
LogInfo(" Local: %u", m_xlxLocal);
|
||||||
|
else
|
||||||
|
LogInfo(" Local: random");
|
||||||
|
LogInfo(" Slot: %u", m_xlxSlot);
|
||||||
|
LogInfo(" TG: %u", m_xlxTG);
|
||||||
|
LogInfo(" Base: %u", m_xlxBase);
|
||||||
|
if (m_xlxStartup > 0U)
|
||||||
|
LogInfo(" Startup: XLX%03u", m_xlxStartup);
|
||||||
|
if (xlxRelink > 0U) {
|
||||||
|
m_xlxRelink.setTimeout(xlxRelink * 60U);
|
||||||
|
LogInfo(" Relink: %u minutes", xlxRelink);
|
||||||
} else {
|
} else {
|
||||||
LogInfo(" Relink: disabled");
|
LogInfo(" Relink: disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_rpt1Rewrite = new CRewriteTG(m_xlx1Name, XLX_SLOT, XLX_TG, m_xlx1Slot, m_xlx1TG, 1U);
|
if (m_xlxStartup > 0U)
|
||||||
m_xlx1Rewrite = new CRewriteTG(m_xlx1Name, m_xlx1Slot, m_xlx1TG, XLX_SLOT, XLX_TG, 1U);
|
linkXLX(m_xlxStartup);
|
||||||
|
|
||||||
|
m_rptRewrite = new CRewriteTG("XLX", XLX_SLOT, XLX_TG, m_xlxSlot, m_xlxTG, 1U);
|
||||||
|
m_xlxRewrite = new CRewriteTG("XLX", m_xlxSlot, m_xlxTG, XLX_SLOT, XLX_TG, 1U);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDMRGateway::createXLXNetwork2()
|
bool CDMRGateway::linkXLX(unsigned int number)
|
||||||
{
|
{
|
||||||
std::string address = m_conf.getXLXNetwork2Address();
|
CReflector* reflector = m_xlxReflectors->find(number);
|
||||||
unsigned int port = m_conf.getXLXNetwork2Port();
|
if (reflector == NULL)
|
||||||
unsigned int local = m_conf.getXLXNetwork2Local();
|
return false;
|
||||||
m_xlx2Id = m_conf.getXLXNetwork2Id();
|
|
||||||
m_xlx2Name = m_conf.getXLXNetwork2Name();
|
|
||||||
std::string password = m_conf.getXLXNetwork2Password();
|
|
||||||
bool debug = m_conf.getXLXNetwork2Debug();
|
|
||||||
|
|
||||||
if (m_xlx2Id == 0U)
|
if (m_xlxNetwork != NULL) {
|
||||||
m_xlx2Id = m_repeater->getId();
|
LogMessage("XLX, Disconnecting from XLX%03u", m_xlxNumber);
|
||||||
|
m_xlxNetwork->close();
|
||||||
LogInfo("XLX Network 2 Parameters");
|
delete m_xlxNetwork;
|
||||||
LogInfo(" Name: %s", m_xlx2Name.c_str());
|
m_xlxRelink.setTimeout(0U);
|
||||||
LogInfo(" Id: %u", m_xlx2Id);
|
|
||||||
LogInfo(" Address: %s", address.c_str());
|
|
||||||
LogInfo(" Port: %u", port);
|
|
||||||
if (local > 0U)
|
|
||||||
LogInfo(" Local: %u", local);
|
|
||||||
else
|
|
||||||
LogInfo(" Local: random");
|
|
||||||
|
|
||||||
m_xlxNetwork2 = new CDMRNetwork(address, port, local, m_xlx2Id, password, m_xlx2Name, debug);
|
|
||||||
|
|
||||||
std::string options = m_conf.getXLXNetwork2Options();
|
|
||||||
if (!options.empty()) {
|
|
||||||
LogInfo(" Options: %s", options.c_str());
|
|
||||||
m_xlxNetwork2->setOptions(options);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_xlxConnected = false;
|
||||||
|
|
||||||
|
m_xlxNetwork = new CDMRNetwork(reflector->m_address, reflector->m_port, m_xlxLocal, m_xlxId, reflector->m_password, "XLX", m_xlxDebug);
|
||||||
|
|
||||||
unsigned char config[400U];
|
unsigned char config[400U];
|
||||||
unsigned int len = m_repeater->getConfig(config);
|
unsigned int len = m_repeater->getConfig(config);
|
||||||
|
|
||||||
m_xlxNetwork2->setConfig(config, len);
|
m_xlxNetwork->setConfig(config, len);
|
||||||
|
|
||||||
bool ret = m_xlxNetwork2->open();
|
bool ret = m_xlxNetwork->open();
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
delete m_xlxNetwork2;
|
delete m_xlxNetwork;
|
||||||
m_xlxNetwork2 = NULL;
|
m_xlxNetwork = NULL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_xlx2Slot = m_conf.getXLXNetwork2Slot();
|
m_xlxNumber = number;
|
||||||
m_xlx2TG = m_conf.getXLXNetwork2TG();
|
m_xlxRoom = reflector->m_startup;
|
||||||
m_xlx2Base = m_conf.getXLXNetwork2Base();
|
m_xlxRelink.stop();
|
||||||
m_xlx2Startup = m_conf.getXLXNetwork2Startup();
|
|
||||||
|
|
||||||
unsigned int xlx2Relink = m_conf.getXLXNetwork2Relink();
|
LogMessage("XLX, Connecting to XLX%03u", m_xlxNumber);
|
||||||
|
|
||||||
LogInfo(" Slot: %u", m_xlx2Slot);
|
|
||||||
LogInfo(" TG: %u", m_xlx2TG);
|
|
||||||
LogInfo(" Base: %u", m_xlx2Base);
|
|
||||||
|
|
||||||
if (m_xlx2Startup != 4000U)
|
|
||||||
LogInfo(" Startup: %u", m_xlx2Startup);
|
|
||||||
|
|
||||||
if (xlx2Relink > 0U) {
|
|
||||||
LogInfo(" Relink: %u minutes", xlx2Relink);
|
|
||||||
m_xlx2Relink.setTimeout(xlx2Relink * 60U);
|
|
||||||
} else {
|
|
||||||
LogInfo(" Relink: disabled");
|
|
||||||
}
|
|
||||||
|
|
||||||
m_rpt2Rewrite = new CRewriteTG(m_xlx2Name, XLX_SLOT, XLX_TG, m_xlx2Slot, m_xlx2TG, 1U);
|
|
||||||
m_xlx2Rewrite = new CRewriteTG(m_xlx2Name, m_xlx2Slot, m_xlx2TG, XLX_SLOT, XLX_TG, 1U);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
46
DMRGateway.h
46
DMRGateway.h
@@ -22,6 +22,7 @@
|
|||||||
#include "RepeaterProtocol.h"
|
#include "RepeaterProtocol.h"
|
||||||
#include "MMDVMNetwork.h"
|
#include "MMDVMNetwork.h"
|
||||||
#include "DMRNetwork.h"
|
#include "DMRNetwork.h"
|
||||||
|
#include "Reflectors.h"
|
||||||
#include "RewriteTG.h"
|
#include "RewriteTG.h"
|
||||||
#include "Rewrite.h"
|
#include "Rewrite.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
@@ -44,30 +45,22 @@ private:
|
|||||||
std::string m_dmr1Name;
|
std::string m_dmr1Name;
|
||||||
CDMRNetwork* m_dmrNetwork2;
|
CDMRNetwork* m_dmrNetwork2;
|
||||||
std::string m_dmr2Name;
|
std::string m_dmr2Name;
|
||||||
CDMRNetwork* m_xlxNetwork1;
|
CReflectors* m_xlxReflectors;
|
||||||
std::string m_xlx1Name;
|
CDMRNetwork* m_xlxNetwork;
|
||||||
CDMRNetwork* m_xlxNetwork2;
|
unsigned int m_xlxId;
|
||||||
std::string m_xlx2Name;
|
unsigned int m_xlxNumber;
|
||||||
unsigned int m_xlx1Id;
|
unsigned int m_xlxReflector;
|
||||||
unsigned int m_xlx1Reflector;
|
unsigned int m_xlxSlot;
|
||||||
unsigned int m_xlx1Slot;
|
unsigned int m_xlxTG;
|
||||||
unsigned int m_xlx1TG;
|
unsigned int m_xlxBase;
|
||||||
unsigned int m_xlx1Base;
|
unsigned int m_xlxLocal;
|
||||||
unsigned int m_xlx1Startup;
|
unsigned int m_xlxStartup;
|
||||||
CTimer m_xlx1Relink;
|
unsigned int m_xlxRoom;
|
||||||
bool m_xlx1Connected;
|
CTimer m_xlxRelink;
|
||||||
CRewriteTG* m_rpt1Rewrite;
|
bool m_xlxConnected;
|
||||||
CRewriteTG* m_xlx1Rewrite;
|
bool m_xlxDebug;
|
||||||
unsigned int m_xlx2Id;
|
CRewriteTG* m_rptRewrite;
|
||||||
unsigned int m_xlx2Reflector;
|
CRewriteTG* m_xlxRewrite;
|
||||||
unsigned int m_xlx2Slot;
|
|
||||||
unsigned int m_xlx2TG;
|
|
||||||
unsigned int m_xlx2Base;
|
|
||||||
unsigned int m_xlx2Startup;
|
|
||||||
CTimer m_xlx2Relink;
|
|
||||||
bool m_xlx2Connected;
|
|
||||||
CRewriteTG* m_rpt2Rewrite;
|
|
||||||
CRewriteTG* m_xlx2Rewrite;
|
|
||||||
std::vector<CRewrite*> m_dmr1NetRewrites;
|
std::vector<CRewrite*> m_dmr1NetRewrites;
|
||||||
std::vector<CRewrite*> m_dmr1RFRewrites;
|
std::vector<CRewrite*> m_dmr1RFRewrites;
|
||||||
std::vector<CRewrite*> m_dmr2NetRewrites;
|
std::vector<CRewrite*> m_dmr2NetRewrites;
|
||||||
@@ -78,8 +71,9 @@ private:
|
|||||||
bool createMMDVM();
|
bool createMMDVM();
|
||||||
bool createDMRNetwork1();
|
bool createDMRNetwork1();
|
||||||
bool createDMRNetwork2();
|
bool createDMRNetwork2();
|
||||||
bool createXLXNetwork1();
|
bool createXLXNetwork();
|
||||||
bool createXLXNetwork2();
|
|
||||||
|
bool linkXLX(unsigned int number);
|
||||||
void writeXLXLink(unsigned int srcId, unsigned int dstId, CDMRNetwork* network);
|
void writeXLXLink(unsigned int srcId, unsigned int dstId, CDMRNetwork* network);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -20,32 +20,15 @@ Enabled=1
|
|||||||
Language=en_GB
|
Language=en_GB
|
||||||
Directory=./Audio
|
Directory=./Audio
|
||||||
|
|
||||||
[XLX Network 1]
|
[XLX Network]
|
||||||
Enabled=1
|
Enabled=1
|
||||||
Name=XLX950
|
File=XLXHosts.txt
|
||||||
Address=xlx950.epf.lu
|
|
||||||
Port=62030
|
|
||||||
# Local=3351
|
# Local=3351
|
||||||
# Options=
|
|
||||||
Slot=1
|
Slot=1
|
||||||
TG=6
|
TG=6
|
||||||
Base=64000
|
Base=64000
|
||||||
Startup=4005
|
Startup=950
|
||||||
Relink=10
|
Relink=10
|
||||||
Password=passw0rd
|
|
||||||
Debug=0
|
|
||||||
|
|
||||||
[XLX Network 2]
|
|
||||||
Enabled=0
|
|
||||||
Name=XLX000
|
|
||||||
Address=44.131.4.1
|
|
||||||
Port=62030
|
|
||||||
# Local=3351
|
|
||||||
# Options=
|
|
||||||
Slot=1
|
|
||||||
TG=7
|
|
||||||
Base=74000
|
|
||||||
Password=passw0rd
|
|
||||||
Debug=0
|
Debug=0
|
||||||
|
|
||||||
# BrandMeister
|
# BrandMeister
|
||||||
|
|||||||
@@ -173,6 +173,7 @@
|
|||||||
<ClInclude Include="PassAllPC.h" />
|
<ClInclude Include="PassAllPC.h" />
|
||||||
<ClInclude Include="PassAllTG.h" />
|
<ClInclude Include="PassAllTG.h" />
|
||||||
<ClInclude Include="QR1676.h" />
|
<ClInclude Include="QR1676.h" />
|
||||||
|
<ClInclude Include="Reflectors.h" />
|
||||||
<ClInclude Include="RepeaterProtocol.h" />
|
<ClInclude Include="RepeaterProtocol.h" />
|
||||||
<ClInclude Include="Rewrite.h" />
|
<ClInclude Include="Rewrite.h" />
|
||||||
<ClInclude Include="RewritePC.h" />
|
<ClInclude Include="RewritePC.h" />
|
||||||
@@ -212,6 +213,7 @@
|
|||||||
<ClCompile Include="PassAllPC.cpp" />
|
<ClCompile Include="PassAllPC.cpp" />
|
||||||
<ClCompile Include="PassAllTG.cpp" />
|
<ClCompile Include="PassAllTG.cpp" />
|
||||||
<ClCompile Include="QR1676.cpp" />
|
<ClCompile Include="QR1676.cpp" />
|
||||||
|
<ClCompile Include="Reflectors.cpp" />
|
||||||
<ClCompile Include="RepeaterProtocol.cpp" />
|
<ClCompile Include="RepeaterProtocol.cpp" />
|
||||||
<ClCompile Include="Rewrite.cpp" />
|
<ClCompile Include="Rewrite.cpp" />
|
||||||
<ClCompile Include="RewritePC.cpp" />
|
<ClCompile Include="RewritePC.cpp" />
|
||||||
|
|||||||
@@ -125,6 +125,9 @@
|
|||||||
<ClInclude Include="DMRDataHeader.h">
|
<ClInclude Include="DMRDataHeader.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="Reflectors.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="Conf.cpp">
|
<ClCompile Include="Conf.cpp">
|
||||||
@@ -232,5 +235,8 @@
|
|||||||
<ClCompile Include="DMRDataHeader.cpp">
|
<ClCompile Include="DMRDataHeader.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="Reflectors.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
4
Makefile
4
Makefile
@@ -5,8 +5,8 @@ LIBS = -lpthread
|
|||||||
LDFLAGS = -g
|
LDFLAGS = -g
|
||||||
|
|
||||||
OBJECTS = BPTC19696.o Conf.o CRC.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREmbeddedData.o DMREMB.o DMRFullLC.o DMRGateway.o DMRLC.o DMRNetwork.o DMRSlotType.o \
|
OBJECTS = BPTC19696.o Conf.o CRC.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREmbeddedData.o DMREMB.o DMRFullLC.o DMRGateway.o DMRLC.o DMRNetwork.o DMRSlotType.o \
|
||||||
Golay2087.o Hamming.o Log.o MMDVMNetwork.o PassAllPC.o PassAllTG.o QR1676.o RepeaterProtocol.o Rewrite.o RewritePC.o RewriteSrc.o RewriteTG.o RewriteType.o \
|
Golay2087.o Hamming.o Log.o MMDVMNetwork.o PassAllPC.o PassAllTG.o QR1676.o Reflectors.o RepeaterProtocol.o Rewrite.o RewritePC.o RewriteSrc.o RewriteTG.o \
|
||||||
RS129.o SHA256.o StopWatch.o Sync.o Thread.o Timer.o UDPSocket.o Utils.o Voice.o
|
RewriteType.o RS129.o SHA256.o StopWatch.o Sync.o Thread.o Timer.o UDPSocket.o Utils.o Voice.o
|
||||||
|
|
||||||
all: DMRGateway
|
all: DMRGateway
|
||||||
|
|
||||||
|
|||||||
97
Reflectors.cpp
Normal file
97
Reflectors.cpp
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016,2017 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 "Reflectors.h"
|
||||||
|
#include "Log.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <functional>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstring>
|
||||||
|
#include <cctype>
|
||||||
|
|
||||||
|
CReflectors::CReflectors(const std::string& hostsFile) :
|
||||||
|
m_hostsFile(hostsFile),
|
||||||
|
m_reflectors()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CReflectors::~CReflectors()
|
||||||
|
{
|
||||||
|
for (std::vector<CReflector*>::iterator it = m_reflectors.begin(); it != m_reflectors.end(); ++it)
|
||||||
|
delete *it;
|
||||||
|
|
||||||
|
m_reflectors.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CReflectors::load()
|
||||||
|
{
|
||||||
|
for (std::vector<CReflector*>::iterator it = m_reflectors.begin(); it != m_reflectors.end(); ++it)
|
||||||
|
delete *it;
|
||||||
|
|
||||||
|
m_reflectors.clear();
|
||||||
|
|
||||||
|
FILE* fp = ::fopen(m_hostsFile.c_str(), "rt");
|
||||||
|
if (fp != NULL) {
|
||||||
|
char buffer[100U];
|
||||||
|
while (::fgets(buffer, 100U, fp) != NULL) {
|
||||||
|
if (buffer[0U] == '#')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
char* p1 = ::strtok(buffer, ";\r\n");
|
||||||
|
char* p2 = ::strtok(NULL, ";\r\n");
|
||||||
|
char* p3 = ::strtok(NULL, ";\r\n");
|
||||||
|
char* p4 = ::strtok(NULL, ";\r\n");
|
||||||
|
char* p5 = ::strtok(NULL, "\r\n");
|
||||||
|
|
||||||
|
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) {
|
||||||
|
CReflector* refl = new CReflector;
|
||||||
|
refl->m_id = (unsigned int)::atoi(p1);
|
||||||
|
refl->m_address = std::string(p2);
|
||||||
|
refl->m_port = (unsigned int)::atoi(p3);
|
||||||
|
refl->m_startup = (unsigned int)::atoi(p4);
|
||||||
|
refl->m_password = std::string(p5);
|
||||||
|
m_reflectors.push_back(refl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
::fclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t size = m_reflectors.size();
|
||||||
|
LogInfo("Loaded %u XLX reflectors", size);
|
||||||
|
|
||||||
|
size = m_reflectors.size();
|
||||||
|
if (size == 0U)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
CReflector* CReflectors::find(unsigned int id)
|
||||||
|
{
|
||||||
|
for (std::vector<CReflector*>::iterator it = m_reflectors.begin(); it != m_reflectors.end(); ++it) {
|
||||||
|
if (id == (*it)->m_id)
|
||||||
|
return *it;
|
||||||
|
}
|
||||||
|
|
||||||
|
LogMessage("Trying to find non existent XLX reflector with an id of %u", id);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
57
Reflectors.h
Normal file
57
Reflectors.h
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016,2017 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(Reflectors_H)
|
||||||
|
#define Reflectors_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
class CReflector {
|
||||||
|
public:
|
||||||
|
CReflector() :
|
||||||
|
m_id(0U),
|
||||||
|
m_address(),
|
||||||
|
m_port(0U),
|
||||||
|
m_startup(0U),
|
||||||
|
m_password()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int m_id;
|
||||||
|
std::string m_address;
|
||||||
|
unsigned int m_port;
|
||||||
|
unsigned int m_startup;
|
||||||
|
std::string m_password;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CReflectors {
|
||||||
|
public:
|
||||||
|
CReflectors(const std::string& hostsFile);
|
||||||
|
~CReflectors();
|
||||||
|
|
||||||
|
bool load();
|
||||||
|
|
||||||
|
CReflector* find(unsigned int id);
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string m_hostsFile;
|
||||||
|
std::vector<CReflector*> m_reflectors;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
5
XLXHosts.txt
Normal file
5
XLXHosts.txt
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# The format of this file is:
|
||||||
|
# XLX Number;host;port;default;password
|
||||||
|
|
||||||
|
# XLX950
|
||||||
|
950;xlx950.epf.lu;62030;4005;passw0rd
|
||||||
Reference in New Issue
Block a user