mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-21 23:45:49 +08:00
Merge branch 'master' into nxdn
This commit is contained in:
8
Conf.cpp
8
Conf.cpp
@@ -165,6 +165,7 @@ m_dmrNetworkLocal(0U),
|
|||||||
m_dmrNetworkPassword(),
|
m_dmrNetworkPassword(),
|
||||||
m_dmrNetworkOptions(),
|
m_dmrNetworkOptions(),
|
||||||
m_dmrNetworkDebug(false),
|
m_dmrNetworkDebug(false),
|
||||||
|
m_dmrNetworkJitterEnabled(true),
|
||||||
m_dmrNetworkJitter(300U),
|
m_dmrNetworkJitter(300U),
|
||||||
m_dmrNetworkSlot1(true),
|
m_dmrNetworkSlot1(true),
|
||||||
m_dmrNetworkSlot2(true),
|
m_dmrNetworkSlot2(true),
|
||||||
@@ -595,6 +596,8 @@ bool CConf::read()
|
|||||||
m_dmrNetworkOptions = value;
|
m_dmrNetworkOptions = value;
|
||||||
else if (::strcmp(key, "Debug") == 0)
|
else if (::strcmp(key, "Debug") == 0)
|
||||||
m_dmrNetworkDebug = ::atoi(value) == 1;
|
m_dmrNetworkDebug = ::atoi(value) == 1;
|
||||||
|
else if (::strcmp(key, "JitterEnabled") == 0)
|
||||||
|
m_dmrNetworkJitterEnabled = ::atoi(value) == 1;
|
||||||
else if (::strcmp(key, "Jitter") == 0)
|
else if (::strcmp(key, "Jitter") == 0)
|
||||||
m_dmrNetworkJitter = (unsigned int)::atoi(value);
|
m_dmrNetworkJitter = (unsigned int)::atoi(value);
|
||||||
else if (::strcmp(key, "Slot1") == 0)
|
else if (::strcmp(key, "Slot1") == 0)
|
||||||
@@ -1266,6 +1269,11 @@ bool CConf::getDMRNetworkDebug() const
|
|||||||
return m_dmrNetworkDebug;
|
return m_dmrNetworkDebug;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CConf::getDMRNetworkJitterEnabled() const
|
||||||
|
{
|
||||||
|
return m_dmrNetworkJitterEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int CConf::getDMRNetworkJitter() const
|
unsigned int CConf::getDMRNetworkJitter() const
|
||||||
{
|
{
|
||||||
return m_dmrNetworkJitter;
|
return m_dmrNetworkJitter;
|
||||||
|
|||||||
2
Conf.h
2
Conf.h
@@ -167,6 +167,7 @@ public:
|
|||||||
std::string getDMRNetworkPassword() const;
|
std::string getDMRNetworkPassword() const;
|
||||||
std::string getDMRNetworkOptions() const;
|
std::string getDMRNetworkOptions() const;
|
||||||
bool getDMRNetworkDebug() const;
|
bool getDMRNetworkDebug() const;
|
||||||
|
bool getDMRNetworkJitterEnabled() const;
|
||||||
unsigned int getDMRNetworkJitter() const;
|
unsigned int getDMRNetworkJitter() const;
|
||||||
bool getDMRNetworkSlot1() const;
|
bool getDMRNetworkSlot1() const;
|
||||||
bool getDMRNetworkSlot2() const;
|
bool getDMRNetworkSlot2() const;
|
||||||
@@ -360,6 +361,7 @@ private:
|
|||||||
std::string m_dmrNetworkPassword;
|
std::string m_dmrNetworkPassword;
|
||||||
std::string m_dmrNetworkOptions;
|
std::string m_dmrNetworkOptions;
|
||||||
bool m_dmrNetworkDebug;
|
bool m_dmrNetworkDebug;
|
||||||
|
bool m_dmrNetworkJitterEnabled;
|
||||||
unsigned int m_dmrNetworkJitter;
|
unsigned int m_dmrNetworkJitter;
|
||||||
bool m_dmrNetworkSlot1;
|
bool m_dmrNetworkSlot1;
|
||||||
bool m_dmrNetworkSlot2;
|
bool m_dmrNetworkSlot2;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ const unsigned int BUFFER_LENGTH = 500U;
|
|||||||
const unsigned int HOMEBREW_DATA_PACKET_LENGTH = 55U;
|
const unsigned int HOMEBREW_DATA_PACKET_LENGTH = 55U;
|
||||||
|
|
||||||
|
|
||||||
CDMRNetwork::CDMRNetwork(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, HW_TYPE hwType, unsigned int jitter) :
|
CDMRNetwork::CDMRNetwork(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, HW_TYPE hwType, bool jitterEnabled, unsigned int jitter) :
|
||||||
m_address(),
|
m_address(),
|
||||||
m_port(port),
|
m_port(port),
|
||||||
m_id(NULL),
|
m_id(NULL),
|
||||||
@@ -44,6 +44,7 @@ m_socket(local),
|
|||||||
m_enabled(false),
|
m_enabled(false),
|
||||||
m_slot1(slot1),
|
m_slot1(slot1),
|
||||||
m_slot2(slot2),
|
m_slot2(slot2),
|
||||||
|
m_jitterEnabled(jitterEnabled),
|
||||||
m_jitterBuffers(NULL),
|
m_jitterBuffers(NULL),
|
||||||
m_hwType(hwType),
|
m_hwType(hwType),
|
||||||
m_status(WAITING_CONNECT),
|
m_status(WAITING_CONNECT),
|
||||||
@@ -498,9 +499,7 @@ void CDMRNetwork::receiveData(const unsigned char* data, unsigned int length)
|
|||||||
if (slotNo == 2U && !m_slot2)
|
if (slotNo == 2U && !m_slot2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_jitterBuffers[slotNo]->appendData(data, length);
|
if (m_jitterEnabled) {
|
||||||
|
|
||||||
/*
|
|
||||||
unsigned char dataType = data[15U] & 0x3FU;
|
unsigned char dataType = data[15U] & 0x3FU;
|
||||||
if (dataType == (0x20U | DT_CSBK) ||
|
if (dataType == (0x20U | DT_CSBK) ||
|
||||||
dataType == (0x20U | DT_DATA_HEADER) ||
|
dataType == (0x20U | DT_DATA_HEADER) ||
|
||||||
@@ -514,7 +513,9 @@ void CDMRNetwork::receiveData(const unsigned char* data, unsigned int length)
|
|||||||
unsigned char seqNo = data[4U];
|
unsigned char seqNo = data[4U];
|
||||||
m_jitterBuffers[slotNo]->addData(data, length, seqNo);
|
m_jitterBuffers[slotNo]->addData(data, length, seqNo);
|
||||||
}
|
}
|
||||||
*/
|
} else {
|
||||||
|
m_jitterBuffers[slotNo]->appendData(data, length);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDMRNetwork::writeLogin()
|
bool CDMRNetwork::writeLogin()
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
class CDMRNetwork
|
class CDMRNetwork
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CDMRNetwork(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, HW_TYPE hwType, unsigned int jitter);
|
CDMRNetwork(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, HW_TYPE hwType, bool jitterEnabled, unsigned int jitter);
|
||||||
~CDMRNetwork();
|
~CDMRNetwork();
|
||||||
|
|
||||||
void setOptions(const std::string& options);
|
void setOptions(const std::string& options);
|
||||||
@@ -70,6 +70,7 @@ private:
|
|||||||
bool m_enabled;
|
bool m_enabled;
|
||||||
bool m_slot1;
|
bool m_slot1;
|
||||||
bool m_slot2;
|
bool m_slot2;
|
||||||
|
bool m_jitterEnabled;
|
||||||
CJitterBuffer** m_jitterBuffers;
|
CJitterBuffer** m_jitterBuffers;
|
||||||
HW_TYPE m_hwType;
|
HW_TYPE m_hwType;
|
||||||
|
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ Debug=0
|
|||||||
Enable=1
|
Enable=1
|
||||||
Address=44.131.4.1
|
Address=44.131.4.1
|
||||||
Port=62031
|
Port=62031
|
||||||
|
JitterEnabled=1
|
||||||
Jitter=500
|
Jitter=500
|
||||||
# Local=62032
|
# Local=62032
|
||||||
Password=PASSWORD
|
Password=PASSWORD
|
||||||
|
|||||||
@@ -1035,6 +1035,7 @@ bool CMMDVMHost::createDMRNetwork()
|
|||||||
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();
|
||||||
|
bool jitterEnabled = m_conf.getDMRNetworkJitterEnabled();
|
||||||
unsigned int jitter = m_conf.getDMRNetworkJitter();
|
unsigned int jitter = m_conf.getDMRNetworkJitter();
|
||||||
bool slot1 = m_conf.getDMRNetworkSlot1();
|
bool slot1 = m_conf.getDMRNetworkSlot1();
|
||||||
bool slot2 = m_conf.getDMRNetworkSlot2();
|
bool slot2 = m_conf.getDMRNetworkSlot2();
|
||||||
@@ -1048,12 +1049,13 @@ bool CMMDVMHost::createDMRNetwork()
|
|||||||
LogInfo(" Local: %u", local);
|
LogInfo(" Local: %u", local);
|
||||||
else
|
else
|
||||||
LogInfo(" Local: random");
|
LogInfo(" Local: random");
|
||||||
|
LogInfo(" Jitter Buffer: %s", jitterEnabled ? "enabled" : "disabled");
|
||||||
LogInfo(" Jitter: %ums", jitter);
|
LogInfo(" Jitter: %ums", jitter);
|
||||||
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");
|
||||||
LogInfo(" Mode Hang: %us", m_dmrNetModeHang);
|
LogInfo(" Mode Hang: %us", m_dmrNetModeHang);
|
||||||
|
|
||||||
m_dmrNetwork = new CDMRNetwork(address, port, local, id, password, m_duplex, VERSION, debug, slot1, slot2, hwType, jitter);
|
m_dmrNetwork = new CDMRNetwork(address, port, local, id, password, m_duplex, VERSION, debug, slot1, slot2, hwType, jitterEnabled, jitter);
|
||||||
|
|
||||||
std::string options = m_conf.getDMRNetworkOptions();
|
std::string options = m_conf.getDMRNetworkOptions();
|
||||||
if (!options.empty()) {
|
if (!options.empty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user