mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-21 23:45:49 +08:00
Merge branch 'master' into pocsag
This commit is contained in:
2
Conf.cpp
2
Conf.cpp
@@ -176,7 +176,7 @@ m_dmrNetworkLocal(0U),
|
|||||||
m_dmrNetworkPassword(),
|
m_dmrNetworkPassword(),
|
||||||
m_dmrNetworkOptions(),
|
m_dmrNetworkOptions(),
|
||||||
m_dmrNetworkDebug(false),
|
m_dmrNetworkDebug(false),
|
||||||
m_dmrNetworkJitter(300U),
|
m_dmrNetworkJitter(360U),
|
||||||
m_dmrNetworkSlot1(true),
|
m_dmrNetworkSlot1(true),
|
||||||
m_dmrNetworkSlot2(true),
|
m_dmrNetworkSlot2(true),
|
||||||
m_dmrNetworkModeHang(3U),
|
m_dmrNetworkModeHang(3U),
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
const unsigned int BUFFER_LENGTH = 500U;
|
const unsigned int BUFFER_LENGTH = 500U;
|
||||||
|
|
||||||
@@ -33,6 +34,7 @@ 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) :
|
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) :
|
||||||
|
m_addressStr(address),
|
||||||
m_address(),
|
m_address(),
|
||||||
m_port(port),
|
m_port(port),
|
||||||
m_id(NULL),
|
m_id(NULL),
|
||||||
@@ -122,6 +124,9 @@ bool CDMRNetwork::open()
|
|||||||
{
|
{
|
||||||
LogMessage("DMR, Opening DMR Network");
|
LogMessage("DMR, Opening DMR Network");
|
||||||
|
|
||||||
|
if (m_address.s_addr == INADDR_NONE)
|
||||||
|
m_address = CUDPSocket::lookup(m_addressStr);
|
||||||
|
|
||||||
m_status = WAITING_CONNECT;
|
m_status = WAITING_CONNECT;
|
||||||
m_timeoutTimer.stop();
|
m_timeoutTimer.stop();
|
||||||
m_retryTimer.start();
|
m_retryTimer.start();
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ public:
|
|||||||
void close();
|
void close();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::string m_addressStr;
|
||||||
in_addr m_address;
|
in_addr m_address;
|
||||||
unsigned int m_port;
|
unsigned int m_port;
|
||||||
uint8_t* m_id;
|
uint8_t* m_id;
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
const unsigned int BUFFER_LENGTH = 100U;
|
const unsigned int BUFFER_LENGTH = 100U;
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,8 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
#if !defined(_WIN32) && !defined(_WIN64)
|
#if !defined(_WIN32) && !defined(_WIN64)
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -210,7 +212,7 @@ int CMMDVMHost::run()
|
|||||||
::close(STDOUT_FILENO);
|
::close(STDOUT_FILENO);
|
||||||
::close(STDERR_FILENO);
|
::close(STDERR_FILENO);
|
||||||
|
|
||||||
#if !defined(HD44780) && !defined(OLED)
|
#if !defined(HD44780) && !defined(OLED) && !defined(_OPENWRT)
|
||||||
// If we are currently root...
|
// If we are currently root...
|
||||||
if (getuid() == 0) {
|
if (getuid() == 0) {
|
||||||
struct passwd* user = ::getpwnam("mmdvm");
|
struct passwd* user = ::getpwnam("mmdvm");
|
||||||
@@ -241,7 +243,7 @@ int CMMDVMHost::run()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
::fprintf(stderr, "Dropping root permissions in daemon mode is disabled with HD44780 display\n");
|
::fprintf(stderr, "Dropping root permissions in daemon mode is disabled.\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ m_ldu1(NULL),
|
|||||||
m_ldu2(NULL),
|
m_ldu2(NULL),
|
||||||
m_termlc(NULL),
|
m_termlc(NULL),
|
||||||
m_term(NULL),
|
m_term(NULL),
|
||||||
m_pdu(NULL)
|
m_pdu(NULL),
|
||||||
|
m_tsdu(NULL)
|
||||||
{
|
{
|
||||||
CBCH bch;
|
CBCH bch;
|
||||||
|
|
||||||
@@ -97,6 +98,7 @@ CP25NID::~CP25NID()
|
|||||||
delete[] m_term;
|
delete[] m_term;
|
||||||
delete[] m_tsdu;
|
delete[] m_tsdu;
|
||||||
delete[] m_pdu;
|
delete[] m_pdu;
|
||||||
|
delete[] m_tsdu;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CP25NID::decode(const unsigned char* data)
|
bool CP25NID::decode(const unsigned char* data)
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ unsigned int CStopWatch::elapsed()
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
CStopWatch::CStopWatch() :
|
CStopWatch::CStopWatch() :
|
||||||
m_start()
|
m_start()
|
||||||
@@ -64,21 +65,17 @@ CStopWatch::~CStopWatch()
|
|||||||
|
|
||||||
unsigned long CStopWatch::start()
|
unsigned long CStopWatch::start()
|
||||||
{
|
{
|
||||||
::gettimeofday(&m_start, NULL);
|
::clock_gettime(CLOCK_MONOTONIC, &m_start);
|
||||||
|
|
||||||
return m_start.tv_usec;
|
return m_start.tv_sec * 1000UL + m_start.tv_nsec / 1000000UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CStopWatch::elapsed()
|
unsigned int CStopWatch::elapsed()
|
||||||
{
|
{
|
||||||
struct timeval now;
|
struct timespec now;
|
||||||
::gettimeofday(&now, NULL);
|
::clock_gettime(CLOCK_MONOTONIC, &now);
|
||||||
|
int offset = ((now.tv_sec - m_start.tv_sec) * 1000000000UL + now.tv_nsec - m_start.tv_nsec ) / 1000000UL;
|
||||||
unsigned int elapsed = (now.tv_sec - m_start.tv_sec) * 1000U;
|
return (unsigned int)offset;
|
||||||
elapsed += now.tv_usec / 1000U;
|
|
||||||
elapsed -= m_start.tv_usec / 1000U;
|
|
||||||
|
|
||||||
return elapsed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ private:
|
|||||||
LARGE_INTEGER m_frequency;
|
LARGE_INTEGER m_frequency;
|
||||||
LARGE_INTEGER m_start;
|
LARGE_INTEGER m_start;
|
||||||
#else
|
#else
|
||||||
struct timeval m_start;
|
struct timespec m_start;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user