mirror of
https://github.com/g4klx/DMRGateway
synced 2025-12-21 21:45:39 +08:00
Add seperate timeouts for RF and network.
This commit is contained in:
18
Conf.cpp
18
Conf.cpp
@@ -44,7 +44,8 @@ m_rptAddress("127.0.0.1"),
|
|||||||
m_rptPort(62032U),
|
m_rptPort(62032U),
|
||||||
m_localAddress("127.0.0.1"),
|
m_localAddress("127.0.0.1"),
|
||||||
m_localPort(62031U),
|
m_localPort(62031U),
|
||||||
m_timeout(10U),
|
m_rfTimeout(10U),
|
||||||
|
m_netTimeout(10U),
|
||||||
m_ruleTrace(false),
|
m_ruleTrace(false),
|
||||||
m_debug(false),
|
m_debug(false),
|
||||||
m_voiceEnabled(true),
|
m_voiceEnabled(true),
|
||||||
@@ -169,7 +170,11 @@ bool CConf::read()
|
|||||||
if (::strcmp(key, "Daemon") == 0)
|
if (::strcmp(key, "Daemon") == 0)
|
||||||
m_daemon = ::atoi(value) == 1;
|
m_daemon = ::atoi(value) == 1;
|
||||||
else if (::strcmp(key, "Timeout") == 0)
|
else if (::strcmp(key, "Timeout") == 0)
|
||||||
m_timeout = (unsigned int)::atoi(value);
|
m_rfTimeout = m_netTimeout = (unsigned int)::atoi(value);
|
||||||
|
else if (::strcmp(key, "RFTimeout") == 0)
|
||||||
|
m_rfTimeout = (unsigned int)::atoi(value);
|
||||||
|
else if (::strcmp(key, "NetTimeout") == 0)
|
||||||
|
m_netTimeout = (unsigned int)::atoi(value);
|
||||||
else if (::strcmp(key, "RptAddress") == 0)
|
else if (::strcmp(key, "RptAddress") == 0)
|
||||||
m_rptAddress = value;
|
m_rptAddress = value;
|
||||||
else if (::strcmp(key, "RptPort") == 0)
|
else if (::strcmp(key, "RptPort") == 0)
|
||||||
@@ -461,9 +466,14 @@ unsigned int CConf::getLocalPort() const
|
|||||||
return m_localPort;
|
return m_localPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CConf::getTimeout() const
|
unsigned int CConf::getRFTimeout() const
|
||||||
{
|
{
|
||||||
return m_timeout;
|
return m_rfTimeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int CConf::getNetTimeout() const
|
||||||
|
{
|
||||||
|
return m_netTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CConf::getRuleTrace() const
|
bool CConf::getRuleTrace() const
|
||||||
|
|||||||
6
Conf.h
6
Conf.h
@@ -63,7 +63,8 @@ public:
|
|||||||
|
|
||||||
// The General section
|
// The General section
|
||||||
bool getDaemon() const;
|
bool getDaemon() const;
|
||||||
unsigned int getTimeout() const;
|
unsigned int getRFTimeout() const;
|
||||||
|
unsigned int getNetTimeout() const;
|
||||||
std::string getRptAddress() const;
|
std::string getRptAddress() const;
|
||||||
unsigned int getRptPort() const;
|
unsigned int getRptPort() const;
|
||||||
std::string getLocalAddress() const;
|
std::string getLocalAddress() const;
|
||||||
@@ -157,7 +158,8 @@ private:
|
|||||||
unsigned int m_rptPort;
|
unsigned int m_rptPort;
|
||||||
std::string m_localAddress;
|
std::string m_localAddress;
|
||||||
unsigned int m_localPort;
|
unsigned int m_localPort;
|
||||||
unsigned int m_timeout;
|
unsigned int m_rfTimeout;
|
||||||
|
unsigned int m_netTimeout;
|
||||||
bool m_ruleTrace;
|
bool m_ruleTrace;
|
||||||
bool m_debug;
|
bool m_debug;
|
||||||
|
|
||||||
|
|||||||
@@ -329,7 +329,8 @@ int CDMRGateway::run()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int timeout = m_conf.getTimeout();
|
unsigned int rfTimeout = m_conf.getRFTimeout();
|
||||||
|
unsigned int netTimeout = m_conf.getNetTimeout();
|
||||||
|
|
||||||
CVoice* voice1 = NULL;
|
CVoice* voice1 = NULL;
|
||||||
CVoice* voice2 = NULL;
|
CVoice* voice2 = NULL;
|
||||||
@@ -362,8 +363,8 @@ int CDMRGateway::run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
CTimer* timer[3U];
|
CTimer* timer[3U];
|
||||||
timer[1U] = new CTimer(1000U, timeout);
|
timer[1U] = new CTimer(1000U);
|
||||||
timer[2U] = new CTimer(1000U, timeout);
|
timer[2U] = new CTimer(1000U);
|
||||||
|
|
||||||
DMRGW_STATUS status[3U];
|
DMRGW_STATUS status[3U];
|
||||||
status[1U] = DMRGWS_NONE;
|
status[1U] = DMRGWS_NONE;
|
||||||
@@ -489,6 +490,7 @@ int CDMRGateway::run()
|
|||||||
m_xlx1Rewrite->process(data, false);
|
m_xlx1Rewrite->process(data, false);
|
||||||
m_xlxNetwork1->write(data);
|
m_xlxNetwork1->write(data);
|
||||||
status[slotNo] = DMRGWS_XLXREFLECTOR1;
|
status[slotNo] = DMRGWS_XLXREFLECTOR1;
|
||||||
|
timer[slotNo]->setTimeout(rfTimeout);
|
||||||
timer[slotNo]->start();
|
timer[slotNo]->start();
|
||||||
} else if (flco == FLCO_GROUP && slotNo == m_xlx2Slot && dstId == m_xlx2TG) {
|
} else if (flco == FLCO_GROUP && slotNo == m_xlx2Slot && dstId == m_xlx2TG) {
|
||||||
if (m_xlx2Reflector != m_xlx2Startup)
|
if (m_xlx2Reflector != m_xlx2Startup)
|
||||||
@@ -497,6 +499,7 @@ int CDMRGateway::run()
|
|||||||
m_xlx2Rewrite->process(data, false);
|
m_xlx2Rewrite->process(data, false);
|
||||||
m_xlxNetwork2->write(data);
|
m_xlxNetwork2->write(data);
|
||||||
status[slotNo] = DMRGWS_XLXREFLECTOR2;
|
status[slotNo] = DMRGWS_XLXREFLECTOR2;
|
||||||
|
timer[slotNo]->setTimeout(rfTimeout);
|
||||||
timer[slotNo]->start();
|
timer[slotNo]->start();
|
||||||
} else if ((dstId <= (m_xlx1Base + 26U) || dstId == (m_xlx1Base + 1000U)) && flco == FLCO_USER_USER && slotNo == m_xlx1Slot && dstId >= m_xlx1Base) {
|
} else if ((dstId <= (m_xlx1Base + 26U) || dstId == (m_xlx1Base + 1000U)) && flco == FLCO_USER_USER && slotNo == m_xlx1Slot && dstId >= m_xlx1Base) {
|
||||||
dstId += 4000U;
|
dstId += 4000U;
|
||||||
@@ -530,6 +533,7 @@ int CDMRGateway::run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
status[slotNo] = DMRGWS_XLXREFLECTOR1;
|
status[slotNo] = DMRGWS_XLXREFLECTOR1;
|
||||||
|
timer[slotNo]->setTimeout(rfTimeout);
|
||||||
timer[slotNo]->start();
|
timer[slotNo]->start();
|
||||||
|
|
||||||
if (voice1 != NULL) {
|
if (voice1 != NULL) {
|
||||||
@@ -576,6 +580,7 @@ int CDMRGateway::run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
status[slotNo] = DMRGWS_XLXREFLECTOR2;
|
status[slotNo] = DMRGWS_XLXREFLECTOR2;
|
||||||
|
timer[slotNo]->setTimeout(rfTimeout);
|
||||||
timer[slotNo]->start();
|
timer[slotNo]->start();
|
||||||
|
|
||||||
if (voice2 != NULL) {
|
if (voice2 != NULL) {
|
||||||
@@ -622,6 +627,7 @@ int CDMRGateway::run()
|
|||||||
if (status[slotNo] == DMRGWS_NONE || status[slotNo] == DMRGWS_DMRNETWORK1) {
|
if (status[slotNo] == DMRGWS_NONE || status[slotNo] == DMRGWS_DMRNETWORK1) {
|
||||||
m_dmrNetwork1->write(data);
|
m_dmrNetwork1->write(data);
|
||||||
status[slotNo] = DMRGWS_DMRNETWORK1;
|
status[slotNo] = DMRGWS_DMRNETWORK1;
|
||||||
|
timer[slotNo]->setTimeout(rfTimeout);
|
||||||
timer[slotNo]->start();
|
timer[slotNo]->start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -642,6 +648,7 @@ int CDMRGateway::run()
|
|||||||
if (status[slotNo] == DMRGWS_NONE || status[slotNo] == DMRGWS_DMRNETWORK2) {
|
if (status[slotNo] == DMRGWS_NONE || status[slotNo] == DMRGWS_DMRNETWORK2) {
|
||||||
m_dmrNetwork2->write(data);
|
m_dmrNetwork2->write(data);
|
||||||
status[slotNo] = DMRGWS_DMRNETWORK2;
|
status[slotNo] = DMRGWS_DMRNETWORK2;
|
||||||
|
timer[slotNo]->setTimeout(rfTimeout);
|
||||||
timer[slotNo]->start();
|
timer[slotNo]->start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -662,6 +669,7 @@ int CDMRGateway::run()
|
|||||||
if (status[slotNo] == DMRGWS_NONE || status[slotNo] == DMRGWS_DMRNETWORK1) {
|
if (status[slotNo] == DMRGWS_NONE || status[slotNo] == DMRGWS_DMRNETWORK1) {
|
||||||
m_dmrNetwork1->write(data);
|
m_dmrNetwork1->write(data);
|
||||||
status[slotNo] = DMRGWS_DMRNETWORK1;
|
status[slotNo] = DMRGWS_DMRNETWORK1;
|
||||||
|
timer[slotNo]->setTimeout(rfTimeout);
|
||||||
timer[slotNo]->start();
|
timer[slotNo]->start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -682,6 +690,7 @@ int CDMRGateway::run()
|
|||||||
if (status[slotNo] == DMRGWS_NONE || status[slotNo] == DMRGWS_DMRNETWORK2) {
|
if (status[slotNo] == DMRGWS_NONE || status[slotNo] == DMRGWS_DMRNETWORK2) {
|
||||||
m_dmrNetwork2->write(data);
|
m_dmrNetwork2->write(data);
|
||||||
status[slotNo] = DMRGWS_DMRNETWORK2;
|
status[slotNo] = DMRGWS_DMRNETWORK2;
|
||||||
|
timer[slotNo]->setTimeout(rfTimeout);
|
||||||
timer[slotNo]->start();
|
timer[slotNo]->start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -701,6 +710,7 @@ int CDMRGateway::run()
|
|||||||
if (ret) {
|
if (ret) {
|
||||||
m_repeater->write(data);
|
m_repeater->write(data);
|
||||||
status[m_xlx1Slot] = DMRGWS_XLXREFLECTOR1;
|
status[m_xlx1Slot] = DMRGWS_XLXREFLECTOR1;
|
||||||
|
timer[m_xlx1Slot]->setTimeout(netTimeout);
|
||||||
timer[m_xlx1Slot]->start();
|
timer[m_xlx1Slot]->start();
|
||||||
} else {
|
} else {
|
||||||
unsigned int slotNo = data.getSlotNo();
|
unsigned int slotNo = data.getSlotNo();
|
||||||
@@ -720,6 +730,7 @@ int CDMRGateway::run()
|
|||||||
if (ret) {
|
if (ret) {
|
||||||
m_repeater->write(data);
|
m_repeater->write(data);
|
||||||
status[m_xlx2Slot] = DMRGWS_XLXREFLECTOR2;
|
status[m_xlx2Slot] = DMRGWS_XLXREFLECTOR2;
|
||||||
|
timer[m_xlx2Slot]->setTimeout(netTimeout);
|
||||||
timer[m_xlx2Slot]->start();
|
timer[m_xlx2Slot]->start();
|
||||||
} else {
|
} else {
|
||||||
unsigned int slotNo = data.getSlotNo();
|
unsigned int slotNo = data.getSlotNo();
|
||||||
@@ -765,6 +776,7 @@ int CDMRGateway::run()
|
|||||||
if (status[slotNo] == DMRGWS_NONE || status[slotNo] == DMRGWS_DMRNETWORK1) {
|
if (status[slotNo] == DMRGWS_NONE || status[slotNo] == DMRGWS_DMRNETWORK1) {
|
||||||
m_repeater->write(data);
|
m_repeater->write(data);
|
||||||
status[slotNo] = DMRGWS_DMRNETWORK1;
|
status[slotNo] = DMRGWS_DMRNETWORK1;
|
||||||
|
timer[slotNo]->setTimeout(netTimeout);
|
||||||
timer[slotNo]->start();
|
timer[slotNo]->start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -812,6 +824,7 @@ int CDMRGateway::run()
|
|||||||
if (status[slotNo] == DMRGWS_NONE || status[slotNo] == DMRGWS_DMRNETWORK2) {
|
if (status[slotNo] == DMRGWS_NONE || status[slotNo] == DMRGWS_DMRNETWORK2) {
|
||||||
m_repeater->write(data);
|
m_repeater->write(data);
|
||||||
status[slotNo] = DMRGWS_DMRNETWORK2;
|
status[slotNo] = DMRGWS_DMRNETWORK2;
|
||||||
|
timer[slotNo]->setTimeout(netTimeout);
|
||||||
timer[slotNo]->start();
|
timer[slotNo]->start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -855,6 +868,7 @@ int CDMRGateway::run()
|
|||||||
if (ret) {
|
if (ret) {
|
||||||
m_repeater->write(data);
|
m_repeater->write(data);
|
||||||
status[m_xlx1Slot] = DMRGWS_XLXREFLECTOR1;
|
status[m_xlx1Slot] = DMRGWS_XLXREFLECTOR1;
|
||||||
|
timer[m_xlx1Slot]->setTimeout(netTimeout);
|
||||||
timer[m_xlx1Slot]->start();
|
timer[m_xlx1Slot]->start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -864,6 +878,7 @@ int CDMRGateway::run()
|
|||||||
if (ret) {
|
if (ret) {
|
||||||
m_repeater->write(data);
|
m_repeater->write(data);
|
||||||
status[m_xlx2Slot] = DMRGWS_XLXREFLECTOR2;
|
status[m_xlx2Slot] = DMRGWS_XLXREFLECTOR2;
|
||||||
|
timer[m_xlx2Slot]->setTimeout(netTimeout);
|
||||||
timer[m_xlx2Slot]->start();
|
timer[m_xlx2Slot]->start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
[General]
|
[General]
|
||||||
Timeout=10
|
Timeout=10
|
||||||
|
# RFTimeout=10
|
||||||
|
# NetTimeout=7
|
||||||
RptAddress=127.0.0.1
|
RptAddress=127.0.0.1
|
||||||
RptPort=62032
|
RptPort=62032
|
||||||
LocalAddress=127.0.0.1
|
LocalAddress=127.0.0.1
|
||||||
|
|||||||
Reference in New Issue
Block a user