mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-24 01:25:41 +08:00
Re-introduce optional network DMR beacons.
This commit is contained in:
11
Conf.cpp
11
Conf.cpp
@@ -130,7 +130,7 @@ m_dstarErrorReply(true),
|
|||||||
m_dstarRemoteGateway(false),
|
m_dstarRemoteGateway(false),
|
||||||
m_dstarModeHang(10U),
|
m_dstarModeHang(10U),
|
||||||
m_dmrEnabled(false),
|
m_dmrEnabled(false),
|
||||||
m_dmrBeacons(false),
|
m_dmrBeacons(DMR_BEACONS_OFF),
|
||||||
m_dmrBeaconInterval(60U),
|
m_dmrBeaconInterval(60U),
|
||||||
m_dmrBeaconDuration(3U),
|
m_dmrBeaconDuration(3U),
|
||||||
m_dmrId(0U),
|
m_dmrId(0U),
|
||||||
@@ -530,10 +530,11 @@ bool CConf::read()
|
|||||||
if (::strcmp(key, "Enable") == 0)
|
if (::strcmp(key, "Enable") == 0)
|
||||||
m_dmrEnabled = ::atoi(value) == 1;
|
m_dmrEnabled = ::atoi(value) == 1;
|
||||||
else if (::strcmp(key, "Beacons") == 0)
|
else if (::strcmp(key, "Beacons") == 0)
|
||||||
m_dmrBeacons = ::atoi(value) == 1;
|
m_dmrBeacons = ::atoi(value) == 1 ? DMR_BEACONS_NETWORK : DMR_BEACONS_OFF;
|
||||||
else if (::strcmp(key, "BeaconInterval") == 0)
|
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);
|
m_dmrBeaconInterval = (unsigned int)::atoi(value);
|
||||||
else if (::strcmp(key, "BeaconDuration") == 0)
|
} else if (::strcmp(key, "BeaconDuration") == 0)
|
||||||
m_dmrBeaconDuration = (unsigned int)::atoi(value);
|
m_dmrBeaconDuration = (unsigned int)::atoi(value);
|
||||||
else if (::strcmp(key, "Id") == 0)
|
else if (::strcmp(key, "Id") == 0)
|
||||||
m_dmrId = (unsigned int)::atoi(value);
|
m_dmrId = (unsigned int)::atoi(value);
|
||||||
@@ -1174,7 +1175,7 @@ bool CConf::getDMREnabled() const
|
|||||||
return m_dmrEnabled;
|
return m_dmrEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CConf::getDMRBeacons() const
|
DMR_BEACONS CConf::getDMRBeacons() const
|
||||||
{
|
{
|
||||||
return m_dmrBeacons;
|
return m_dmrBeacons;
|
||||||
}
|
}
|
||||||
|
|||||||
2
Conf.h
2
Conf.h
@@ -119,7 +119,7 @@ public:
|
|||||||
|
|
||||||
// The DMR section
|
// The DMR section
|
||||||
bool getDMREnabled() const;
|
bool getDMREnabled() const;
|
||||||
bool getDMRBeacons() const;
|
DMR_BEACONS getDMRBeacons() const;
|
||||||
unsigned int getDMRBeaconInterval() const;
|
unsigned int getDMRBeaconInterval() const;
|
||||||
unsigned int getDMRBeaconDuration() const;
|
unsigned int getDMRBeaconDuration() const;
|
||||||
unsigned int getDMRId() const;
|
unsigned int getDMRId() const;
|
||||||
|
|||||||
@@ -64,4 +64,10 @@ enum RPT_NET_STATE {
|
|||||||
RS_NET_DATA
|
RS_NET_DATA
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum DMR_BEACONS {
|
||||||
|
DMR_BEACONS_OFF,
|
||||||
|
DMR_BEACONS_NETWORK,
|
||||||
|
DMR_BEACONS_TIMED
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -443,7 +443,7 @@ int CMMDVMHost::run()
|
|||||||
unsigned int txHang = m_conf.getDMRTXHang();
|
unsigned int txHang = m_conf.getDMRTXHang();
|
||||||
unsigned int jitter = m_conf.getDMRNetworkJitter();
|
unsigned int jitter = m_conf.getDMRNetworkJitter();
|
||||||
m_dmrRFModeHang = m_conf.getDMRModeHang();
|
m_dmrRFModeHang = m_conf.getDMRModeHang();
|
||||||
bool dmrBeacons = m_conf.getDMRBeacons();
|
DMR_BEACONS dmrBeacons = m_conf.getDMRBeacons();
|
||||||
bool ovcm = m_conf.getDMROVCM();
|
bool ovcm = m_conf.getDMROVCM();
|
||||||
|
|
||||||
if (txHang > m_dmrRFModeHang)
|
if (txHang > m_dmrRFModeHang)
|
||||||
@@ -479,17 +479,33 @@ int CMMDVMHost::run()
|
|||||||
LogInfo(" Mode Hang: %us", m_dmrRFModeHang);
|
LogInfo(" Mode Hang: %us", m_dmrRFModeHang);
|
||||||
LogInfo(" OVCM: %s", ovcm ? "on" : "off");
|
LogInfo(" OVCM: %s", ovcm ? "on" : "off");
|
||||||
|
|
||||||
if (dmrBeacons) {
|
switch (dmrBeacons) {
|
||||||
unsigned int dmrBeaconInterval = m_conf.getDMRBeaconInterval();
|
case DMR_BEACONS_NETWORK: {
|
||||||
unsigned int dmrBeaconDuration = m_conf.getDMRBeaconDuration();
|
unsigned int dmrBeaconDuration = m_conf.getDMRBeaconDuration();
|
||||||
|
|
||||||
LogInfo(" DMR Roaming Beacon Interval: %us", dmrBeaconInterval);
|
LogInfo(" DMR Roaming Beacons Type: network");
|
||||||
LogInfo(" DMR Roaming Beacon Duration: %us", dmrBeaconDuration);
|
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);
|
LogInfo(" DMR Roaming Beacons Type: timed");
|
||||||
dmrBeaconIntervalTimer.start();
|
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);
|
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);
|
switch (dmrBeacons) {
|
||||||
if (dmrBeaconIntervalTimer.isRunning() && dmrBeaconIntervalTimer.hasExpired()) {
|
case DMR_BEACONS_TIMED:
|
||||||
if ((m_mode == MODE_IDLE || m_mode == MODE_DMR) && !m_modem->hasTX()) {
|
dmrBeaconIntervalTimer.clock(ms);
|
||||||
if (!m_fixedMode && m_mode == MODE_IDLE)
|
if (dmrBeaconIntervalTimer.isRunning() && dmrBeaconIntervalTimer.hasExpired()) {
|
||||||
setMode(MODE_DMR);
|
if ((m_mode == MODE_IDLE || m_mode == MODE_DMR) && !m_modem->hasTX()) {
|
||||||
dmrBeaconIntervalTimer.start();
|
if (!m_fixedMode && m_mode == MODE_IDLE)
|
||||||
dmrBeaconDurationTimer.start();
|
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);
|
dmrBeaconDurationTimer.clock(ms);
|
||||||
|
|||||||
Reference in New Issue
Block a user