Re-introduce optional network DMR beacons.
This commit is contained in:
parent
079c95aac1
commit
98e0869257
11
Conf.cpp
11
Conf.cpp
|
@ -130,7 +130,7 @@ m_dstarErrorReply(true),
|
|||
m_dstarRemoteGateway(false),
|
||||
m_dstarModeHang(10U),
|
||||
m_dmrEnabled(false),
|
||||
m_dmrBeacons(false),
|
||||
m_dmrBeacons(DMR_BEACONS_OFF),
|
||||
m_dmrBeaconInterval(60U),
|
||||
m_dmrBeaconDuration(3U),
|
||||
m_dmrId(0U),
|
||||
|
@ -530,10 +530,11 @@ bool CConf::read()
|
|||
if (::strcmp(key, "Enable") == 0)
|
||||
m_dmrEnabled = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "Beacons") == 0)
|
||||
m_dmrBeacons = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "BeaconInterval") == 0)
|
||||
m_dmrBeacons = ::atoi(value) == 1 ? DMR_BEACONS_NETWORK : DMR_BEACONS_OFF;
|
||||
else if (::strcmp(key, "BeaconInterval") == 0) {
|
||||
m_dmrBeacons = m_dmrBeacons != DMR_BEACONS_OFF ? DMR_BEACONS_TIMED : DMR_BEACONS_OFF;
|
||||
m_dmrBeaconInterval = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "BeaconDuration") == 0)
|
||||
} else if (::strcmp(key, "BeaconDuration") == 0)
|
||||
m_dmrBeaconDuration = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "Id") == 0)
|
||||
m_dmrId = (unsigned int)::atoi(value);
|
||||
|
@ -1174,7 +1175,7 @@ bool CConf::getDMREnabled() const
|
|||
return m_dmrEnabled;
|
||||
}
|
||||
|
||||
bool CConf::getDMRBeacons() const
|
||||
DMR_BEACONS CConf::getDMRBeacons() const
|
||||
{
|
||||
return m_dmrBeacons;
|
||||
}
|
||||
|
|
2
Conf.h
2
Conf.h
|
@ -119,7 +119,7 @@ public:
|
|||
|
||||
// The DMR section
|
||||
bool getDMREnabled() const;
|
||||
bool getDMRBeacons() const;
|
||||
DMR_BEACONS getDMRBeacons() const;
|
||||
unsigned int getDMRBeaconInterval() const;
|
||||
unsigned int getDMRBeaconDuration() const;
|
||||
unsigned int getDMRId() const;
|
||||
|
|
|
@ -64,4 +64,10 @@ enum RPT_NET_STATE {
|
|||
RS_NET_DATA
|
||||
};
|
||||
|
||||
enum DMR_BEACONS {
|
||||
DMR_BEACONS_OFF,
|
||||
DMR_BEACONS_NETWORK,
|
||||
DMR_BEACONS_TIMED
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -443,7 +443,7 @@ int CMMDVMHost::run()
|
|||
unsigned int txHang = m_conf.getDMRTXHang();
|
||||
unsigned int jitter = m_conf.getDMRNetworkJitter();
|
||||
m_dmrRFModeHang = m_conf.getDMRModeHang();
|
||||
bool dmrBeacons = m_conf.getDMRBeacons();
|
||||
DMR_BEACONS dmrBeacons = m_conf.getDMRBeacons();
|
||||
bool ovcm = m_conf.getDMROVCM();
|
||||
|
||||
if (txHang > m_dmrRFModeHang)
|
||||
|
@ -479,17 +479,33 @@ int CMMDVMHost::run()
|
|||
LogInfo(" Mode Hang: %us", m_dmrRFModeHang);
|
||||
LogInfo(" OVCM: %s", ovcm ? "on" : "off");
|
||||
|
||||
if (dmrBeacons) {
|
||||
unsigned int dmrBeaconInterval = m_conf.getDMRBeaconInterval();
|
||||
unsigned int dmrBeaconDuration = m_conf.getDMRBeaconDuration();
|
||||
switch (dmrBeacons) {
|
||||
case DMR_BEACONS_NETWORK: {
|
||||
unsigned int dmrBeaconDuration = m_conf.getDMRBeaconDuration();
|
||||
|
||||
LogInfo(" DMR Roaming Beacon Interval: %us", dmrBeaconInterval);
|
||||
LogInfo(" DMR Roaming Beacon Duration: %us", dmrBeaconDuration);
|
||||
LogInfo(" DMR Roaming Beacons Type: network");
|
||||
LogInfo(" DMR Roaming Beacons Duration: %us", dmrBeaconDuration);
|
||||
|
||||
dmrBeaconDurationTimer.setTimeout(dmrBeaconDuration);
|
||||
dmrBeaconDurationTimer.setTimeout(dmrBeaconDuration);
|
||||
}
|
||||
break;
|
||||
case DMR_BEACONS_TIMED: {
|
||||
unsigned int dmrBeaconInterval = m_conf.getDMRBeaconInterval();
|
||||
unsigned int dmrBeaconDuration = m_conf.getDMRBeaconDuration();
|
||||
|
||||
dmrBeaconIntervalTimer.setTimeout(dmrBeaconInterval);
|
||||
dmrBeaconIntervalTimer.start();
|
||||
LogInfo(" DMR Roaming Beacons Type: timed");
|
||||
LogInfo(" DMR Roaming Beacons Interval: %us", dmrBeaconInterval);
|
||||
LogInfo(" DMR Roaming Beacons Duration: %us", dmrBeaconDuration);
|
||||
|
||||
dmrBeaconDurationTimer.setTimeout(dmrBeaconDuration);
|
||||
|
||||
dmrBeaconIntervalTimer.setTimeout(dmrBeaconInterval);
|
||||
dmrBeaconIntervalTimer.start();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
LogInfo(" DMR Roaming Beacons Type: off");
|
||||
break;
|
||||
}
|
||||
|
||||
m_dmr = new CDMRControl(id, colorCode, callHang, selfOnly, embeddedLCOnly, dumpTAData, prefixes, blackList, whiteList, slot1TGWhiteList, slot2TGWhiteList, m_timeout, m_modem, m_dmrNetwork, m_display, m_duplex, m_dmrLookup, rssi, jitter, ovcm);
|
||||
|
@ -977,14 +993,32 @@ int CMMDVMHost::run()
|
|||
}
|
||||
}
|
||||
|
||||
dmrBeaconIntervalTimer.clock(ms);
|
||||
if (dmrBeaconIntervalTimer.isRunning() && dmrBeaconIntervalTimer.hasExpired()) {
|
||||
if ((m_mode == MODE_IDLE || m_mode == MODE_DMR) && !m_modem->hasTX()) {
|
||||
if (!m_fixedMode && m_mode == MODE_IDLE)
|
||||
setMode(MODE_DMR);
|
||||
dmrBeaconIntervalTimer.start();
|
||||
dmrBeaconDurationTimer.start();
|
||||
}
|
||||
switch (dmrBeacons) {
|
||||
case DMR_BEACONS_TIMED:
|
||||
dmrBeaconIntervalTimer.clock(ms);
|
||||
if (dmrBeaconIntervalTimer.isRunning() && dmrBeaconIntervalTimer.hasExpired()) {
|
||||
if ((m_mode == MODE_IDLE || m_mode == MODE_DMR) && !m_modem->hasTX()) {
|
||||
if (!m_fixedMode && m_mode == MODE_IDLE)
|
||||
setMode(MODE_DMR);
|
||||
dmrBeaconIntervalTimer.start();
|
||||
dmrBeaconDurationTimer.start();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DMR_BEACONS_NETWORK:
|
||||
if (m_dmrNetwork != NULL) {
|
||||
bool beacon = m_dmrNetwork->wantsBeacon();
|
||||
if (beacon) {
|
||||
if ((m_mode == MODE_IDLE || m_mode == MODE_DMR) && !m_modem->hasTX()) {
|
||||
if (!m_fixedMode && m_mode == MODE_IDLE)
|
||||
setMode(MODE_DMR);
|
||||
dmrBeaconDurationTimer.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
dmrBeaconDurationTimer.clock(ms);
|
||||
|
|
Loading…
Reference in a new issue