Add UseCOSAsLockout and FM Access Mode parameters.

This commit is contained in:
Jonathan Naylor 2020-07-13 16:02:04 +01:00
parent 16fac0b41c
commit 3e6d5d5a7f
9 changed files with 59 additions and 43 deletions

View file

@ -112,6 +112,7 @@ m_modemNXDNTXLevel(50.0F),
m_modemPOCSAGTXLevel(50.0F),
m_modemFMTXLevel(50.0F),
m_modemRSSIMappingFile(),
m_modemUseCOSAsLockout(false),
m_modemTrace(false),
m_modemDebug(false),
m_transparentEnabled(false),
@ -200,7 +201,7 @@ m_fmCTCSSLowThreshold(20U),
m_fmCTCSSLevel(2.0F),
m_fmKerchunkTime(0U),
m_fmHangTime(7U),
m_fmUseCOS(true),
m_fmAccessMode(1U),
m_fmCOSInvert(false),
m_fmRFAudioBoost(1U),
m_fmMaxDevLevel(90.0F),
@ -524,6 +525,8 @@ bool CConf::read()
m_modemFMTXLevel = float(::atof(value));
else if (::strcmp(key, "RSSIMappingFile") == 0)
m_modemRSSIMappingFile = value;
else if (::strcmp(key, "UseCOSAsLockout") == 0)
m_modemUseCOSAsLockout = ::atoi(value) == 1;
else if (::strcmp(key, "Trace") == 0)
m_modemTrace = ::atoi(value) == 1;
else if (::strcmp(key, "Debug") == 0)
@ -777,8 +780,8 @@ bool CConf::read()
m_fmKerchunkTime = (unsigned int)::atoi(value);
else if (::strcmp(key, "HangTime") == 0)
m_fmHangTime = (unsigned int)::atoi(value);
else if (::strcmp(key, "UseCOS") == 0)
m_fmUseCOS = ::atoi(value) == 1;
else if (::strcmp(key, "AccessMode") == 0)
m_fmAccessMode = (unsigned int)::atoi(value);
else if (::strcmp(key, "COSInvert") == 0)
m_fmCOSInvert = ::atoi(value) == 1;
else if (::strcmp(key, "RFAudioBoost") == 0)
@ -1226,6 +1229,11 @@ std::string CConf::getModemRSSIMappingFile () const
return m_modemRSSIMappingFile;
}
bool CConf::getModemUseCOSAsLockout() const
{
return m_modemUseCOSAsLockout;
}
bool CConf::getModemTrace() const
{
return m_modemTrace;
@ -1666,9 +1674,9 @@ unsigned int CConf::getFMHangTime() const
return m_fmHangTime;
}
bool CConf::getFMUseCOS() const
unsigned int CConf::getFMAccessMode() const
{
return m_fmUseCOS;
return m_fmAccessMode;
}
bool CConf::getFMCOSInvert() const

6
Conf.h
View file

@ -92,6 +92,7 @@ public:
float getModemPOCSAGTXLevel() const;
float getModemFMTXLevel() const;
std::string getModemRSSIMappingFile() const;
bool getModemUseCOSAsLockout() const;
bool getModemTrace() const;
bool getModemDebug() const;
@ -198,7 +199,7 @@ public:
float getFMCTCSSLevel() const;
unsigned int getFMKerchunkTime() const;
unsigned int getFMHangTime() const;
bool getFMUseCOS() const;
unsigned int getFMAccessMode() const;
bool getFMCOSInvert() const;
unsigned int getFMRFAudioBoost() const;
float getFMMaxDevLevel() const;
@ -372,6 +373,7 @@ private:
float m_modemPOCSAGTXLevel;
float m_modemFMTXLevel;
std::string m_modemRSSIMappingFile;
bool m_modemUseCOSAsLockout;
bool m_modemTrace;
bool m_modemDebug;
@ -469,7 +471,7 @@ private:
float m_fmCTCSSLevel;
unsigned int m_fmKerchunkTime;
unsigned int m_fmHangTime;
bool m_fmUseCOS;
unsigned int m_fmAccessMode;
bool m_fmCOSInvert;
unsigned int m_fmRFAudioBoost;
float m_fmMaxDevLevel;

View file

@ -67,6 +67,7 @@ RFLevel=100
# POCSAGTXLevel=50
# FMTXLevel=50
RSSIMappingFile=RSSI.dat
UseCOSAsLockout=0
Trace=0
Debug=0
@ -169,7 +170,7 @@ CTCSSThreshold=30
CTCSSLevel=20
KerchunkTime=0
HangTime=7
UseCOS=1
AccessMode=1
COSInvert=0
RFAudioBoost=1
MaxDevLevel=90

View file

@ -1188,6 +1188,7 @@ bool CMMDVMHost::createModem()
int rxDCOffset = m_conf.getModemRXDCOffset();
int txDCOffset = m_conf.getModemTXDCOffset();
float rfLevel = m_conf.getModemRFLevel();
bool useCOSAsLockout = m_conf.getModemUseCOSAsLockout();
LogInfo("Modem Parameters");
LogInfo(" Port: %s", port.c_str());
@ -1214,9 +1215,10 @@ bool CMMDVMHost::createModem()
LogInfo(" POCSAG TX Level: %.1f%%", pocsagTXLevel);
LogInfo(" FM TX Level: %.1f%%", fmTXLevel);
LogInfo(" TX Frequency: %uHz (%uHz)", txFrequency, txFrequency + txOffset);
LogInfo(" Use COS as Lockout: %s", useCOSAsLockout ? "yes" : "no");
m_modem = CModem::createModem(port, m_duplex, rxInvert, txInvert, pttInvert, txDelay, dmrDelay, trace, debug);
m_modem->setSerialParams(protocol,address);
m_modem = CModem::createModem(port, m_duplex, rxInvert, txInvert, pttInvert, txDelay, dmrDelay, useCOSAsLockout, trace, debug);
m_modem->setSerialParams(protocol, address);
m_modem->setModeParams(m_dstarEnabled, m_dmrEnabled, m_ysfEnabled, m_p25Enabled, m_nxdnEnabled, m_pocsagEnabled, m_fmEnabled);
m_modem->setLevels(rxLevel, cwIdTXLevel, dstarTXLevel, dmrTXLevel, ysfTXLevel, p25TXLevel, nxdnTXLevel, pocsagTXLevel, fmTXLevel);
m_modem->setRFParams(rxFrequency, rxOffset, txFrequency, txOffset, txDCOffset, rxDCOffset, rfLevel, pocsagFrequency);
@ -1251,7 +1253,7 @@ bool CMMDVMHost::createModem()
float ctcssLevel = m_conf.getFMCTCSSLevel();
unsigned int kerchunkTime = m_conf.getFMKerchunkTime();
unsigned int hangTime = m_conf.getFMHangTime();
bool useCOS = m_conf.getFMUseCOS();
unsigned int accessMode = m_conf.getFMAccessMode();
bool cosInvert = m_conf.getFMCOSInvert();
unsigned int rfAudioBoost = m_conf.getFMRFAudioBoost();
float maxDevLevel = m_conf.getFMMaxDevLevel();
@ -1283,7 +1285,7 @@ bool CMMDVMHost::createModem()
LogInfo(" CTCSS Level: %.1f%%", ctcssLevel);
LogInfo(" Kerchunk Time: %us", kerchunkTime);
LogInfo(" Hang Time: %us", hangTime);
LogInfo(" Use COS: %s", useCOS ? "yes" : "no");
LogInfo(" Access Mode: %u", accessMode);
LogInfo(" COS Invert: %s", cosInvert ? "yes" : "no");
LogInfo(" RF Audio Boost: x%u", rfAudioBoost);
LogInfo(" Max. Deviation Level: %.1f%%", maxDevLevel);
@ -1291,7 +1293,7 @@ bool CMMDVMHost::createModem()
m_modem->setFMCallsignParams(callsign, callsignSpeed, callsignFrequency, callsignTime, callsignHoldoff, callsignHighLevel, callsignLowLevel, callsignAtStart, callsignAtEnd, callsignAtLatch);
m_modem->setFMAckParams(rfAck, ackSpeed, ackFrequency, ackMinTime, ackDelay, ackLevel);
m_modem->setFMMiscParams(timeout, timeoutLevel, ctcssFrequency, ctcssHighThreshold, ctcssLowThreshold, ctcssLevel, kerchunkTime, hangTime, useCOS, cosInvert, rfAudioBoost, maxDevLevel);
m_modem->setFMMiscParams(timeout, timeoutLevel, ctcssFrequency, ctcssHighThreshold, ctcssLowThreshold, ctcssLevel, kerchunkTime, hangTime, accessMode, cosInvert, rfAudioBoost, maxDevLevel);
}
bool ret = m_modem->open();

View file

@ -99,7 +99,7 @@ const unsigned int MAX_RESPONSES = 30U;
const unsigned int BUFFER_LENGTH = 2000U;
CModem::CModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool trace, bool debug) :
CModem::CModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool useCOSAsLockout, bool trace, bool debug) :
m_port(port),
m_dmrColorCode(0U),
m_ysfLoDev(false),
@ -112,15 +112,17 @@ m_txInvert(txInvert),
m_pttInvert(pttInvert),
m_txDelay(txDelay),
m_dmrDelay(dmrDelay),
m_rxLevel(0U),
m_cwIdTXLevel(0U),
m_dstarTXLevel(0U),
m_dmrTXLevel(0U),
m_ysfTXLevel(0U),
m_p25TXLevel(0U),
m_nxdnTXLevel(0U),
m_pocsagTXLevel(0U),
m_fmTXLevel(0U),
m_rxLevel(0.0F),
m_cwIdTXLevel(0.0F),
m_dstarTXLevel(0.0F),
m_dmrTXLevel(0.0F),
m_ysfTXLevel(0.0F),
m_p25TXLevel(0.0F),
m_nxdnTXLevel(0.0F),
m_pocsagTXLevel(0.0F),
m_fmTXLevel(0.0F),
m_rfLevel(0.0F),
m_useCOSAsLockout(useCOSAsLockout),
m_trace(trace),
m_debug(debug),
m_rxFrequency(0U),
@ -195,7 +197,7 @@ m_fmCtcssLowThreshold(20U),
m_fmCtcssLevel(10.0F),
m_fmKerchunkTime(0U),
m_fmHangTime(5U),
m_fmUseCOS(true),
m_fmAccessMode(1U),
m_fmCOSInvert(false),
m_fmRFAudioBoost(1U),
m_fmMaxDevLevel(90.0F)
@ -1534,6 +1536,8 @@ bool CModem::setConfig()
buffer[3U] |= 0x08U;
if (m_debug)
buffer[3U] |= 0x10U;
if (m_useCOSAsLockout)
buffer[3U] |= 0x20U;
if (!m_duplex)
buffer[3U] |= 0x80U;
@ -1930,7 +1934,7 @@ void CModem::setFMAckParams(const std::string& rfAck, unsigned int ackSpeed, uns
m_fmAckLevel = ackLevel;
}
void CModem::setFMMiscParams(unsigned int timeout, float timeoutLevel, float ctcssFrequency, unsigned int ctcssHighThreshold, unsigned int ctcssLowThreshold, float ctcssLevel, unsigned int kerchunkTime, unsigned int hangTime, bool useCOS, bool cosInvert, unsigned int rfAudioBoost, float maxDevLevel)
void CModem::setFMMiscParams(unsigned int timeout, float timeoutLevel, float ctcssFrequency, unsigned int ctcssHighThreshold, unsigned int ctcssLowThreshold, float ctcssLevel, unsigned int kerchunkTime, unsigned int hangTime, unsigned int accessMode, bool cosInvert, unsigned int rfAudioBoost, float maxDevLevel)
{
m_fmTimeout = timeout;
m_fmTimeoutLevel = timeoutLevel;
@ -1943,7 +1947,7 @@ void CModem::setFMMiscParams(unsigned int timeout, float timeoutLevel, float ctc
m_fmKerchunkTime = kerchunkTime;
m_fmHangTime = hangTime;
m_fmUseCOS = useCOS;
m_fmAccessMode = accessMode;
m_fmCOSInvert = cosInvert;
m_fmRFAudioBoost = rfAudioBoost;
@ -2084,11 +2088,9 @@ bool CModem::setFMMiscParams()
buffer[9U] = m_fmKerchunkTime;
buffer[10U] = m_fmHangTime;
buffer[11U] = 0x00U;
if (m_fmUseCOS)
buffer[11U] |= 0x01U;
buffer[11U] = m_fmAccessMode;
if (m_fmCOSInvert)
buffer[11U] |= 0x02U;
buffer[11U] |= 0x80U;
buffer[12U] = m_fmRFAudioBoost;
@ -2152,9 +2154,9 @@ void CModem::printDebug()
}
}
CModem* CModem::createModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool trace, bool debug){
CModem* CModem::createModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool useCOSAsLockout, bool trace, bool debug){
if (port == "NullModem")
return new CNullModem(port, duplex, rxInvert, txInvert, pttInvert, txDelay, dmrDelay, trace, debug);
return new CNullModem(port, duplex, rxInvert, txInvert, pttInvert, txDelay, dmrDelay, useCOSAsLockout, trace, debug);
else
return new CModem(port, duplex, rxInvert, txInvert, pttInvert, txDelay, dmrDelay, trace, debug);
return new CModem(port, duplex, rxInvert, txInvert, pttInvert, txDelay, dmrDelay, useCOSAsLockout, trace, debug);
}

View file

@ -34,7 +34,7 @@ enum RESP_TYPE_MMDVM {
class CModem {
public:
CModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool trace, bool debug);
CModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool useCOSAsLockout, bool trace, bool debug);
virtual ~CModem();
virtual void setSerialParams(const std::string& protocol, unsigned int address);
@ -49,7 +49,7 @@ public:
virtual void setFMCallsignParams(const std::string& callsign, unsigned int callsignSpeed, unsigned int callsignFrequency, unsigned int callsignTime, unsigned int callsignHoldoff, float callsignHighLevel, float callsignLowLevel, bool callsignAtStart, bool callsignAtEnd, bool callsignAtLatch);
virtual void setFMAckParams(const std::string& rfAck, unsigned int ackSpeed, unsigned int ackFrequency, unsigned int ackMinTime, unsigned int ackDelay, float ackLevel);
virtual void setFMMiscParams(unsigned int timeout, float timeoutLevel, float ctcssFrequency, unsigned int ctcssHighThreshold, unsigned int ctcssLowThreshold, float ctcssLevel, unsigned int kerchunkTime, unsigned int hangTime, bool useCOS, bool cosInvert, unsigned int rfAudioBoost, float maxDevLevel);
virtual void setFMMiscParams(unsigned int timeout, float timeoutLevel, float ctcssFrequency, unsigned int ctcssHighThreshold, unsigned int ctcssLowThreshold, float ctcssLevel, unsigned int kerchunkTime, unsigned int hangTime, unsigned int accessMode, bool cosInvert, unsigned int rfAudioBoost, float maxDevLevel);
virtual bool open();
@ -113,7 +113,7 @@ public:
virtual void close();
static CModem* createModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool trace, bool debug);
static CModem* createModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool useCOSAsLockout, bool trace, bool debug);
private:
std::string m_port;
@ -138,6 +138,7 @@ private:
float m_pocsagTXLevel;
float m_fmTXLevel;
float m_rfLevel;
bool m_useCOSAsLockout;
bool m_trace;
bool m_debug;
unsigned int m_rxFrequency;
@ -213,7 +214,7 @@ private:
float m_fmCtcssLevel;
unsigned int m_fmKerchunkTime;
unsigned int m_fmHangTime;
bool m_fmUseCOS;
unsigned int m_fmAccessMode;
bool m_fmCOSInvert;
unsigned int m_fmRFAudioBoost;
float m_fmMaxDevLevel;

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2011-2018 by Jonathan Naylor G4KLX
* Copyright (C) 2011-2018,2020 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -19,8 +19,8 @@
#include "NullModem.h"
#include "Log.h"
CNullModem::CNullModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool trace, bool debug) :
CModem(port, duplex,rxInvert, txInvert,pttInvert,txDelay, dmrDelay, trace, debug),
CNullModem::CNullModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool useCOSAsLockout, bool trace, bool debug) :
CModem(port, duplex,rxInvert, txInvert,pttInvert,txDelay, dmrDelay, useCOSAsLockout, trace, debug),
m_hwType(HWT_MMDVM)
{
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2011-2018 by Jonathan Naylor G4KLX
* Copyright (C) 2011-2018,2020 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -27,7 +27,7 @@
class CNullModem : public CModem {
public:
CNullModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool trace, bool debug);
CNullModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool useCOSAsLockout, bool trace, bool debug);
virtual ~CNullModem();
virtual void setSerialParams(const std::string& protocol, unsigned int address){};

View file

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