mirror of
https://github.com/g4klx/DMRGateway
synced 2025-12-22 22:45:36 +08:00
Pass DMR interrupt packets through.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015-2019 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -992,6 +992,19 @@ int CDMRGateway::run()
|
|||||||
if (m_dmrNetwork4 != NULL)
|
if (m_dmrNetwork4 != NULL)
|
||||||
m_dmrNetwork4->writeHomePosition(buffer, length);
|
m_dmrNetwork4->writeHomePosition(buffer, length);
|
||||||
}
|
}
|
||||||
|
ret = m_repeater->readInterrupt(buffer, length);
|
||||||
|
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 (voice != NULL) {
|
if (voice != NULL) {
|
||||||
ret = voice->read(data);
|
ret = voice->read(data);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015-2019 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -276,6 +276,22 @@ bool CDMRNetwork::writeHomePosition(const unsigned char* data, unsigned int leng
|
|||||||
return write(buffer, length);
|
return write(buffer, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CDMRNetwork::writeInterrupt(const unsigned char* data, unsigned int length)
|
||||||
|
{
|
||||||
|
if (m_status != RUNNING)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
unsigned char buffer[50U];
|
||||||
|
|
||||||
|
::memcpy(buffer + 0U, "RPTINTR", 7U);
|
||||||
|
|
||||||
|
::memcpy(buffer + 7U, m_id, 4U);
|
||||||
|
|
||||||
|
::memcpy(buffer + 11U, data + 11U, length - 11U);
|
||||||
|
|
||||||
|
return write(buffer, length);
|
||||||
|
}
|
||||||
|
|
||||||
bool CDMRNetwork::isConnected() const
|
bool CDMRNetwork::isConnected() const
|
||||||
{
|
{
|
||||||
return m_status == RUNNING;
|
return m_status == RUNNING;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015-2019 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -49,6 +49,8 @@ public:
|
|||||||
|
|
||||||
bool writeHomePosition(const unsigned char* data, unsigned int length);
|
bool writeHomePosition(const unsigned char* data, unsigned int length);
|
||||||
|
|
||||||
|
bool writeInterrupt(const unsigned char* data, unsigned int length);
|
||||||
|
|
||||||
bool wantsBeacon();
|
bool wantsBeacon();
|
||||||
|
|
||||||
void clock(unsigned int ms);
|
void clock(unsigned int ms);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015-2019 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -48,7 +48,9 @@ m_radioPositionLen(0U),
|
|||||||
m_talkerAliasData(NULL),
|
m_talkerAliasData(NULL),
|
||||||
m_talkerAliasLen(0U),
|
m_talkerAliasLen(0U),
|
||||||
m_homePositionData(NULL),
|
m_homePositionData(NULL),
|
||||||
m_homePositionLen(0U)
|
m_homePositionLen(0U),
|
||||||
|
m_interruptData(NULL),
|
||||||
|
m_interruptLen(0U)
|
||||||
{
|
{
|
||||||
assert(!rptAddress.empty());
|
assert(!rptAddress.empty());
|
||||||
assert(rptPort > 0U);
|
assert(rptPort > 0U);
|
||||||
@@ -61,6 +63,7 @@ m_homePositionLen(0U)
|
|||||||
m_radioPositionData = new unsigned char[50U];
|
m_radioPositionData = new unsigned char[50U];
|
||||||
m_talkerAliasData = new unsigned char[50U];
|
m_talkerAliasData = new unsigned char[50U];
|
||||||
m_homePositionData = new unsigned char[50U];
|
m_homePositionData = new unsigned char[50U];
|
||||||
|
m_interruptData = new unsigned char[50U];
|
||||||
|
|
||||||
CStopWatch stopWatch;
|
CStopWatch stopWatch;
|
||||||
::srand(stopWatch.start());
|
::srand(stopWatch.start());
|
||||||
@@ -74,6 +77,7 @@ CMMDVMNetwork::~CMMDVMNetwork()
|
|||||||
delete[] m_radioPositionData;
|
delete[] m_radioPositionData;
|
||||||
delete[] m_talkerAliasData;
|
delete[] m_talkerAliasData;
|
||||||
delete[] m_homePositionData;
|
delete[] m_homePositionData;
|
||||||
|
delete[] m_interruptData;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CMMDVMNetwork::getOptions() const
|
std::string CMMDVMNetwork::getOptions() const
|
||||||
@@ -261,6 +265,19 @@ bool CMMDVMNetwork::readHomePosition(unsigned char* data, unsigned int& length)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CMMDVMNetwork::readInterrupt(unsigned char* data, unsigned int& length)
|
||||||
|
{
|
||||||
|
if (m_interruptLen == 0U)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
::memcpy(data, m_interruptData, m_interruptLen);
|
||||||
|
length = m_interruptLen;
|
||||||
|
|
||||||
|
m_interruptLen = 0U;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool CMMDVMNetwork::writeBeacon()
|
bool CMMDVMNetwork::writeBeacon()
|
||||||
{
|
{
|
||||||
unsigned char buffer[20U];
|
unsigned char buffer[20U];
|
||||||
@@ -316,6 +333,9 @@ void CMMDVMNetwork::clock(unsigned int ms)
|
|||||||
} else if (::memcmp(m_buffer, "RPTG", 4U) == 0) {
|
} else if (::memcmp(m_buffer, "RPTG", 4U) == 0) {
|
||||||
::memcpy(m_homePositionData, m_buffer, length);
|
::memcpy(m_homePositionData, m_buffer, length);
|
||||||
m_homePositionLen = length;
|
m_homePositionLen = length;
|
||||||
|
} else if (::memcmp(m_buffer, "RPTINTR", 7U) == 0) {
|
||||||
|
::memcpy(m_interruptData, m_buffer, length);
|
||||||
|
m_interruptLen = length;
|
||||||
} else if (::memcmp(m_buffer, "RPTL", 4U) == 0) {
|
} else if (::memcmp(m_buffer, "RPTL", 4U) == 0) {
|
||||||
m_id = (m_buffer[4U] << 24) | (m_buffer[5U] << 16) | (m_buffer[6U] << 8) | (m_buffer[7U] << 0);
|
m_id = (m_buffer[4U] << 24) | (m_buffer[5U] << 16) | (m_buffer[6U] << 8) | (m_buffer[7U] << 0);
|
||||||
::memcpy(m_netId, m_buffer + 4U, 4U);
|
::memcpy(m_netId, m_buffer + 4U, 4U);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015-2019 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -52,6 +52,8 @@ public:
|
|||||||
|
|
||||||
virtual bool readHomePosition(unsigned char* data, unsigned int& length);
|
virtual bool readHomePosition(unsigned char* data, unsigned int& length);
|
||||||
|
|
||||||
|
virtual bool readInterrupt(unsigned char* data, unsigned int& length);
|
||||||
|
|
||||||
virtual bool writeBeacon();
|
virtual bool writeBeacon();
|
||||||
|
|
||||||
virtual void clock(unsigned int ms);
|
virtual void clock(unsigned int ms);
|
||||||
@@ -76,6 +78,8 @@ private:
|
|||||||
unsigned int m_talkerAliasLen;
|
unsigned int m_talkerAliasLen;
|
||||||
unsigned char* m_homePositionData;
|
unsigned char* m_homePositionData;
|
||||||
unsigned int m_homePositionLen;
|
unsigned int m_homePositionLen;
|
||||||
|
unsigned char* m_interruptData;
|
||||||
|
unsigned int m_interruptLen;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2017,2018 by Jonathan Naylor G4KLX
|
* Copyright (C) 2017,2018,2019 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -45,6 +45,8 @@ public:
|
|||||||
|
|
||||||
virtual bool readHomePosition(unsigned char* data, unsigned int& length) = 0;
|
virtual bool readHomePosition(unsigned char* data, unsigned int& length) = 0;
|
||||||
|
|
||||||
|
virtual bool readInterrupt(unsigned char* data, unsigned int& length) = 0;
|
||||||
|
|
||||||
virtual void clock(unsigned int ms) = 0;
|
virtual void clock(unsigned int ms) = 0;
|
||||||
|
|
||||||
virtual bool writeBeacon() = 0;
|
virtual bool writeBeacon() = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user