Clean up the code.

This commit is contained in:
Jonathan Naylor
2017-04-29 09:55:49 +01:00
parent 2fd934fd6a
commit a66db5d32a
5 changed files with 16 additions and 25 deletions

View File

@@ -19,6 +19,7 @@
#include "DMRGateway.h"
#include "Version.h"
#include "StopWatch.h"
#include "Rewrite.h"
#include "Thread.h"
#include "Log.h"
@@ -114,9 +115,7 @@ m_conf(confFile),
m_mmdvm(NULL),
m_dmrNetwork(NULL),
m_xlxNetwork(NULL),
m_reflector(0U),
m_rptRewrite(),
m_xlxRewrite()
m_reflector(0U)
{
}
@@ -237,8 +236,8 @@ int CDMRGateway::run()
LogInfo("XLX Local TG: %u", xlxTG);
LogInfo("Timeout: %us", timeout);
m_rptRewrite.setParams(xlxSlot, xlxTG);
m_xlxRewrite.setParams(XLX_SLOT, XLX_TG);
CRewrite rptRewrite(xlxSlot, xlxTG);
CRewrite xlxRewrite(XLX_SLOT, XLX_TG);
ret = createDMRNetwork();
if (!ret)
@@ -268,7 +267,7 @@ int CDMRGateway::run()
unsigned int id = data.getDstId();
if (flco == FLCO_GROUP && id == xlxTG) {
m_xlxRewrite.process(data);
xlxRewrite.process(data);
m_xlxNetwork->write(data);
status = DMRGWS_REFLECTOR;
timer.start();
@@ -279,7 +278,7 @@ int CDMRGateway::run()
m_reflector = reflector;
}
m_xlxRewrite.process(data);
xlxRewrite.process(data);
m_xlxNetwork->write(data);
status = DMRGWS_REFLECTOR;
timer.start();
@@ -298,7 +297,7 @@ int CDMRGateway::run()
if (status == DMRGWS_NONE || status == DMRGWS_REFLECTOR) {
unsigned int slotNo = data.getSlotNo();
if (slotNo == XLX_SLOT) {
m_rptRewrite.process(data);
rptRewrite.process(data);
m_mmdvm->write(data);
status = DMRGWS_REFLECTOR;
timer.start();
@@ -310,7 +309,7 @@ int CDMRGateway::run()
if (ret) {
unsigned int slotNo = data.getSlotNo();
if (slotNo == xlxSlot) {
// Stop BM from using the same TG as XLX
// Stop the DMR network from using the same TG as XLX
unsigned int dstId = data.getDstId();
FLCO flco = data.getFLCO();
if (flco != FLCO_GROUP || dstId != xlxTG) {

View File

@@ -21,7 +21,6 @@
#include "MMDVMNetwork.h"
#include "DMRNetwork.h"
#include "Rewrite.h"
#include "Conf.h"
#include <string>
@@ -40,8 +39,6 @@ private:
CDMRNetwork* m_dmrNetwork;
CDMRNetwork* m_xlxNetwork;
unsigned int m_reflector;
CRewrite m_rptRewrite;
CRewrite m_xlxRewrite;
bool createMMDVM();
bool createDMRNetwork();

View File

@@ -22,25 +22,22 @@
#include "DMRFullLC.h"
#include <cstdio>
#include <cassert>
CRewrite::CRewrite() :
m_slot(0U),
m_tg(0U),
CRewrite::CRewrite(unsigned int slot, unsigned int tg) :
m_slot(slot),
m_tg(tg),
m_lc(NULL),
m_embeddedLC()
{
assert(slot == 1U || slot == 2U);
assert(tg < 16U);
}
CRewrite::~CRewrite()
{
}
void CRewrite::setParams(unsigned int slot, unsigned int tg)
{
m_slot = slot;
m_tg = tg;
}
void CRewrite::process(CDMRData& data)
{
data.setSlotNo(m_slot);

View File

@@ -25,11 +25,9 @@
class CRewrite {
public:
CRewrite();
CRewrite(unsigned int slot, unsigned int tg);
~CRewrite();
void setParams(unsigned int slot, unsigned int tg);
void process(CDMRData& data);
private:

View File

@@ -19,6 +19,6 @@
#if !defined(VERSION_H)
#define VERSION_H
const char* VERSION = "20170428";
const char* VERSION = "20170429";
#endif