mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-21 06:55:52 +08:00
Merge branch 'master' into P25
This commit is contained in:
37
Conf.cpp
37
Conf.cpp
@@ -45,7 +45,8 @@ enum SECTION {
|
||||
SECTION_TFTSERIAL,
|
||||
SECTION_HD44780,
|
||||
SECTION_NEXTION,
|
||||
SECTION_OLED
|
||||
SECTION_OLED,
|
||||
SECTION_TGREWRITE
|
||||
};
|
||||
|
||||
CConf::CConf(const std::string& file) :
|
||||
@@ -96,6 +97,10 @@ m_dmrBeacons(false),
|
||||
m_dmrId(0U),
|
||||
m_dmrColorCode(2U),
|
||||
m_dmrSelfOnly(false),
|
||||
m_dmrTGRewriteSlot1(false),
|
||||
m_dmrTGRewriteSlot2(false),
|
||||
m_dmrBMAutoRewrite(false),
|
||||
m_dmrBMRewriteReflectorVoicePrompts(false),
|
||||
m_dmrPrefixes(),
|
||||
m_dmrBlackList(),
|
||||
m_dmrDstIdBlacklistSlot1RF(),
|
||||
@@ -216,6 +221,7 @@ bool CConf::read()
|
||||
section = SECTION_NEXTION;
|
||||
else if (::strncmp(buffer, "[OLED]", 6U) == 0)
|
||||
section = SECTION_OLED;
|
||||
|
||||
else
|
||||
section = SECTION_NONE;
|
||||
|
||||
@@ -433,6 +439,14 @@ bool CConf::read()
|
||||
m_dmrTXHang = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "CallHang") == 0)
|
||||
m_dmrCallHang = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "TGRewriteSlot1") == 0)
|
||||
m_dmrTGRewriteSlot1 = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "TGRewriteSlot2") == 0)
|
||||
m_dmrTGRewriteSlot2 = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "BMAutoRewrite") == 0)
|
||||
m_dmrBMAutoRewrite = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "BMRewriteReflectorVoicePrompts") == 0)
|
||||
m_dmrBMRewriteReflectorVoicePrompts = ::atoi(value) == 1;
|
||||
} else if (section == SECTION_FUSION) {
|
||||
if (::strcmp(key, "Enable") == 0)
|
||||
m_fusionEnabled = ::atoi(value) == 1;
|
||||
@@ -549,6 +563,7 @@ bool CConf::read()
|
||||
m_oledBrightness = (unsigned char)::atoi(value);
|
||||
else if (::strcmp(key, "Brightness") == 0)
|
||||
m_oledInvert = (unsigned char)::atoi(value);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -788,6 +803,26 @@ bool CConf::getDMRSelfOnly() const
|
||||
return m_dmrSelfOnly;
|
||||
}
|
||||
|
||||
bool CConf::getDMRTGRewriteSlot1() const
|
||||
{
|
||||
return m_dmrTGRewriteSlot1;
|
||||
}
|
||||
|
||||
bool CConf::getDMRTGRewriteSlot2() const
|
||||
{
|
||||
return m_dmrTGRewriteSlot2;
|
||||
}
|
||||
|
||||
bool CConf::getDMRBMAutoRewrite() const
|
||||
{
|
||||
return m_dmrBMAutoRewrite;
|
||||
}
|
||||
|
||||
bool CConf::getDMRBMRewriteReflectorVoicePrompts() const
|
||||
{
|
||||
return m_dmrBMRewriteReflectorVoicePrompts;
|
||||
}
|
||||
|
||||
std::vector<unsigned int> CConf::getDMRPrefixes() const
|
||||
{
|
||||
return m_dmrPrefixes;
|
||||
|
||||
9
Conf.h
9
Conf.h
@@ -89,6 +89,10 @@ public:
|
||||
unsigned int getDMRId() const;
|
||||
unsigned int getDMRColorCode() const;
|
||||
bool getDMRSelfOnly() const;
|
||||
bool getDMRTGRewriteSlot1() const;
|
||||
bool getDMRTGRewriteSlot2() const;
|
||||
bool getDMRBMAutoRewrite() const;
|
||||
bool getDMRBMRewriteReflectorVoicePrompts() const;
|
||||
std::vector<unsigned int> getDMRPrefixes() const;
|
||||
std::vector<unsigned int> getDMRBlackList() const;
|
||||
std::vector<unsigned int> getDMRDstIdBlacklistSlot1RF() const;
|
||||
@@ -227,6 +231,11 @@ private:
|
||||
unsigned int m_dmrId;
|
||||
unsigned int m_dmrColorCode;
|
||||
bool m_dmrSelfOnly;
|
||||
bool m_dmrTGRewriteSlot1;
|
||||
bool m_dmrTGRewriteSlot2;
|
||||
bool m_dmrBMAutoRewrite;
|
||||
bool m_dmrBMRewriteReflectorVoicePrompts;
|
||||
|
||||
std::vector<unsigned int> m_dmrPrefixes;
|
||||
std::vector<unsigned int> m_dmrBlackList;
|
||||
std::vector<unsigned int> m_dmrDstIdBlacklistSlot1RF;
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include <ctime>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
std::vector<unsigned int> DMRAccessControl::m_dstBlackListSlot1RF;
|
||||
std::vector<unsigned int> DMRAccessControl::m_dstBlackListSlot2RF;
|
||||
@@ -37,7 +40,21 @@ bool DMRAccessControl::m_selfOnly = false;
|
||||
|
||||
unsigned int DMRAccessControl::m_id = 0U;
|
||||
|
||||
void DMRAccessControl::init(const std::vector<unsigned int>& DstIdBlacklistSlot1RF, const std::vector<unsigned int>& DstIdWhitelistSlot1RF, const std::vector<unsigned int>& DstIdBlacklistSlot2RF, const std::vector<unsigned int>& DstIdWhitelistSlot2RF, const std::vector<unsigned int>& DstIdBlacklistSlot1NET, const std::vector<unsigned int>& DstIdWhitelistSlot1NET, const std::vector<unsigned int>& DstIdBlacklistSlot2NET, const std::vector<unsigned int>& DstIdWhitelistSlot2NET, const std::vector<unsigned int>& SrcIdBlacklist, bool selfOnly, const std::vector<unsigned int>& prefixes,unsigned int id)
|
||||
unsigned int DMRAccessControl::m_dstRewriteID = 0U;
|
||||
unsigned int DMRAccessControl::m_SrcID = 0U;
|
||||
|
||||
CDMRLC* DMRAccessControl::m_lastdmrLC;
|
||||
|
||||
std::time_t DMRAccessControl::m_time;
|
||||
|
||||
int DMRAccessControl::m_callHang;
|
||||
|
||||
bool DMRAccessControl::m_TGRewriteSlot1;
|
||||
bool DMRAccessControl::m_TGRewriteSlot2;
|
||||
bool DMRAccessControl::m_BMAutoRewrite;
|
||||
bool DMRAccessControl::m_BMRewriteReflectorVoicePrompts;
|
||||
|
||||
void DMRAccessControl::init(const std::vector<unsigned int>& DstIdBlacklistSlot1RF, const std::vector<unsigned int>& DstIdWhitelistSlot1RF, const std::vector<unsigned int>& DstIdBlacklistSlot2RF, const std::vector<unsigned int>& DstIdWhitelistSlot2RF, const std::vector<unsigned int>& DstIdBlacklistSlot1NET, const std::vector<unsigned int>& DstIdWhitelistSlot1NET, const std::vector<unsigned int>& DstIdBlacklistSlot2NET, const std::vector<unsigned int>& DstIdWhitelistSlot2NET, const std::vector<unsigned int>& SrcIdBlacklist, bool selfOnly, const std::vector<unsigned int>& prefixes,unsigned int id,unsigned int callHang,bool TGRewriteSlot1, bool TGRewriteSlot2, bool BMAutoRewrite, bool BMRewriteReflectorVoicePrompts)
|
||||
{
|
||||
m_dstBlackListSlot1RF = DstIdBlacklistSlot1RF;
|
||||
m_dstWhiteListSlot1RF = DstIdWhitelistSlot1RF;
|
||||
@@ -47,6 +64,11 @@ void DMRAccessControl::init(const std::vector<unsigned int>& DstIdBlacklistSlot1
|
||||
m_dstWhiteListSlot1NET = DstIdWhitelistSlot1NET;
|
||||
m_dstBlackListSlot2NET = DstIdBlacklistSlot2NET;
|
||||
m_dstWhiteListSlot2NET = DstIdWhitelistSlot2NET;
|
||||
m_callHang = callHang;
|
||||
m_TGRewriteSlot1 = TGRewriteSlot1;
|
||||
m_TGRewriteSlot2 = TGRewriteSlot2;
|
||||
m_BMAutoRewrite = BMAutoRewrite;
|
||||
m_BMRewriteReflectorVoicePrompts = BMRewriteReflectorVoicePrompts;
|
||||
}
|
||||
|
||||
bool DMRAccessControl::DstIdBlacklist(unsigned int did, unsigned int slot, bool network)
|
||||
@@ -180,3 +202,46 @@ bool DMRAccessControl::validateAccess (unsigned int src_id, unsigned int dst_id,
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int DMRAccessControl::DstIdRewrite (unsigned int did, unsigned int sid, unsigned int slot, bool network, CDMRLC* dmrLC)
|
||||
{
|
||||
|
||||
if (slot == 1U && m_TGRewriteSlot1 == false)
|
||||
return 0U;
|
||||
|
||||
if (slot == 2U && m_TGRewriteSlot2 == false)
|
||||
return 0U;
|
||||
|
||||
|
||||
std::time_t currenttime = std::time(nullptr);
|
||||
|
||||
if (network) {
|
||||
m_dstRewriteID = did;
|
||||
m_SrcID = sid;
|
||||
//not needed at present - for direct dial, which requires change at master end.
|
||||
//memcpy(&m_lastdmrLC, &dmrLC, sizeof(dmrLC));
|
||||
if (m_BMAutoRewrite && (did < 4000U || did > 5000U) && did > 0U && did != 9U && dmrLC->getFLCO() == FLCO_GROUP ) {
|
||||
LogMessage("DMR Slot %u, Rewrite DST ID (TG) of of inbound network traffic from %u to 9",slot,did);
|
||||
return 9U;
|
||||
// rewrite incoming BM voice prompts to TG 9
|
||||
} else if (m_BMRewriteReflectorVoicePrompts && (sid >= 4000U && sid <= 5000U) && dmrLC->getFLCO() == FLCO_USER_USER) {
|
||||
dmrLC->setFLCO(FLCO_GROUP);
|
||||
LogMessage("DMR Slot %u, Rewrite inbound private call to %u to Group Call on TG 9 (BM reflector voice prompt)",slot,did);
|
||||
return 9U;
|
||||
} else {
|
||||
return 0U;
|
||||
}
|
||||
} else if (m_BMAutoRewrite && did == 9U && m_dstRewriteID != 9U && m_dstRewriteID != 0U && (m_time + m_callHang) > currenttime && dmrLC->getFLCO() == FLCO_GROUP ) {
|
||||
LogMessage("DMR Slot %u, Rewrite DST ID (TG) of outbound network traffic from %u to %u (return traffic during CallHang)",slot,did,m_dstRewriteID);
|
||||
return(m_dstRewriteID);
|
||||
} else if (m_BMAutoRewrite && (did < 4000U || did > 5000U) && did > 0U && did !=9U) {
|
||||
m_dstRewriteID = did;
|
||||
}
|
||||
return 0U;
|
||||
}
|
||||
|
||||
|
||||
void DMRAccessControl::setOverEndTime()
|
||||
{
|
||||
m_time = std::time(nullptr);
|
||||
}
|
||||
|
||||
@@ -16,12 +16,17 @@
|
||||
#define DMRAccessControl_H
|
||||
|
||||
#include <vector>
|
||||
#include <ctime>
|
||||
#include "DMRLC.h"
|
||||
|
||||
class DMRAccessControl {
|
||||
public:
|
||||
static bool validateAccess (unsigned int src_id, unsigned int dst_id, unsigned int slot, bool network);
|
||||
|
||||
static void init(const std::vector<unsigned int>& DstIdBlacklistSlot1RF, const std::vector<unsigned int>& DstIdWhitelistSlot1RF, const std::vector<unsigned int>& DstIdBlacklistSlot2RF, const std::vector<unsigned int>& DstIdWhitelistSlot2RF, const std::vector<unsigned int>& DstIdBlacklistSlot1NET, const std::vector<unsigned int>& DstIdWhitelistSlot1NET, const std::vector<unsigned int>& DstIdBlacklistSlot2NET, const std::vector<unsigned int>& DstIdWhitelistSlot2NET, const std::vector<unsigned int>& SrcIdBlacklist, bool selfOnly, const std::vector<unsigned int>& prefixes,unsigned int id);
|
||||
static void init(const std::vector<unsigned int>& DstIdBlacklistSlot1RF, const std::vector<unsigned int>& DstIdWhitelistSlot1RF, const std::vector<unsigned int>& DstIdBlacklistSlot2RF, const std::vector<unsigned int>& DstIdWhitelistSlot2RF, const std::vector<unsigned int>& DstIdBlacklistSlot1NET, const std::vector<unsigned int>& DstIdWhitelistSlot1NET, const std::vector<unsigned int>& DstIdBlacklistSlot2NET, const std::vector<unsigned int>& DstIdWhitelistSlot2NET, const std::vector<unsigned int>& SrcIdBlacklist, bool selfOnly, const std::vector<unsigned int>& prefixes,unsigned int id,unsigned int callHang, bool TGRewrteSlot1, bool TGRewrteSlot2, bool m_BMAutoRewrite, bool m_BMRewriteReflectorVoicePrompts);
|
||||
|
||||
static unsigned int DstIdRewrite(unsigned int id, unsigned int sid,unsigned int slot, bool network, CDMRLC* dmrLC);
|
||||
static void setOverEndTime();
|
||||
|
||||
private:
|
||||
static std::vector<unsigned int> m_dstBlackListSlot1RF;
|
||||
@@ -38,6 +43,8 @@ private:
|
||||
|
||||
static std::vector<unsigned int> m_prefixes;
|
||||
|
||||
static int m_callHang;
|
||||
|
||||
static bool m_selfOnly;
|
||||
static unsigned int m_id;
|
||||
|
||||
@@ -45,6 +52,22 @@ private:
|
||||
static bool DstIdWhitelist(unsigned int did,unsigned int slot,bool gt4k, bool network);
|
||||
|
||||
static bool validateSrcId(unsigned int id);
|
||||
|
||||
static std::time_t m_time;
|
||||
|
||||
static unsigned int m_dstRewriteID;
|
||||
static unsigned int m_SrcID;
|
||||
|
||||
static bool m_TGRewriteSlot1;
|
||||
static bool m_TGRewriteSlot2;
|
||||
static bool m_BMAutoRewrite;
|
||||
static bool m_BMRewriteReflectorVoicePrompts;
|
||||
|
||||
static CDMRLC* m_lastdmrLC;
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,7 +20,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>& DstIdBlacklistSlot1RF, const std::vector<unsigned int>& DstIdWhitelistSlot1RF, const std::vector<unsigned int>& DstIdBlacklistSlot2RF, const std::vector<unsigned int>& DstIdWhitelistSlot2RF, const std::vector<unsigned int>& DstIdBlacklistSlot1NET, const std::vector<unsigned int>& DstIdWhitelistSlot1NET, const std::vector<unsigned int>& DstIdBlacklistSlot2NET, const std::vector<unsigned int>& DstIdWhitelistSlot2NET, unsigned int timeout, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, int rssiMultiplier, int rssiOffset, unsigned int jitter) :
|
||||
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>& DstIdBlacklistSlot1RF, const std::vector<unsigned int>& DstIdWhitelistSlot1RF, const std::vector<unsigned int>& DstIdBlacklistSlot2RF, const std::vector<unsigned int>& DstIdWhitelistSlot2RF, const std::vector<unsigned int>& DstIdBlacklistSlot1NET, const std::vector<unsigned int>& DstIdWhitelistSlot1NET, const std::vector<unsigned int>& DstIdBlacklistSlot2NET, const std::vector<unsigned int>& DstIdWhitelistSlot2NET, unsigned int timeout, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, int rssiMultiplier, int rssiOffset, unsigned int jitter, bool TGRewriteSlot1, bool TGRewriteSlot2, bool BMAutoRewrite, bool BMRewriteReflectorVoicePrompts) :
|
||||
m_id(id),
|
||||
m_colorCode(colorCode),
|
||||
m_selfOnly(selfOnly),
|
||||
@@ -36,7 +36,7 @@ m_lookup(lookup)
|
||||
assert(display != NULL);
|
||||
assert(lookup != NULL);
|
||||
|
||||
CDMRSlot::init(id, colorCode, callHang, selfOnly, prefixes, blackList, DstIdBlacklistSlot1RF, DstIdWhitelistSlot1RF, DstIdBlacklistSlot2RF, DstIdWhitelistSlot2RF, DstIdBlacklistSlot1NET, DstIdWhitelistSlot1NET, DstIdBlacklistSlot2NET, DstIdWhitelistSlot2NET, modem, network, display, duplex, lookup, rssiMultiplier, rssiOffset, jitter);
|
||||
CDMRSlot::init(id, colorCode, callHang, selfOnly, prefixes, blackList, DstIdBlacklistSlot1RF, DstIdWhitelistSlot1RF, DstIdBlacklistSlot2RF, DstIdWhitelistSlot2RF, DstIdBlacklistSlot1NET, DstIdWhitelistSlot1NET, DstIdBlacklistSlot2NET, DstIdWhitelistSlot2NET, modem, network, display, duplex, m_lookup, rssiMultiplier, rssiOffset, jitter, TGRewriteSlot1, TGRewriteSlot2, BMAutoRewrite, BMRewriteReflectorVoicePrompts);
|
||||
}
|
||||
|
||||
CDMRControl::~CDMRControl()
|
||||
|
||||
@@ -30,7 +30,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>& DstIdBlacklistSlot1RF, const std::vector<unsigned int>& DstIdWhitelistSlot1RF, const std::vector<unsigned int>& DstIdBlacklistSlot2RF, const std::vector<unsigned int>& DstIdWhitelistSlot2RF,const std::vector<unsigned int>& DstIdBlacklistSlot1NET, const std::vector<unsigned int>& DstIdWhitelistSlot1NET, const std::vector<unsigned int>& DstIdBlacklistSlot2NET, const std::vector<unsigned int>& DstIdWhitelistSlot2NET, unsigned int timeout, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, int rssiMultiplier, int rssiOffset, unsigned int jitter);
|
||||
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>& DstIdBlacklistSlot1RF, const std::vector<unsigned int>& DstIdWhitelistSlot1RF, const std::vector<unsigned int>& DstIdBlacklistSlot2RF, const std::vector<unsigned int>& DstIdWhitelistSlot2RF,const std::vector<unsigned int>& DstIdBlacklistSlot1NET, const std::vector<unsigned int>& DstIdWhitelistSlot1NET, const std::vector<unsigned int>& DstIdBlacklistSlot2NET, const std::vector<unsigned int>& DstIdWhitelistSlot2NET, unsigned int timeout, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, int rssiMultiplier, int rssiOffset, unsigned int jitter, bool TGRewriteSlot1, bool TGRewriteSlot2, bool BMAutoRewrite, bool BMRewriteReflectorVoicePrompts);
|
||||
~CDMRControl();
|
||||
|
||||
bool processWakeup(const unsigned char* data);
|
||||
|
||||
863
DMRIds.dat
863
DMRIds.dat
File diff suppressed because it is too large
Load Diff
57
DMRSlot.cpp
57
DMRSlot.cpp
@@ -152,13 +152,19 @@ void CDMRSlot::writeModem(unsigned char *data, unsigned int len)
|
||||
if (lc == NULL)
|
||||
return;
|
||||
|
||||
unsigned int id = lc->getSrcId();
|
||||
unsigned int sid = lc->getSrcId();
|
||||
unsigned int did = lc->getDstId();
|
||||
if (!DMRAccessControl::validateAccess(id, did, m_slotNo, false)) {
|
||||
if (!DMRAccessControl::validateAccess(sid, did, m_slotNo, false)) {
|
||||
delete lc;
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int rw_id = DMRAccessControl::DstIdRewrite(did,sid,m_slotNo,false,lc);
|
||||
if (rw_id) {
|
||||
|
||||
lc->setDstId(rw_id);
|
||||
}
|
||||
|
||||
m_rfLC = lc;
|
||||
|
||||
// Store the LC for the embedded LC
|
||||
@@ -196,7 +202,7 @@ void CDMRSlot::writeModem(unsigned char *data, unsigned int len)
|
||||
|
||||
m_rfState = RS_RF_AUDIO;
|
||||
|
||||
std::string src = m_lookup->find(id);
|
||||
std::string src = m_lookup->find(sid);
|
||||
std::string dst = m_lookup->find(m_rfLC->getDstId());
|
||||
|
||||
if (m_netState == RS_NET_IDLE) {
|
||||
@@ -249,13 +255,16 @@ void CDMRSlot::writeModem(unsigned char *data, unsigned int len)
|
||||
writeNetworkRF(data, DT_TERMINATOR_WITH_LC);
|
||||
|
||||
if (m_duplex) {
|
||||
|
||||
for (unsigned int i = 0U; i < m_hangCount; i++)
|
||||
writeQueueRF(data);
|
||||
|
||||
}
|
||||
|
||||
LogMessage("DMR Slot %u, received RF end of voice transmission, %.1f seconds, BER: %.1f%%", m_slotNo, float(m_rfFrames) / 16.667F, float(m_rfErrs * 100U) / float(m_rfBits));
|
||||
|
||||
writeEndRF();
|
||||
DMRAccessControl::setOverEndTime();
|
||||
} else if (dataType == DT_DATA_HEADER) {
|
||||
if (m_rfState == RS_RF_DATA)
|
||||
return;
|
||||
@@ -271,6 +280,7 @@ void CDMRSlot::writeModem(unsigned char *data, unsigned int len)
|
||||
if (!DMRAccessControl::validateAccess(srcId, dstId, m_slotNo, false))
|
||||
return;
|
||||
|
||||
|
||||
m_rfFrames = dataHeader.getBlocks();
|
||||
|
||||
m_rfDataHeader = dataHeader;
|
||||
@@ -478,12 +488,16 @@ void CDMRSlot::writeModem(unsigned char *data, unsigned int len)
|
||||
|
||||
CDMRLC* lc = m_rfEmbeddedLC.addData(data + 2U, emb.getLCSS());
|
||||
if (lc != NULL) {
|
||||
unsigned int id = lc->getSrcId();
|
||||
unsigned int sid = lc->getSrcId();
|
||||
unsigned int did = lc->getDstId();
|
||||
if (!DMRAccessControl::validateAccess(id,did,m_slotNo,false)) {
|
||||
if (!DMRAccessControl::validateAccess(sid,did,m_slotNo,false)) {
|
||||
delete lc;
|
||||
return;
|
||||
}
|
||||
unsigned int rw_id = DMRAccessControl::DstIdRewrite(did,sid,m_slotNo,false,lc);
|
||||
if (rw_id) {
|
||||
lc->setDstId(rw_id);
|
||||
}
|
||||
|
||||
m_rfLC = lc;
|
||||
|
||||
@@ -645,8 +659,10 @@ void CDMRSlot::writeEndRF(bool writeEnd)
|
||||
data[0U] = TAG_EOT;
|
||||
data[1U] = 0x00U;
|
||||
|
||||
|
||||
for (unsigned int i = 0U; i < m_hangCount; i++)
|
||||
writeQueueRF(data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -719,8 +735,10 @@ void CDMRSlot::writeEndNet(bool writeEnd)
|
||||
data[1U] = 0x00U;
|
||||
|
||||
if (m_duplex) {
|
||||
|
||||
for (unsigned int i = 0U; i < m_hangCount; i++)
|
||||
writeQueueNet(data);
|
||||
|
||||
} else {
|
||||
for (unsigned int i = 0U; i < 3U; i++)
|
||||
writeQueueNet(data);
|
||||
@@ -759,10 +777,17 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
||||
}
|
||||
|
||||
unsigned int did = m_netLC->getDstId();
|
||||
unsigned int id = m_netLC->getSrcId();
|
||||
if (!DMRAccessControl::validateAccess(id, did, m_slotNo, true))
|
||||
unsigned int sid = m_netLC->getSrcId();
|
||||
if (!DMRAccessControl::validateAccess(sid, did, m_slotNo, true))
|
||||
return;
|
||||
|
||||
// Test dst rewrite
|
||||
unsigned int rw_id = DMRAccessControl::DstIdRewrite(did, sid,m_slotNo, true,m_netLC);
|
||||
if (rw_id) {
|
||||
|
||||
m_netLC->setDstId(rw_id);
|
||||
}
|
||||
|
||||
// Store the LC for the embedded LC
|
||||
m_netEmbeddedLC.setData(*m_netLC);
|
||||
|
||||
@@ -822,10 +847,17 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
||||
return;
|
||||
|
||||
unsigned int did = m_netLC->getDstId();
|
||||
unsigned int id = m_netLC->getSrcId();
|
||||
if (!DMRAccessControl::validateAccess(id, did, m_slotNo, true))
|
||||
unsigned int sid = m_netLC->getSrcId();
|
||||
if (!DMRAccessControl::validateAccess(sid, did, m_slotNo, true))
|
||||
return;
|
||||
|
||||
// Test dst rewrite
|
||||
unsigned int rw_id = DMRAccessControl::DstIdRewrite(did,sid,m_slotNo,true, m_netLC);
|
||||
if (rw_id) {
|
||||
|
||||
m_netLC->setDstId(rw_id);
|
||||
}
|
||||
|
||||
// Regenerate the Slot Type
|
||||
CDMRSlotType slotType;
|
||||
slotType.setColorCode(m_colorCode);
|
||||
@@ -875,8 +907,10 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
||||
data[1U] = 0x00U;
|
||||
|
||||
if (m_duplex) {
|
||||
|
||||
for (unsigned int i = 0U; i < m_hangCount; i++)
|
||||
writeQueueNet(data);
|
||||
|
||||
} else {
|
||||
for (unsigned int i = 0U; i < 3U; i++)
|
||||
writeQueueNet(data);
|
||||
@@ -891,6 +925,7 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
||||
LogMessage("DMR Slot %u, received network end of voice transmission, %.1f seconds, %u%% packet loss, BER: %.1f%%", m_slotNo, float(m_netFrames) / 16.667F, (m_netLost * 100U) / m_netFrames, float(m_netErrs * 100U) / float(m_netBits));
|
||||
|
||||
writeEndNet();
|
||||
DMRAccessControl::setOverEndTime();
|
||||
} else if (dataType == DT_DATA_HEADER) {
|
||||
if (m_netState == RS_NET_DATA)
|
||||
return;
|
||||
@@ -1333,7 +1368,7 @@ void CDMRSlot::writeQueueNet(const unsigned char *data)
|
||||
m_queue.addData(data, len);
|
||||
}
|
||||
|
||||
void CDMRSlot::init(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& SrcIdBlacklist, const std::vector<unsigned int>& DstIdBlacklistSlot1RF, const std::vector<unsigned int>& DstIdWhitelistSlot1RF, const std::vector<unsigned int>& DstIdBlacklistSlot2RF, const std::vector<unsigned int>& DstIdWhitelistSlot2RF, const std::vector<unsigned int>& DstIdBlacklistSlot1NET, const std::vector<unsigned int>& DstIdWhitelistSlot1NET, const std::vector<unsigned int>& DstIdBlacklistSlot2NET, const std::vector<unsigned int>& DstIdWhitelistSlot2NET, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, int rssiMultiplier, int rssiOffset, unsigned int jitter)
|
||||
void CDMRSlot::init(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& SrcIdBlacklist, const std::vector<unsigned int>& DstIdBlacklistSlot1RF, const std::vector<unsigned int>& DstIdWhitelistSlot1RF, const std::vector<unsigned int>& DstIdBlacklistSlot2RF, const std::vector<unsigned int>& DstIdWhitelistSlot2RF, const std::vector<unsigned int>& DstIdBlacklistSlot1NET, const std::vector<unsigned int>& DstIdWhitelistSlot1NET, const std::vector<unsigned int>& DstIdBlacklistSlot2NET, const std::vector<unsigned int>& DstIdWhitelistSlot2NET, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, int rssiMultiplier, int rssiOffset, unsigned int jitter, bool TGRewriteSlot1, bool TGRewriteSlot2, bool BMAutoRewrite, bool BMRewriteReflectorVoicePrompts)
|
||||
{
|
||||
assert(id != 0U);
|
||||
assert(modem != NULL);
|
||||
@@ -1368,7 +1403,7 @@ void CDMRSlot::init(unsigned int id, unsigned int colorCode, unsigned int callHa
|
||||
slotType.getData(m_idle + 2U);
|
||||
|
||||
//Load black and white lists to DMRAccessControl
|
||||
DMRAccessControl::init(DstIdBlacklistSlot1RF, DstIdWhitelistSlot1RF, DstIdBlacklistSlot2RF, DstIdWhitelistSlot2RF, DstIdBlacklistSlot1NET, DstIdWhitelistSlot1NET, DstIdBlacklistSlot2NET, DstIdWhitelistSlot2NET, SrcIdBlacklist, m_selfOnly, m_prefixes, m_id);
|
||||
DMRAccessControl::init(DstIdBlacklistSlot1RF, DstIdWhitelistSlot1RF, DstIdBlacklistSlot2RF, DstIdWhitelistSlot2RF, DstIdBlacklistSlot1NET, DstIdWhitelistSlot1NET, DstIdBlacklistSlot2NET, DstIdWhitelistSlot2NET, SrcIdBlacklist, m_selfOnly, m_prefixes, m_id,callHang, TGRewriteSlot1, TGRewriteSlot2, BMAutoRewrite, BMRewriteReflectorVoicePrompts);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
|
||||
void clock();
|
||||
|
||||
static void init(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& SrcIdBlackList, const std::vector<unsigned int>& DstIdBlacklistSlot1RF, const std::vector<unsigned int>& DstIdWhitelistSlot1RF, const std::vector<unsigned int>& DstIdBlacklistSlot2RF, const std::vector<unsigned int>& DstIdWhitelistSlot2RF, const std::vector<unsigned int>& DstIdBlacklistSlot1NET, const std::vector<unsigned int>& DstIdWhitelistSlot1NET, const std::vector<unsigned int>& DstIdBlacklistSlot2NET, const std::vector<unsigned int>& DstIdWhitelistSlot2NET, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, int rssiMultiplier, int rssiOffset, unsigned int jitter);
|
||||
static void init(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& SrcIdBlackList, const std::vector<unsigned int>& DstIdBlacklistSlot1RF, const std::vector<unsigned int>& DstIdWhitelistSlot1RF, const std::vector<unsigned int>& DstIdBlacklistSlot2RF, const std::vector<unsigned int>& DstIdWhitelistSlot2RF, const std::vector<unsigned int>& DstIdBlacklistSlot1NET, const std::vector<unsigned int>& DstIdWhitelistSlot1NET, const std::vector<unsigned int>& DstIdBlacklistSlot2NET, const std::vector<unsigned int>& DstIdWhitelistSlot2NET, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, int rssiMultiplier, int rssiOffset, unsigned int jitter, bool TGRewriteSlot1, bool TGRewriteSlot2, bool BMAutoRewrite, bool BMRewriteReflectorVoicePrompts);
|
||||
|
||||
private:
|
||||
unsigned int m_slotNo;
|
||||
|
||||
@@ -24,6 +24,7 @@ const unsigned char MODE_DSTAR = 1U;
|
||||
const unsigned char MODE_DMR = 2U;
|
||||
const unsigned char MODE_YSF = 3U;
|
||||
const unsigned char MODE_P25 = 4U;
|
||||
const unsigned char MODE_CW = 98U;
|
||||
const unsigned char MODE_LOCKOUT = 99U;
|
||||
const unsigned char MODE_ERROR = 100U;
|
||||
|
||||
|
||||
13
Display.cpp
13
Display.cpp
@@ -177,6 +177,14 @@ void CDisplay::clearP25()
|
||||
}
|
||||
}
|
||||
|
||||
void CDisplay::writeCW()
|
||||
{
|
||||
m_timer1.start();
|
||||
m_mode1 = MODE_CW;
|
||||
|
||||
writeCWInt();
|
||||
}
|
||||
|
||||
void CDisplay::clock(unsigned int ms)
|
||||
{
|
||||
m_timer1.clock(ms);
|
||||
@@ -202,6 +210,11 @@ void CDisplay::clock(unsigned int ms)
|
||||
m_mode1 = MODE_IDLE;
|
||||
m_timer1.stop();
|
||||
break;
|
||||
case MODE_CW:
|
||||
clearCWInt();
|
||||
m_mode1 = MODE_IDLE;
|
||||
m_timer1.stop();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -47,6 +47,9 @@ public:
|
||||
void writeP25(const char* source, bool group, unsigned int dest, const char* type);
|
||||
void clearP25();
|
||||
|
||||
void writeCW();
|
||||
void clearCW();
|
||||
|
||||
virtual void close() = 0;
|
||||
|
||||
void clock(unsigned int ms);
|
||||
@@ -68,6 +71,9 @@ protected:
|
||||
virtual void writeP25Int(const char* source, bool group, unsigned int dest, const char* type) = 0;
|
||||
virtual void clearP25Int() = 0;
|
||||
|
||||
virtual void writeCWInt() = 0;
|
||||
virtual void clearCWInt() = 0;
|
||||
|
||||
virtual void clockInt(unsigned int ms);
|
||||
|
||||
private:
|
||||
|
||||
12
HD44780.cpp
12
HD44780.cpp
@@ -815,6 +815,18 @@ void CHD44780::clearP25Int()
|
||||
}
|
||||
}
|
||||
|
||||
void CHD44780::writeCWInt()
|
||||
{
|
||||
::lcdPosition(m_fd, m_cols - 5, m_rows - 1);
|
||||
::lcdPuts(m_fd, "CW TX");
|
||||
}
|
||||
|
||||
void CHD44780::clearCWInt()
|
||||
{
|
||||
::lcdPosition(m_fd, m_cols - 5, m_rows - 1);
|
||||
::lcdPuts(m_fd, " Idle");
|
||||
}
|
||||
|
||||
void CHD44780::clockInt(unsigned int ms)
|
||||
{
|
||||
m_clockDisplayTimer.clock(ms);
|
||||
|
||||
@@ -113,6 +113,9 @@ protected:
|
||||
virtual void writeP25Int(const char* source, bool group, unsigned int dest, const char* type);
|
||||
virtual void clearP25Int();
|
||||
|
||||
virtual void writeCWInt();
|
||||
virtual void clearCWInt();
|
||||
|
||||
virtual void clockInt(unsigned int ms);
|
||||
|
||||
private:
|
||||
|
||||
10
MMDVM.ini
10
MMDVM.ini
@@ -73,6 +73,16 @@ TXHang=4
|
||||
#DstIdBlackListSlot2NET=
|
||||
#DstIdWhiteListSlot1NET=
|
||||
#DstIdWhiteListSlot2NET=
|
||||
TGRewriteSlot1=0
|
||||
TGRewriteSlot2=0
|
||||
BMAutoRewrite=0
|
||||
BMRewriteReflectorVoicePrompts=0
|
||||
|
||||
|
||||
DirectDial=0
|
||||
TargetTG=9
|
||||
#RewriteMapSlot1=
|
||||
#RewritemapSlot2=
|
||||
|
||||
[System Fusion]
|
||||
Enable=1
|
||||
|
||||
@@ -316,6 +316,10 @@ int CMMDVMHost::run()
|
||||
unsigned int id = m_conf.getDMRId();
|
||||
unsigned int colorCode = m_conf.getDMRColorCode();
|
||||
bool selfOnly = m_conf.getDMRSelfOnly();
|
||||
bool TGRewriteSlot1 = m_conf.getDMRTGRewriteSlot1();
|
||||
bool TGRewriteSlot2 = m_conf.getDMRTGRewriteSlot2();
|
||||
bool BMAutoRewrite = m_conf.getDMRBMAutoRewrite();
|
||||
bool BMRewriteReflectorVoicePrompts = m_conf.getDMRBMRewriteReflectorVoicePrompts();
|
||||
std::vector<unsigned int> prefixes = m_conf.getDMRPrefixes();
|
||||
std::vector<unsigned int> blackList = m_conf.getDMRBlackList();
|
||||
std::vector<unsigned int> dstIDBlackListSlot1RF = m_conf.getDMRDstIdBlacklistSlot1RF();
|
||||
@@ -373,7 +377,17 @@ int CMMDVMHost::run()
|
||||
LogInfo(" RSSI Offset: %d", rssiOffset);
|
||||
}
|
||||
|
||||
dmr = new CDMRControl(id, colorCode, callHang, selfOnly, prefixes, blackList, dstIDBlackListSlot1RF, dstIDWhiteListSlot1RF, dstIDBlackListSlot2RF, dstIDWhiteListSlot2RF, dstIDBlackListSlot1NET,dstIDWhiteListSlot1NET, dstIDBlackListSlot2NET, dstIDWhiteListSlot2NET, m_timeout, m_modem, m_dmrNetwork, m_display, m_duplex, lookup, rssiMultiplier, rssiOffset, jitter);
|
||||
if (TGRewriteSlot1)
|
||||
LogInfo(" TG Rewrite Slot 1 enabled");
|
||||
|
||||
if (TGRewriteSlot2)
|
||||
LogInfo(" TG Rewrite Slot 2 enabled");
|
||||
if (BMAutoRewrite)
|
||||
LogInfo(" BrandMeister Auto Rewrite enabled");
|
||||
if (BMRewriteReflectorVoicePrompts)
|
||||
LogInfo(" BrandMeister Rewrite Reflector Voice Prompts enabled");
|
||||
|
||||
dmr = new CDMRControl(id, colorCode, callHang, selfOnly, prefixes, blackList,dstIDBlackListSlot1RF,dstIDWhiteListSlot1RF, dstIDBlackListSlot2RF, dstIDWhiteListSlot2RF, dstIDBlackListSlot1NET,dstIDWhiteListSlot1NET, dstIDBlackListSlot2NET, dstIDWhiteListSlot2NET, m_timeout, m_modem, m_dmrNetwork, m_display, m_duplex, lookup, rssiMultiplier, rssiOffset, jitter, TGRewriteSlot1, TGRewriteSlot2, BMAutoRewrite, BMRewriteReflectorVoicePrompts);
|
||||
|
||||
m_dmrTXTimer.setTimeout(txHang);
|
||||
}
|
||||
@@ -696,6 +710,7 @@ int CMMDVMHost::run()
|
||||
if (m_cwIdTimer.isRunning() && m_cwIdTimer.hasExpired()) {
|
||||
if (m_mode == MODE_IDLE && !m_modem->hasTX()){
|
||||
LogDebug("sending CW ID");
|
||||
m_display->writeCW();
|
||||
m_modem->sendCWId(m_callsign);
|
||||
|
||||
m_cwIdTimer.start(); //reset only after sending ID, timer-overflow after 49 days doesnt matter
|
||||
|
||||
16
Nextion.cpp
16
Nextion.cpp
@@ -263,11 +263,25 @@ void CNextion::clearP25Int()
|
||||
sendCommand("t2.txt=\"\"");
|
||||
}
|
||||
|
||||
void CNextion::writeCWInt()
|
||||
{
|
||||
sendCommand("t1.txt=\"Sending CW Ident\"");
|
||||
|
||||
m_clockDisplayTimer.start();
|
||||
|
||||
m_mode = MODE_CW;
|
||||
}
|
||||
|
||||
void CNextion::clearCWInt()
|
||||
{
|
||||
sendCommand("t1.txt=\"MMDVM IDLE\"");
|
||||
}
|
||||
|
||||
void CNextion::clockInt(unsigned int ms)
|
||||
{
|
||||
// Update the clock display in IDLE mode every 400ms
|
||||
m_clockDisplayTimer.clock(ms);
|
||||
if (m_displayClock && m_mode == MODE_IDLE && m_clockDisplayTimer.isRunning() && m_clockDisplayTimer.hasExpired()) {
|
||||
if (m_displayClock && (m_mode == MODE_IDLE || m_mode == MODE_CW) && m_clockDisplayTimer.isRunning() && m_clockDisplayTimer.hasExpired()) {
|
||||
time_t currentTime;
|
||||
struct tm *Time;
|
||||
::time(¤tTime); // Get the current time
|
||||
|
||||
@@ -53,6 +53,9 @@ protected:
|
||||
virtual void writeP25Int(const char* source, bool group, unsigned int dest, const char* type);
|
||||
virtual void clearP25Int();
|
||||
|
||||
virtual void writeCWInt();
|
||||
virtual void clearCWInt();
|
||||
|
||||
virtual void clockInt(unsigned int ms);
|
||||
|
||||
private:
|
||||
|
||||
@@ -76,6 +76,14 @@ void CNullDisplay::clearP25Int()
|
||||
{
|
||||
}
|
||||
|
||||
void CNullDisplay::writeCWInt()
|
||||
{
|
||||
}
|
||||
|
||||
void CNullDisplay::clearCWInt()
|
||||
{
|
||||
}
|
||||
|
||||
void CNullDisplay::close()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -50,6 +50,9 @@ protected:
|
||||
virtual void writeP25Int(const char* source, bool group, unsigned int dest, const char* type);
|
||||
virtual void clearP25Int();
|
||||
|
||||
virtual void writeCWInt();
|
||||
virtual void clearCWInt();
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
53
README.TGRewrite
Normal file
53
README.TGRewrite
Normal file
@@ -0,0 +1,53 @@
|
||||
Talk-Group Rewrite was conceived as a way of making talk-groups behave more
|
||||
like the reflector system and of attempting to solve the problem of "slot
|
||||
contention",where the user may be locked out of a slot by traffic on a
|
||||
talk-group they know nothing about, without knowing why. This is frustrating to
|
||||
users, both those new to DMR and seasoned DMR users.
|
||||
|
||||
TG Rewrite, when enabled for a slot, rewrites the DST ID of incoming talkgroup
|
||||
traffic to TG9, alowing audio to be heard by any user monitoring TG9 on that
|
||||
slot. If the user then replies on TG9, as long as they key-up during the
|
||||
CallHang period, the DST ID (TG) is again rewritten on the outbound traffic,
|
||||
which transparently maps back to the originating talkgroup. Rewrite is also
|
||||
enabled if an outbound call is made to a talkgroup and then TG9 is activated
|
||||
during the CallHang period.
|
||||
|
||||
To use a User Activated talk-group, briefly key-up on that talk-group to
|
||||
activate it, then switch back to TG9 and talk as normal. If the CallHang period
|
||||
expires, you may need to activate the talk-group again by keying up on that
|
||||
talkgroup briefly, as before. Alternatively, you can wait for inbound audio to
|
||||
re-activate the rewrite, then respond during the CallHang period.
|
||||
|
||||
Note, proper ettiquette dictates that the user confirms the repeater is free
|
||||
before activiating this feature. It is best to ensure the slot is keyed from
|
||||
"cold" when activating a talkgroup for rewrite. Although not strictly
|
||||
neccesary, it may be advantageous to also disconnect the repeater from the
|
||||
reflector system first, if using slot 2.
|
||||
|
||||
Talk-group rewrite was originally intended to work with User-Activated talk
|
||||
groups, although it will function with permanent talk-groups too.
|
||||
|
||||
It is useful to set the CallHang parameter to a generous amount. I am currently
|
||||
using seven seconds.
|
||||
|
||||
In addition to the above, there is also the capability ro rewrite voice prompts
|
||||
on link/unlink so all users can hear them on TG9.
|
||||
|
||||
Configuration options are as follows:
|
||||
|
||||
TGRewriteSlot1=[0|1]
|
||||
TGRewriteSlot2=[0|1]
|
||||
BMAutoRewrite=[0|1]
|
||||
BMRewriteReflectorVoicePrompts=[0|1]
|
||||
|
||||
Note at present, Auto rewrite is the only type of rewrite that is implemented so
|
||||
to do something useful, this option must be set.
|
||||
|
||||
|
||||
ACL's are applied before the rewrite, so still apply to rewritten traffic on
|
||||
original (non-rewritten) talk-group.
|
||||
|
||||
73
|
||||
|
||||
Simon (G7RZU)
|
||||
|
||||
@@ -50,7 +50,8 @@ public:
|
||||
bool addData(const T* buffer, unsigned int nSamples)
|
||||
{
|
||||
if (nSamples >= freeSpace()) {
|
||||
LogError("**** Overflow in %s ring buffer, %u >= %u", m_name, nSamples, freeSpace());
|
||||
LogError("%s buffer overflow, clearing the buffer. (%u >= %u)", m_name, nSamples, freeSpace());
|
||||
clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -352,6 +352,20 @@ void CTFTSerial::clearP25Int()
|
||||
displayText(" ");
|
||||
}
|
||||
|
||||
void CTFTSerial::writeCWInt()
|
||||
{
|
||||
gotoPosPixel(45U, 90U);
|
||||
displayText("CW TX");
|
||||
|
||||
m_mode = MODE_CW;
|
||||
}
|
||||
|
||||
void CTFTSerial::clearCWInt()
|
||||
{
|
||||
gotoPosPixel(45U, 90U);
|
||||
displayText("IDLE");
|
||||
}
|
||||
|
||||
void CTFTSerial::close()
|
||||
{
|
||||
m_serial.close();
|
||||
|
||||
@@ -52,6 +52,9 @@ protected:
|
||||
virtual void writeP25Int(const char* source, bool group, unsigned int dest, const char* type);
|
||||
virtual void clearP25Int();
|
||||
|
||||
virtual void writeCWInt();
|
||||
virtual void clearCWInt();
|
||||
|
||||
private:
|
||||
std::string m_callsign;
|
||||
unsigned int m_dmrid;
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
// #define DUMP_YSF
|
||||
|
||||
CYSFControl::CYSFControl(const std::string& callsign, CYSFNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, bool remoteGateway, int rssiMultiplier, int rssiOffset) :
|
||||
m_callsign(NULL),
|
||||
m_network(network),
|
||||
m_display(display),
|
||||
m_duplex(duplex),
|
||||
@@ -70,6 +71,14 @@ m_fp(NULL)
|
||||
m_netDest = new unsigned char[YSF_CALLSIGN_LENGTH];
|
||||
|
||||
m_lastFrame = new unsigned char[YSF_FRAME_LENGTH_BYTES + 2U];
|
||||
|
||||
m_callsign = new unsigned char[YSF_CALLSIGN_LENGTH];
|
||||
|
||||
std::string node = callsign;
|
||||
node.resize(YSF_CALLSIGN_LENGTH, ' ');
|
||||
|
||||
for (unsigned int i = 0U; i < YSF_CALLSIGN_LENGTH; i++)
|
||||
m_callsign[i] = node.at(i);
|
||||
}
|
||||
|
||||
CYSFControl::~CYSFControl()
|
||||
@@ -77,6 +86,7 @@ CYSFControl::~CYSFControl()
|
||||
delete[] m_netSource;
|
||||
delete[] m_netDest;
|
||||
delete[] m_lastFrame;
|
||||
delete[] m_callsign;
|
||||
}
|
||||
|
||||
bool CYSFControl::writeModem(unsigned char *data, unsigned int len)
|
||||
@@ -404,7 +414,7 @@ void CYSFControl::writeNetwork()
|
||||
|
||||
m_networkWatchdog.start();
|
||||
|
||||
bool gateway = ::memcmp(data + 4U, "GATEWAY ", YSF_CALLSIGN_LENGTH) == 0;
|
||||
bool gateway = ::memcmp(data + 4U, m_callsign, YSF_CALLSIGN_LENGTH) == 0;
|
||||
|
||||
unsigned char n = (data[34U] & 0xFEU) >> 1;
|
||||
bool end = (data[34U] & 0x01U) == 0x01U;
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
void clock(unsigned int ms);
|
||||
|
||||
private:
|
||||
unsigned char* m_callsign;
|
||||
CYSFNetwork* m_network;
|
||||
CDisplay* m_display;
|
||||
bool m_duplex;
|
||||
|
||||
Reference in New Issue
Block a user