diff --git a/Conf.cpp b/Conf.cpp index 1d8c2d9..ace7a0f 100644 --- a/Conf.cpp +++ b/Conf.cpp @@ -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; diff --git a/Conf.h b/Conf.h index 217d04c..c385cb1 100644 --- a/Conf.h +++ b/Conf.h @@ -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; diff --git a/DMRIPSC.cpp b/DMRIPSC.cpp index a8d9727..4cf7178 100644 --- a/DMRIPSC.cpp +++ b/DMRIPSC.cpp @@ -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), diff --git a/DMRIPSC.h b/DMRIPSC.h index 847d568..069febe 100644 --- a/DMRIPSC.h +++ b/DMRIPSC.h @@ -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); diff --git a/MMDVM.ini b/MMDVM.ini index 2aa5b2b..40bd15e 100644 --- a/MMDVM.ini +++ b/MMDVM.ini @@ -61,6 +61,7 @@ Debug=0 Enable=1 Address=44.131.4.1 Port=62031 +# Local=3350 Password=PASSWORD Slot1=1 Slot2=1 diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index 41e0785..4fea953 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -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();