Add the BER and a future RSSI to the DMR data.

This commit is contained in:
Jonathan Naylor
2016-03-23 17:30:06 +00:00
parent 1df9c159cb
commit 49a278a952
5 changed files with 58 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015 Jonathan Naylor, G4KLX * Copyright (C) 2015,2016 Jonathan Naylor, G4KLX
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -29,7 +29,9 @@ m_dstId(data.m_dstId),
m_flco(data.m_flco), m_flco(data.m_flco),
m_dataType(data.m_dataType), m_dataType(data.m_dataType),
m_seqNo(data.m_seqNo), m_seqNo(data.m_seqNo),
m_n(data.m_n) m_n(data.m_n),
m_ber(data.m_ber),
m_rssi(data.m_rssi)
{ {
m_data = new unsigned char[2U * DMR_FRAME_LENGTH_BYTES]; m_data = new unsigned char[2U * DMR_FRAME_LENGTH_BYTES];
::memcpy(m_data, data.m_data, 2U * DMR_FRAME_LENGTH_BYTES); ::memcpy(m_data, data.m_data, 2U * DMR_FRAME_LENGTH_BYTES);
@@ -43,7 +45,9 @@ m_dstId(0U),
m_flco(FLCO_GROUP), m_flco(FLCO_GROUP),
m_dataType(0U), m_dataType(0U),
m_seqNo(0U), m_seqNo(0U),
m_n(0U) m_n(0U),
m_ber(0U),
m_rssi(0U)
{ {
m_data = new unsigned char[2U * DMR_FRAME_LENGTH_BYTES]; m_data = new unsigned char[2U * DMR_FRAME_LENGTH_BYTES];
} }
@@ -65,6 +69,8 @@ CDMRData& CDMRData::operator=(const CDMRData& data)
m_dataType = data.m_dataType; m_dataType = data.m_dataType;
m_seqNo = data.m_seqNo; m_seqNo = data.m_seqNo;
m_n = data.m_n; m_n = data.m_n;
m_ber = data.m_ber;
m_rssi = data.m_rssi;
} }
return *this; return *this;
@@ -142,6 +148,26 @@ void CDMRData::setN(unsigned char n)
m_n = n; m_n = n;
} }
unsigned char CDMRData::getBER() const
{
return m_ber;
}
void CDMRData::setBER(unsigned char ber)
{
m_ber = ber;
}
unsigned char CDMRData::getRSSI() const
{
return m_rssi;
}
void CDMRData::setRSSI(unsigned char rssi)
{
m_rssi = rssi;
}
unsigned int CDMRData::getData(unsigned char* buffer) const unsigned int CDMRData::getData(unsigned char* buffer) const
{ {
assert(buffer != NULL); assert(buffer != NULL);

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015 by Jonathan Naylor, G4KLX * Copyright (C) 2015,2016 by Jonathan Naylor, G4KLX
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -45,6 +45,12 @@ public:
unsigned char getDataType() const; unsigned char getDataType() const;
void setDataType(unsigned char dataType); void setDataType(unsigned char dataType);
unsigned char getBER() const;
void setBER(unsigned char ber);
unsigned char getRSSI() const;
void setRSSI(unsigned char ber);
void setData(const unsigned char* buffer); void setData(const unsigned char* buffer);
unsigned int getData(unsigned char* buffer) const; unsigned int getData(unsigned char* buffer) const;
@@ -57,6 +63,8 @@ private:
unsigned char m_dataType; unsigned char m_dataType;
unsigned char m_seqNo; unsigned char m_seqNo;
unsigned char m_n; unsigned char m_n;
unsigned char m_ber;
unsigned char m_rssi;
}; };
#endif #endif

View File

@@ -28,7 +28,7 @@
const unsigned int BUFFER_LENGTH = 500U; const unsigned int BUFFER_LENGTH = 500U;
const unsigned int HOMEBREW_DATA_PACKET_LENGTH = 53U; const unsigned int HOMEBREW_DATA_PACKET_LENGTH = 55U;
CDMRIPSC::CDMRIPSC(const std::string& address, unsigned int port, unsigned int id, const std::string& password, bool duplex, const char* version, bool debug, bool slot1, bool slot2) : CDMRIPSC::CDMRIPSC(const std::string& address, unsigned int port, unsigned int id, const std::string& password, bool duplex, const char* version, bool debug, bool slot1, bool slot2) :
@@ -265,6 +265,10 @@ bool CDMRIPSC::write(const CDMRData& data)
data.getData(buffer + 20U); data.getData(buffer + 20U);
buffer[53U] = data.getBER();
buffer[54U] = data.getRSSI();
if (m_debug) if (m_debug)
CUtils::dump(1U, "IPSC Transmitted", buffer, HOMEBREW_DATA_PACKET_LENGTH); CUtils::dump(1U, "IPSC Transmitted", buffer, HOMEBREW_DATA_PACKET_LENGTH);

View File

@@ -394,9 +394,10 @@ void CDMRSlot::writeModem(unsigned char *data)
// Convert the Audio Sync to be from the BS // Convert the Audio Sync to be from the BS
CSync::addDMRAudioSync(data + 2U); CSync::addDMRAudioSync(data + 2U);
unsigned int errors = 0U;
unsigned char fid = m_rfLC->getFID(); unsigned char fid = m_rfLC->getFID();
if (fid == FID_ETSI || fid == FID_DMRA) { if (fid == FID_ETSI || fid == FID_DMRA) {
unsigned int errors = m_fec.regenerateDMR(data + 2U); errors = m_fec.regenerateDMR(data + 2U);
LogDebug("DMR Slot %u, audio sequence no. 0, errs: %u/141", m_slotNo, errors); LogDebug("DMR Slot %u, audio sequence no. 0, errs: %u/141", m_slotNo, errors);
m_rfErrs += errors; m_rfErrs += errors;
} }
@@ -409,7 +410,7 @@ void CDMRSlot::writeModem(unsigned char *data)
if (m_duplex) if (m_duplex)
writeQueueRF(data); writeQueueRF(data);
writeNetworkRF(data, DT_VOICE_SYNC); writeNetworkRF(data, DT_VOICE_SYNC, errors);
} else if (m_rfState == RS_RF_LISTENING) { } else if (m_rfState == RS_RF_LISTENING) {
m_rfState = RS_RF_LATE_ENTRY; m_rfState = RS_RF_LATE_ENTRY;
} }
@@ -428,9 +429,10 @@ void CDMRSlot::writeModem(unsigned char *data)
emb.setLCSS(lcss); emb.setLCSS(lcss);
emb.getData(data + 2U); emb.getData(data + 2U);
unsigned int errors = 0U;
unsigned char fid = m_rfLC->getFID(); unsigned char fid = m_rfLC->getFID();
if (fid == FID_ETSI || fid == FID_DMRA) { if (fid == FID_ETSI || fid == FID_DMRA) {
unsigned int errors = m_fec.regenerateDMR(data + 2U); errors = m_fec.regenerateDMR(data + 2U);
LogDebug("DMR Slot %u, audio sequence no. %u, errs: %u/141", m_slotNo, m_rfN, errors); LogDebug("DMR Slot %u, audio sequence no. %u, errs: %u/141", m_slotNo, m_rfN, errors);
m_rfErrs += errors; m_rfErrs += errors;
} }
@@ -443,7 +445,7 @@ void CDMRSlot::writeModem(unsigned char *data)
if (m_duplex) if (m_duplex)
writeQueueRF(data); writeQueueRF(data);
writeNetworkRF(data, DT_VOICE); writeNetworkRF(data, DT_VOICE, errors);
} else if (m_rfState == RS_RF_LATE_ENTRY) { } else if (m_rfState == RS_RF_LATE_ENTRY) {
CDMREMB emb; CDMREMB emb;
emb.putData(data + 2U); emb.putData(data + 2U);
@@ -498,9 +500,10 @@ void CDMRSlot::writeModem(unsigned char *data)
emb.getData(data + 2U); emb.getData(data + 2U);
// Send the original audio frame out // Send the original audio frame out
unsigned int errors = 0U;
unsigned char fid = m_rfLC->getFID(); unsigned char fid = m_rfLC->getFID();
if (fid == FID_ETSI || fid == FID_DMRA) { if (fid == FID_ETSI || fid == FID_DMRA) {
unsigned int errors = m_fec.regenerateDMR(data + 2U); errors = m_fec.regenerateDMR(data + 2U);
LogDebug("DMR Slot %u, audio sequence no. %u, errs: %u/141", m_slotNo, m_rfN, errors); LogDebug("DMR Slot %u, audio sequence no. %u, errs: %u/141", m_slotNo, m_rfN, errors);
m_rfErrs += errors; m_rfErrs += errors;
} }
@@ -513,7 +516,7 @@ void CDMRSlot::writeModem(unsigned char *data)
if (m_duplex) if (m_duplex)
writeQueueRF(data); writeQueueRF(data);
writeNetworkRF(data, DT_VOICE); writeNetworkRF(data, DT_VOICE, errors);
m_rfState = RS_RF_AUDIO; m_rfState = RS_RF_AUDIO;
@@ -1133,7 +1136,7 @@ void CDMRSlot::writeQueueRF(const unsigned char *data)
m_queue.addData(data, len); m_queue.addData(data, len);
} }
void CDMRSlot::writeNetworkRF(const unsigned char* data, unsigned char dataType, FLCO flco, unsigned int srcId, unsigned int dstId) void CDMRSlot::writeNetworkRF(const unsigned char* data, unsigned char dataType, FLCO flco, unsigned int srcId, unsigned int dstId, unsigned char errors)
{ {
assert(data != NULL); assert(data != NULL);
@@ -1155,6 +1158,7 @@ void CDMRSlot::writeNetworkRF(const unsigned char* data, unsigned char dataType,
dmrData.setFLCO(flco); dmrData.setFLCO(flco);
dmrData.setN(m_rfN); dmrData.setN(m_rfN);
dmrData.setSeqNo(m_rfSeqNo); dmrData.setSeqNo(m_rfSeqNo);
dmrData.setBER(errors);
m_rfSeqNo++; m_rfSeqNo++;
@@ -1163,12 +1167,12 @@ void CDMRSlot::writeNetworkRF(const unsigned char* data, unsigned char dataType,
m_network->write(dmrData); m_network->write(dmrData);
} }
void CDMRSlot::writeNetworkRF(const unsigned char* data, unsigned char dataType) void CDMRSlot::writeNetworkRF(const unsigned char* data, unsigned char dataType, unsigned char errors)
{ {
assert(data != NULL); assert(data != NULL);
assert(m_rfLC != NULL); assert(m_rfLC != NULL);
writeNetworkRF(data, dataType, m_rfLC->getFLCO(), m_rfLC->getSrcId(), m_rfLC->getDstId()); writeNetworkRF(data, dataType, m_rfLC->getFLCO(), m_rfLC->getSrcId(), m_rfLC->getDstId(), errors);
} }
void CDMRSlot::writeQueueNet(const unsigned char *data) void CDMRSlot::writeQueueNet(const unsigned char *data)

View File

@@ -99,8 +99,8 @@ private:
void writeQueueRF(const unsigned char* data); void writeQueueRF(const unsigned char* data);
void writeQueueNet(const unsigned char* data); void writeQueueNet(const unsigned char* data);
void writeNetworkRF(const unsigned char* data, unsigned char dataType); void writeNetworkRF(const unsigned char* data, unsigned char dataType, unsigned char errors = 0U);
void writeNetworkRF(const unsigned char* data, unsigned char dataType, FLCO flco, unsigned int srcId, unsigned int dstId); void writeNetworkRF(const unsigned char* data, unsigned char dataType, FLCO flco, unsigned int srcId, unsigned int dstId, unsigned char errors = 0U);
void writeEndRF(bool writeEnd = false); void writeEndRF(bool writeEnd = false);
void writeEndNet(bool writeEnd = false); void writeEndNet(bool writeEnd = false);