Use the new APRSGateway for APRS data.

This commit is contained in:
Jonathan Naylor 2020-06-01 13:57:10 +01:00
parent 2cd2fe5de5
commit ae842aad07
19 changed files with 110 additions and 525 deletions

View file

@ -118,25 +118,26 @@ bool CAPRSEntry::isOK()
}
}
CAPRSWriter::CAPRSWriter(const wxString& hostname, unsigned int port, const wxString& gateway, const wxString& password, const wxString& address) :
m_thread(NULL),
CAPRSWriter::CAPRSWriter(const wxString& address, unsigned int port, const wxString& gateway) :
m_idTimer(1000U),
m_gateway(),
m_array(),
m_address(),
m_port(0U),
m_socket(NULL)
m_aprsAddress(),
m_aprsPort(port),
m_aprsSocket(),
m_mobileAddress(),
m_mobilePort(0U),
m_mobileSocket(NULL)
{
wxASSERT(!hostname.IsEmpty());
wxASSERT(!address.IsEmpty());
wxASSERT(port > 0U);
wxASSERT(!gateway.IsEmpty());
wxASSERT(!password.IsEmpty());
m_thread = new CAPRSWriterThread(gateway, password, address, hostname, port);
m_gateway = gateway;
m_gateway.Truncate(LONG_CALLSIGN_LENGTH - 1U);
m_gateway.Trim();
m_aprsAddress = CUDPReaderWriter::lookup(address);
}
CAPRSWriter::~CAPRSWriter()
@ -164,21 +165,21 @@ void CAPRSWriter::setPortMobile(const wxString& callsign, const wxString& band,
m_array[temp] = new CAPRSEntry(callsign, band, frequency, offset, range, 0.0, 0.0, 0.0);
if (m_socket == NULL) {
m_address = CUDPReaderWriter::lookup(address);
m_port = port;
if (m_mobileSocket == NULL) {
m_mobileAddress = CUDPReaderWriter::lookup(address);
m_mobilePort = port;
m_socket = new CUDPReaderWriter;
m_mobileSocket = new CUDPReaderWriter;
}
}
bool CAPRSWriter::open()
{
if (m_socket != NULL) {
bool ret = m_socket->open();
if (m_mobileSocket != NULL) {
bool ret = m_mobileSocket->open();
if (!ret) {
delete m_socket;
m_socket = NULL;
delete m_mobileSocket;
m_mobileSocket = NULL;
return false;
}
@ -190,7 +191,7 @@ bool CAPRSWriter::open()
m_idTimer.start();
return m_thread->start();
return m_aprsSocket.open();
}
void CAPRSWriter::writeHeader(const wxString& callsign, const CHeaderData& header)
@ -233,11 +234,6 @@ void CAPRSWriter::writeData(const wxString& callsign, const CAMBEData& data)
if (!complete)
return;
if (!m_thread->isConnected()) {
collector->reset();
return;
}
// Check the transmission timer
bool ok = entry->isOK();
if (!ok) {
@ -268,14 +264,14 @@ void CAPRSWriter::writeData(const wxString& callsign, const CAMBEData& data)
body = body.Left(n);
wxString output;
output.Printf(wxT("%s,qAR,%s-%s:%s"), header.c_str(), entry->getCallsign().c_str(), entry->getBand().c_str(), body.c_str());
output.Printf(wxT("%s,qAR,%s-%s:%s\r\n"), header.c_str(), entry->getCallsign().c_str(), entry->getBand().c_str(), body.c_str());
char ascii[500U];
::memset(ascii, 0x00, 500U);
for (unsigned int i = 0U; i < output.Len(); i++)
ascii[i] = output.GetChar(i);
m_thread->write(ascii);
m_aprsSocket.write((unsigned char*)ascii, (unsigned int)::strlen(ascii), m_aprsAddress, m_aprsPort);
collector->reset();
}
@ -284,9 +280,7 @@ void CAPRSWriter::clock(unsigned int ms)
{
m_idTimer.clock(ms);
m_thread->clock(ms);
if (m_socket != NULL) {
if (m_mobileSocket != NULL) {
if (m_idTimer.hasExpired()) {
pollGPS();
m_idTimer.start();
@ -304,33 +298,25 @@ void CAPRSWriter::clock(unsigned int ms)
it->second->clock(ms);
}
bool CAPRSWriter::isConnected() const
{
return m_thread->isConnected();
}
void CAPRSWriter::close()
{
if (m_socket != NULL) {
m_socket->close();
delete m_socket;
}
m_aprsSocket.close();
m_thread->stop();
if (m_mobileSocket != NULL) {
m_mobileSocket->close();
delete m_mobileSocket;
}
}
bool CAPRSWriter::pollGPS()
{
assert(m_socket != NULL);
assert(m_mobileSocket != NULL);
return m_socket->write((unsigned char*)"ircDDBGateway", 13U, m_address, m_port);
return m_mobileSocket->write((unsigned char*)"ircDDBGateway", 13U, m_mobileAddress, m_mobilePort);
}
void CAPRSWriter::sendIdFramesFixed()
{
if (!m_thread->isConnected())
return;
time_t now;
::time(&now);
struct tm* tm = ::gmtime(&now);
@ -408,7 +394,7 @@ void CAPRSWriter::sendIdFramesFixed()
lon.Replace(wxT(","), wxT("."));
wxString output;
output.Printf(wxT("%s-S>APDG01,TCPIP*,qAC,%s-GS:;%-7s%-2s*%02d%02d%02dz%s%cD%s%caRNG%04.0lf/A=%06.0lf %s %s"),
output.Printf(wxT("%s-S>APDG01,TCPIP*,qAC,%s-GS:;%-7s%-2s*%02d%02d%02dz%s%cD%s%caRNG%04.0lf/A=%06.0lf %s %s\r\n"),
m_gateway.c_str(), m_gateway.c_str(), entry->getCallsign().c_str(), entry->getBand().c_str(),
tm->tm_mday, tm->tm_hour, tm->tm_min,
lat.c_str(), (entry->getLatitude() < 0.0F) ? wxT('S') : wxT('N'),
@ -420,10 +406,10 @@ void CAPRSWriter::sendIdFramesFixed()
for (unsigned int i = 0U; i < output.Len(); i++)
ascii[i] = output.GetChar(i);
m_thread->write(ascii);
m_aprsSocket.write((unsigned char*)ascii, (unsigned int)::strlen(ascii), m_aprsAddress, m_aprsPort);
if (entry->getBand().Len() == 1U) {
output.Printf(wxT("%s-%s>APDG02,TCPIP*,qAC,%s-%sS:!%s%cD%s%c&RNG%04.0lf/A=%06.0lf %s %s"),
output.Printf(wxT("%s-%s>APDG02,TCPIP*,qAC,%s-%sS:!%s%cD%s%c&RNG%04.0lf/A=%06.0lf %s %s\r\n"),
entry->getCallsign().c_str(), entry->getBand().c_str(), entry->getCallsign().c_str(), entry->getBand().c_str(),
lat.c_str(), (entry->getLatitude() < 0.0F) ? wxT('S') : wxT('N'),
lon.c_str(), (entry->getLongitude() < 0.0F) ? wxT('W') : wxT('E'),
@ -433,7 +419,7 @@ void CAPRSWriter::sendIdFramesFixed()
for (unsigned int i = 0U; i < output.Len(); i++)
ascii[i] = output.GetChar(i);
m_thread->write(ascii);
m_aprsSocket.write((unsigned char*)ascii, (unsigned int)::strlen(ascii), m_aprsAddress, m_aprsPort);
}
}
}
@ -444,13 +430,10 @@ void CAPRSWriter::sendIdFramesMobile()
unsigned char buffer[200U];
in_addr address;
unsigned int port;
int ret = m_socket->read(buffer, 200U, address, port);
int ret = m_mobileSocket->read(buffer, 200U, address, port);
if (ret <= 0)
return;
if (!m_thread->isConnected())
return;
buffer[ret] = '\0';
// Parse the GPS data
@ -556,7 +539,7 @@ void CAPRSWriter::sendIdFramesMobile()
}
wxString output3;
output3.Printf(wxT("RNG%04.0lf %s %s"), entry->getRange() * 0.6214, band.c_str(), desc.c_str());
output3.Printf(wxT("RNG%04.0lf %s %s\r\n"), entry->getRange() * 0.6214, band.c_str(), desc.c_str());
char ascii[300U];
::memset(ascii, 0x00, 300U);
@ -568,7 +551,7 @@ void CAPRSWriter::sendIdFramesMobile()
for (unsigned int i = 0U; i < output3.Len(); i++, n++)
ascii[n] = output3.GetChar(i);
m_thread->write(ascii);
m_aprsSocket.write((unsigned char*)ascii, (unsigned int)::strlen(ascii), m_aprsAddress, m_aprsPort);
if (entry->getBand().Len() == 1U) {
output1.Printf(wxT("%s-%s>APDG02,TCPIP*,qAC,%s-%sS:!%s%cD%s%c&/A=%06.0lf"),
@ -586,8 +569,7 @@ void CAPRSWriter::sendIdFramesMobile()
for (unsigned int i = 0U; i < output3.Len(); i++, n++)
ascii[n] = output3.GetChar(i);
m_thread->write(ascii);
m_aprsSocket.write((unsigned char*)ascii, (unsigned int)::strlen(ascii), m_aprsAddress, m_aprsPort);
}
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010,2011,2012,2018 by Jonathan Naylor G4KLX
* Copyright (C) 2010,2011,2012,2018,2020 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
@ -19,7 +19,6 @@
#ifndef APRSWriter_H
#define APRSWriter_H
#include "APRSWriterThread.h"
#include "UDPReaderWriter.h"
#include "APRSCollector.h"
#include "DStarDefines.h"
@ -68,7 +67,7 @@ WX_DECLARE_STRING_HASH_MAP(CAPRSEntry*, CEntry_t);
class CAPRSWriter {
public:
CAPRSWriter(const wxString& hostname, unsigned int port, const wxString& gateway, const wxString& password, const wxString& address);
CAPRSWriter(const wxString& address, unsigned int port, const wxString& gateway);
~CAPRSWriter();
bool open();
@ -81,20 +80,20 @@ public:
void writeData(const wxString& callsign, const CAMBEData& data);
bool isConnected() const;
void clock(unsigned int ms);
void close();
private:
CAPRSWriterThread* m_thread;
CTimer m_idTimer;
wxString m_gateway;
CEntry_t m_array;
in_addr m_address;
unsigned int m_port;
CUDPReaderWriter* m_socket;
in_addr m_aprsAddress;
unsigned int m_aprsPort;
CUDPReaderWriter m_aprsSocket;
in_addr m_mobileAddress;
unsigned int m_mobilePort;
CUDPReaderWriter* m_mobileSocket;
bool pollGPS();
void sendIdFramesFixed();

View file

@ -1,281 +0,0 @@
/*
* Copyright (C) 2010-2014,2018,2020 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "APRSWriterThread.h"
#include "DStarDefines.h"
#include "Utils.h"
#include "Defs.h"
// #define DUMP_TX
const unsigned int APRS_TIMEOUT = 10U;
CAPRSWriterThread::CAPRSWriterThread(const wxString& callsign, const wxString& password, const wxString& address, const wxString& hostname, unsigned int port) :
wxThread(wxTHREAD_JOINABLE),
m_username(callsign),
m_password(password),
m_ssid(callsign),
m_socket(hostname, port, address),
m_queue(20U),
m_exit(false),
m_connected(false),
m_reconnectTimer(1000U),
m_tries(0U),
m_APRSReadCallback(NULL),
m_filter(wxT("")),
m_clientName(wxT("ircDDBGateway"))
{
wxASSERT(!callsign.IsEmpty());
wxASSERT(!password.IsEmpty());
wxASSERT(!hostname.IsEmpty());
wxASSERT(port > 0U);
m_username.SetChar(LONG_CALLSIGN_LENGTH - 1U, wxT(' '));
m_username.Trim();
m_username.MakeUpper();
m_ssid = m_ssid.SubString(LONG_CALLSIGN_LENGTH - 1U, 1);
}
CAPRSWriterThread::CAPRSWriterThread(const wxString& callsign, const wxString& password, const wxString& address, const wxString& hostname, unsigned int port, const wxString& filter, const wxString& clientName) :
wxThread(wxTHREAD_JOINABLE),
m_username(callsign),
m_password(password),
m_ssid(callsign),
m_socket(hostname, port, address),
m_queue(20U),
m_exit(false),
m_connected(false),
m_reconnectTimer(1000U),
m_tries(0U),
m_APRSReadCallback(NULL),
m_filter(filter),
m_clientName(clientName)
{
wxASSERT(!callsign.IsEmpty());
wxASSERT(!password.IsEmpty());
wxASSERT(!hostname.IsEmpty());
wxASSERT(port > 0U);
m_username.SetChar(LONG_CALLSIGN_LENGTH - 1U, wxT(' '));
m_username.Trim();
m_username.MakeUpper();
m_ssid = m_ssid.SubString(LONG_CALLSIGN_LENGTH - 1U, 1);
}
CAPRSWriterThread::~CAPRSWriterThread()
{
m_username.Clear();
m_password.Clear();
}
bool CAPRSWriterThread::start()
{
Create();
Run();
return true;
}
void* CAPRSWriterThread::Entry()
{
wxLogMessage(wxT("Starting the APRS Writer thread"));
m_connected = connect();
if (!m_connected) {
wxLogError(wxT("Connect attempt to the APRS server has failed"));
startReconnectionTimer();
}
try {
while (!m_exit) {
if (!m_connected) {
if (m_reconnectTimer.isRunning() && m_reconnectTimer.hasExpired()) {
m_reconnectTimer.stop();
m_connected = connect();
if (!m_connected) {
wxLogError(wxT("Reconnect attempt to the APRS server has failed"));
startReconnectionTimer();
}
}
}
if (m_connected) {
m_tries = 0U;
if(!m_queue.isEmpty()){
char* p = m_queue.getData();
wxString text(p, wxConvLocal);
wxLogMessage(wxT("APRS ==> %s"), text.c_str());
::strcat(p, "\r\n");
bool ret = m_socket.write((unsigned char*)p, ::strlen(p));
if (!ret) {
m_connected = false;
m_socket.close();
wxLogError(wxT("Connection to the APRS thread has failed"));
startReconnectionTimer();
}
delete[] p;
}
{
wxString line;
int length = m_socket.readLine(line, APRS_TIMEOUT);
/*if (length == 0)
wxLogWarning(wxT("No response from the APRS server after %u seconds"), APRS_TIMEOUT);*/
if (length < 0) {
m_connected = false;
m_socket.close();
wxLogError(wxT("Error when reading from the APRS server"));
startReconnectionTimer();
}
if(length > 0 && line.GetChar(0) != '#'//check if we have something and if that something is an APRS frame
&& m_APRSReadCallback != NULL)//do we have someone wanting an APRS Frame?
{
//wxLogMessage(wxT("Received APRS Frame : ") + line);
m_APRSReadCallback(wxString(line));
}
}
}
}
if (m_connected)
m_socket.close();
while (!m_queue.isEmpty()) {
char* p = m_queue.getData();
delete[] p;
}
}
catch (std::exception& e) {
wxString message(e.what(), wxConvLocal);
wxLogError(wxT("Exception raised in the APRS Writer thread - \"%s\""), message.c_str());
}
catch (...) {
wxLogError(wxT("Unknown exception raised in the APRS Writer thread"));
}
wxLogMessage(wxT("Stopping the APRS Writer thread"));
return NULL;
}
void CAPRSWriterThread::setReadAPRSCallback(ReadAPRSFrameCallback cb)
{
m_APRSReadCallback = cb;
}
void CAPRSWriterThread::write(const char* data)
{
wxASSERT(data != NULL);
if (!m_connected)
return;
unsigned int len = ::strlen(data);
char* p = new char[len + 5U];
::strcpy(p, data);
m_queue.addData(p);
}
bool CAPRSWriterThread::isConnected() const
{
return m_connected;
}
void CAPRSWriterThread::stop()
{
m_exit = true;
Wait();
}
void CAPRSWriterThread::clock(unsigned int ms)
{
m_reconnectTimer.clock(ms);
}
bool CAPRSWriterThread::connect()
{
bool ret = m_socket.open();
if (!ret)
return false;
//wait for lgin banner
int length;
wxString serverResponse(wxT(""));
length = m_socket.readLine(serverResponse, APRS_TIMEOUT);
if (length == 0) {
wxLogError(wxT("No reply from the APRS server after %u seconds"), APRS_TIMEOUT);
m_socket.close();
return false;
}
wxLogMessage(wxT("Received login banner : %s"), serverResponse.c_str());
wxString filter(m_filter);
if (filter.Length() > 0) filter.Prepend(wxT(" filter "));
wxString connectString = wxString::Format(wxT("user %s-%s pass %s vers %s%s\n"), m_username.c_str(), m_ssid.c_str(), m_password.c_str(),
(m_clientName.Length() ? m_clientName : wxT("ircDDBGateway")).c_str(),
filter.c_str());
//wxLogMessage(wxT("Connect String : ") + connectString);
ret = m_socket.writeLine(connectString);
if (!ret) {
m_socket.close();
return false;
}
length = m_socket.readLine(serverResponse, APRS_TIMEOUT);
if (length == 0) {
wxLogError(wxT("No reply from the APRS server after %u seconds"), APRS_TIMEOUT);
m_socket.close();
return false;
}
if (length < 0) {
wxLogError(wxT("Error when reading from the APRS server"));
m_socket.close();
return false;
}
wxLogMessage(wxT("Response from APRS server: %s"), serverResponse.c_str());
wxLogMessage(wxT("Connected to the APRS server"));
return true;
}
void CAPRSWriterThread::startReconnectionTimer()
{
// Clamp at a ten minutes reconnect time
m_tries++;
if (m_tries > 10U)
m_tries = 10U;
m_reconnectTimer.setTimeout(m_tries * 60U);
m_reconnectTimer.start();
}

View file

@ -1,67 +0,0 @@
/*
* Copyright (C) 2010,2011,2012,2018,2020 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef APRSWriterThread_H
#define APRSWriterThread_H
#include "TCPReaderWriterClient.h"
#include "RingBuffer.h"
#include "Timer.h"
#include <wx/wx.h>
typedef void (*ReadAPRSFrameCallback)(const wxString&);
class CAPRSWriterThread : public wxThread {
public:
CAPRSWriterThread(const wxString& callsign, const wxString& password, const wxString& address, const wxString& hostname, unsigned int port);
CAPRSWriterThread(const wxString& callsign, const wxString& password, const wxString& address, const wxString& hostname, unsigned int port, const wxString& filter, const wxString& clientName);
virtual ~CAPRSWriterThread();
virtual bool start();
virtual bool isConnected() const;
virtual void write(const char* data);
virtual void* Entry();
virtual void stop();
void clock(unsigned int ms);
void setReadAPRSCallback(ReadAPRSFrameCallback cb);
private:
wxString m_username;
wxString m_password;
wxString m_ssid;
CTCPReaderWriterClient m_socket;
CRingBuffer<char*> m_queue;
bool m_exit;
bool m_connected;
CTimer m_reconnectTimer;
unsigned int m_tries;
ReadAPRSFrameCallback m_APRSReadCallback;
wxString m_filter;
wxString m_clientName;
bool connect();
void startReconnectionTimer();
};
#endif

View file

@ -154,7 +154,6 @@
<ClCompile Include="AnnouncementUnit.cpp" />
<ClCompile Include="APRSCollector.cpp" />
<ClCompile Include="APRSWriter.cpp" />
<ClCompile Include="APRSWriterThread.cpp" />
<ClCompile Include="AudioUnit.cpp" />
<ClCompile Include="CacheManager.cpp" />
<ClCompile Include="CallsignList.cpp" />
@ -223,7 +222,6 @@
<ClInclude Include="AnnouncementUnit.h" />
<ClInclude Include="APRSCollector.h" />
<ClInclude Include="APRSWriter.h" />
<ClInclude Include="APRSWriterThread.h" />
<ClInclude Include="AudioUnit.h" />
<ClInclude Include="CacheManager.h" />
<ClInclude Include="CallsignList.h" />

View file

@ -23,9 +23,6 @@
<ClCompile Include="APRSWriter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="APRSWriterThread.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="AudioUnit.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -229,9 +226,6 @@
<ClInclude Include="APRSWriter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="APRSWriterThread.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="AudioUnit.h">
<Filter>Header Files</Filter>
</ClInclude>

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2015,2018 by Jonathan Naylor G4KLX
* Copyright (C) 2010-2015,2018,2020 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
@ -129,8 +129,7 @@ const wxString KEY_IRCDDB_HOSTNAME4 = wxT("ircddbHostname4");
const wxString KEY_IRCDDB_USERNAME4 = wxT("ircddbUsername4");
const wxString KEY_IRCDDB_PASSWORD4 = wxT("ircddbPassword4");
const wxString KEY_APRS_ENABLED = wxT("aprsEnabled");
const wxString KEY_APRS_PASSWORD = wxT("aprsPassword");
const wxString KEY_APRS_HOSTNAME = wxT("aprsHostname");
const wxString KEY_APRS_ADDRESS = wxT("aprsAddress");
const wxString KEY_APRS_PORT = wxT("aprsPort");
const wxString KEY_DEXTRA_ENABLED = wxT("dextraEnabled");
const wxString KEY_DEXTRA_MAXDONGLES = wxT("dextraMaxDongles");
@ -254,9 +253,8 @@ const wxString DEFAULT_IRCDDB_HOSTNAME4 = wxEmptyString;
const wxString DEFAULT_IRCDDB_USERNAME4 = wxEmptyString;
const wxString DEFAULT_IRCDDB_PASSWORD4 = wxEmptyString;
const bool DEFAULT_APRS_ENABLED = false;
const wxString DEFAULT_APRS_PASSWORD = wxT("00000");
const wxString DEFAULT_APRS_HOSTNAME = wxT("rotate.aprs2.net");
const unsigned int DEFAULT_APRS_PORT = 14580U;
const wxString DEFAULT_APRS_ADDRESS = wxT("127.0.0.1");
const unsigned int DEFAULT_APRS_PORT = 8673U;
const bool DEFAULT_DEXTRA_ENABLED = true;
const unsigned int DEFAULT_DEXTRA_MAXDONGLES = 5U;
const bool DEFAULT_DPLUS_ENABLED = false;
@ -408,8 +406,7 @@ m_ircddbHostname4(DEFAULT_IRCDDB_HOSTNAME4),
m_ircddbUsername4(DEFAULT_IRCDDB_USERNAME4),
m_ircddbPassword4(DEFAULT_IRCDDB_PASSWORD4),
m_aprsEnabled(DEFAULT_APRS_ENABLED),
m_aprsPassword(DEFAULT_APRS_PASSWORD),
m_aprsHostname(DEFAULT_APRS_HOSTNAME),
m_aprsAddress(DEFAULT_APRS_ADDRESS),
m_aprsPort(DEFAULT_APRS_PORT),
m_dextraEnabled(DEFAULT_DEXTRA_ENABLED),
m_dextraMaxDongles(DEFAULT_DEXTRA_MAXDONGLES),
@ -732,9 +729,7 @@ m_y(DEFAULT_WINDOW_Y)
m_config->Read(m_name + KEY_APRS_ENABLED, &m_aprsEnabled, DEFAULT_APRS_ENABLED);
m_config->Read(m_name + KEY_APRS_PASSWORD, &m_aprsPassword, DEFAULT_APRS_PASSWORD);
m_config->Read(m_name + KEY_APRS_HOSTNAME, &m_aprsHostname, DEFAULT_APRS_HOSTNAME);
m_config->Read(m_name + KEY_APRS_ADDRESS, &m_aprsAddress, DEFAULT_APRS_ADDRESS);
m_config->Read(m_name + KEY_APRS_PORT, &temp, long(DEFAULT_APRS_PORT));
m_aprsPort = (unsigned int)temp;
@ -1030,8 +1025,7 @@ m_ircddbHostname4(DEFAULT_IRCDDB_HOSTNAME4),
m_ircddbUsername4(DEFAULT_IRCDDB_USERNAME4),
m_ircddbPassword4(DEFAULT_IRCDDB_PASSWORD4),
m_aprsEnabled(DEFAULT_APRS_ENABLED),
m_aprsPassword(DEFAULT_APRS_PASSWORD),
m_aprsHostname(DEFAULT_APRS_HOSTNAME),
m_aprsAddress(DEFAULT_APRS_ADDRESS),
m_aprsPort(DEFAULT_APRS_PORT),
m_dextraEnabled(DEFAULT_DEXTRA_ENABLED),
m_dextraMaxDongles(DEFAULT_DEXTRA_MAXDONGLES),
@ -1402,10 +1396,8 @@ m_y(DEFAULT_WINDOW_Y)
} else if (key.IsSameAs(KEY_APRS_ENABLED)) {
val.ToLong(&temp1);
m_aprsEnabled = temp1 == 1L;
} else if (key.IsSameAs(KEY_APRS_PASSWORD)) {
m_aprsPassword = val;
} else if (key.IsSameAs(KEY_APRS_HOSTNAME)) {
m_aprsHostname = val;
} else if (key.IsSameAs(KEY_APRS_ADDRESS)) {
m_aprsAddress = val;
} else if (key.IsSameAs(KEY_APRS_PORT)) {
val.ToULong(&temp2);
m_aprsPort = (unsigned int)temp2;
@ -1854,14 +1846,6 @@ void CIRCDDBGatewayConfig::getIrcDDB2(bool& enabled, wxString& hostname, wxStrin
enabled = m_ircddbEnabled2;
hostname = m_ircddbHostname2;
username = m_ircddbUsername2;
/*if(username.IsEmpty()){
//no user specified for openquad? use the one from the default network !
username = m_ircddbUsername;
if(username[0] >= '0' && username[0] <= '9')
username = wxT("r") + username;
}*/
password = m_ircddbPassword2;
}
@ -1905,19 +1889,17 @@ void CIRCDDBGatewayConfig::setIrcDDB4(bool enabled, const wxString& hostname, co
m_ircddbPassword4 = password;
}
void CIRCDDBGatewayConfig::getDPRS(bool& enabled, wxString& password, wxString& hostname, unsigned int& port) const
void CIRCDDBGatewayConfig::getDPRS(bool& enabled, wxString& address, unsigned int& port) const
{
enabled = m_aprsEnabled;
password = m_aprsPassword;
hostname = m_aprsHostname;
port = m_aprsPort;
enabled = m_aprsEnabled;
address = m_aprsAddress;
port = m_aprsPort;
}
void CIRCDDBGatewayConfig::setDPRS(bool enabled, const wxString& password, const wxString& hostname, unsigned int port)
void CIRCDDBGatewayConfig::setDPRS(bool enabled, const wxString& address, unsigned int port)
{
m_aprsEnabled = enabled;
m_aprsPassword = password;
m_aprsHostname = hostname;
m_aprsAddress = address;
m_aprsPort = port;
}
@ -2398,8 +2380,7 @@ bool CIRCDDBGatewayConfig::write()
m_config->Write(m_name + KEY_IRCDDB_USERNAME4, m_ircddbUsername4);
m_config->Write(m_name + KEY_IRCDDB_PASSWORD4, m_ircddbPassword4);
m_config->Write(m_name + KEY_APRS_ENABLED, m_aprsEnabled);
m_config->Write(m_name + KEY_APRS_PASSWORD, m_aprsPassword);
m_config->Write(m_name + KEY_APRS_HOSTNAME, m_aprsHostname);
m_config->Write(m_name + KEY_APRS_ADDRESS, m_aprsAddress);
m_config->Write(m_name + KEY_APRS_PORT, long(m_aprsPort));
m_config->Write(m_name + KEY_DEXTRA_ENABLED, m_dextraEnabled);
m_config->Write(m_name + KEY_DEXTRA_MAXDONGLES, long(m_dextraMaxDongles));
@ -2608,8 +2589,7 @@ bool CIRCDDBGatewayConfig::write()
buffer.Printf("%s=%s", KEY_IRCDDB_USERNAME4.c_str(), m_ircddbUsername4.c_str()); file.AddLine(buffer);
buffer.Printf("%s=%s", KEY_IRCDDB_PASSWORD4.c_str(), m_ircddbPassword4.c_str()); file.AddLine(buffer);
buffer.Printf(wxT("%s=%d"), KEY_APRS_ENABLED.c_str(), m_aprsEnabled ? 1 : 0); file.AddLine(buffer);
buffer.Printf(wxT("%s=%s"), KEY_APRS_PASSWORD.c_str(), m_aprsPassword.c_str()); file.AddLine(buffer);
buffer.Printf(wxT("%s=%s"), KEY_APRS_HOSTNAME.c_str(), m_aprsHostname.c_str()); file.AddLine(buffer);
buffer.Printf(wxT("%s=%s"), KEY_APRS_ADDRESS.c_str(), m_aprsAddress.c_str()); file.AddLine(buffer);
buffer.Printf(wxT("%s=%u"), KEY_APRS_PORT.c_str(), m_aprsPort); file.AddLine(buffer);
buffer.Printf(wxT("%s=%d"), KEY_DEXTRA_ENABLED.c_str(), m_dextraEnabled ? 1 : 0); file.AddLine(buffer);
buffer.Printf(wxT("%s=%u"), KEY_DEXTRA_MAXDONGLES.c_str(), m_dextraMaxDongles); file.AddLine(buffer);

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2014,2018 by Jonathan Naylor G4KLX
* Copyright (C) 2010-2014,2018,2020 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
@ -59,8 +59,8 @@ public:
void setIrcDDB3(bool enabled, const wxString& hostname, const wxString& username, const wxString& password);
void setIrcDDB4(bool enabled, const wxString& hostname, const wxString& username, const wxString& password);
void getDPRS(bool& enabled, wxString& password, wxString& hostname, unsigned int& port) const;
void setDPRS(bool enabled, const wxString& password, const wxString& hostname, unsigned int port);
void getDPRS(bool& enabled, wxString& address, unsigned int& port) const;
void setDPRS(bool enabled, const wxString& address, unsigned int port);
void getDExtra(bool& enabled, unsigned int& maxDongles) const;
void setDExtra(bool enabled, unsigned int maxDongles);
@ -235,8 +235,7 @@ private:
wxString m_ircddbUsername4;
wxString m_ircddbPassword4;
bool m_aprsEnabled;
wxString m_aprsPassword;
wxString m_aprsHostname;
wxString m_aprsAddress;
unsigned int m_aprsPort;
bool m_dextraEnabled;
unsigned int m_dextraMaxDongles;

View file

@ -1,4 +1,4 @@
OBJECTS = AMBEData.o AnnouncementUnit.o APRSCollector.o APRSWriter.o APRSWriterThread.o AudioUnit.o CacheManager.o CallsignList.o \
OBJECTS = AMBEData.o AnnouncementUnit.o APRSCollector.o APRSWriter.o AudioUnit.o CacheManager.o CallsignList.o \
CallsignServer.o CCITTChecksum.o CCSData.o CCSHandler.o CCSProtocolHandler.o ConnectData.o ConsoleLogger.o DCSHandler.o DCSProtocolHandler.o \
DCSProtocolHandlerPool.o DDData.o DDHandler.o DExtraHandler.o DExtraProtocolHandler.o DExtraProtocolHandlerPool.o \
DPlusAuthenticator.o DPlusHandler.o DPlusProtocolHandler.o DPlusProtocolHandlerPool.o DRATSServer.o DTMF.o \

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2015,2018,2019 by Jonathan Naylor G4KLX
* Copyright (C) 2010-2015,2018,2019,2020 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
@ -24,9 +24,9 @@
const wxString VENDOR_NAME = wxT("G4KLX");
#if defined(__WXDEBUG__)
const wxString VERSION = wxT("20190402 - DEBUG");
const wxString VERSION = wxT("20200601 - DEBUG");
#else
const wxString VERSION = wxT("20190402");
const wxString VERSION = wxT("20190601");
#endif
#endif

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010,2018 by Jonathan Naylor G4KLX
* Copyright (C) 2010,2018,2020 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
@ -25,12 +25,11 @@ const unsigned int CONTROL_WIDTH2 = 80U;
const unsigned int PORT_LENGTH = 5U;
const unsigned int PASSWORD_LENGTH = 5U;
CDPRSSet::CDPRSSet(wxWindow* parent, int id, const wxString& title, bool enabled, const wxString& password, const wxString& hostname, unsigned int port) :
CDPRSSet::CDPRSSet(wxWindow* parent, int id, const wxString& title, bool enabled, const wxString& address, unsigned int port) :
wxPanel(parent, id),
m_title(title),
m_enabled(NULL),
m_password(NULL),
m_hostname(NULL),
m_address(NULL),
m_port(NULL)
{
wxFlexGridSizer* sizer = new wxFlexGridSizer(2);
@ -44,17 +43,11 @@ m_port(NULL)
sizer->Add(m_enabled, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE);
m_enabled->SetSelection(enabled ? 1 : 0);
wxStaticText* passwordLabel = new wxStaticText(this, -1, _("Password"));
sizer->Add(passwordLabel, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE);
wxStaticText* addressLabel = new wxStaticText(this, -1, _("Address"));
sizer->Add(addressLabel, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE);
m_password = new wxTextCtrl(this, -1, password, wxDefaultPosition, wxSize(CONTROL_WIDTH1, -1));
sizer->Add(m_password, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE);
wxStaticText* hostnameLabel = new wxStaticText(this, -1, _("Hostname"));
sizer->Add(hostnameLabel, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE);
m_hostname = new wxTextCtrl(this, -1, hostname, wxDefaultPosition, wxSize(CONTROL_WIDTH1, -1));
sizer->Add(m_hostname, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE);
m_address = new wxTextCtrl(this, -1, address, wxDefaultPosition, wxSize(CONTROL_WIDTH1, -1));
sizer->Add(m_address, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE);
wxStaticText* portLabel = new wxStaticText(this, -1, _("Port"));
sizer->Add(portLabel, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE);
@ -82,12 +75,8 @@ bool CDPRSSet::Validate()
if (n == wxNOT_FOUND)
return false;
wxString password = m_password->GetValue();
if (password.IsEmpty())
return true;
wxString hostname = m_hostname->GetValue();
if (hostname.IsEmpty())
wxString address = m_address->GetValue();
if (address.IsEmpty())
return true;
unsigned int port = getPort();
@ -110,14 +99,9 @@ bool CDPRSSet::getEnabled() const
return c == 1;
}
wxString CDPRSSet::getPassword() const
wxString CDPRSSet::getAddress() const
{
return m_password->GetValue();
}
wxString CDPRSSet::getHostname() const
{
return m_hostname->GetValue();
return m_address->GetValue();
}
unsigned int CDPRSSet::getPort() const

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010,2018 by Jonathan Naylor G4KLX
* Copyright (C) 2010,2018,2020 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
@ -25,21 +25,19 @@
class CDPRSSet : public wxPanel {
public:
CDPRSSet(wxWindow* parent, int id, const wxString& title, bool enabled, const wxString& password, const wxString& hostname, unsigned int port);
CDPRSSet(wxWindow* parent, int id, const wxString& title, bool enabled, const wxString& address, unsigned int port);
virtual ~CDPRSSet();
virtual bool Validate();
virtual bool getEnabled() const;
virtual wxString getPassword() const;
virtual wxString getHostname() const;
virtual wxString getAddress() const;
virtual unsigned int getPort() const;
private:
wxString m_title;
wxChoice* m_enabled;
wxTextCtrl* m_password;
wxTextCtrl* m_hostname;
wxTextCtrl* m_address;
CPortTextCtrl* m_port;
};

View file

@ -28,7 +28,7 @@ export LIBS := $(shell wx-config --libs base,net)
export LDFLAGS :=
.PHONY: all
all: ircDDBGateway/ircddbgatewayd ircDDBGatewayConfig/ircddbgatewayconfig APRSTransmit/aprstransmitd RemoteControl/remotecontrold \
all: ircDDBGateway/ircddbgatewayd ircDDBGatewayConfig/ircddbgatewayconfig RemoteControl/remotecontrold \
StarNetServer/starnetserverd TextTransmit/texttransmitd TimerControl/timercontrold TimeServer/timeserverd VoiceTransmit/voicetransmitd
ircDDBGateway/ircddbgatewayd: Common/Common.a ircDDB/IRCDDB.a force

View file

@ -20,7 +20,7 @@ export LIBS := $(shell wx-config --libs base,net)
export LDFLAGS :=
.PHONY: all
all: ircDDBGateway/ircddbgateway ircDDBGatewayConfig/ircddbgatewayconfig APRSTransmit/aprstransmitd RemoteControl/remotecontrol \
all: ircDDBGateway/ircddbgateway ircDDBGatewayConfig/ircddbgatewayconfig RemoteControl/remotecontrol \
StarNetServer/starnetserver TextTransmit/texttransmitd TimerControl/timercontrol TimeServer/timeserver VoiceTransmit/voicetransmitd
ircDDBGateway/ircddbgateway: GUICommon/GUICommon.a Common/Common.a ircDDB/IRCDDB.a force

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2015,2018 by Jonathan Naylor G4KLX
* Copyright (C) 2010-2015,2018,2020 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
@ -268,15 +268,15 @@ void CIRCDDBGatewayApp::createThread()
thread->setGateway(gatewayType, gatewayCallsign, gatewayAddress);
wxString aprsHostname, aprsPassword;
wxString aprsAddress;
unsigned int aprsPort;
bool aprsEnabled;
m_config->getDPRS(aprsEnabled, aprsPassword, aprsHostname, aprsPort);
wxLogInfo(wxT("APRS enabled: %d, host: %s:%u"), int(aprsEnabled), aprsHostname.c_str(), aprsPort);
m_config->getDPRS(aprsEnabled, aprsAddress, aprsPort);
wxLogInfo(wxT("APRS enabled: %d, host: %s:%u"), int(aprsEnabled), aprsAddress.c_str(), aprsPort);
CAPRSWriter* aprs = NULL;
if (aprsEnabled && !gatewayCallsign.IsEmpty() && !aprsHostname.IsEmpty() && aprsPort != 0U) {
aprs = new CAPRSWriter(aprsHostname, aprsPort, gatewayCallsign, aprsPassword, gatewayAddress);
if (aprsEnabled && !aprsAddress.IsEmpty() && aprsPort != 0U) {
aprs = new CAPRSWriter(aprsAddress, aprsPort, gatewayCallsign);
bool res = aprs->open();
if (!res)

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2013,2015,2018 by Jonathan Naylor G4KLX
* Copyright (C) 2010-2013,2015,2018,2020 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
@ -275,15 +275,15 @@ bool CIRCDDBGatewayAppD::createThread()
m_thread->setGateway(gatewayType, gatewayCallsign, gatewayAddress);
wxString aprsHostname, aprsPassword;
wxString aprsAddress;
unsigned int aprsPort;
bool aprsEnabled;
config.getDPRS(aprsEnabled, aprsPassword, aprsHostname, aprsPort);
wxLogInfo(wxT("APRS enabled: %d, host: %s:%u"), int(aprsEnabled), aprsHostname.c_str(), aprsPort);
config.getDPRS(aprsEnabled, aprsAddress, aprsPort);
wxLogInfo(wxT("APRS enabled: %d, host: %s:%u"), int(aprsEnabled), aprsAddress.c_str(), aprsPort);
CAPRSWriter* aprs = NULL;
if (aprsEnabled && !gatewayCallsign.IsEmpty() && !aprsHostname.IsEmpty() && aprsPort != 0U) {
aprs = new CAPRSWriter(aprsHostname, aprsPort, gatewayCallsign, aprsPassword, gatewayAddress);
if (aprsEnabled && !aprsAddress.IsEmpty() && aprsPort != 0U) {
aprs = new CAPRSWriter(aprsAddress, aprsPort, gatewayCallsign);
bool res = aprs->open();
if (!res)

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2015,2018 by Jonathan Naylor G4KLX
* Copyright (C) 2010-2015,2018,2020 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
@ -199,7 +199,7 @@ void CIRCDDBGatewayFrame::onAbout(wxCommandEvent&)
wxAboutDialogInfo info;
info.AddDeveloper(wxT("Jonathan Naylor, G4KLX"));
info.AddDeveloper(wxT("Michael Dirska, DL1BFF"));
info.SetCopyright(wxT("(C) 2010-2018 using GPL v2 or later"));
info.SetCopyright(wxT("(C) 2010-2020 using GPL v2 or later"));
info.SetName(APPLICATION_NAME);
info.SetVersion(VERSION);
info.SetDescription(_("This program allows a computer running homebrew repeaters\nto access the ircDDB network for G2 callsign and repeater routing,\nas well as D-Plus and DExtra reflectors. It includes a StarNet\nDigital server."));

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2015,2018 by Jonathan Naylor G4KLX
* Copyright (C) 2010-2015,2018,2020 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
@ -1324,7 +1324,7 @@ CIRCDDBGatewayStatusData* CIRCDDBGatewayThread::getStatus() const
{
bool aprsStatus = false;
if (m_aprsWriter != NULL)
aprsStatus = m_aprsWriter->isConnected();
aprsStatus = true;
CIRCDDBGatewayStatusData* status = new CIRCDDBGatewayStatusData(m_lastStatus, aprsStatus);

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2015,2018 by Jonathan Naylor G4KLX
* Copyright (C) 2010-2015,2018,2020 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
@ -194,12 +194,12 @@ m_miscellaneous(NULL)
m_ircDDB4 = new CIRCDDBGatewayConfigIrcDDBSet(noteBook, -1, APPLICATION_NAME, ircDDBEnabled, ircDDBHostname, ircDDBUsername, ircDDBPassword);
noteBook->AddPage(m_ircDDB4, wxT("ircDDB 4th Network"), false);
wxString aprsHostname, aprsPassword;
wxString aprsAddress;
unsigned int aprsPort;
bool aprsEnabled;
m_config->getDPRS(aprsEnabled, aprsPassword, aprsHostname, aprsPort);
m_config->getDPRS(aprsEnabled, aprsAddress, aprsPort);
m_dprs = new CDPRSSet(noteBook, -1, APPLICATION_NAME, aprsEnabled, aprsPassword, aprsHostname, aprsPort);
m_dprs = new CDPRSSet(noteBook, -1, APPLICATION_NAME, aprsEnabled, aprsAddress, aprsPort);
noteBook->AddPage(m_dprs, wxT("D-PRS"), false);
m_dextra = new CDExtraSet(noteBook, -1, APPLICATION_NAME, dextraEnabled, maxDExtraDongles, MAX_DEXTRA_LINKS);
@ -505,10 +505,9 @@ void CIRCDDBGatewayConfigFrame::onSave(wxCommandEvent&)
m_config->setIrcDDB4(ircDDBEnabled, ircDDBHostname, ircDDBUsername, ircDDBPassword);
bool aprsEnabled = m_dprs->getEnabled();
wxString aprsPassword = m_dprs->getPassword();
wxString aprsHostname = m_dprs->getHostname();
wxString aprsAddress = m_dprs->getAddress();
unsigned int aprsPort = m_dprs->getPort();
m_config->setDPRS(aprsEnabled, aprsPassword, aprsHostname, aprsPort);
m_config->setDPRS(aprsEnabled, aprsAddress, aprsPort);
bool dextraEnabled = m_dextra->getEnabled();
unsigned int maxDExtraDongles = m_dextra->getMaxDongles();
@ -640,7 +639,7 @@ void CIRCDDBGatewayConfigFrame::onAbout(wxCommandEvent&)
{
wxAboutDialogInfo info;
info.AddDeveloper(wxT("Jonathan Naylor, G4KLX"));
info.SetCopyright(wxT("(C) 2010-2018 using GPL v2 or later"));
info.SetCopyright(wxT("(C) 2010-2020 using GPL v2 or later"));
info.SetName(APPLICATION_NAME);
info.SetVersion(VERSION);
info.SetDescription(_("This program configures the ircDDB Gateway."));