Exemple #1
0
void CDMRSlot::insertSilence(unsigned char newSeqNo)
{
	// Check to see if we have any spaces to fill
	unsigned char seqNo = m_seqNo + 1U;
	if (newSeqNo == seqNo)
		return;

	unsigned char data[DMR_FRAME_LENGTH_BYTES + 2U];
	::memcpy(data, m_lastFrame, DMR_FRAME_LENGTH_BYTES + 2U);

	data[0U] = TAG_DATA;
	data[1U] = 0x00U;

	unsigned char n = (m_n + 1U) % 6U;

	unsigned int count = 0U;
	while (seqNo < newSeqNo) {
		if (n == 0U) {
			// Add the voice sync
			CDMRSync sync;
			sync.addSync(data + 2U, DST_BS_AUDIO);
		} else {
			// Set the embedded signalling to be nulls
			::memset(data + 16U, 0x00U, 5U);

			// Change the color code in the EMB
			// XXX Note that the PI flag is lost here
			CEMB emb;
			emb.setPI(false);
			emb.setLCSS(0U);
			emb.setColorCode(m_colorCode);
			emb.getData(data + 2U);
		}

		data[0U] = TAG_DATA;
		data[1U] = 0x00U;

		writeQueue(data);

		m_seqNo = seqNo;
		m_n     = n;

		count++;
		m_frames++;
		m_lost++;

		seqNo++;
		n = (n + 1U) % 6U;
	}

	LogMessage("DMR Slot %u, inserted %u audio frames", m_slotNo, count);
}