Add the POCSAG frequency to the modem protocol (for hotspots).

This commit is contained in:
Jonathan Naylor 2018-06-12 19:40:49 +01:00
parent a084e14fdf
commit 413a44e088
6 changed files with 65 additions and 38 deletions

View file

@ -162,6 +162,7 @@ m_nxdnSelfOnly(false),
m_nxdnRemoteGateway(false),
m_nxdnModeHang(10U),
m_pocsagEnabled(false),
m_pocsagFrequency(0U),
m_dstarNetworkEnabled(false),
m_dstarGatewayAddress(),
m_dstarGatewayPort(0U),
@ -354,7 +355,7 @@ bool CConf::read()
m_daemon = ::atoi(value) == 1;
} else if (section == SECTION_INFO) {
if (::strcmp(key, "TXFrequency") == 0)
m_txFrequency = (unsigned int)::atoi(value);
m_pocsagFrequency = m_txFrequency = (unsigned int)::atoi(value);
else if (::strcmp(key, "RXFrequency") == 0)
m_rxFrequency = (unsigned int)::atoi(value);
else if (::strcmp(key, "Power") == 0)
@ -606,6 +607,8 @@ bool CConf::read()
} else if (section == SECTION_POCSAG) {
if (::strcmp(key, "Enable") == 0)
m_pocsagEnabled = ::atoi(value) == 1;
else if (::strcmp(key, "Frequency") == 0)
m_pocsagFrequency = (unsigned int)::atoi(value);
} else if (section == SECTION_DSTAR_NETWORK) {
if (::strcmp(key, "Enable") == 0)
m_dstarNetworkEnabled = ::atoi(value) == 1;
@ -1285,6 +1288,11 @@ bool CConf::getPOCSAGEnabled() const
return m_pocsagEnabled;
}
unsigned int CConf::getPOCSAGFrequency() const
{
return m_pocsagFrequency;
}
bool CConf::getDStarNetworkEnabled() const
{
return m_dstarNetworkEnabled;

2
Conf.h
View file

@ -161,6 +161,7 @@ public:
// The POCSAG section
bool getPOCSAGEnabled() const;
unsigned int getPOCSAGFrequency() const;
// The D-Star Network section
bool getDStarNetworkEnabled() const;
@ -374,6 +375,7 @@ private:
unsigned int m_nxdnModeHang;
bool m_pocsagEnabled;
unsigned int m_pocsagFrequency;
bool m_dstarNetworkEnabled;
std::string m_dstarGatewayAddress;

View file

@ -130,6 +130,7 @@ RemoteGateway=0
[POCSAG]
Enable=1
Frequency=439987500
[D-Star Network]
Enable=1

View file

@ -556,8 +556,14 @@ int CMMDVMHost::run()
}
CPOCSAGControl* pocsag = NULL;
if (m_pocsagEnabled)
if (m_pocsagEnabled) {
unsigned int frequency = m_conf.getPOCSAGFrequency();
LogInfo("POCSAG RF Parameters");
LogInfo(" Frequency: %uHz", frequency);
pocsag = new CPOCSAGControl(m_pocsagNetwork, m_display);
}
setMode(MODE_IDLE);
@ -1024,32 +1030,33 @@ int CMMDVMHost::run()
bool CMMDVMHost::createModem()
{
std::string port = m_conf.getModemPort();
bool rxInvert = m_conf.getModemRXInvert();
bool txInvert = m_conf.getModemTXInvert();
bool pttInvert = m_conf.getModemPTTInvert();
unsigned int txDelay = m_conf.getModemTXDelay();
unsigned int dmrDelay = m_conf.getModemDMRDelay();
float rxLevel = m_conf.getModemRXLevel();
float cwIdTXLevel = m_conf.getModemCWIdTXLevel();
float dstarTXLevel = m_conf.getModemDStarTXLevel();
float dmrTXLevel = m_conf.getModemDMRTXLevel();
float ysfTXLevel = m_conf.getModemYSFTXLevel();
float p25TXLevel = m_conf.getModemP25TXLevel();
float nxdnTXLevel = m_conf.getModemNXDNTXLevel();
float pocsagTXLevel = m_conf.getModemPOCSAGTXLevel();
bool trace = m_conf.getModemTrace();
bool debug = m_conf.getModemDebug();
unsigned int colorCode = m_conf.getDMRColorCode();
bool lowDeviation = m_conf.getFusionLowDeviation();
unsigned int txHang = m_conf.getFusionTXHang();
unsigned int rxFrequency = m_conf.getRXFrequency();
unsigned int txFrequency = m_conf.getTXFrequency();
int rxOffset = m_conf.getModemRXOffset();
int txOffset = m_conf.getModemTXOffset();
int rxDCOffset = m_conf.getModemRXDCOffset();
int txDCOffset = m_conf.getModemTXDCOffset();
float rfLevel = m_conf.getModemRFLevel();
std::string port = m_conf.getModemPort();
bool rxInvert = m_conf.getModemRXInvert();
bool txInvert = m_conf.getModemTXInvert();
bool pttInvert = m_conf.getModemPTTInvert();
unsigned int txDelay = m_conf.getModemTXDelay();
unsigned int dmrDelay = m_conf.getModemDMRDelay();
float rxLevel = m_conf.getModemRXLevel();
float cwIdTXLevel = m_conf.getModemCWIdTXLevel();
float dstarTXLevel = m_conf.getModemDStarTXLevel();
float dmrTXLevel = m_conf.getModemDMRTXLevel();
float ysfTXLevel = m_conf.getModemYSFTXLevel();
float p25TXLevel = m_conf.getModemP25TXLevel();
float nxdnTXLevel = m_conf.getModemNXDNTXLevel();
float pocsagTXLevel = m_conf.getModemPOCSAGTXLevel();
bool trace = m_conf.getModemTrace();
bool debug = m_conf.getModemDebug();
unsigned int colorCode = m_conf.getDMRColorCode();
bool lowDeviation = m_conf.getFusionLowDeviation();
unsigned int txHang = m_conf.getFusionTXHang();
unsigned int rxFrequency = m_conf.getRXFrequency();
unsigned int txFrequency = m_conf.getTXFrequency();
unsigned int pocsagFrequency = m_conf.getPOCSAGFrequency();
int rxOffset = m_conf.getModemRXOffset();
int txOffset = m_conf.getModemTXOffset();
int rxDCOffset = m_conf.getModemRXDCOffset();
int txDCOffset = m_conf.getModemTXDCOffset();
float rfLevel = m_conf.getModemRFLevel();
LogInfo("Modem Parameters");
LogInfo(" Port: %s", port.c_str());
@ -1077,7 +1084,7 @@ bool CMMDVMHost::createModem()
m_modem = new CModem(port, m_duplex, rxInvert, txInvert, pttInvert, txDelay, dmrDelay, trace, debug);
m_modem->setModeParams(m_dstarEnabled, m_dmrEnabled, m_ysfEnabled, m_p25Enabled, m_nxdnEnabled, m_pocsagEnabled);
m_modem->setLevels(rxLevel, cwIdTXLevel, dstarTXLevel, dmrTXLevel, ysfTXLevel, p25TXLevel, nxdnTXLevel, pocsagTXLevel);
m_modem->setRFParams(rxFrequency, rxOffset, txFrequency, txOffset, txDCOffset, rxDCOffset, rfLevel);
m_modem->setRFParams(rxFrequency, rxOffset, txFrequency, txOffset, txDCOffset, rxDCOffset, rfLevel, pocsagFrequency);
m_modem->setDMRParams(colorCode);
m_modem->setYSFParams(lowDeviation, txHang);

View file

@ -115,6 +115,7 @@ m_trace(trace),
m_debug(debug),
m_rxFrequency(0U),
m_txFrequency(0U),
m_pocsagFrequency(0U),
m_dstarEnabled(false),
m_dmrEnabled(false),
m_ysfEnabled(false),
@ -168,13 +169,14 @@ CModem::~CModem()
delete[] m_buffer;
}
void CModem::setRFParams(unsigned int rxFrequency, int rxOffset, unsigned int txFrequency, int txOffset, int txDCOffset, int rxDCOffset, float rfLevel)
void CModem::setRFParams(unsigned int rxFrequency, int rxOffset, unsigned int txFrequency, int txOffset, int txDCOffset, int rxDCOffset, float rfLevel, unsigned int pocsagFrequency)
{
m_rxFrequency = rxFrequency + rxOffset;
m_txFrequency = txFrequency + txOffset;
m_txDCOffset = txDCOffset;
m_rxDCOffset = rxDCOffset;
m_rfLevel = rfLevel;
m_rxFrequency = rxFrequency + rxOffset;
m_txFrequency = txFrequency + txOffset;
m_txDCOffset = txDCOffset;
m_rxDCOffset = rxDCOffset;
m_rfLevel = rfLevel;
m_pocsagFrequency = pocsagFrequency + txOffset;
}
void CModem::setModeParams(bool dstarEnabled, bool dmrEnabled, bool ysfEnabled, bool p25Enabled, bool nxdnEnabled, bool pocsagEnabled)
@ -1276,14 +1278,20 @@ bool CModem::setConfig()
bool CModem::setFrequency()
{
unsigned char buffer[16U];
unsigned char buffer[20U];
unsigned char len;
if (m_hwType == HWT_DVMEGA)
len = 12U;
else {
buffer[12U] = (unsigned char)(m_rfLevel * 2.55F + 0.5F);
len = 13U;
buffer[13U] = (m_pocsagFrequency >> 0) & 0xFFU;
buffer[14U] = (m_pocsagFrequency >> 8) & 0xFFU;
buffer[15U] = (m_pocsagFrequency >> 16) & 0xFFU;
buffer[16U] = (m_pocsagFrequency >> 24) & 0xFFU;
len = 17U;
}
buffer[0U] = MMDVM_FRAME_START;

View file

@ -37,7 +37,7 @@ 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();
void setRFParams(unsigned int rxFrequency, int rxOffset, unsigned int txFrequency, int txOffset, int txDCOffset, int rxDCOffset, float rfLevel);
void setRFParams(unsigned int rxFrequency, int rxOffset, unsigned int txFrequency, int txOffset, int txDCOffset, int rxDCOffset, float rfLevel, unsigned int pocsagFrequency);
void setModeParams(bool dstarEnabled, bool dmrEnabled, bool ysfEnabled, bool p25Enabled, bool nxdnEnabled, bool pocsagEnabled);
void setLevels(float rxLevel, float cwIdTXLevel, float dstarTXLevel, float dmrTXLevel, float ysfTXLevel, float p25TXLevel, float nxdnTXLevel, float pocsagLevel);
void setDMRParams(unsigned int colorCode);
@ -118,6 +118,7 @@ private:
bool m_debug;
unsigned int m_rxFrequency;
unsigned int m_txFrequency;
unsigned int m_pocsagFrequency;
bool m_dstarEnabled;
bool m_dmrEnabled;
bool m_ysfEnabled;