Allow for setting of outgoing port number on DMR networking.

This commit is contained in:
Jonathan Naylor 2016-04-03 19:11:45 +01:00
parent 582775aeed
commit 9d03c83609
6 changed files with 20 additions and 4 deletions

View file

@ -87,6 +87,7 @@ m_dstarNetworkDebug(false),
m_dmrNetworkEnabled(true),
m_dmrNetworkAddress(),
m_dmrNetworkPort(0U),
m_dmrNetworkLocal(0U),
m_dmrNetworkPassword(),
m_dmrNetworkDebug(false),
m_dmrNetworkSlot1(true),
@ -254,6 +255,8 @@ bool CConf::read()
m_dmrNetworkAddress = value;
else if (::strcmp(key, "Port") == 0)
m_dmrNetworkPort = (unsigned int)::atoi(value);
else if (::strcmp(key, "Local") == 0)
m_dmrNetworkLocal = (unsigned int)::atoi(value);
else if (::strcmp(key, "Password") == 0)
m_dmrNetworkPassword = value;
else if (::strcmp(key, "Debug") == 0)
@ -509,6 +512,11 @@ unsigned int CConf::getDMRNetworkPort() const
return m_dmrNetworkPort;
}
unsigned int CConf::getDMRNetworkLocal() const
{
return m_dmrNetworkLocal;
}
std::string CConf::getDMRNetworkPassword() const
{
return m_dmrNetworkPassword;

2
Conf.h
View file

@ -90,6 +90,7 @@ public:
bool getDMRNetworkEnabled() const;
std::string getDMRNetworkAddress() const;
unsigned int getDMRNetworkPort() const;
unsigned int getDMRNetworkLocal() const;
std::string getDMRNetworkPassword() const;
bool getDMRNetworkDebug() const;
bool getDMRNetworkSlot1() const;
@ -163,6 +164,7 @@ private:
bool m_dmrNetworkEnabled;
std::string m_dmrNetworkAddress;
unsigned int m_dmrNetworkPort;
unsigned int m_dmrNetworkLocal;
std::string m_dmrNetworkPassword;
bool m_dmrNetworkDebug;
bool m_dmrNetworkSlot1;

View file

@ -31,7 +31,7 @@ const unsigned int BUFFER_LENGTH = 500U;
const unsigned int HOMEBREW_DATA_PACKET_LENGTH = 55U;
CDMRIPSC::CDMRIPSC(const std::string& address, unsigned int port, unsigned int id, const std::string& password, bool duplex, const char* version, bool debug, bool slot1, bool slot2) :
CDMRIPSC::CDMRIPSC(const std::string& address, unsigned int port, unsigned int local, unsigned int id, const std::string& password, bool duplex, const char* version, bool debug, bool slot1, bool slot2) :
m_address(),
m_port(port),
m_id(NULL),
@ -39,7 +39,7 @@ m_password(password),
m_duplex(duplex),
m_version(version),
m_debug(debug),
m_socket(),
m_socket(local),
m_enabled(false),
m_slot1(slot1),
m_slot2(slot2),

View file

@ -30,7 +30,7 @@
class CDMRIPSC
{
public:
CDMRIPSC(const std::string& address, unsigned int port, unsigned int id, const std::string& password, bool duplex, const char* version, bool debug, bool slot1, bool slot2);
CDMRIPSC(const std::string& address, unsigned int port, unsigned int local, unsigned int id, const std::string& password, bool duplex, const char* version, bool debug, bool slot1, bool slot2);
~CDMRIPSC();
void setConfig(const std::string& callsign, unsigned int rxFrequency, unsigned int txFrequency, unsigned int power, unsigned int colorCode, float latitude, float longitude, int height, const std::string& location, const std::string& description, const std::string& url);

View file

@ -61,6 +61,7 @@ Debug=0
Enable=1
Address=44.131.4.1
Port=62031
# Local=3350
Password=PASSWORD
Slot1=1
Slot2=1

View file

@ -485,6 +485,7 @@ bool CMMDVMHost::createDMRNetwork()
{
std::string address = m_conf.getDMRNetworkAddress();
unsigned int port = m_conf.getDMRNetworkPort();
unsigned int local = m_conf.getDMRNetworkLocal();
unsigned int id = m_conf.getDMRId();
std::string password = m_conf.getDMRNetworkPassword();
bool debug = m_conf.getDMRNetworkDebug();
@ -494,10 +495,14 @@ bool CMMDVMHost::createDMRNetwork()
LogInfo("DMR Network Parameters");
LogInfo(" Address: %s", address.c_str());
LogInfo(" Port: %u", port);
if (local > 0U)
LogInfo(" Local: %u", local);
else
LogInfo(" Local: random");
LogInfo(" Slot 1: %s", slot1 ? "enabled" : "disabled");
LogInfo(" Slot 2: %s", slot2 ? "enabled" : "disabled");
m_dmrNetwork = new CDMRIPSC(address, port, id, password, m_duplex, VERSION, debug, slot1, slot2);
m_dmrNetwork = new CDMRIPSC(address, port, local, id, password, m_duplex, VERSION, debug, slot1, slot2);
std::string callsign = m_conf.getCallsign();
unsigned int rxFrequency = m_conf.getRxFrequency();