Skip to content

Commit

Permalink
Optional non Embedded LC data suppression
Browse files Browse the repository at this point in the history
  • Loading branch information
phl0 committed Jan 16, 2017
1 parent 9667ae2 commit 8ffdb9b
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 22 deletions.
8 changes: 8 additions & 0 deletions Conf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ m_dmrBeacons(false),
m_dmrId(0U),
m_dmrColorCode(2U),
m_dmrSelfOnly(false),
m_dmrEmbeddedLCOnly(false),
m_dmrPrefixes(),
m_dmrBlackList(),
m_dmrWhiteList(),
Expand Down Expand Up @@ -370,6 +371,8 @@ bool CConf::read()
m_dmrColorCode = (unsigned int)::atoi(value);
else if (::strcmp(key, "SelfOnly") == 0)
m_dmrSelfOnly = ::atoi(value) == 1;
else if (::strcmp(key, "EmbeddedLCOnly") == 0)
m_dmrEmbeddedLCOnly = ::atoi(value) == 1;
else if (::strcmp(key, "Prefixes") == 0) {
char* p = ::strtok(value, ",\r\n");
while (p != NULL) {
Expand Down Expand Up @@ -801,6 +804,11 @@ bool CConf::getDMRSelfOnly() const
return m_dmrSelfOnly;
}

bool CConf::getDMREmbeddedLCOnly() const
{
return m_dmrEmbeddedLCOnly;
}

std::vector<unsigned int> CConf::getDMRPrefixes() const
{
return m_dmrPrefixes;
Expand Down
2 changes: 2 additions & 0 deletions Conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class CConf
bool getDMRBeacons() const;
unsigned int getDMRId() const;
unsigned int getDMRColorCode() const;
bool getDMREmbeddedLCOnly() const;
bool getDMRSelfOnly() const;
std::vector<unsigned int> getDMRPrefixes() const;
std::vector<unsigned int> getDMRBlackList() const;
Expand Down Expand Up @@ -243,6 +244,7 @@ class CConf
unsigned int m_dmrId;
unsigned int m_dmrColorCode;
bool m_dmrSelfOnly;
bool m_dmrEmbeddedLCOnly;
std::vector<unsigned int> m_dmrPrefixes;
std::vector<unsigned int> m_dmrBlackList;
std::vector<unsigned int> m_dmrWhiteList;
Expand Down
4 changes: 2 additions & 2 deletions DMRControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <cassert>
#include <algorithm>

CDMRControl::CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& blacklist, const std::vector<unsigned int>& whitelist, const std::vector<unsigned int>& slot1TGWhitelist, const std::vector<unsigned int>& slot2TGWhitelist, unsigned int timeout, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssi, unsigned int jitter) :
CDMRControl::CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, bool embeddedLCOnly, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& blacklist, const std::vector<unsigned int>& whitelist, const std::vector<unsigned int>& slot1TGWhitelist, const std::vector<unsigned int>& slot2TGWhitelist, unsigned int timeout, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssi, unsigned int jitter) :
m_id(id),
m_colorCode(colorCode),
m_modem(modem),
Expand All @@ -39,7 +39,7 @@ m_lookup(lookup)
// Load black and white lists to DMRAccessControl
CDMRAccessControl::init(blacklist, whitelist, slot1TGWhitelist, slot2TGWhitelist, selfOnly, prefixes, id);

CDMRSlot::init(colorCode, callHang, modem, network, display, duplex, m_lookup, rssi, jitter);
CDMRSlot::init(colorCode, embeddedLCOnly, callHang, modem, network, display, duplex, m_lookup, rssi, jitter);
}

CDMRControl::~CDMRControl()
Expand Down
2 changes: 1 addition & 1 deletion DMRControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

class CDMRControl {
public:
CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& blacklist, const std::vector<unsigned int>& whitelist, const std::vector<unsigned int>& slot1TGWhitelist, const std::vector<unsigned int>& slot2TGWhitelist, unsigned int timeout, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssi, unsigned int jitter);
CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, bool embeddedLCOnly, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& blacklist, const std::vector<unsigned int>& whitelist, const std::vector<unsigned int>& slot1TGWhitelist, const std::vector<unsigned int>& slot2TGWhitelist, unsigned int timeout, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssi, unsigned int jitter);
~CDMRControl();

bool processWakeup(const unsigned char* data);
Expand Down
52 changes: 35 additions & 17 deletions DMRSlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

unsigned int CDMRSlot::m_colorCode = 0U;

bool CDMRSlot::m_embeddedLCOnly = false;

CModem* CDMRSlot::m_modem = NULL;
CDMRNetwork* CDMRSlot::m_network = NULL;
CDisplay* CDMRSlot::m_display = NULL;
Expand Down Expand Up @@ -584,10 +586,20 @@ void CDMRSlot::writeModem(unsigned char *data, unsigned int len)
data[0U] = TAG_DATA;
data[1U] = 0x00U;

writeNetworkRF(data, DT_VOICE, errors);

if (m_embeddedLCOnly) {
// Only send the previously received LC
lcss = m_rfEmbeddedLC.getData(data + 2U, m_rfN);

// Regenerate the EMB
emb.setColorCode(m_colorCode);
emb.setLCSS(lcss);
emb.getData(data + 2U);
}

if (m_duplex)
writeQueueRF(data);

writeNetworkRF(data, DT_VOICE, errors);
} else if (m_rfState == RS_RF_LATE_ENTRY) {
CDMREMB emb;
emb.putData(data + 2U);
Expand Down Expand Up @@ -1297,11 +1309,16 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
}
}

// Regenerate the previous super blocks Embedded Data or substitude the LC for it
if (m_netEmbeddedData[m_netEmbeddedReadN].isValid())
lcss = m_netEmbeddedData[m_netEmbeddedReadN].getData(data + 2U, dmrData.getN());
else
if (m_embeddedLCOnly) {
// Only send the previously received LC
lcss = m_netEmbeddedLC.getData(data + 2U, dmrData.getN());
} else {
// Regenerate the previous super blocks Embedded Data or substitude the LC for it
if (m_netEmbeddedData[m_netEmbeddedReadN].isValid())
lcss = m_netEmbeddedData[m_netEmbeddedReadN].getData(data + 2U, dmrData.getN());
else
lcss = m_netEmbeddedLC.getData(data + 2U, dmrData.getN());
}

// Regenerate the EMB
emb.setColorCode(m_colorCode);
Expand Down Expand Up @@ -1571,25 +1588,26 @@ void CDMRSlot::writeQueueNet(const unsigned char *data)
m_queue.addData(data, len);
}

void CDMRSlot::init(unsigned int colorCode, unsigned int callHang, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssiMapper, unsigned int jitter)
void CDMRSlot::init(unsigned int colorCode, bool embeddedLCOnly, unsigned int callHang, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssiMapper, unsigned int jitter)
{
assert(modem != NULL);
assert(display != NULL);
assert(lookup != NULL);
assert(rssiMapper != NULL);

m_colorCode = colorCode;
m_modem = modem;
m_network = network;
m_display = display;
m_duplex = duplex;
m_lookup = lookup;
m_hangCount = callHang * 17U;
m_colorCode = colorCode;
m_embeddedLCOnly = embeddedLCOnly;
m_modem = modem;
m_network = network;
m_display = display;
m_duplex = duplex;
m_lookup = lookup;
m_hangCount = callHang * 17U;

m_rssiMapper = rssiMapper;
m_rssiMapper = rssiMapper;

m_jitterTime = jitter;
m_jitterSlots = jitter / DMR_SLOT_TIME;
m_jitterTime = jitter;
m_jitterSlots = jitter / DMR_SLOT_TIME;

m_idle = new unsigned char[DMR_FRAME_LENGTH_BYTES + 2U];
::memcpy(m_idle, DMR_IDLE_DATA, DMR_FRAME_LENGTH_BYTES + 2U);
Expand Down
4 changes: 3 additions & 1 deletion DMRSlot.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class CDMRSlot {

void clock();

static void init(unsigned int colorCode, unsigned int callHang, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssiMapper, unsigned int jitter);
static void init(unsigned int colorCode, bool embeddedLCOnly, unsigned int callHang, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssiMapper, unsigned int jitter);

private:
unsigned int m_slotNo;
Expand Down Expand Up @@ -98,6 +98,8 @@ class CDMRSlot {

static unsigned int m_colorCode;

static bool m_embeddedLCOnly;

static CModem* m_modem;
static CDMRNetwork* m_network;
static CDisplay* m_display;
Expand Down
1 change: 1 addition & 0 deletions MMDVM.ini
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Beacons=1
Id=123456
ColorCode=1
SelfOnly=0
EmbeddedLCOnly=0
# Prefixes=234,235
# Slot1TGWhiteList=
# Slot2TGWhiteList=
Expand Down
4 changes: 3 additions & 1 deletion MMDVMHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ int CMMDVMHost::run()
unsigned int id = m_conf.getDMRId();
unsigned int colorCode = m_conf.getDMRColorCode();
bool selfOnly = m_conf.getDMRSelfOnly();
bool embeddedLCOnly = m_conf.getDMREmbeddedLCOnly();
std::vector<unsigned int> prefixes = m_conf.getDMRPrefixes();
std::vector<unsigned int> blackList = m_conf.getDMRBlackList();
std::vector<unsigned int> whiteList = m_conf.getDMRWhiteList();
Expand All @@ -366,6 +367,7 @@ int CMMDVMHost::run()
LogInfo(" Id: %u", id);
LogInfo(" Color Code: %u", colorCode);
LogInfo(" Self Only: %s", selfOnly ? "yes" : "no");
LogInfo(" Embedded LC Only: %s", embeddedLCOnly ? "yes" : "no");
LogInfo(" Prefixes: %u", prefixes.size());

if (blackList.size() > 0U)
Expand All @@ -380,7 +382,7 @@ int CMMDVMHost::run()
LogInfo(" Call Hang: %us", callHang);
LogInfo(" TX Hang: %us", txHang);

dmr = new CDMRControl(id, colorCode, callHang, selfOnly, prefixes, blackList, whiteList, slot1TGWhiteList, slot2TGWhiteList, m_timeout, m_modem, m_dmrNetwork, m_display, m_duplex, m_lookup, rssi, jitter);
dmr = new CDMRControl(id, colorCode, callHang, selfOnly, embeddedLCOnly, prefixes, blackList, whiteList, slot1TGWhiteList, slot2TGWhiteList, m_timeout, m_modem, m_dmrNetwork, m_display, m_duplex, m_lookup, rssi, jitter);

m_dmrTXTimer.setTimeout(txHang);
}
Expand Down

0 comments on commit 8ffdb9b

Please sign in to comment.