Add the IAX configuration options.

This commit is contained in:
Jonathan Naylor
2024-02-01 12:54:24 +00:00
parent 8a6595e4eb
commit 73084ed734
12 changed files with 75 additions and 25 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015-2023 by Jonathan Naylor G4KLX * Copyright (C) 2015-2024 by Jonathan Naylor G4KLX
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -290,6 +290,9 @@ m_pocsagNetworkModeHang(3U),
m_pocsagNetworkDebug(false), m_pocsagNetworkDebug(false),
m_fmNetworkEnabled(false), m_fmNetworkEnabled(false),
m_fmNetworkProtocol("USRP"), m_fmNetworkProtocol("USRP"),
m_fmNetworkUsername("Dave"),
m_fmNetworkPassword("PASSWORD"),
m_fmNetworkNode("Node1"),
m_fmNetworkSampleRate(48000U), m_fmNetworkSampleRate(48000U),
m_fmNetworkSquelchFile(), m_fmNetworkSquelchFile(),
m_fmGatewayAddress(), m_fmGatewayAddress(),
@@ -1036,6 +1039,12 @@ bool CConf::read()
m_fmNetworkEnabled = ::atoi(value) == 1; m_fmNetworkEnabled = ::atoi(value) == 1;
else if (::strcmp(key, "Protocol") == 0) else if (::strcmp(key, "Protocol") == 0)
m_fmNetworkProtocol = value; m_fmNetworkProtocol = value;
else if (::strcmp(key, "Username") == 0)
m_fmNetworkUsername = value;
else if (::strcmp(key, "Password") == 0)
m_fmNetworkPassword = value;
else if (::strcmp(key, "Node") == 0)
m_fmNetworkNode = value;
else if (::strcmp(key, "SampleRate") == 0) else if (::strcmp(key, "SampleRate") == 0)
m_fmNetworkSampleRate = (unsigned int)::atoi(value); m_fmNetworkSampleRate = (unsigned int)::atoi(value);
else if (::strcmp(key, "SquelchFile") == 0) else if (::strcmp(key, "SquelchFile") == 0)
@@ -2282,6 +2291,21 @@ std::string CConf::getFMNetworkProtocol() const
return m_fmNetworkProtocol; return m_fmNetworkProtocol;
} }
std::string CConf::getFMNetworkUsername() const
{
return m_fmNetworkUsername;
}
std::string CConf::getFMNetworkPassword() const
{
return m_fmNetworkPassword;
}
std::string CConf::getFMNetworkNode() const
{
return m_fmNetworkNode;
}
unsigned int CConf::getFMNetworkSampleRate() const unsigned int CConf::getFMNetworkSampleRate() const
{ {
return m_fmNetworkSampleRate; return m_fmNetworkSampleRate;

8
Conf.h
View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015-2023 by Jonathan Naylor G4KLX * Copyright (C) 2015-2024 by Jonathan Naylor G4KLX
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -303,6 +303,9 @@ public:
// The FM Network section // The FM Network section
bool getFMNetworkEnabled() const; bool getFMNetworkEnabled() const;
std::string getFMNetworkProtocol() const; std::string getFMNetworkProtocol() const;
std::string getFMNetworkUsername() const;
std::string getFMNetworkPassword() const;
std::string getFMNetworkNode() const;
unsigned int getFMNetworkSampleRate() const; unsigned int getFMNetworkSampleRate() const;
std::string getFMNetworkSquelchFile() const; std::string getFMNetworkSquelchFile() const;
std::string getFMGatewayAddress() const; std::string getFMGatewayAddress() const;
@@ -623,6 +626,9 @@ private:
bool m_fmNetworkEnabled; bool m_fmNetworkEnabled;
std::string m_fmNetworkProtocol; std::string m_fmNetworkProtocol;
std::string m_fmNetworkUsername;
std::string m_fmNetworkPassword;
std::string m_fmNetworkNode;
unsigned int m_fmNetworkSampleRate; unsigned int m_fmNetworkSampleRate;
std::string m_fmNetworkSquelchFile; std::string m_fmNetworkSquelchFile;
std::string m_fmGatewayAddress; std::string m_fmGatewayAddress;

View File

@@ -97,11 +97,11 @@ const unsigned char IAX_IE_RR_OOO = 51U;
const unsigned int BUFFER_LENGTH = 1500U; const unsigned int BUFFER_LENGTH = 1500U;
CFMIAXNetwork::CFMIAXNetwork(const std::string& callsign, const std::string& localAddress, unsigned short localPort, const std::string& gatewayAddress, unsigned short gatewayPort, bool debug) : CFMIAXNetwork::CFMIAXNetwork(const std::string& callsign, const std::string& username, const std::string& password, const std::string& node, const std::string& localAddress, unsigned short localPort, const std::string& gatewayAddress, unsigned short gatewayPort, bool debug) :
m_callsign(callsign), m_callsign(callsign),
m_username(), m_username(username),
m_password(), m_password(password),
m_node(), m_node(node),
m_socket(localAddress, localPort), m_socket(localAddress, localPort),
m_addr(), m_addr(),
m_addrLen(0U), m_addrLen(0U),
@@ -121,6 +121,9 @@ m_rxDropped(0U),
m_rxOOO(0U) m_rxOOO(0U)
{ {
assert(!callsign.empty()); assert(!callsign.empty());
assert(!username.empty());
assert(!password.empty());
assert(!node.empty());
assert(gatewayPort > 0U); assert(gatewayPort > 0U);
assert(!gatewayAddress.empty()); assert(!gatewayAddress.empty());
@@ -153,17 +156,19 @@ bool CFMIAXNetwork::writeData(const float* data, unsigned int nSamples)
{ {
assert(data != NULL); assert(data != NULL);
assert(nSamples > 0U); assert(nSamples > 0U);
/*
if (m_seqNo == 0U) { if (m_iSeqNo == 0U) {
bool ret = writeStart(); bool ret = writeStart();
if (!ret) if (!ret)
return false; return false;
} }
*/
return true;
} }
bool CFMIAXNetwork::writeEnd() bool CFMIAXNetwork::writeEnd()
{ {
return true;
} }
void CFMIAXNetwork::clock(unsigned int ms) void CFMIAXNetwork::clock(unsigned int ms)
@@ -529,6 +534,8 @@ bool CFMIAXNetwork::writeAck(unsigned short sCallNo, unsigned short dCallNo, uns
if (m_debug) if (m_debug)
CUtils::dump(1U, "FM IAX Network Data Sent", buffer, 12U); CUtils::dump(1U, "FM IAX Network Data Sent", buffer, 12U);
m_oSeqNo++;
return m_socket.write(buffer, 12U, m_addr, m_addrLen); return m_socket.write(buffer, 12U, m_addr, m_addrLen);
} }

View File

@@ -29,7 +29,7 @@
class CFMIAXNetwork : public IFMNetwork { class CFMIAXNetwork : public IFMNetwork {
public: public:
CFMIAXNetwork(const std::string& callsign, const std::string& localAddress, unsigned short localPort, const std::string& gatewayAddress, unsigned short gatewayPort, bool debug); CFMIAXNetwork(const std::string& callsign, const std::string& username, const std::string& password, const std::string& node, const std::string& localAddress, unsigned short localPort, const std::string& gatewayAddress, unsigned short gatewayPort, bool debug);
virtual ~CFMIAXNetwork(); virtual ~CFMIAXNetwork();
virtual bool open(); virtual bool open();

View File

@@ -289,10 +289,6 @@ Debug=0
Enable=1 Enable=1
# Protocol may be USRP, RAW, or IAX # Protocol may be USRP, RAW, or IAX
Protocol=USRP Protocol=USRP
# SampleRate is only used in RAW mode
SampleRate=48000
# The squelch file is optional and only used in RAW mode
SquelchFile=/tmp/sql
LocalAddress=127.0.0.1 LocalAddress=127.0.0.1
LocalPort=3810 LocalPort=3810
GatewayAddress=127.0.0.1 GatewayAddress=127.0.0.1
@@ -303,6 +299,14 @@ TXAudioGain=1.0
RXAudioGain=1.0 RXAudioGain=1.0
# ModeHang=3 # ModeHang=3
Debug=0 Debug=0
# SampleRate and SquelchFile are RAW mode only options
SampleRate=48000
# The squelch file is optional
SquelchFile=/tmp/sql
# Username, Password, and Node are IAX only options
Username=Dave
Password=PASSWORD
Node=Node1
[AX.25 Network] [AX.25 Network]
Enable=1 Enable=1

View File

@@ -1888,6 +1888,9 @@ bool CMMDVMHost::createPOCSAGNetwork()
bool CMMDVMHost::createFMNetwork() bool CMMDVMHost::createFMNetwork()
{ {
std::string callsign = m_conf.getFMCallsign(); std::string callsign = m_conf.getFMCallsign();
std::string username = m_conf.getFMNetworkUsername();
std::string password = m_conf.getFMNetworkPassword();
std::string node = m_conf.getFMNetworkNode();
std::string protocol = m_conf.getFMNetworkProtocol(); std::string protocol = m_conf.getFMNetworkProtocol();
unsigned int sampleRate = m_conf.getFMNetworkSampleRate(); unsigned int sampleRate = m_conf.getFMNetworkSampleRate();
std::string squelchFile = m_conf.getFMNetworkSquelchFile(); std::string squelchFile = m_conf.getFMNetworkSquelchFile();
@@ -1904,10 +1907,6 @@ bool CMMDVMHost::createFMNetwork()
LogInfo("FM Network Parameters"); LogInfo("FM Network Parameters");
LogInfo(" Protocol: %s", protocol.c_str()); LogInfo(" Protocol: %s", protocol.c_str());
if (protocol == "RAW") {
LogInfo(" Sample Rate: %u", sampleRate);
LogInfo(" Squelch File: %s", squelchFile.empty() ? "(none)" : squelchFile.c_str());
}
LogInfo(" Gateway Address: %s", gatewayAddress.c_str()); LogInfo(" Gateway Address: %s", gatewayAddress.c_str());
LogInfo(" Gateway Port: %hu", gatewayPort); LogInfo(" Gateway Port: %hu", gatewayPort);
LogInfo(" Local Address: %s", localAddress.c_str()); LogInfo(" Local Address: %s", localAddress.c_str());
@@ -1918,12 +1917,22 @@ bool CMMDVMHost::createFMNetwork()
LogInfo(" RX Audio Gain: %.2f", rxAudioGain); LogInfo(" RX Audio Gain: %.2f", rxAudioGain);
LogInfo(" Mode Hang: %us", m_fmNetModeHang); LogInfo(" Mode Hang: %us", m_fmNetModeHang);
if (protocol == "RAW") {
LogInfo(" Sample Rate: %u", sampleRate);
LogInfo(" Squelch File: %s", squelchFile.empty() ? "(none)" : squelchFile.c_str());
}
if (protocol == "IAX") {
LogInfo(" Username: %s", username.c_str());
LogInfo(" Node: %s", node.c_str());
}
if (protocol == "USRP") { if (protocol == "USRP") {
m_fmNetwork = new CFMUSRPNetwork(callsign, localAddress, localPort, gatewayAddress, gatewayPort, debug); m_fmNetwork = new CFMUSRPNetwork(callsign, localAddress, localPort, gatewayAddress, gatewayPort, debug);
} else if (protocol == "RAW") { } else if (protocol == "RAW") {
m_fmNetwork = new CFMRAWNetwork(localAddress, localPort, gatewayAddress, gatewayPort, sampleRate, squelchFile, debug); m_fmNetwork = new CFMRAWNetwork(localAddress, localPort, gatewayAddress, gatewayPort, sampleRate, squelchFile, debug);
} else if (protocol == "IAX") { } else if (protocol == "IAX") {
m_fmNetwork = new CFMIAXNetwork(callsign, localAddress, localPort, gatewayAddress, gatewayPort, debug); m_fmNetwork = new CFMIAXNetwork(callsign, username, password, node, localAddress, localPort, gatewayAddress, gatewayPort, debug);
} else { } else {
LogError("Invalid FM network protocol specified - %s", protocol.c_str()); LogError("Invalid FM network protocol specified - %s", protocol.c_str());
return false; return false;

View File

@@ -3,7 +3,7 @@
CC = cc CC = cc
CXX = c++ CXX = c++
CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHAVE_LOG_H -I/usr/local/include CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHAVE_LOG_H -I/usr/local/include
LIBS = -lpthread -lutil -lsamplerate LIBS = -lpthread -lutil -lsamplerate -lmd
LDFLAGS = -g -L/usr/local/lib LDFLAGS = -g -L/usr/local/lib
OBJECTS = \ OBJECTS = \

View File

@@ -4,7 +4,7 @@
CC = cc CC = cc
CXX = c++ CXX = c++
CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHAVE_LOG_H -DHD44780 -DADAFRUIT_DISPLAY -I/usr/local/include CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHAVE_LOG_H -DHD44780 -DADAFRUIT_DISPLAY -I/usr/local/include
LIBS = -lwiringPi -lwiringPiDev -lpthread -lutil -lsamplerate LIBS = -lwiringPi -lwiringPiDev -lpthread -lutil -lsamplerate -lmd
LDFLAGS = -g -L/usr/local/lib LDFLAGS = -g -L/usr/local/lib
OBJECTS = \ OBJECTS = \

View File

@@ -3,7 +3,7 @@
CC = cc CC = cc
CXX = c++ CXX = c++
CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHAVE_LOG_H -DHD44780 -I/usr/local/include CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHAVE_LOG_H -DHD44780 -I/usr/local/include
LIBS = -lwiringPi -lwiringPiDev -lpthread -lutil -lsamplerate LIBS = -lwiringPi -lwiringPiDev -lpthread -lutil -lsamplerate -lmd
LDFLAGS = -g -L/usr/local/lib LDFLAGS = -g -L/usr/local/lib
OBJECTS = \ OBJECTS = \

View File

@@ -3,7 +3,7 @@
CC = cc CC = cc
CXX = c++ CXX = c++
CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHAVE_LOG_H -DRASPBERRY_PI -I/usr/local/include CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHAVE_LOG_H -DRASPBERRY_PI -I/usr/local/include
LIBS = -lwiringPi -lwiringPiDev -lpthread -lutil -lsamplerate LIBS = -lwiringPi -lwiringPiDev -lpthread -lutil -lsamplerate -lmd
LDFLAGS = -g -L/usr/local/lib LDFLAGS = -g -L/usr/local/lib
OBJECTS = \ OBJECTS = \

View File

@@ -3,7 +3,7 @@
CC = cc CC = cc
CXX = c++ CXX = c++
CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHAVE_LOG_H -DOLED -I/usr/local/include CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHAVE_LOG_H -DOLED -I/usr/local/include
LIBS = -lArduiPi_OLED -lpthread -lutil -lsamplerate LIBS = -lArduiPi_OLED -lpthread -lutil -lsamplerate -lmd
# If you use NetBSD, add following CFLAGS # If you use NetBSD, add following CFLAGS
#CFLAGS += -L/usr/local/lib -Wl,-rpath=/usr/local/lib #CFLAGS += -L/usr/local/lib -Wl,-rpath=/usr/local/lib

View File

@@ -4,7 +4,7 @@
CC = cc CC = cc
CXX = c++ CXX = c++
CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHAVE_LOG_H -DHD44780 -DPCF8574_DISPLAY -I/usr/local/include CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHAVE_LOG_H -DHD44780 -DPCF8574_DISPLAY -I/usr/local/include
LIBS = -lwiringPi -lwiringPiDev -lpthread -lutil -lsamplerate LIBS = -lwiringPi -lwiringPiDev -lpthread -lutil -lsamplerate -lmd
LDFLAGS = -g -L/usr/local/lib LDFLAGS = -g -L/usr/local/lib
OBJECTS = \ OBJECTS = \