1
0
Fork 0

Add better logging for DG-ID changes.

ycs232-kbc
Jonathan Naylor 4 years ago
parent 76e32b6fff
commit a3a93807a5

@ -240,7 +240,7 @@ int CDGIdGateway::run()
dgIdNetwork[dgid]->m_rfHangTime = rfHangTime; dgIdNetwork[dgid]->m_rfHangTime = rfHangTime;
dgIdNetwork[dgid]->m_netHangTime = netHangTime; dgIdNetwork[dgid]->m_netHangTime = netHangTime;
} }
} else if (type == "IMRS") { /* } else if (type == "IMRS") {
if (imrs != NULL) { if (imrs != NULL) {
std::vector<IMRSDestination*> destinations = (*it)->m_destinations; std::vector<IMRSDestination*> destinations = (*it)->m_destinations;
std::vector<IMRSDest*> dests; std::vector<IMRSDest*> dests;
@ -260,6 +260,7 @@ int CDGIdGateway::run()
dgIdNetwork[dgid]->m_rfHangTime = rfHangTime; dgIdNetwork[dgid]->m_rfHangTime = rfHangTime;
dgIdNetwork[dgid]->m_netHangTime = netHangTime; dgIdNetwork[dgid]->m_netHangTime = netHangTime;
} }
*/
} else if (type == "Parrot") { } else if (type == "Parrot") {
in_addr address = CUDPSocket::lookup((*it)->m_address); in_addr address = CUDPSocket::lookup((*it)->m_address);
unsigned int port = (*it)->m_port; unsigned int port = (*it)->m_port;
@ -361,7 +362,8 @@ int CDGIdGateway::run()
dgIdNetwork[dgId]->link(); dgIdNetwork[dgId]->link();
} }
LogDebug("DG-ID set to %u via RF", dgId); std::string desc = dgIdNetwork[dgId]->getDesc();
LogDebug("DG-ID set to %u (%s) via RF", dgId, desc.c_str());
currentDGId = dgId; currentDGId = dgId;
} }
@ -407,7 +409,8 @@ int CDGIdGateway::run()
inactivityTimer.start(); inactivityTimer.start();
if (currentDGId == 0U) { if (currentDGId == 0U) {
LogDebug("DG-ID set to %u via Network", i); std::string desc = dgIdNetwork[i]->getDesc();
LogDebug("DG-ID set to %u (%s) via Network", i, desc.c_str());
currentDGId = i; currentDGId = i;
} }
} }
@ -437,7 +440,7 @@ int CDGIdGateway::run()
dgIdNetwork[currentDGId]->unlink(); dgIdNetwork[currentDGId]->unlink();
} }
LogDebug("DG-ID set to 0 via timeout"); LogDebug("DG-ID set to 0 (None) via timeout");
currentDGId = 0U; currentDGId = 0U;
inactivityTimer.stop(); inactivityTimer.stop();

@ -19,11 +19,14 @@
#ifndef DGIdNetwork_H #ifndef DGIdNetwork_H
#define DGIdNetwork_H #define DGIdNetwork_H
#include <string>
class CDGIdNetwork { class CDGIdNetwork {
public: public:
virtual ~CDGIdNetwork() = 0; virtual ~CDGIdNetwork() = 0;
virtual std::string getDesc() = 0;
virtual bool open() = 0; virtual bool open() = 0;
virtual void link() = 0; virtual void link() = 0;

@ -63,6 +63,11 @@ CFCSNetwork::~CFCSNetwork()
delete[] m_ping; delete[] m_ping;
} }
std::string CFCSNetwork::getDesc()
{
return "FCS: " + m_reflector;
}
bool CFCSNetwork::open() bool CFCSNetwork::open()
{ {
LogMessage("Resolving FCS00x addresses"); LogMessage("Resolving FCS00x addresses");

@ -40,6 +40,8 @@ public:
CFCSNetwork(const std::string& reflector, unsigned int port, const std::string& callsign, unsigned int rxFrequency, unsigned int txFrequency, const std::string& locator, unsigned int id, bool debug); CFCSNetwork(const std::string& reflector, unsigned int port, const std::string& callsign, unsigned int rxFrequency, unsigned int txFrequency, const std::string& locator, unsigned int id, bool debug);
virtual ~CFCSNetwork(); virtual ~CFCSNetwork();
virtual std::string getDesc();
virtual bool open(); virtual bool open();
virtual void link(); virtual void link();

@ -49,6 +49,11 @@ void CIMRSNetwork::addDGId(unsigned int dgId, const std::vector<IMRSDest*>& dest
m_dgIds.push_back(f); m_dgIds.push_back(f);
} }
std::string CIMRSNetwork::getDesc()
{
return "IMRS";
}
bool CIMRSNetwork::open() bool CIMRSNetwork::open()
{ {
LogMessage("Opening IMRS network connection"); LogMessage("Opening IMRS network connection");
@ -69,26 +74,43 @@ void CIMRSNetwork::write(unsigned int dgId, const unsigned char* data)
unsigned char buffer[200U]; unsigned char buffer[200U];
switch (fich.getDT()) { // XXX // Create the header
switch (fich.getDT()) {
case YSF_DT_VD_MODE1: case YSF_DT_VD_MODE1:
buffer[0U] = '0'; buffer[0U] = '0';
buffer[1U] = '0'; buffer[1U] = '0';
buffer[2U] = '0'; buffer[2U] = '0';
// Copy the audio
::memcpy(buffer + 35U + 0U, data + 35U + 9U, 9U);
::memcpy(buffer + 35U + 9U, data + 35U + 27U, 9U);
::memcpy(buffer + 35U + 18U, data + 35U + 45U, 9U);
::memcpy(buffer + 35U + 27U, data + 35U + 63U, 9U);
::memcpy(buffer + 35U + 36U, data + 35U + 81U, 9U);
break; break;
case YSF_DT_DATA_FR_MODE: case YSF_DT_DATA_FR_MODE:
buffer[0U] = '1'; buffer[0U] = '1';
buffer[1U] = '1'; buffer[1U] = '1';
buffer[2U] = '1'; buffer[2U] = '1';
// Copy the audio
::memcpy(buffer + 35U, data + 45U, 130U);
break; break;
case YSF_DT_VD_MODE2: case YSF_DT_VD_MODE2:
buffer[0U] = '2'; buffer[0U] = '2';
buffer[1U] = '2'; buffer[1U] = '2';
buffer[2U] = '2'; buffer[2U] = '2';
// Copy the audio
::memcpy(buffer + 35U, data + 45U, 130U);
break; break;
case YSF_DT_VOICE_FR_MODE: case YSF_DT_VOICE_FR_MODE:
buffer[0U] = '3'; buffer[0U] = '3';
buffer[1U] = '3'; buffer[1U] = '3';
buffer[2U] = '3'; buffer[2U] = '3';
// Copy the audio
::memcpy(buffer + 35U + 0U, data + 35U + 9U, 18U);
::memcpy(buffer + 35U + 18U, data + 35U + 27U, 18U);
::memcpy(buffer + 35U + 36U, data + 35U + 45U, 18U);
::memcpy(buffer + 35U + 54U, data + 35U + 63U, 18U);
::memcpy(buffer + 35U + 72U, data + 35U + 81U, 18U);
break; break;
default: default:
return; return;
@ -96,9 +118,6 @@ void CIMRSNetwork::write(unsigned int dgId, const unsigned char* data)
// Copy the raw DCH // Copy the raw DCH
// Copy the audio
::memcpy(buffer + 35U, data + 45U, 130U); // XXX
for (std::vector<IMRSDest*>::const_iterator it = ptr->m_destinations.begin(); it != ptr->m_destinations.end(); ++it) { for (std::vector<IMRSDest*>::const_iterator it = ptr->m_destinations.begin(); it != ptr->m_destinations.end(); ++it) {
// Set the correct DG-ID for this destination // Set the correct DG-ID for this destination
fich.setDGId((*it)->m_dgId); fich.setDGId((*it)->m_dgId);

@ -54,6 +54,8 @@ public:
void addDGId(unsigned int dgId, const std::vector<IMRSDest*>& destinations, bool debug); void addDGId(unsigned int dgId, const std::vector<IMRSDest*>& destinations, bool debug);
virtual std::string getDesc();
virtual bool open(); virtual bool open();
virtual void link(); virtual void link();

@ -19,6 +19,6 @@
#if !defined(VERSION_H) #if !defined(VERSION_H)
#define VERSION_H #define VERSION_H
const char* VERSION = "20200820"; const char* VERSION = "20200821";
#endif #endif

@ -86,6 +86,11 @@ CYSFNetwork::~CYSFNetwork()
delete[] m_poll; delete[] m_poll;
} }
std::string CYSFNetwork::getDesc()
{
return "YSF: " + m_name;
}
bool CYSFNetwork::open() bool CYSFNetwork::open()
{ {
LogMessage("Opening YSF network connection"); LogMessage("Opening YSF network connection");

@ -34,6 +34,8 @@ public:
CYSFNetwork(unsigned int localPort, const std::string& name, const in_addr& address, unsigned int port, const std::string& callsign, bool debug); CYSFNetwork(unsigned int localPort, const std::string& name, const in_addr& address, unsigned int port, const std::string& callsign, bool debug);
virtual ~CYSFNetwork(); virtual ~CYSFNetwork();
virtual std::string getDesc();
virtual bool open(); virtual bool open();
virtual void link(); virtual void link();

Loading…
Cancel
Save