Add DSTAR radio mode for use with DSTAR2PCM

This commit is contained in:
Doug McLain 2020-09-27 20:53:54 -04:00
parent 9ccc94923e
commit 9d002ebfb4
6 changed files with 33 additions and 8 deletions

View file

@ -125,6 +125,7 @@ m_umpPort(),
m_dstarEnabled(false),
m_dstarModule("C"),
m_dstarSelfOnly(false),
m_dstarRadioMode(false),
m_dstarBlackList(),
m_dstarAckReply(true),
m_dstarAckTime(750U),
@ -555,6 +556,8 @@ bool CConf::read()
m_dstarModule = value;
} else if (::strcmp(key, "SelfOnly") == 0)
m_dstarSelfOnly = ::atoi(value) == 1;
else if (::strcmp(key, "RadioMode") == 0)
m_dstarRadioMode = ::atoi(value) == 1;
else if (::strcmp(key, "BlackList") == 0) {
char* p = ::strtok(value, ",\r\n");
while (p != NULL) {
@ -1289,6 +1292,11 @@ bool CConf::getDStarSelfOnly() const
return m_dstarSelfOnly;
}
bool CConf::getDStarRadioMode() const
{
return m_dstarRadioMode;
}
std::vector<std::string> CConf::getDStarBlackList() const
{
return m_dstarBlackList;

2
Conf.h
View file

@ -111,6 +111,7 @@ public:
bool getDStarEnabled() const;
std::string getDStarModule() const;
bool getDStarSelfOnly() const;
bool getDStarRadioMode() const;
std::vector<std::string> getDStarBlackList() const;
bool getDStarAckReply() const;
unsigned int getDStarAckTime() const;
@ -387,6 +388,7 @@ private:
bool m_dstarEnabled;
std::string m_dstarModule;
bool m_dstarSelfOnly;
bool m_dstarRadioMode;
std::vector<std::string> m_dstarBlackList;
bool m_dstarAckReply;
unsigned int m_dstarAckTime;

View file

@ -36,10 +36,11 @@ bool CallsignCompare(const std::string& arg, const unsigned char* my)
// #define DUMP_DSTAR
CDStarControl::CDStarControl(const std::string& callsign, const std::string& module, bool selfOnly, bool ackReply, unsigned int ackTime, bool ackMessage, bool errorReply, const std::vector<std::string>& blackList, CDStarNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, bool remoteGateway, CRSSIInterpolator* rssiMapper) :
CDStarControl::CDStarControl(const std::string& callsign, const std::string& module, bool selfOnly, bool dstarRadioMode, bool ackReply, unsigned int ackTime, bool ackMessage, bool errorReply, const std::vector<std::string>& blackList, CDStarNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, bool remoteGateway, CRSSIInterpolator* rssiMapper) :
m_callsign(NULL),
m_gateway(NULL),
m_selfOnly(selfOnly),
m_dstarRadioMode(dstarRadioMode),
m_ackReply(ackReply),
m_ackMessage(ackMessage),
m_errorReply(errorReply),
@ -214,8 +215,8 @@ bool CDStarControl::writeModem(unsigned char *data, unsigned int len)
unsigned char my1[DSTAR_LONG_CALLSIGN_LENGTH];
header.getMyCall1(my1);
// Is this a transmission destined for a repeater?
if (!header.isRepeater()) {
// Is this a transmission destined for a repeater? If we are in radio mode we want it anyway
if (!header.isRepeater() && !m_dstarRadioMode) {
LogMessage("D-Star, non repeater RF header received from %8.8s", my1);
m_rfState = RS_RF_INVALID;
return false;
@ -224,8 +225,8 @@ bool CDStarControl::writeModem(unsigned char *data, unsigned int len)
unsigned char callsign[DSTAR_LONG_CALLSIGN_LENGTH];
header.getRPTCall1(callsign);
// Is it for us?
if (::memcmp(callsign, m_callsign, DSTAR_LONG_CALLSIGN_LENGTH) != 0) {
// Is it for us? If we are in radio mode, then its all for us!
if ((::memcmp(callsign, m_callsign, DSTAR_LONG_CALLSIGN_LENGTH) != 0) && !m_dstarRadioMode) {
LogMessage("D-Star, received RF header for wrong repeater (%8.8s) from %8.8s", callsign, my1);
m_rfState = RS_RF_INVALID;
return false;
@ -252,7 +253,13 @@ bool CDStarControl::writeModem(unsigned char *data, unsigned int len)
unsigned char your[DSTAR_LONG_CALLSIGN_LENGTH];
header.getYourCall(your);
m_net = ::memcmp(gateway, m_gateway, DSTAR_LONG_CALLSIGN_LENGTH) == 0;
if((::memcmp(gateway, m_gateway, DSTAR_LONG_CALLSIGN_LENGTH) == 0) || m_dstarRadioMode){
m_net = true;
}
else{
m_net = false;
}
//m_net = ::memcmp(gateway, m_gateway, DSTAR_LONG_CALLSIGN_LENGTH) == 0;
// Only start the timeout if not already running
if (!m_rfTimeoutTimer.isRunning())
@ -675,6 +682,11 @@ void CDStarControl::writeNetwork()
m_netBits = 1U;
m_netErrs = 0U;
if (m_dstarRadioMode) {
header.setRepeater(true);
header.get(data + 1U);
}
if (m_remoteGateway) {
header.setRepeater(true);
header.setRPTCall1(m_callsign);

View file

@ -37,7 +37,7 @@
class CDStarControl {
public:
CDStarControl(const std::string& callsign, const std::string& module, bool selfOnly, bool ackReply, unsigned int ackTime, bool ackMessage, bool errorReply, const std::vector<std::string>& blackList, CDStarNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, bool remoteGateway, CRSSIInterpolator* rssiMapper);
CDStarControl(const std::string& callsign, const std::string& module, bool selfOnly, bool dstarRadioMode, bool ackReply, unsigned int ackTime, bool ackMessage, bool errorReply, const std::vector<std::string>& blackList, CDStarNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, bool remoteGateway, CRSSIInterpolator* rssiMapper);
~CDStarControl();
bool writeModem(unsigned char* data, unsigned int len);
@ -54,6 +54,7 @@ private:
unsigned char* m_callsign;
unsigned char* m_gateway;
bool m_selfOnly;
bool m_dstarRadioMode;
bool m_ackReply;
bool m_ackMessage;
bool m_errorReply;

View file

@ -87,6 +87,7 @@ Port=/dev/ttyACM1
Enable=1
Module=C
SelfOnly=0
RadioMode=0
AckReply=1
AckTime=750
AckMessage=0

View file

@ -409,6 +409,7 @@ int CMMDVMHost::run()
if (m_dstarEnabled) {
std::string module = m_conf.getDStarModule();
bool selfOnly = m_conf.getDStarSelfOnly();
bool dstarRadioMode = m_conf.getDStarRadioMode();
std::vector<std::string> blackList = m_conf.getDStarBlackList();
bool ackReply = m_conf.getDStarAckReply();
unsigned int ackTime = m_conf.getDStarAckTime();
@ -430,7 +431,7 @@ int CMMDVMHost::run()
if (blackList.size() > 0U)
LogInfo(" Black List: %u", blackList.size());
m_dstar = new CDStarControl(m_callsign, module, selfOnly, ackReply, ackTime, ackMessage, errorReply, blackList, m_dstarNetwork, m_display, m_timeout, m_duplex, remoteGateway, rssi);
m_dstar = new CDStarControl(m_callsign, module, selfOnly, dstarRadioMode, ackReply, ackTime, ackMessage, errorReply, blackList, m_dstarNetwork, m_display, m_timeout, m_duplex, remoteGateway, rssi);
}
DMR_BEACONS dmrBeacons = DMR_BEACONS_OFF;