Skip to content

Commit

Permalink
Change ovcm config to int value
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnchain committed Nov 16, 2019
1 parent aa7ae23 commit 2f95959
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 38 deletions.
14 changes: 3 additions & 11 deletions Conf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ m_dmrSlot2TGWhiteList(),
m_dmrCallHang(10U),
m_dmrTXHang(4U),
m_dmrModeHang(10U),
m_dmrOVCM(false),
m_dmrOVCMRX(false),
m_dmrOVCM(0),
m_fusionEnabled(false),
m_fusionLowDeviation(false),
m_fusionRemoteGateway(false),
Expand Down Expand Up @@ -594,9 +593,7 @@ bool CConf::read()
else if (::strcmp(key, "ModeHang") == 0)
m_dmrModeHang = (unsigned int)::atoi(value);
else if (::strcmp(key, "OVCM") == 0)
m_dmrOVCM = ::atoi(value) == 1;
else if (::strcmp(key, "OVCMRX") == 0)
m_dmrOVCMRX = ::atoi(value) == 1;
m_dmrOVCM = ::atoi(value);
} else if (section == SECTION_FUSION) {
if (::strcmp(key, "Enable") == 0)
m_fusionEnabled = ::atoi(value) == 1;
Expand Down Expand Up @@ -1258,16 +1255,11 @@ unsigned int CConf::getDMRModeHang() const
return m_dmrModeHang;
}

bool CConf::getDMROVCM() const
int CConf::getDMROVCM() const
{
return m_dmrOVCM;
}

bool CConf::getDMROVCMRX() const
{
return m_dmrOVCMRX;
}

bool CConf::getFusionEnabled() const
{
return m_fusionEnabled;
Expand Down
6 changes: 2 additions & 4 deletions Conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ class CConf
unsigned int getDMRCallHang() const;
unsigned int getDMRTXHang() const;
unsigned int getDMRModeHang() const;
bool getDMROVCM() const;
bool getDMROVCMRX() const;
int getDMROVCM() const;

// The System Fusion section
bool getFusionEnabled() const;
Expand Down Expand Up @@ -375,8 +374,7 @@ class CConf
unsigned int m_dmrCallHang;
unsigned int m_dmrTXHang;
unsigned int m_dmrModeHang;
bool m_dmrOVCM;
bool m_dmrOVCMRX;
int m_dmrOVCM;

bool m_fusionEnabled;
bool m_fusionLowDeviation;
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, bool embeddedLCOnly, bool dumpTAData, 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, bool ovcm, bool ovcmRX) :
CDMRControl::CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, bool embeddedLCOnly, bool dumpTAData, 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, int ovcm) :
m_colorCode(colorCode),
m_modem(modem),
m_network(network),
Expand All @@ -38,7 +38,7 @@ m_lookup(lookup)
// Load black and white lists to DMRAccessControl
CDMRAccessControl::init(blacklist, whitelist, slot1TGWhitelist, slot2TGWhitelist, selfOnly, prefixes, id);

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

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, bool embeddedLCOnly, bool dumpTAData, 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, bool ovcm, bool ovcmRX);
CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, bool embeddedLCOnly, bool dumpTAData, 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, int ovcm);
~CDMRControl();

bool processWakeup(const unsigned char* data);
Expand Down
20 changes: 9 additions & 11 deletions DMRSlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ CDisplay* CDMRSlot::m_display = NULL;
bool CDMRSlot::m_duplex = true;
CDMRLookup* CDMRSlot::m_lookup = NULL;
unsigned int CDMRSlot::m_hangCount = 3U * 17U;
bool CDMRSlot::m_ovcm = false;
bool CDMRSlot::m_ovcmRX = false;
int CDMRSlot::m_ovcm = 0;

CRSSIInterpolator* CDMRSlot::m_rssiMapper = NULL;

Expand Down Expand Up @@ -234,7 +233,7 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len)
return false;
}

lc->setOVCM(m_ovcm);
lc->setOVCM(m_ovcm & 0x02);
m_rfLC = lc;

// The standby LC data
Expand Down Expand Up @@ -439,7 +438,7 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len)
return false;

// set the OVCM bit for the supported csbk
csbk.setOVCM(m_ovcm);
csbk.setOVCM(m_ovcm & 0x02);

bool gi = csbk.getGI();
unsigned int srcId = csbk.getSrcId();
Expand Down Expand Up @@ -790,7 +789,7 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len)
return false;
}

lc->setOVCM(m_ovcm);
lc->setOVCM(m_ovcm & 0x02);
m_rfLC = lc;

// The standby LC data
Expand Down Expand Up @@ -1046,7 +1045,7 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
dmrData.getSrcId(), dmrData.getFLCO() == FLCO_GROUP ? "TG" : "", dmrData.getDstId(),
srcId, flco == FLCO_GROUP ? "TG" : "", dstId);

lc->setOVCM(m_ovcmRX);
lc->setOVCM(m_ovcm & 0x01);
m_netLC = lc;

// The standby LC data
Expand Down Expand Up @@ -1120,7 +1119,7 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
unsigned int dstId = lc->getDstId();
unsigned int srcId = lc->getSrcId();

lc->setOVCM(m_ovcmRX);
lc->setOVCM(m_ovcm & 0x01);
m_netLC = lc;

m_lastFrameValid = false;
Expand Down Expand Up @@ -1306,7 +1305,7 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
unsigned int dstId = lc->getDstId();
unsigned int srcId = lc->getSrcId();

lc->setOVCM(m_ovcmRX);
lc->setOVCM(m_ovcm & 0x01);
m_netLC = lc;

// The standby LC data
Expand Down Expand Up @@ -1576,7 +1575,7 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
return;

// set the OVCM bit for the supported csbk
csbk.setOVCM(m_ovcmRX);
csbk.setOVCM(m_ovcm & 0x01);

bool gi = csbk.getGI();
unsigned int srcId = csbk.getSrcId();
Expand Down Expand Up @@ -1882,7 +1881,7 @@ void CDMRSlot::writeQueueNet(const unsigned char *data)
m_queue.addData(data, len);
}

void CDMRSlot::init(unsigned int colorCode, bool embeddedLCOnly, bool dumpTAData, unsigned int callHang, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssiMapper, unsigned int jitter, bool ovcm, bool ovcmRX)
void CDMRSlot::init(unsigned int colorCode, bool embeddedLCOnly, bool dumpTAData, unsigned int callHang, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssiMapper, unsigned int jitter, int ovcm)
{
assert(modem != NULL);
assert(display != NULL);
Expand All @@ -1899,7 +1898,6 @@ void CDMRSlot::init(unsigned int colorCode, bool embeddedLCOnly, bool dumpTAData
m_lookup = lookup;
m_hangCount = callHang * 17U;
m_ovcm = ovcm;
m_ovcmRX = ovcmRX;

m_rssiMapper = rssiMapper;

Expand Down
5 changes: 2 additions & 3 deletions DMRSlot.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class CDMRSlot {

void enable(bool enabled);

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

private:
unsigned int m_slotNo;
Expand Down Expand Up @@ -123,8 +123,7 @@ class CDMRSlot {
static bool m_duplex;
static CDMRLookup* m_lookup;
static unsigned int m_hangCount;
static bool m_ovcm;
static bool m_ovcmRX;
static int m_ovcm;

static CRSSIInterpolator* m_rssiMapper;

Expand Down
2 changes: 1 addition & 1 deletion MMDVM.ini
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ DumpTAData=1
CallHang=3
TXHang=4
# ModeHang=10
# OVCM Values, 0=off, 1=rf_on, 2=net_on, 3=both_on
# OVCM=0
# OVCMRX=0

[System Fusion]
Enable=1
Expand Down
13 changes: 8 additions & 5 deletions MMDVMHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,7 @@ int CMMDVMHost::run()
unsigned int jitter = m_conf.getDMRNetworkJitter();
m_dmrRFModeHang = m_conf.getDMRModeHang();
dmrBeacons = m_conf.getDMRBeacons();
bool ovcm = m_conf.getDMROVCM();
bool ovcmRX = m_conf.getDMROVCMRX();
int ovcm = m_conf.getDMROVCM();

if (txHang > m_dmrRFModeHang)
txHang = m_dmrRFModeHang;
Expand Down Expand Up @@ -479,8 +478,12 @@ int CMMDVMHost::run()
LogInfo(" Call Hang: %us", callHang);
LogInfo(" TX Hang: %us", txHang);
LogInfo(" Mode Hang: %us", m_dmrRFModeHang);
LogInfo(" OVCM: %s", ovcm ? "on" : "off");
LogInfo(" OVCMRX: %s", ovcmRX ? "on" : "off");
if (ovcm == 0)
LogInfo(" OVCM: off");
else if (ovcm == 1)
LogInfo(" OVCM: on(rx)");
else
LogInfo(" OVCM: on");

switch (dmrBeacons) {
case DMR_BEACONS_NETWORK: {
Expand Down Expand Up @@ -511,7 +514,7 @@ int CMMDVMHost::run()
break;
}

m_dmr = new CDMRControl(id, colorCode, callHang, selfOnly, embeddedLCOnly, dumpTAData, prefixes, blackList, whiteList, slot1TGWhiteList, slot2TGWhiteList, m_timeout, m_modem, m_dmrNetwork, m_display, m_duplex, m_dmrLookup, rssi, jitter, ovcm, ovcmRX);
m_dmr = new CDMRControl(id, colorCode, callHang, selfOnly, embeddedLCOnly, dumpTAData, prefixes, blackList, whiteList, slot1TGWhiteList, slot2TGWhiteList, m_timeout, m_modem, m_dmrNetwork, m_display, m_duplex, m_dmrLookup, rssi, jitter, ovcm);

m_dmrTXTimer.setTimeout(txHang);
}
Expand Down

0 comments on commit 2f95959

Please sign in to comment.