Add the enable method for network functions.
This commit is contained in:
parent
daa15203e2
commit
810c167a20
3 changed files with 16 additions and 3 deletions
|
@ -38,6 +38,7 @@ m_debug(debug),
|
||||||
m_software(software),
|
m_software(software),
|
||||||
m_version(version),
|
m_version(version),
|
||||||
m_socket(),
|
m_socket(),
|
||||||
|
m_enabled(false),
|
||||||
m_status(DISCONNECTED),
|
m_status(DISCONNECTED),
|
||||||
m_retryTimer(1000U, 10U),
|
m_retryTimer(1000U, 10U),
|
||||||
m_timeoutTimer(1000U, 600U),
|
m_timeoutTimer(1000U, 600U),
|
||||||
|
@ -127,6 +128,11 @@ bool CHomebrewDMRIPSC::open()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CHomebrewDMRIPSC::enable(bool enabled)
|
||||||
|
{
|
||||||
|
m_enabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
bool CHomebrewDMRIPSC::read(CDMRData& data)
|
bool CHomebrewDMRIPSC::read(CDMRData& data)
|
||||||
{
|
{
|
||||||
if (m_status != RUNNING)
|
if (m_status != RUNNING)
|
||||||
|
@ -259,9 +265,11 @@ void CHomebrewDMRIPSC::clock(unsigned int ms)
|
||||||
|
|
||||||
if (length > 0 && m_address.s_addr == address.s_addr && m_port == port) {
|
if (length > 0 && m_address.s_addr == address.s_addr && m_port == port) {
|
||||||
if (::memcmp(m_buffer, "DMRD", 4U) == 0) {
|
if (::memcmp(m_buffer, "DMRD", 4U) == 0) {
|
||||||
|
if (m_enabled) {
|
||||||
unsigned char len = length;
|
unsigned char len = length;
|
||||||
m_rxData.addData(&len, 1U);
|
m_rxData.addData(&len, 1U);
|
||||||
m_rxData.addData(m_buffer, len);
|
m_rxData.addData(m_buffer, len);
|
||||||
|
}
|
||||||
} else if (::memcmp(m_buffer, "MSTNAK", 6U) == 0) {
|
} else if (::memcmp(m_buffer, "MSTNAK", 6U) == 0) {
|
||||||
if (m_status == RUNNING) {
|
if (m_status == RUNNING) {
|
||||||
LogWarning("The master is restarting, logging back in");
|
LogWarning("The master is restarting, logging back in");
|
||||||
|
|
|
@ -37,6 +37,8 @@ public:
|
||||||
|
|
||||||
bool open();
|
bool open();
|
||||||
|
|
||||||
|
void enable(bool enabled);
|
||||||
|
|
||||||
bool read(CDMRData& data);
|
bool read(CDMRData& data);
|
||||||
|
|
||||||
bool write(const CDMRData& data);
|
bool write(const CDMRData& data);
|
||||||
|
@ -56,6 +58,7 @@ private:
|
||||||
const char* m_software;
|
const char* m_software;
|
||||||
const char* m_version;
|
const char* m_version;
|
||||||
CUDPSocket m_socket;
|
CUDPSocket m_socket;
|
||||||
|
bool m_enabled;
|
||||||
|
|
||||||
enum STATUS {
|
enum STATUS {
|
||||||
DISCONNECTED,
|
DISCONNECTED,
|
||||||
|
|
|
@ -459,6 +459,8 @@ bool CMMDVMHost::createDMRNetwork()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_dmrNetwork->enable(true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue