mirror of
https://github.com/g4klx/DMRGateway
synced 2025-12-20 21:25:37 +08:00
Increase the sophistication of the stream interruption.
This commit is contained in:
@@ -992,18 +992,19 @@ int CDMRGateway::run()
|
||||
if (m_dmrNetwork4 != NULL)
|
||||
m_dmrNetwork4->writeHomePosition(buffer, length);
|
||||
}
|
||||
ret = m_repeater->readInterrupt(buffer, length);
|
||||
unsigned int slotNo = 0U;
|
||||
ret = m_repeater->readInterrupt(slotNo);
|
||||
if (ret) {
|
||||
if (m_xlxNetwork != NULL)
|
||||
m_xlxNetwork->writeInterrupt(buffer, length);
|
||||
if (m_dmrNetwork1 != NULL)
|
||||
m_dmrNetwork1->writeInterrupt(buffer, length);
|
||||
if (m_dmrNetwork2 != NULL)
|
||||
m_dmrNetwork2->writeInterrupt(buffer, length);
|
||||
if (m_dmrNetwork3 != NULL)
|
||||
m_dmrNetwork3->writeInterrupt(buffer, length);
|
||||
if (m_dmrNetwork4 != NULL)
|
||||
m_dmrNetwork4->writeInterrupt(buffer, length);
|
||||
if (m_xlxNetwork != NULL && status[slotNo] == DMRGWS_XLXREFLECTOR)
|
||||
m_xlxNetwork->writeInterrupt(slotNo);
|
||||
if (m_dmrNetwork1 != NULL && status[slotNo] == DMRGWS_DMRNETWORK1)
|
||||
m_dmrNetwork1->writeInterrupt(slotNo);
|
||||
if (m_dmrNetwork2 != NULL && status[slotNo] == DMRGWS_DMRNETWORK2)
|
||||
m_dmrNetwork2->writeInterrupt(slotNo);
|
||||
if (m_dmrNetwork3 != NULL && status[slotNo] == DMRGWS_DMRNETWORK3)
|
||||
m_dmrNetwork3->writeInterrupt(slotNo);
|
||||
if (m_dmrNetwork4 != NULL && status[slotNo] == DMRGWS_DMRNETWORK4)
|
||||
m_dmrNetwork4->writeInterrupt(slotNo);
|
||||
}
|
||||
|
||||
if (voice != NULL) {
|
||||
|
||||
@@ -276,7 +276,7 @@ bool CDMRNetwork::writeHomePosition(const unsigned char* data, unsigned int leng
|
||||
return write(buffer, length);
|
||||
}
|
||||
|
||||
bool CDMRNetwork::writeInterrupt(const unsigned char* data, unsigned int length)
|
||||
bool CDMRNetwork::writeInterrupt(unsigned int slotNo)
|
||||
{
|
||||
if (m_status != RUNNING)
|
||||
return false;
|
||||
@@ -287,9 +287,9 @@ bool CDMRNetwork::writeInterrupt(const unsigned char* data, unsigned int length)
|
||||
|
||||
::memcpy(buffer + 7U, m_id, 4U);
|
||||
|
||||
::memcpy(buffer + 11U, data + 11U, length - 11U);
|
||||
::sprintf((char*)buffer + 11U, ":%u", slotNo);
|
||||
|
||||
return write(buffer, length);
|
||||
return write(buffer, ::strlen((char*)buffer));
|
||||
}
|
||||
|
||||
bool CDMRNetwork::isConnected() const
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
bool writeHomePosition(const unsigned char* data, unsigned int length);
|
||||
|
||||
bool writeInterrupt(const unsigned char* data, unsigned int length);
|
||||
bool writeInterrupt(unsigned int slotNo);
|
||||
|
||||
bool wantsBeacon();
|
||||
|
||||
|
||||
@@ -265,17 +265,16 @@ bool CMMDVMNetwork::readHomePosition(unsigned char* data, unsigned int& length)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CMMDVMNetwork::readInterrupt(unsigned char* data, unsigned int& length)
|
||||
bool CMMDVMNetwork::readInterrupt(unsigned int& slotNo)
|
||||
{
|
||||
if (m_interruptLen == 0U)
|
||||
return false;
|
||||
|
||||
::memcpy(data, m_interruptData, m_interruptLen);
|
||||
length = m_interruptLen;
|
||||
slotNo = m_interruptData[12U] - '0';
|
||||
|
||||
m_interruptLen = 0U;
|
||||
|
||||
return true;
|
||||
return slotNo == 0U || slotNo == 1U || slotNo == 2U;
|
||||
}
|
||||
|
||||
bool CMMDVMNetwork::writeBeacon()
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
|
||||
virtual bool readHomePosition(unsigned char* data, unsigned int& length);
|
||||
|
||||
virtual bool readInterrupt(unsigned char* data, unsigned int& length);
|
||||
virtual bool readInterrupt(unsigned int& slotNo);
|
||||
|
||||
virtual bool writeBeacon();
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
|
||||
virtual bool readHomePosition(unsigned char* data, unsigned int& length) = 0;
|
||||
|
||||
virtual bool readInterrupt(unsigned char* data, unsigned int& length) = 0;
|
||||
virtual bool readInterrupt(unsigned int& slotNo) = 0;
|
||||
|
||||
virtual void clock(unsigned int ms) = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user