Add dynamic TG voice prompts and status TG.

This commit is contained in:
Jonathan Naylor
2020-04-03 16:54:35 +01:00
parent 9771b1ff0c
commit 0fef073c13
16 changed files with 651 additions and 151 deletions

View File

@@ -24,7 +24,7 @@
#include <cstdio>
#include <cassert>
CRewriteDynTGRF::CRewriteDynTGRF(const std::string& name, unsigned int slot, unsigned int fromTG, unsigned int toTG, unsigned int discTG, unsigned int range, CRewriteDynTGNet* rewriteNet) :
CRewriteDynTGRF::CRewriteDynTGRF(const std::string& name, unsigned int slot, unsigned int fromTG, unsigned int toTG, unsigned int discTG, unsigned int statusTG, unsigned int range, CRewriteDynTGNet* rewriteNet, CDynVoice* voice) :
CRewrite(),
m_name(name),
m_slot(slot),
@@ -32,11 +32,16 @@ m_fromTGStart(fromTG),
m_fromTGEnd(fromTG + range - 1U),
m_toTG(toTG),
m_discTG(discTG),
m_statusTG(statusTG),
m_rewriteNet(rewriteNet),
m_voice(voice),
m_currentTG(0U)
{
assert(slot == 1U || slot == 2U);
assert(rewriteNet != NULL);
if (voice != NULL)
voice->setSlotAndTG(slot, toTG);
}
CRewriteDynTGRF::~CRewriteDynTGRF()
@@ -45,9 +50,10 @@ CRewriteDynTGRF::~CRewriteDynTGRF()
PROCESS_RESULT CRewriteDynTGRF::process(CDMRData& data, bool trace)
{
FLCO flco = data.getFLCO();
unsigned int dstId = data.getDstId();
FLCO flco = data.getFLCO();
unsigned int dstId = data.getDstId();
unsigned int slotNo = data.getSlotNo();
unsigned char type = data.getDataType();
if (flco == FLCO_GROUP && slotNo == m_slot && dstId == m_toTG && m_currentTG != 0U) {
data.setDstId(m_currentTG);
@@ -64,13 +70,17 @@ PROCESS_RESULT CRewriteDynTGRF::process(CDMRData& data, bool trace)
if (trace)
LogDebug("Rule Trace,\tRewriteDynTGRF from %s Slot=%u Dst=TG%u: matched", m_name.c_str(), m_slot, m_discTG);
m_rewriteNet->setCurrentTG(0U);
m_currentTG = 0U;
if (type == DT_TERMINATOR_WITH_LC) {
m_rewriteNet->setCurrentTG(0U);
m_currentTG = 0U;
if (m_voice != NULL)
m_voice->unlinked();
}
return RESULT_MATCHED;
}
if (flco == FLCO_GROUP && slotNo == m_slot && dstId >= m_fromTGStart && dstId <= m_fromTGEnd) {
if (slotNo == m_slot && dstId >= m_fromTGStart && dstId <= m_fromTGEnd) {
if (trace) {
if (m_fromTGStart == m_fromTGEnd)
LogDebug("Rule Trace,\tRewriteDynTGRF from %s Slot=%u Dst=TG%u: matched", m_name.c_str(), m_slot, m_fromTGStart);
@@ -78,17 +88,37 @@ PROCESS_RESULT CRewriteDynTGRF::process(CDMRData& data, bool trace)
LogDebug("Rule Trace,\tRewriteDynTGRF from %s Slot=%u Dst=TG%u-TG%u: matched", m_name.c_str(), m_slot, m_fromTGStart, m_fromTGEnd);
}
m_rewriteNet->setCurrentTG(dstId);
m_currentTG = dstId;
data.setFLCO(FLCO_GROUP);
if (type == DT_TERMINATOR_WITH_LC) {
m_rewriteNet->setCurrentTG(dstId);
m_currentTG = dstId;
if (m_voice != NULL)
m_voice->linkedTo(dstId);
}
return RESULT_MATCHED;
}
if (flco == FLCO_GROUP && slotNo == m_slot && dstId == m_statusTG) {
if (trace)
LogDebug("Rule Trace,\tRewriteDynTGRF from %s Slot=%u Dst=TG%u: matched", m_name.c_str(), m_slot, m_statusTG);
if (type == DT_TERMINATOR_WITH_LC && m_voice != NULL) {
if (m_currentTG == 0U)
m_voice->unlinked();
else
m_voice->linkedTo(dstId);
}
return RESULT_IGNORED;
}
if (trace) {
if (m_fromTGStart == m_fromTGEnd)
LogDebug("Rule Trace,\tRewriteDynTGRF from %s Slot=%u Dst=TG%u or Dst=TG%u or Dst=TG%u: not matched", m_name.c_str(), m_slot, m_fromTGStart, m_toTG, m_discTG);
LogDebug("Rule Trace,\tRewriteDynTGRF from %s Slot=%u Dst=TG%u or Dst=TG%u or Dst=TG%u or Dst=TG%u: not matched", m_name.c_str(), m_slot, m_fromTGStart, m_toTG, m_discTG, m_statusTG);
else
LogDebug("Rule Trace,\tRewriteDynTGRF from %s Slot=%u Dst=TG%u-TG%u or Dst=TG%u or Dst=TG%u: not matched", m_name.c_str(), m_slot, m_fromTGStart, m_fromTGEnd, m_toTG, m_discTG);
LogDebug("Rule Trace,\tRewriteDynTGRF from %s Slot=%u Dst=TG%u-TG%u or Dst=TG%u or Dst=TG%u or Dst=TG%u: not matched", m_name.c_str(), m_slot, m_fromTGStart, m_fromTGEnd, m_toTG, m_discTG, m_statusTG);
}
return RESULT_UNMATCHED;