mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-23 16:55:52 +08:00
Allow for setting of outgoing port number on DMR networking.
This commit is contained in:
8
Conf.cpp
8
Conf.cpp
@@ -87,6 +87,7 @@ m_dstarNetworkDebug(false),
|
|||||||
m_dmrNetworkEnabled(true),
|
m_dmrNetworkEnabled(true),
|
||||||
m_dmrNetworkAddress(),
|
m_dmrNetworkAddress(),
|
||||||
m_dmrNetworkPort(0U),
|
m_dmrNetworkPort(0U),
|
||||||
|
m_dmrNetworkLocal(0U),
|
||||||
m_dmrNetworkPassword(),
|
m_dmrNetworkPassword(),
|
||||||
m_dmrNetworkDebug(false),
|
m_dmrNetworkDebug(false),
|
||||||
m_dmrNetworkSlot1(true),
|
m_dmrNetworkSlot1(true),
|
||||||
@@ -254,6 +255,8 @@ bool CConf::read()
|
|||||||
m_dmrNetworkAddress = value;
|
m_dmrNetworkAddress = value;
|
||||||
else if (::strcmp(key, "Port") == 0)
|
else if (::strcmp(key, "Port") == 0)
|
||||||
m_dmrNetworkPort = (unsigned int)::atoi(value);
|
m_dmrNetworkPort = (unsigned int)::atoi(value);
|
||||||
|
else if (::strcmp(key, "Local") == 0)
|
||||||
|
m_dmrNetworkLocal = (unsigned int)::atoi(value);
|
||||||
else if (::strcmp(key, "Password") == 0)
|
else if (::strcmp(key, "Password") == 0)
|
||||||
m_dmrNetworkPassword = value;
|
m_dmrNetworkPassword = value;
|
||||||
else if (::strcmp(key, "Debug") == 0)
|
else if (::strcmp(key, "Debug") == 0)
|
||||||
@@ -509,6 +512,11 @@ unsigned int CConf::getDMRNetworkPort() const
|
|||||||
return m_dmrNetworkPort;
|
return m_dmrNetworkPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int CConf::getDMRNetworkLocal() const
|
||||||
|
{
|
||||||
|
return m_dmrNetworkLocal;
|
||||||
|
}
|
||||||
|
|
||||||
std::string CConf::getDMRNetworkPassword() const
|
std::string CConf::getDMRNetworkPassword() const
|
||||||
{
|
{
|
||||||
return m_dmrNetworkPassword;
|
return m_dmrNetworkPassword;
|
||||||
|
|||||||
2
Conf.h
2
Conf.h
@@ -90,6 +90,7 @@ public:
|
|||||||
bool getDMRNetworkEnabled() const;
|
bool getDMRNetworkEnabled() const;
|
||||||
std::string getDMRNetworkAddress() const;
|
std::string getDMRNetworkAddress() const;
|
||||||
unsigned int getDMRNetworkPort() const;
|
unsigned int getDMRNetworkPort() const;
|
||||||
|
unsigned int getDMRNetworkLocal() const;
|
||||||
std::string getDMRNetworkPassword() const;
|
std::string getDMRNetworkPassword() const;
|
||||||
bool getDMRNetworkDebug() const;
|
bool getDMRNetworkDebug() const;
|
||||||
bool getDMRNetworkSlot1() const;
|
bool getDMRNetworkSlot1() const;
|
||||||
@@ -163,6 +164,7 @@ private:
|
|||||||
bool m_dmrNetworkEnabled;
|
bool m_dmrNetworkEnabled;
|
||||||
std::string m_dmrNetworkAddress;
|
std::string m_dmrNetworkAddress;
|
||||||
unsigned int m_dmrNetworkPort;
|
unsigned int m_dmrNetworkPort;
|
||||||
|
unsigned int m_dmrNetworkLocal;
|
||||||
std::string m_dmrNetworkPassword;
|
std::string m_dmrNetworkPassword;
|
||||||
bool m_dmrNetworkDebug;
|
bool m_dmrNetworkDebug;
|
||||||
bool m_dmrNetworkSlot1;
|
bool m_dmrNetworkSlot1;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ const unsigned int BUFFER_LENGTH = 500U;
|
|||||||
const unsigned int HOMEBREW_DATA_PACKET_LENGTH = 55U;
|
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_address(),
|
||||||
m_port(port),
|
m_port(port),
|
||||||
m_id(NULL),
|
m_id(NULL),
|
||||||
@@ -39,7 +39,7 @@ m_password(password),
|
|||||||
m_duplex(duplex),
|
m_duplex(duplex),
|
||||||
m_version(version),
|
m_version(version),
|
||||||
m_debug(debug),
|
m_debug(debug),
|
||||||
m_socket(),
|
m_socket(local),
|
||||||
m_enabled(false),
|
m_enabled(false),
|
||||||
m_slot1(slot1),
|
m_slot1(slot1),
|
||||||
m_slot2(slot2),
|
m_slot2(slot2),
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
class CDMRIPSC
|
class CDMRIPSC
|
||||||
{
|
{
|
||||||
public:
|
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();
|
~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);
|
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);
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ Debug=0
|
|||||||
Enable=1
|
Enable=1
|
||||||
Address=44.131.4.1
|
Address=44.131.4.1
|
||||||
Port=62031
|
Port=62031
|
||||||
|
# Local=3350
|
||||||
Password=PASSWORD
|
Password=PASSWORD
|
||||||
Slot1=1
|
Slot1=1
|
||||||
Slot2=1
|
Slot2=1
|
||||||
|
|||||||
@@ -485,6 +485,7 @@ bool CMMDVMHost::createDMRNetwork()
|
|||||||
{
|
{
|
||||||
std::string address = m_conf.getDMRNetworkAddress();
|
std::string address = m_conf.getDMRNetworkAddress();
|
||||||
unsigned int port = m_conf.getDMRNetworkPort();
|
unsigned int port = m_conf.getDMRNetworkPort();
|
||||||
|
unsigned int local = m_conf.getDMRNetworkLocal();
|
||||||
unsigned int id = m_conf.getDMRId();
|
unsigned int id = m_conf.getDMRId();
|
||||||
std::string password = m_conf.getDMRNetworkPassword();
|
std::string password = m_conf.getDMRNetworkPassword();
|
||||||
bool debug = m_conf.getDMRNetworkDebug();
|
bool debug = m_conf.getDMRNetworkDebug();
|
||||||
@@ -494,10 +495,14 @@ bool CMMDVMHost::createDMRNetwork()
|
|||||||
LogInfo("DMR Network Parameters");
|
LogInfo("DMR Network Parameters");
|
||||||
LogInfo(" Address: %s", address.c_str());
|
LogInfo(" Address: %s", address.c_str());
|
||||||
LogInfo(" Port: %u", port);
|
LogInfo(" Port: %u", port);
|
||||||
|
if (local > 0U)
|
||||||
|
LogInfo(" Local: %u", local);
|
||||||
|
else
|
||||||
|
LogInfo(" Local: random");
|
||||||
LogInfo(" Slot 1: %s", slot1 ? "enabled" : "disabled");
|
LogInfo(" Slot 1: %s", slot1 ? "enabled" : "disabled");
|
||||||
LogInfo(" Slot 2: %s", slot2 ? "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();
|
std::string callsign = m_conf.getCallsign();
|
||||||
unsigned int rxFrequency = m_conf.getRxFrequency();
|
unsigned int rxFrequency = m_conf.getRxFrequency();
|
||||||
|
|||||||
Reference in New Issue
Block a user