Merge remote-tracking branch 'g4klx/master'

This commit is contained in:
Andy CA6JAU
2016-12-05 20:55:52 -03:00
4 changed files with 46 additions and 43 deletions

View File

@@ -42,8 +42,6 @@ unsigned int CDMRAccessControl::m_id = 0U;
unsigned int CDMRAccessControl::m_dstRewriteID[2];
unsigned int CDMRAccessControl::m_srcID[2];
CDMRLC* CDMRAccessControl::m_lastdmrLC;
time_t CDMRAccessControl::m_time[2];
int CDMRAccessControl::m_callHang;
@@ -215,10 +213,14 @@ unsigned int CDMRAccessControl::dstIdRewrite(unsigned int did, unsigned int sid,
if (network) {
m_dstRewriteID[slot - 1U] = did;
m_srcID[slot - 1U] = sid;
// Not needed at present - for direct dial, which requires change at master end.
//memcpy(&m_lastdmrLC, &dmrLC, sizeof(dmrLC));
if (m_bmAutoRewrite && (did < 4000U || did > 5000U) && did > 0U && did != 9U && dmrLC->getFLCO() == FLCO_GROUP) {
//deal with values of did we should never rewrite for
if(did == 0U || did == 9U) {
return 0U;
};
if (m_bmAutoRewrite && (did < 4000U || did > 5000U) && dmrLC->getFLCO() == FLCO_GROUP) {
LogMessage("DMR Slot %u, Rewrite DST ID (TG) of of inbound network traffic from %u to 9", slot, did);
return 9U;
// Rewrite incoming BM voice prompts to TG 9
@@ -229,19 +231,33 @@ unsigned int CDMRAccessControl::dstIdRewrite(unsigned int did, unsigned int sid,
} else {
return 0U;
}
} else if (m_bmAutoRewrite && did == 9U && m_dstRewriteID[slot - 1U] != 9U && m_dstRewriteID[slot - 1U] != 0U && (m_time[slot - 1U] + m_callHang) > currenttime && dmrLC->getFLCO() == FLCO_GROUP) {
LogMessage("DMR Slot %u, Rewrite DST ID (TG) of outbound network traffic from %u to %u (return traffic during CallHang)", slot, did, m_dstRewriteID[slot - 1U]);
return m_dstRewriteID[slot - 1U];
} else if (m_bmAutoRewrite && (did < 4000U || did > 5000U) && did > 0U && did != 9U && did != 9990U && did < 999999U && dmrLC->getFLCO() == FLCO_USER_USER) {
m_dstRewriteID[slot - 1U] = did;
dmrLC->setFLCO(FLCO_GROUP);
LogMessage("DMR Slot %u, Rewrite outbound private call to %u Group Call (Connect talkgroup by private call)", slot, did);
return did;
} else if (m_bmAutoRewrite && (did < 4000U || did > 5000U) && did > 0U && did != 9U && did != 9990U && did > 999999U) {
m_dstRewriteID[slot - 1U] = did;
}
} else {
//deal with values of did we should never rewrite for
switch(did) {
case 0U :
return 0U;
break;
case 9990U :
LogMessage("DMR Slot %u, Outbound call to Echo on 9990 by %u", slot, sid);
return 0U;
break;
}
if (m_bmAutoRewrite && did == 9U && m_dstRewriteID[slot - 1U] != 9U && m_dstRewriteID[slot - 1U] != 0U && (m_time[slot - 1U] + m_callHang) > currenttime && dmrLC->getFLCO() == FLCO_GROUP) {
LogMessage("DMR Slot %u, Rewrite DST ID (TG) of outbound network traffic from %u to %u (return traffic during CallHang)", slot, did, m_dstRewriteID[slot - 1U]);
return m_dstRewriteID[slot - 1U];
} else if (m_bmAutoRewrite && (did < 4000U || did > 5000U) && did != 9U && did < 999999U && dmrLC->getFLCO() == FLCO_USER_USER) {
m_dstRewriteID[slot - 1U] = did;
dmrLC->setFLCO(FLCO_GROUP);
LogMessage("DMR Slot %u, Rewrite outbound private call to %u Group Call (Connect talkgroup by private call)", slot, did);
return did;
} else if (m_bmAutoRewrite && (did < 4000U || did > 5000U) && did != 9U && did > 999999U) {
m_dstRewriteID[slot - 1U] = did;
}
return 0U;
return 0U;
}
}
void CDMRAccessControl::setOverEndTime(unsigned int slot)

View File

@@ -250,7 +250,17 @@ CDMRLC* CDMREmbeddedLC::processMultiBlockEmbeddedLC()
if (!CCRC::checkFiveBit(lcData, crc))
return NULL;
return new CDMRLC(lcData);
CDMRLC* lc = new CDMRLC(lcData);
// Only generate the LC when it's the correct FLCO
switch (lc->getFLCO()) {
case FLCO_GROUP:
case FLCO_USER_USER:
return lc;
default:
delete lc;
return NULL;
}
}
// Deal with a single block embedded LC

View File

@@ -164,9 +164,6 @@ void CDMRSlot::writeModem(unsigned char *data, unsigned int len)
m_rfLC = lc;
// Store the LC for the embedded LC
m_rfEmbeddedLC.setData(*m_rfLC);
// Regenerate the LC data
fullLC.encode(*m_rfLC, data + 2U, DT_VOICE_LC_HEADER);
@@ -445,15 +442,10 @@ void CDMRSlot::writeModem(unsigned char *data, unsigned int len)
if (m_rfState == RS_RF_AUDIO) {
m_rfN = data[1U] & 0x0FU;
// Regenerate the embedded LC
unsigned char lcss = m_rfEmbeddedLC.getData(data + 2U, m_rfN);
// Regenerate the EMB
CDMREMB emb;
emb.putData(data + 2U);
// Regenerate the EMB
emb.setColorCode(m_colorCode);
emb.setLCSS(lcss);
emb.getData(data + 2U);
unsigned int errors = 0U;
@@ -502,9 +494,6 @@ void CDMRSlot::writeModem(unsigned char *data, unsigned int len)
m_rfLC = lc;
// Store the LC for the embedded LC
m_rfEmbeddedLC.setData(*m_rfLC);
// Create a dummy start frame to replace the received frame
unsigned char start[DMR_FRAME_LENGTH_BYTES + 2U];
@@ -541,11 +530,7 @@ void CDMRSlot::writeModem(unsigned char *data, unsigned int len)
m_rfN = data[1U] & 0x0FU;
// Regenerate the embedded LC
unsigned char lcss = m_rfEmbeddedLC.getData(data + 2U, m_rfN);
// Regenerate the EMB
emb.setLCSS(lcss);
emb.getData(data + 2U);
// Send the original audio frame out
@@ -1154,13 +1139,9 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
m_netErrs += m_fec.regenerateDMR(data + 2U);
m_netBits += 141U;
// Regenerate the embedded LC
unsigned char lcss = m_netEmbeddedLC.getData(data + 2U, dmrData.getN());
// Change the color code in the EMB
m_lastEMB.putData(data + 2U);
m_lastEMB.setColorCode(m_colorCode);
m_lastEMB.setLCSS(lcss);
m_lastEMB.getData(data + 2U);
data[0U] = TAG_DATA;

View File

@@ -86,10 +86,6 @@ TGRewriteSlot1=0
TGRewriteSlot2=0
BMAutoRewrite=0
BMRewriteReflectorVoicePrompts=0
DirectDial=0
TargetTG=9
#RewriteMapSlot1=
#RewritemapSlot2=
[System Fusion]
Enable=1