always reset and set HDU parameters; add some debug trace messaging; correct issue with position count for the LDU2 being incorrect in the network;

pull/1/head
Bryan Biedenkapp 5 years ago
parent ef453a4f73
commit 529de62616

@ -719,6 +719,8 @@ bool BaseNetwork::writeP25LDU2(const uint32_t id, const uint32_t streamId, const
uint8_t mi[p25::P25_MI_LENGTH_BYTES]; uint8_t mi[p25::P25_MI_LENGTH_BYTES];
control.getMI(mi); control.getMI(mi);
// Utils::dump(1U, "LDU2 Control MI", mi, p25::P25_MI_LENGTH_BYTES);
// The '6D' record // The '6D' record
::memcpy(tempBuf, LDU2_REC6D, 17U); ::memcpy(tempBuf, LDU2_REC6D, 17U);
tempBuf[1U] = mi[0U]; tempBuf[1U] = mi[0U];
@ -774,6 +776,7 @@ bool BaseNetwork::writeP25LDU2(const uint32_t id, const uint32_t streamId, const
tempBuf[2U] = lsd.getLSD2(); tempBuf[2U] = lsd.getLSD2();
m_audio.decode(data, tempBuf + 4U, 8U); m_audio.decode(data, tempBuf + 4U, 8U);
::memcpy(buffer + 162U, tempBuf, 16U); ::memcpy(buffer + 162U, tempBuf, 16U);
count += 16U;
buffer[23U] = count; buffer[23U] = count;

@ -155,6 +155,8 @@ void Audio::decode(const uint8_t* data, uint8_t* imbe, uint32_t n)
return; return;
} }
// Utils::dump(2U, "Audio::decode()", temp, 18U);
bool bit[144U]; bool bit[144U];
// De-interleave // De-interleave
@ -334,6 +336,8 @@ void Audio::encode(uint8_t* data, const uint8_t* imbe, uint32_t n)
WRITE_BIT(temp, n, bTemp[i]); WRITE_BIT(temp, n, bTemp[i]);
} }
// Utils::dump(2U, "Audio::encode()", temp, 18U);
switch (n) { switch (n) {
case 0U: case 0U:
P25Utils::encode(temp, data, 114U, 262U); P25Utils::encode(temp, data, 114U, 262U);

@ -334,23 +334,16 @@ bool VoicePacket::process(uint8_t* data, uint32_t len)
m_p25->m_trunk->writeRF_TSDU_Grant(m_rfLC.getGroup(), true, false); m_p25->m_trunk->writeRF_TSDU_Grant(m_rfLC.getGroup(), true, false);
} }
// perform lost/corrupt HDU checking m_rfLC.reset();
if (m_rfLastHDU.getAlgId() != P25_ALGO_UNENCRYPT && m_rfLastHDU.getKId() != 0) { m_rfLC.setDstId(m_rfLastHDU.getDstId());
if ((m_rfLC.getAlgId() == P25_ALGO_UNENCRYPT && m_rfLC.getAlgId() != m_rfLastHDU.getAlgId()) && m_rfLC.setAlgId(m_rfLastHDU.getAlgId());
(m_rfLC.getKId() == 0 && m_rfLC.getKId() != m_rfLastHDU.getKId())) { m_rfLC.setKId(m_rfLastHDU.getKId());
LogWarning(LOG_RF, P25_HDU_STR ", lost or changed data, using last HDU LC");
LogWarning(LOG_RF, P25_HDU_STR ", algo = $%02X, kid = $%04X doesn't match last HDU algo = $%02X, kid = $%04X, fixing",
m_rfLC.getAlgId(), m_rfLC.getKId(), m_rfLastHDU.getAlgId(), m_rfLastHDU.getKId());
m_rfLC.setAlgId(m_rfLastHDU.getAlgId());
m_rfLC.setKId(m_rfLastHDU.getKId());
uint8_t mi[P25_MI_LENGTH_BYTES];
m_rfLastHDU.getMI(mi);
m_rfLC.setMI(mi);
m_rfLastHDU.reset(); uint8_t mi[P25_MI_LENGTH_BYTES];
} m_rfLastHDU.getMI(mi);
} m_rfLC.setMI(mi);
m_rfLastHDU.reset();
m_hadVoice = true; m_hadVoice = true;
@ -474,8 +467,8 @@ bool VoicePacket::process(uint8_t* data, uint32_t len)
} }
if (m_verbose) { if (m_verbose) {
LogMessage(LOG_RF, P25_LDU1_STR ", audio, srcId = %u, group = %u, emerg = %u, encrypt = %u, prio = %u, errs = %u/1233 (%.1f%%)", LogMessage(LOG_RF, P25_LDU1_STR ", audio, srcId = %u, dstId = %u, group = %u, emerg = %u, encrypt = %u, prio = %u, errs = %u/1233 (%.1f%%)",
m_rfLC.getSrcId(), m_rfLC.getGroup(), m_rfLC.getEmergency(), m_rfLC.getEncrypted(), m_rfLC.getPriority(), errors, float(errors) / 12.33F); m_rfLC.getSrcId(), m_rfLC.getDstId(), m_rfLC.getGroup(), m_rfLC.getEmergency(), m_rfLC.getEncrypted(), m_rfLC.getPriority(), errors, float(errors) / 12.33F);
} }
if (m_debug) { if (m_debug) {
@ -698,7 +691,7 @@ bool VoicePacket::processNetwork(uint8_t* data, uint32_t len, lc::LC& control, d
// The '6A' record - IMBE Voice 9 + Low Speed Data // The '6A' record - IMBE Voice 9 + Low Speed Data
::memcpy(m_netLDU1 + 200U, data + count, 16U); ::memcpy(m_netLDU1 + 200U, data + count, 16U);
count += 17U; count += 16U;
m_p25->m_trunk->resetStatusCommand(); m_p25->m_trunk->resetStatusCommand();
@ -751,7 +744,7 @@ bool VoicePacket::processNetwork(uint8_t* data, uint32_t len, lc::LC& control, d
// The '73' record - IMBE Voice 18 + Low Speed Data // The '73' record - IMBE Voice 18 + Low Speed Data
::memcpy(m_netLDU2 + 200U, data + count, 16U); ::memcpy(m_netLDU2 + 200U, data + count, 16U);
count += 17U; count += 16U;
m_p25->m_trunk->resetStatusCommand(); m_p25->m_trunk->resetStatusCommand();
@ -1034,6 +1027,8 @@ void VoicePacket::writeNet_HDU(const lc::LC& control, const data::LowSpeedData&
::memcpy(mi + 3U, m_netLDU2 + 76U, 3U); ::memcpy(mi + 3U, m_netLDU2 + 76U, 3U);
::memcpy(mi + 6U, m_netLDU2 + 101U, 3U); ::memcpy(mi + 6U, m_netLDU2 + 101U, 3U);
// Utils::dump(1U, "HDU Network MI", mi, P25_MI_LENGTH_BYTES);
uint8_t serviceOptions = (uint8_t)(m_netLDU1[53U]); uint8_t serviceOptions = (uint8_t)(m_netLDU1[53U]);
m_netLC.reset(); m_netLC.reset();
@ -1077,6 +1072,8 @@ void VoicePacket::writeNet_HDU(const lc::LC& control, const data::LowSpeedData&
m_p25->m_trunk->writeRF_ControlData(255U, 0U, false); m_p25->m_trunk->writeRF_ControlData(255U, 0U, false);
} }
m_p25->writeRF_Preamble();
::ActivityLog("P25", false, "network %svoice transmission from %u to %s%u", m_netLC.getEncrypted() ? "encrypted " : "", srcId, group ? "TG " : "", dstId); ::ActivityLog("P25", false, "network %svoice transmission from %u to %s%u", m_netLC.getEncrypted() ? "encrypted " : "", srcId, group ? "TG " : "", dstId);
m_rfLC.reset(); m_rfLC.reset();
@ -1093,8 +1090,6 @@ void VoicePacket::writeNet_HDU(const lc::LC& control, const data::LowSpeedData&
m_p25->m_trunk->setRFLC(m_rfLC); m_p25->m_trunk->setRFLC(m_rfLC);
m_p25->writeRF_Preamble();
if (m_p25->m_control) { if (m_p25->m_control) {
if (group && (m_lastPatchGroup != dstId) && if (group && (m_lastPatchGroup != dstId) &&
(dstId != m_p25->m_trunk->m_patchSuperGroup)) { (dstId != m_p25->m_trunk->m_patchSuperGroup)) {
@ -1326,8 +1321,8 @@ void VoicePacket::writeNet_LDU1(const lc::LC& control, const data::LowSpeedData&
} }
} }
LogMessage(LOG_NET, P25_LDU1_STR " audio, srcId = %u, group = %u, emerg = %u, encrypt = %u, prio = %u, %u%% packet loss", LogMessage(LOG_NET, P25_LDU1_STR " audio, srcId = %u, dstId = %u, group = %u, emerg = %u, encrypt = %u, prio = %u, %u%% packet loss",
m_netLC.getSrcId(), m_netLC.getGroup(), m_netLC.getEmergency(), m_netLC.getEncrypted(), m_netLC.getPriority(), loss); m_netLC.getSrcId(), m_netLC.getDstId(), m_netLC.getGroup(), m_netLC.getEmergency(), m_netLC.getEncrypted(), m_netLC.getPriority(), loss);
} }
if (m_debug) { if (m_debug) {
@ -1379,6 +1374,8 @@ void VoicePacket::writeNet_LDU2(const lc::LC& control, const data::LowSpeedData&
::memcpy(mi + 3U, m_netLDU2 + 76U, 3U); ::memcpy(mi + 3U, m_netLDU2 + 76U, 3U);
::memcpy(mi + 6U, m_netLDU2 + 101U, 3U); ::memcpy(mi + 6U, m_netLDU2 + 101U, 3U);
// Utils::dump(1U, "LDU2 Network MI", mi, P25_MI_LENGTH_BYTES);
m_netLC.setMI(mi); m_netLC.setMI(mi);
m_netLC.setAlgId(algId); m_netLC.setAlgId(algId);
m_netLC.setKId(kId); m_netLC.setKId(kId);

Loading…
Cancel
Save

Powered by TurnKey Linux.