Improve the logging of the Icom and Kenwood networking.
This commit is contained in:
parent
dd3a117712
commit
b31bc5f8a7
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2014,2016,2018,2020 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2009-2014,2016,2018,2020,2021 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* 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
|
||||
|
@ -51,9 +51,15 @@ bool CIcomNetwork::open()
|
|||
return false;
|
||||
}
|
||||
|
||||
LogMessage("Opening Icom network connection");
|
||||
bool ret = m_socket.open(m_addr);
|
||||
if (!ret) {
|
||||
LogError("Unable to open the Icom network connection");
|
||||
return false;
|
||||
}
|
||||
|
||||
return m_socket.open(m_addr);
|
||||
LogMessage("Opened the Icom network connection");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CIcomNetwork::write(const unsigned char* data, unsigned int len)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2014,2016,2018,2020 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2009-2014,2016,2018,2020,2021 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* 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
|
||||
|
@ -89,16 +89,19 @@ bool CKenwoodNetwork::open()
|
|||
return false;
|
||||
}
|
||||
|
||||
LogMessage("Opening Kenwood connection");
|
||||
|
||||
if (!m_rtcpSocket.open(m_rtcpAddr))
|
||||
if (!m_rtcpSocket.open(m_rtcpAddr)) {
|
||||
LogError("Unable to open the Kenwood network connection");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_rtpSocket.open(m_rtpAddr)) {
|
||||
LogError("Unable to open the Kenwood network connection");
|
||||
m_rtcpSocket.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
LogMessage("Opened the Kenwood network connection");
|
||||
|
||||
std::uniform_int_distribution<unsigned int> dist(0x00000001, 0xfffffffe);
|
||||
m_ssrc = dist(m_random);
|
||||
|
||||
|
|
|
@ -181,10 +181,12 @@ void CNXDNReflector::run()
|
|||
return;
|
||||
}
|
||||
|
||||
bool icomEnabled = m_conf.getIcomEnabled();
|
||||
|
||||
unsigned short icomTGEnable = 0U;
|
||||
unsigned short icomTGDisable = 0U;
|
||||
|
||||
if (m_conf.getIcomEnabled()) {
|
||||
if (icomEnabled) {
|
||||
ret = openIcomNetwork();
|
||||
if (!ret) {
|
||||
nxdnNetwork.close();
|
||||
|
@ -196,10 +198,12 @@ void CNXDNReflector::run()
|
|||
icomTGDisable = m_conf.getIcomTGDisable();
|
||||
}
|
||||
|
||||
bool kenwoodEnabled = m_conf.getKenwoodEnabled();
|
||||
|
||||
unsigned short kenwoodTGEnable = 0U;
|
||||
unsigned short kenwoodTGDisable = 0U;
|
||||
|
||||
if (m_conf.getKenwoodEnabled()) {
|
||||
if (kenwoodEnabled) {
|
||||
ret = openKenwoodNetwork();
|
||||
if (!ret) {
|
||||
nxdnNetwork.close();
|
||||
|
@ -291,7 +295,7 @@ void CNXDNReflector::run()
|
|||
unsigned short dstId = (buffer[7U] << 8) | buffer[8U];
|
||||
bool grp = (buffer[9U] & 0x01U) == 0x01U;
|
||||
|
||||
if (icomTGEnable != 0U && grp && dstId == icomTGEnable) {
|
||||
if (icomEnabled && icomTGEnable != 0U && grp && dstId == icomTGEnable) {
|
||||
if (m_icomNetwork == NULL) {
|
||||
std::string callsign = lookup->find(srcId);
|
||||
LogMessage("Icom Network link enabled by %s at %s", callsign.c_str(), current->m_callsign.c_str());
|
||||
|
@ -301,7 +305,7 @@ void CNXDNReflector::run()
|
|||
}
|
||||
}
|
||||
|
||||
if (kenwoodTGEnable != 0U && grp && dstId == kenwoodTGEnable) {
|
||||
if (kenwoodEnabled && kenwoodTGEnable != 0U && grp && dstId == kenwoodTGEnable) {
|
||||
if (m_kenwoodNetwork == NULL) {
|
||||
std::string callsign = lookup->find(srcId);
|
||||
LogMessage("Kenwood Network link enabled by %s at %s", callsign.c_str(), current->m_callsign.c_str());
|
||||
|
@ -311,7 +315,7 @@ void CNXDNReflector::run()
|
|||
}
|
||||
}
|
||||
|
||||
if (icomTGDisable != 0U && grp && dstId == icomTGDisable) {
|
||||
if (icomEnabled && icomTGDisable != 0U && grp && dstId == icomTGDisable) {
|
||||
if (m_icomNetwork != NULL) {
|
||||
std::string callsign = lookup->find(srcId);
|
||||
LogMessage("Icom Network link disabled by %s at %s", callsign.c_str(), current->m_callsign.c_str());
|
||||
|
@ -319,7 +323,7 @@ void CNXDNReflector::run()
|
|||
}
|
||||
}
|
||||
|
||||
if (kenwoodTGDisable != 0U && grp && dstId == kenwoodTGDisable) {
|
||||
if (kenwoodEnabled && kenwoodTGDisable != 0U && grp && dstId == kenwoodTGDisable) {
|
||||
if (m_kenwoodNetwork != NULL) {
|
||||
std::string callsign = lookup->find(srcId);
|
||||
LogMessage("Kenwood Network link disabled by %s at %s", callsign.c_str(), current->m_callsign.c_str());
|
||||
|
|
|
@ -19,6 +19,6 @@
|
|||
#if !defined(VERSION_H)
|
||||
#define VERSION_H
|
||||
|
||||
const char* VERSION = "20210213";
|
||||
const char* VERSION = "20210309";
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue