mirror of
https://github.com/g4klx/ircDDBGateway.git
synced 2025-12-06 05:32:02 +01:00
Fix up aprstransmit.
This commit is contained in:
parent
d6f04c3bc2
commit
1a83eb4f52
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2014,2020 by Jonathan Naylor G4KLX
|
||||
* APRSTransmit Copyright (C) 2015 Geoffrey Merck F4FXL / KC3FRA
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
|
||||
CAPRSTransmit::CAPRSTransmit(const wxString& callsign, const wxString& text) :
|
||||
m_socket(wxEmptyString, 0U),
|
||||
m_socket(),
|
||||
m_repeaterCallsign(callsign),
|
||||
m_APRSCallsign(callsign),
|
||||
m_text(text)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014,2018 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2014,2018,2020 by Jonathan Naylor G4KLX
|
||||
* APRSTransmit Copyright (C) 2015 Geoffrey Merck F4FXL / KC3FRA
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -20,7 +20,6 @@
|
|||
#include "DStarDefines.h"
|
||||
#include "APRSTransmit.h"
|
||||
#include "APRSTransmitAppD.h"
|
||||
#include "APRSWriterThread.h"
|
||||
|
||||
#include <wx/textfile.h>
|
||||
#include <wx/cmdline.h>
|
||||
|
|
@ -33,10 +32,8 @@
|
|||
#endif
|
||||
|
||||
const wxChar* REPEATER_PARAM = wxT("Repeater");
|
||||
const wxChar* APRS_PASSWORD = wxT("password");
|
||||
const wxChar* APRS_HOST = wxT("host");
|
||||
const wxChar* APRS_PORT = wxT("port");
|
||||
const wxChar* APRS_FILTER = wxT("filter");
|
||||
const wxChar* DAEMON_SWITCH = wxT("daemon");
|
||||
|
||||
static CAPRSTransmitAppD* m_aprsTransmit = NULL;
|
||||
|
|
@ -46,12 +43,6 @@ static void handler(int signum)
|
|||
m_aprsTransmit->kill();
|
||||
}
|
||||
|
||||
static void aprsFrameCallback(const wxString& aprsFrame)
|
||||
{
|
||||
//wxLogMessage(wxT("Received APRS Frame : ") + aprsFrame);
|
||||
m_aprsTransmit->m_aprsFramesQueue->addData(new wxString(aprsFrame.Clone()));
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
bool res = ::wxInitialize();
|
||||
|
|
@ -62,10 +53,8 @@ int main(int argc, char** argv)
|
|||
|
||||
wxCmdLineParser parser(argc, argv);
|
||||
parser.AddParam(REPEATER_PARAM, wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL);
|
||||
parser.AddOption(APRS_PASSWORD, wxEmptyString, wxEmptyString, wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL);
|
||||
parser.AddOption(APRS_HOST, wxEmptyString, wxEmptyString, wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL);
|
||||
parser.AddOption(APRS_PORT, wxEmptyString, wxEmptyString, wxCMD_LINE_VAL_NUMBER, wxCMD_LINE_PARAM_OPTIONAL);
|
||||
parser.AddOption(APRS_FILTER, wxEmptyString, wxEmptyString, wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL);
|
||||
parser.AddSwitch(DAEMON_SWITCH, wxEmptyString, wxEmptyString, wxCMD_LINE_PARAM_OPTIONAL);
|
||||
|
||||
int cmd = parser.Parse();
|
||||
|
|
@ -75,7 +64,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
if (parser.GetParamCount() < 1U) {
|
||||
::fprintf(stderr, "aprstransmitd: invalid command line usage: aprstransmitd <repeater> [-password <aprs_password>] [-host <aprs_server>] [-port <aprs_port>] [-filter <aprsis_filter1>[;<aprsis_filter2]] [-daemon] exiting\n");
|
||||
::fprintf(stderr, "aprstransmitd: invalid command line usage: aprstransmitd <repeater> [-host <aprs_server>] [-port <aprs_port>] [-daemon] exiting\n");
|
||||
::wxUninitialize();
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -91,10 +80,6 @@ int main(int argc, char** argv)
|
|||
}
|
||||
repeater.Replace(wxT("_"), wxT(" "));
|
||||
repeater.MakeUpper();
|
||||
|
||||
wxString aprsPassword;
|
||||
if (!parser.Found(APRS_PASSWORD, &aprsPassword))
|
||||
aprsPassword = wxT("00000");
|
||||
|
||||
long aprsPort;
|
||||
if (!parser.Found(APRS_PORT, &aprsPort))
|
||||
|
|
@ -104,18 +89,10 @@ int main(int argc, char** argv)
|
|||
if (!parser.Found(APRS_HOST, &aprsHost))
|
||||
aprsHost = wxT("rotate.aprs2.net");
|
||||
|
||||
wxString aprsFilter;
|
||||
if (!parser.Found(APRS_FILTER, &aprsFilter)) {
|
||||
/* no filter specified on command line,
|
||||
build one which will tell the APRS server to pass
|
||||
us all stations 50km around our repeater */
|
||||
aprsFilter = wxT("m/50");
|
||||
}
|
||||
|
||||
bool daemon = parser.Found(DAEMON_SWITCH);
|
||||
|
||||
#if defined(__WINDOWS__)
|
||||
m_aprsTransmit = new CAPRSTransmitAppD(repeater, aprsPassword, aprsHost, aprsPort, aprsFilter, daemon);
|
||||
m_aprsTransmit = new CAPRSTransmitAppD(repeater, aprsHost, aprsPort, daemon);
|
||||
if (!m_aprsTransmit->init()) {
|
||||
::wxUninitialize();
|
||||
return 1;
|
||||
|
|
@ -148,7 +125,7 @@ int main(int argc, char** argv)
|
|||
::fclose(fp);
|
||||
}
|
||||
|
||||
m_aprsTransmit = new CAPRSTransmitAppD(repeater, aprsPassword, aprsHost, aprsPort, aprsFilter, daemon);
|
||||
m_aprsTransmit = new CAPRSTransmitAppD(repeater, aprsHost, aprsPort, daemon);
|
||||
if (!m_aprsTransmit->init()) {
|
||||
::wxUninitialize();
|
||||
return 1;
|
||||
|
|
@ -167,14 +144,12 @@ int main(int argc, char** argv)
|
|||
|
||||
|
||||
|
||||
CAPRSTransmitAppD::CAPRSTransmitAppD(const wxString& repeater, const wxString& aprsPassword, const wxString& aprsHost, unsigned int aprsPort, const wxString& aprsFilter, bool daemon) :
|
||||
CAPRSTransmitAppD::CAPRSTransmitAppD(const wxString& repeater, const wxString& aprsHost, unsigned int aprsPort, bool daemon) :
|
||||
m_aprsFramesQueue(NULL),
|
||||
m_repeater(repeater),
|
||||
m_aprsPassword(aprsPassword),
|
||||
m_aprsHost(aprsHost),
|
||||
m_aprsFilter(aprsFilter),
|
||||
m_aprsPort(aprsPort),
|
||||
m_aprsThread(NULL),
|
||||
m_aprsSocket(NULL),
|
||||
m_run(false),
|
||||
m_checker(NULL),
|
||||
m_daemon(daemon)
|
||||
|
|
@ -226,9 +201,8 @@ void CAPRSTransmitAppD::run()
|
|||
if(m_run) return;
|
||||
|
||||
m_aprsFramesQueue = new CRingBuffer<wxString*>(30U);
|
||||
m_aprsThread = new CAPRSWriterThread(m_repeater, m_aprsPassword, wxT("0.0.0.0"), m_aprsHost, m_aprsPort, m_aprsFilter, wxT("APRSTransmit 1.1"));
|
||||
m_aprsThread->setReadAPRSCallback(aprsFrameCallback);
|
||||
m_aprsThread->start();
|
||||
m_aprsSocket = new CUDPReaderWriter;
|
||||
m_aprsSocket->open();
|
||||
|
||||
wxString * aprsFrame;
|
||||
|
||||
|
|
@ -236,38 +210,36 @@ void CAPRSTransmitAppD::run()
|
|||
while(m_run){
|
||||
wxMilliSleep(10U);
|
||||
aprsFrame = m_aprsFramesQueue->getData();
|
||||
if(aprsFrame){
|
||||
if (aprsFrame != NULL) {
|
||||
CAPRSTransmit aprsTransmit(m_repeater, wxString(*aprsFrame));
|
||||
aprsTransmit.run();
|
||||
delete aprsFrame;
|
||||
}
|
||||
}
|
||||
|
||||
m_aprsThread->stop();
|
||||
|
||||
cleanup();
|
||||
}
|
||||
|
||||
|
||||
void CAPRSTransmitAppD::cleanup()
|
||||
{
|
||||
m_aprsThread->setReadAPRSCallback(NULL);
|
||||
|
||||
if(m_aprsFramesQueue)
|
||||
if (m_aprsFramesQueue != NULL)
|
||||
{
|
||||
while(m_aprsFramesQueue->peek()) delete m_aprsFramesQueue->getData();
|
||||
while (m_aprsFramesQueue->peek()) delete m_aprsFramesQueue->getData();
|
||||
delete m_aprsFramesQueue;
|
||||
m_aprsFramesQueue = NULL;
|
||||
}
|
||||
if(m_checker) {
|
||||
|
||||
if (m_checker != NULL) {
|
||||
delete m_checker;
|
||||
m_checker = NULL;
|
||||
}
|
||||
|
||||
if(m_aprsThread)
|
||||
if (m_aprsSocket != NULL)
|
||||
{
|
||||
delete m_aprsThread;
|
||||
m_aprsThread = NULL;
|
||||
m_aprsSocket->close();
|
||||
delete m_aprsSocket;
|
||||
m_aprsSocket = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2014,2018 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2014,2018,2020 by Jonathan Naylor G4KLX
|
||||
* APRSTransmit Copyright (C) 2015 Geoffrey Merck F4FXL / KC3FRA
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -20,8 +20,8 @@
|
|||
#ifndef APRSTransmitAppD_H
|
||||
#define APRSTransmitAppD_H
|
||||
|
||||
#include "UDPReaderWriter.h"
|
||||
#include "RingBuffer.h"
|
||||
#include "APRSWriterThread.h"
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/config.h>
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
class CAPRSTransmitAppD {
|
||||
|
||||
public:
|
||||
CAPRSTransmitAppD(const wxString& repeater, const wxString& aprsPassword, const wxString& aprsHost, unsigned int aprsPort, const wxString& aprsFilter, bool daemon);
|
||||
CAPRSTransmitAppD(const wxString& repeater, const wxString& aprsHost, unsigned int aprsPort, bool daemon);
|
||||
~CAPRSTransmitAppD();
|
||||
|
||||
CRingBuffer<wxString*> * m_aprsFramesQueue;
|
||||
|
|
@ -41,9 +41,9 @@ public:
|
|||
void kill();
|
||||
|
||||
private:
|
||||
wxString m_repeater, m_aprsPassword, m_aprsHost, m_aprsFilter;
|
||||
wxString m_repeater, m_aprsHost;
|
||||
unsigned int m_aprsPort;
|
||||
CAPRSWriterThread * m_aprsThread;
|
||||
CUDPReaderWriter * m_aprsSocket;
|
||||
bool m_run;
|
||||
wxSingleInstanceChecker * m_checker;
|
||||
bool m_daemon;
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@
|
|||
<ClCompile Include="DExtraSet.cpp" />
|
||||
<ClCompile Include="DPlusSet.cpp" />
|
||||
<ClCompile Include="DPRSSet.cpp" />
|
||||
<ClCompile Include="MobileGPSSet.cpp" />
|
||||
<ClCompile Include="GPSDSet.cpp" />
|
||||
<ClCompile Include="PortTextCtrl.cpp" />
|
||||
<ClCompile Include="RemoteSet.cpp" />
|
||||
<ClCompile Include="RepeaterDataSet.cpp" />
|
||||
|
|
@ -160,7 +160,7 @@
|
|||
<ClInclude Include="DExtraSet.h" />
|
||||
<ClInclude Include="DPlusSet.h" />
|
||||
<ClInclude Include="DPRSSet.h" />
|
||||
<ClInclude Include="MobileGPSSet.h" />
|
||||
<ClInclude Include="GPSDSet.h" />
|
||||
<ClInclude Include="PortTextCtrl.h" />
|
||||
<ClInclude Include="RemoteSet.h" />
|
||||
<ClInclude Include="RepeaterDataSet.h" />
|
||||
|
|
@ -172,4 +172,4 @@
|
|||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@
|
|||
<ClCompile Include="DPRSSet.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GPSDSet.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PortTextCtrl.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -53,9 +56,6 @@
|
|||
<ClCompile Include="XLXSet.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MobileGPSSet.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="AddressTextCtrl.h">
|
||||
|
|
@ -79,6 +79,9 @@
|
|||
<ClInclude Include="DPRSSet.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="GPSDSet.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PortTextCtrl.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -100,8 +103,5 @@
|
|||
<ClInclude Include="XLXSet.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MobileGPSSet.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
|||
2
Makefile
2
Makefile
|
|
@ -27,7 +27,7 @@ export LIBS := $(shell wx-config --libs base,net) -lgps
|
|||
export LDFLAGS :=
|
||||
|
||||
.PHONY: all
|
||||
all: ircDDBGateway/ircddbgatewayd RemoteControl/remotecontrold \
|
||||
all: ircDDBGateway/ircddbgatewayd APRSTransmit/aprstransmitd RemoteControl/remotecontrold \
|
||||
StarNetServer/starnetserverd TextTransmit/texttransmitd TimerControl/timercontrold TimeServer/timeserverd VoiceTransmit/voicetransmitd
|
||||
|
||||
ircDDBGateway/ircddbgatewayd: Common/Common.a ircDDB/IRCDDB.a force
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export LIBS := $(shell wx-config --libs base,net) -lgps
|
|||
export LDFLAGS :=
|
||||
|
||||
.PHONY: all
|
||||
all: ircDDBGateway/ircddbgateway ircDDBGatewayConfig/ircddbgatewayconfig RemoteControl/remotecontrol \
|
||||
all: ircDDBGateway/ircddbgateway ircDDBGatewayConfig/ircddbgatewayconfig APRSTransmit/aprstransmitd RemoteControl/remotecontrol \
|
||||
StarNetServer/starnetserver TextTransmit/texttransmitd TimerControl/timercontrol TimeServer/timeserver VoiceTransmit/voicetransmitd
|
||||
|
||||
ircDDBGateway/ircddbgateway: GUICommon/GUICommon.a Common/Common.a ircDDB/IRCDDB.a force
|
||||
|
|
|
|||
Loading…
Reference in a new issue