mirror of
https://github.com/g4klx/ircDDBGateway.git
synced 2025-12-06 05:32:02 +01:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
a2e73e5351
|
|
@ -1481,3 +1481,9 @@ Simplify the Linux build.
|
|||
--------
|
||||
|
||||
Support the GPS data from the Kenwood TH-D74.
|
||||
|
||||
2018xxxx
|
||||
--------
|
||||
|
||||
Add support for external GPS input for mobile systems.
|
||||
|
||||
|
|
|
|||
|
|
@ -401,7 +401,7 @@ unsigned int CAPRSCollector::convertNMEA1(unsigned char* data, unsigned int)
|
|||
unsigned int nGGA = 0U;
|
||||
|
||||
char* str = (char*)m_ggaData;
|
||||
for (;;) {
|
||||
while (nGGA < 20U) {
|
||||
char* p = mystrsep(&str, ",\r\n");
|
||||
|
||||
pGGA[nGGA++] = p;
|
||||
|
|
@ -464,7 +464,7 @@ unsigned int CAPRSCollector::convertNMEA2(unsigned char* data, unsigned int)
|
|||
unsigned int nRMC = 0U;
|
||||
|
||||
char* str = (char*)m_rmcData;
|
||||
for (;;) {
|
||||
while (nRMC < 20U) {
|
||||
char* p = mystrsep(&str, ",\r\n");
|
||||
|
||||
pRMC[nRMC++] = p;
|
||||
|
|
|
|||
|
|
@ -120,9 +120,12 @@ bool CAPRSEntry::isOK()
|
|||
|
||||
CAPRSWriter::CAPRSWriter(const wxString& hostname, unsigned int port, const wxString& gateway, const wxString& password, const wxString& address) :
|
||||
m_thread(NULL),
|
||||
m_idTimer(1000U, 20U * 60U), // 20 minutes
|
||||
m_idTimer(1000U),
|
||||
m_gateway(),
|
||||
m_array()
|
||||
m_array(),
|
||||
m_address(),
|
||||
m_port(0U),
|
||||
m_socket(NULL)
|
||||
{
|
||||
wxASSERT(!hostname.IsEmpty());
|
||||
wxASSERT(port > 0U);
|
||||
|
|
@ -144,7 +147,7 @@ CAPRSWriter::~CAPRSWriter()
|
|||
m_array.clear();
|
||||
}
|
||||
|
||||
void CAPRSWriter::setPort(const wxString& callsign, const wxString& band, double frequency, double offset, double range, double latitude, double longitude, double agl)
|
||||
void CAPRSWriter::setPortFixed(const wxString& callsign, const wxString& band, double frequency, double offset, double range, double latitude, double longitude, double agl)
|
||||
{
|
||||
wxString temp = callsign;
|
||||
temp.resize(LONG_CALLSIGN_LENGTH - 1U, wxT(' '));
|
||||
|
|
@ -153,16 +156,41 @@ void CAPRSWriter::setPort(const wxString& callsign, const wxString& band, double
|
|||
m_array[temp] = new CAPRSEntry(callsign, band, frequency, offset, range, latitude, longitude, agl);
|
||||
}
|
||||
|
||||
void CAPRSWriter::setPortMobile(const wxString& callsign, const wxString& band, double frequency, double offset, double range, const wxString& address, unsigned int port)
|
||||
{
|
||||
wxString temp = callsign;
|
||||
temp.resize(LONG_CALLSIGN_LENGTH - 1U, wxT(' '));
|
||||
temp.Append(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;
|
||||
|
||||
m_socket = new CUDPReaderWriter;
|
||||
}
|
||||
}
|
||||
|
||||
bool CAPRSWriter::open()
|
||||
{
|
||||
bool ret = m_thread->start();
|
||||
if(ret) {
|
||||
sendIdFrames();
|
||||
m_idTimer.start();
|
||||
return ret;
|
||||
if (m_socket != NULL) {
|
||||
bool ret = m_socket->open();
|
||||
if (!ret) {
|
||||
delete m_socket;
|
||||
m_socket = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Poll the GPS every minute
|
||||
m_idTimer.setTimeout(60U);
|
||||
} else {
|
||||
m_idTimer.setTimeout(20U * 60U);
|
||||
}
|
||||
|
||||
return false;
|
||||
m_idTimer.start();
|
||||
|
||||
return m_thread->start();
|
||||
}
|
||||
|
||||
void CAPRSWriter::writeHeader(const wxString& callsign, const CHeaderData& header)
|
||||
|
|
@ -256,9 +284,18 @@ void CAPRSWriter::clock(unsigned int ms)
|
|||
{
|
||||
m_idTimer.clock(ms);
|
||||
|
||||
if (m_idTimer.hasExpired()) {
|
||||
sendIdFrames();
|
||||
m_idTimer.start();
|
||||
if (m_socket != NULL) {
|
||||
if (m_idTimer.hasExpired()) {
|
||||
pollGPS();
|
||||
m_idTimer.start();
|
||||
}
|
||||
|
||||
sendIdFramesMobile();
|
||||
} else {
|
||||
if (m_idTimer.hasExpired()) {
|
||||
sendIdFramesFixed();
|
||||
m_idTimer.start();
|
||||
}
|
||||
}
|
||||
|
||||
for (CEntry_t::iterator it = m_array.begin(); it != m_array.end(); ++it)
|
||||
|
|
@ -272,10 +309,22 @@ bool CAPRSWriter::isConnected() const
|
|||
|
||||
void CAPRSWriter::close()
|
||||
{
|
||||
if (m_socket != NULL) {
|
||||
m_socket->close();
|
||||
delete m_socket;
|
||||
}
|
||||
|
||||
m_thread->stop();
|
||||
}
|
||||
|
||||
void CAPRSWriter::sendIdFrames()
|
||||
bool CAPRSWriter::pollGPS()
|
||||
{
|
||||
assert(m_socket != NULL);
|
||||
|
||||
return m_socket->write((unsigned char*)"ircDDBGateway", 13U, m_address, m_port);
|
||||
}
|
||||
|
||||
void CAPRSWriter::sendIdFramesFixed()
|
||||
{
|
||||
if (!m_thread->isConnected())
|
||||
return;
|
||||
|
|
@ -357,12 +406,12 @@ void CAPRSWriter::sendIdFrames()
|
|||
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 %s %s"),
|
||||
output.Printf(wxT("%s-S>APDG01,TCPIP*,qAC,%s-GS:;%-7s%-2s*%02d%02d%02dz%s%cD%s%ca/A=%06.0lfRNG%04.0lf %s %s"),
|
||||
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'),
|
||||
lon.c_str(), (entry->getLongitude() < 0.0F) ? wxT('W') : wxT('E'),
|
||||
entry->getRange() * 0.6214, band.c_str(), desc.c_str());
|
||||
entry->getAGL() * 3.28, entry->getRange() * 0.6214, band.c_str(), desc.c_str());
|
||||
|
||||
char ascii[300U];
|
||||
::memset(ascii, 0x00, 300U);
|
||||
|
|
@ -372,11 +421,11 @@ void CAPRSWriter::sendIdFrames()
|
|||
m_thread->write(ascii);
|
||||
|
||||
if (entry->getBand().Len() == 1U) {
|
||||
output.Printf(wxT("%s-%s>APDG02,TCPIP*,qAC,%s-%sS:!%s%cD%s%c&RNG%04.0lf %s %s"),
|
||||
output.Printf(wxT("%s-%s>APDG02,TCPIP*,qAC,%s-%sS:!%s%cD%s%c&/A=%06.0lfRNG%04.0lf %s %s"),
|
||||
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'),
|
||||
entry->getRange() * 0.6214, band.c_str(), desc.c_str());
|
||||
entry->getAGL() * 3.28, entry->getRange() * 0.6214, band.c_str(), desc.c_str());
|
||||
|
||||
::memset(ascii, 0x00, 300U);
|
||||
for (unsigned int i = 0U; i < output.Len(); i++)
|
||||
|
|
@ -385,6 +434,158 @@ void CAPRSWriter::sendIdFrames()
|
|||
m_thread->write(ascii);
|
||||
}
|
||||
}
|
||||
|
||||
m_idTimer.start();
|
||||
}
|
||||
|
||||
void CAPRSWriter::sendIdFramesMobile()
|
||||
{
|
||||
// Grab GPS data if it's available
|
||||
unsigned char buffer[200U];
|
||||
in_addr address;
|
||||
unsigned int port;
|
||||
int ret = m_socket->read(buffer, 200U, address, port);
|
||||
if (ret <= 0)
|
||||
return;
|
||||
|
||||
if (!m_thread->isConnected())
|
||||
return;
|
||||
|
||||
buffer[ret] = '\0';
|
||||
|
||||
// Parse the GPS data
|
||||
char* pLatitude = ::strtok((char*)buffer, ",\n"); // Latitude
|
||||
char* pLongitude = ::strtok(NULL, ",\n"); // Longitude
|
||||
char* pAltitude = ::strtok(NULL, ",\n"); // Altitude (m)
|
||||
char* pVelocity = ::strtok(NULL, ",\n"); // Velocity (kms/h)
|
||||
char* pBearing = ::strtok(NULL, "\n"); // Bearing
|
||||
|
||||
if (pLatitude == NULL || pLongitude == NULL || pAltitude == NULL)
|
||||
return;
|
||||
|
||||
double rawLatitude = ::atof(pLatitude);
|
||||
double rawLongitude = ::atof(pLongitude);
|
||||
double rawAltitude = ::atof(pAltitude);
|
||||
|
||||
time_t now;
|
||||
::time(&now);
|
||||
struct tm* tm = ::gmtime(&now);
|
||||
|
||||
for (CEntry_t::iterator it = m_array.begin(); it != m_array.end(); ++it) {
|
||||
CAPRSEntry* entry = it->second;
|
||||
if (entry == NULL)
|
||||
continue;
|
||||
|
||||
wxString desc;
|
||||
if (entry->getBand().Len() > 1U) {
|
||||
if (entry->getFrequency() != 0.0)
|
||||
desc.Printf(wxT("Data %.5lfMHz"), entry->getFrequency());
|
||||
else
|
||||
desc = wxT("Data");
|
||||
} else {
|
||||
if (entry->getFrequency() != 0.0)
|
||||
desc.Printf(wxT("Voice %.5lfMHz %c%.4lfMHz"),
|
||||
entry->getFrequency(),
|
||||
entry->getOffset() < 0.0 ? wxT('-') : wxT('+'),
|
||||
::fabs(entry->getOffset()));
|
||||
else
|
||||
desc = wxT("Voice");
|
||||
}
|
||||
|
||||
wxString band;
|
||||
if (entry->getFrequency() >= 1200.0)
|
||||
band = wxT("1.2");
|
||||
else if (entry->getFrequency() >= 420.0)
|
||||
band = wxT("440");
|
||||
else if (entry->getFrequency() >= 144.0)
|
||||
band = wxT("2m");
|
||||
else if (entry->getFrequency() >= 50.0)
|
||||
band = wxT("6m");
|
||||
else if (entry->getFrequency() >= 28.0)
|
||||
band = wxT("10m");
|
||||
|
||||
double tempLat = ::fabs(rawLatitude);
|
||||
double tempLong = ::fabs(rawLongitude);
|
||||
|
||||
double latitude = ::floor(tempLat);
|
||||
double longitude = ::floor(tempLong);
|
||||
|
||||
latitude = (tempLat - latitude) * 60.0 + latitude * 100.0;
|
||||
longitude = (tempLong - longitude) * 60.0 + longitude * 100.0;
|
||||
|
||||
wxString lat;
|
||||
if (latitude >= 1000.0F)
|
||||
lat.Printf(wxT("%.2lf"), latitude);
|
||||
else if (latitude >= 100.0F)
|
||||
lat.Printf(wxT("0%.2lf"), latitude);
|
||||
else if (latitude >= 10.0F)
|
||||
lat.Printf(wxT("00%.2lf"), latitude);
|
||||
else
|
||||
lat.Printf(wxT("000%.2lf"), latitude);
|
||||
|
||||
wxString lon;
|
||||
if (longitude >= 10000.0F)
|
||||
lon.Printf(wxT("%.2lf"), longitude);
|
||||
else if (longitude >= 1000.0F)
|
||||
lon.Printf(wxT("0%.2lf"), longitude);
|
||||
else if (longitude >= 100.0F)
|
||||
lon.Printf(wxT("00%.2lf"), longitude);
|
||||
else if (longitude >= 10.0F)
|
||||
lon.Printf(wxT("000%.2lf"), longitude);
|
||||
else
|
||||
lon.Printf(wxT("0000%.2lf"), longitude);
|
||||
|
||||
// Convert commas to periods in the latitude and longitude
|
||||
lat.Replace(wxT(","), wxT("."));
|
||||
lon.Replace(wxT(","), wxT("."));
|
||||
|
||||
wxString output1;
|
||||
output1.Printf(wxT("%s-S>APDG01,TCPIP*,qAC,%s-GS:;%-7s%-2s*%02d%02d%02dz%s%cD%s%ca/A=%06.0lf"),
|
||||
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(), (rawLatitude < 0.0) ? wxT('S') : wxT('N'),
|
||||
lon.c_str(), (rawLongitude < 0.0) ? wxT('W') : wxT('E'),
|
||||
rawAltitude * 3.28);
|
||||
|
||||
wxString output2;
|
||||
if (pBearing != NULL && pVelocity != NULL) {
|
||||
double rawBearing = ::atof(pBearing);
|
||||
double rawVelocity = ::atof(pVelocity);
|
||||
|
||||
output2.Printf(wxT("%03.0lf/%03.0lf"), rawBearing, rawVelocity * 0.539957F);
|
||||
}
|
||||
|
||||
wxString output3;
|
||||
output3.Printf(wxT("RNG%04.0lf %s %s"), entry->getRange() * 0.6214, band.c_str(), desc.c_str());
|
||||
|
||||
char ascii[300U];
|
||||
::memset(ascii, 0x00, 300U);
|
||||
unsigned int n = 0U;
|
||||
for (unsigned int i = 0U; i < output1.Len(); i++, n++)
|
||||
ascii[n] = output1.GetChar(i);
|
||||
for (unsigned int i = 0U; i < output2.Len(); i++, n++)
|
||||
ascii[n] = output2.GetChar(i);
|
||||
for (unsigned int i = 0U; i < output3.Len(); i++, n++)
|
||||
ascii[n] = output3.GetChar(i);
|
||||
|
||||
m_thread->write(ascii);
|
||||
|
||||
if (entry->getBand().Len() == 1U) {
|
||||
output1.Printf(wxT("%s-%s>APDG02,TCPIP*,qAC,%s-%sS:!%s%cD%s%c&/A=%06.0lf"),
|
||||
entry->getCallsign().c_str(), entry->getBand().c_str(), entry->getCallsign().c_str(), entry->getBand().c_str(),
|
||||
lat.c_str(), (rawLatitude < 0.0) ? wxT('S') : wxT('N'),
|
||||
lon.c_str(), (rawLongitude < 0.0) ? wxT('W') : wxT('E'),
|
||||
rawAltitude * 3.28);
|
||||
|
||||
::memset(ascii, 0x00, 300U);
|
||||
unsigned int n = 0U;
|
||||
for (unsigned int i = 0U; i < output1.Len(); i++, n++)
|
||||
ascii[n] = output1.GetChar(i);
|
||||
for (unsigned int i = 0U; i < output2.Len(); i++, n++)
|
||||
ascii[n] = output2.GetChar(i);
|
||||
for (unsigned int i = 0U; i < output3.Len(); i++, n++)
|
||||
ascii[n] = output3.GetChar(i);
|
||||
|
||||
m_thread->write(ascii);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#define APRSWriter_H
|
||||
|
||||
#include "APRSWriterThread.h"
|
||||
#include "UDPReaderWriter.h"
|
||||
#include "APRSCollector.h"
|
||||
#include "DStarDefines.h"
|
||||
#include "HeaderData.h"
|
||||
|
|
@ -72,7 +73,9 @@ public:
|
|||
|
||||
bool open();
|
||||
|
||||
void setPort(const wxString& callsign, const wxString& band, double frequency, double offset, double range, double latitude, double longitude, double agl);
|
||||
void setPortFixed(const wxString& callsign, const wxString& band, double frequency, double offset, double range, double latitude, double longitude, double agl);
|
||||
|
||||
void setPortMobile(const wxString& callsign, const wxString& band, double frequency, double offset, double range, const wxString& address, unsigned int port);
|
||||
|
||||
void writeHeader(const wxString& callsign, const CHeaderData& header);
|
||||
|
||||
|
|
@ -89,8 +92,14 @@ private:
|
|||
CTimer m_idTimer;
|
||||
wxString m_gateway;
|
||||
CEntry_t m_array;
|
||||
in_addr m_address;
|
||||
unsigned int m_port;
|
||||
CUDPReaderWriter* m_socket;
|
||||
|
||||
void sendIdFrames();
|
||||
bool pollGPS();
|
||||
void sendIdFramesFixed();
|
||||
void sendIdFramesMobile();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -144,6 +144,18 @@ CAMBEData* CG2ProtocolHandler::readAMBE()
|
|||
return data;
|
||||
}
|
||||
|
||||
void CG2ProtocolHandler::punchUDPHole(const wxString& address)
|
||||
{
|
||||
unsigned char buffer[1];
|
||||
::memset(buffer, 0, 1);
|
||||
|
||||
in_addr addr = CUDPReaderWriter::lookup(address);
|
||||
|
||||
//wxLogError(wxT("Punching hole to %s"), address.mb_str());
|
||||
|
||||
m_socket.write(buffer, 1, addr, G2_DV_PORT);
|
||||
}
|
||||
|
||||
void CG2ProtocolHandler::close()
|
||||
{
|
||||
m_socket.close();
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@ public:
|
|||
CHeaderData* readHeader();
|
||||
CAMBEData* readAMBE();
|
||||
|
||||
void punchUDPHole(const wxString& addr);
|
||||
|
||||
void close();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -202,6 +202,9 @@ const wxString KEY_ECHO_ENABLED = wxT("echoEnabled");
|
|||
const wxString KEY_LOG_ENABLED = wxT("logEnabled");
|
||||
const wxString KEY_DRATS_ENABLED = wxT("dratsEnabled");
|
||||
const wxString KEY_DTMF_ENABLED = wxT("dtmfEnabled");
|
||||
const wxString KEY_MOBILE_GPS_ENABLED = wxT("mobileGPSEnabled");
|
||||
const wxString KEY_MOBILE_GPS_ADDRESS = wxT("mobileGPSAddress");
|
||||
const wxString KEY_MOBILE_GPS_PORT = wxT("mobileGPSPort");
|
||||
const wxString KEY_WINDOW_X = wxT("windowX");
|
||||
const wxString KEY_WINDOW_Y = wxT("windowY");
|
||||
|
||||
|
|
@ -285,6 +288,9 @@ const bool DEFAULT_INFO_ENABLED = true;
|
|||
const bool DEFAULT_ECHO_ENABLED = true;
|
||||
const bool DEFAULT_DRATS_ENABLED = false;
|
||||
const bool DEFAULT_DTMF_ENABLED = true;
|
||||
const bool DEFAULT_MOBILE_GPS_ENABLED = false;
|
||||
const wxString DEFAULT_MOBILE_GPS_ADDRESS = wxT("127.0.0.1");
|
||||
const unsigned int DEFAULT_MOBILE_GPS_PORT = 7834U;
|
||||
const int DEFAULT_WINDOW_X = -1;
|
||||
const int DEFAULT_WINDOW_Y = -1;
|
||||
|
||||
|
|
@ -477,6 +483,9 @@ m_echoEnabled(DEFAULT_ECHO_ENABLED),
|
|||
m_logEnabled(DEFAULT_LOG_ENABLED),
|
||||
m_dratsEnabled(DEFAULT_DRATS_ENABLED),
|
||||
m_dtmfEnabled(DEFAULT_DTMF_ENABLED),
|
||||
m_mobileGPSEnabled(DEFAULT_MOBILE_GPS_ENABLED),
|
||||
m_mobileGPSAddress(DEFAULT_MOBILE_GPS_ADDRESS),
|
||||
m_mobileGPSPort(DEFAULT_MOBILE_GPS_PORT),
|
||||
m_x(DEFAULT_WINDOW_X),
|
||||
m_y(DEFAULT_WINDOW_Y)
|
||||
{
|
||||
|
|
@ -892,6 +901,13 @@ m_y(DEFAULT_WINDOW_Y)
|
|||
|
||||
m_config->Read(m_name + KEY_DTMF_ENABLED, &m_dtmfEnabled, DEFAULT_DTMF_ENABLED);
|
||||
|
||||
m_config->Read(m_name + KEY_MOBILE_GPS_ENABLED, &m_mobileGPSEnabled, DEFAULT_MOBILE_GPS_ENABLED);
|
||||
|
||||
m_config->Read(m_name + KEY_MOBILE_GPS_ADDRESS, &m_mobileGPSAddress, DEFAULT_MOBILE_GPS_ADDRESS);
|
||||
|
||||
m_config->Read(m_name + KEY_MOBILE_GPS_PORT, &temp, long(DEFAULT_MOBILE_GPS_PORT));
|
||||
m_mobileGPSPort = (unsigned int)temp;
|
||||
|
||||
m_config->Read(m_name + KEY_WINDOW_X, &temp, long(DEFAULT_WINDOW_X));
|
||||
m_x = int(temp);
|
||||
|
||||
|
|
@ -1090,6 +1106,9 @@ m_echoEnabled(DEFAULT_ECHO_ENABLED),
|
|||
m_logEnabled(DEFAULT_LOG_ENABLED),
|
||||
m_dratsEnabled(DEFAULT_DRATS_ENABLED),
|
||||
m_dtmfEnabled(DEFAULT_DTMF_ENABLED),
|
||||
m_mobileGPSEnabled(DEFAULT_MOBILE_GPS_ENABLED),
|
||||
m_mobileGPSAddress(DEFAULT_MOBILE_GPS_ADDRESS),
|
||||
m_mobileGPSPort(DEFAULT_MOBILE_GPS_PORT),
|
||||
m_x(DEFAULT_WINDOW_X),
|
||||
m_y(DEFAULT_WINDOW_Y)
|
||||
{
|
||||
|
|
@ -1570,6 +1589,14 @@ m_y(DEFAULT_WINDOW_Y)
|
|||
} else if (key.IsSameAs(KEY_DTMF_ENABLED)) {
|
||||
val.ToLong(&temp1);
|
||||
m_dtmfEnabled = temp1 == 1L;
|
||||
} else if (key.IsSameAs(KEY_MOBILE_GPS_ENABLED)) {
|
||||
val.ToLong(&temp1);
|
||||
m_mobileGPSEnabled = temp1 == 1L;
|
||||
} else if (key.IsSameAs(KEY_MOBILE_GPS_ADDRESS)) {
|
||||
m_mobileGPSAddress = val;
|
||||
} else if (key.IsSameAs(KEY_MOBILE_GPS_PORT)) {
|
||||
val.ToULong(&temp2);
|
||||
m_mobileGPSPort = (unsigned int)temp2;
|
||||
} else if (key.IsSameAs(KEY_WINDOW_X)) {
|
||||
val.ToLong(&temp1);
|
||||
m_x = int(temp1);
|
||||
|
|
@ -2199,6 +2226,20 @@ void CIRCDDBGatewayConfig::setMiscellaneous(TEXT_LANG language, bool infoEnabled
|
|||
m_dtmfEnabled = dtmfEnabled;
|
||||
}
|
||||
|
||||
void CIRCDDBGatewayConfig::getMobileGPS(bool& enabled, wxString& address, unsigned int& port) const
|
||||
{
|
||||
enabled = m_mobileGPSEnabled;
|
||||
address = m_mobileGPSAddress;
|
||||
port = m_mobileGPSPort;
|
||||
}
|
||||
|
||||
void CIRCDDBGatewayConfig::setMobileGPS(bool enabled, const wxString& address, unsigned int port)
|
||||
{
|
||||
m_mobileGPSEnabled = enabled;
|
||||
m_mobileGPSAddress = address;
|
||||
m_mobileGPSPort = port;
|
||||
}
|
||||
|
||||
void CIRCDDBGatewayConfig::getPosition(int& x, int& y) const
|
||||
{
|
||||
x = m_x;
|
||||
|
|
@ -2439,6 +2480,9 @@ bool CIRCDDBGatewayConfig::write()
|
|||
m_config->Write(m_name + KEY_LOG_ENABLED, m_logEnabled);
|
||||
m_config->Write(m_name + KEY_DRATS_ENABLED, m_dratsEnabled);
|
||||
m_config->Write(m_name + KEY_DTMF_ENABLED, m_dtmfEnabled);
|
||||
m_config->Write(m_name + KEY_MOBILE_GPS_ENABLED, m_mobileGPSEnabled);
|
||||
m_config->Write(m_name + KEY_MOBILE_GPS_ADDRESS, m_mobileGPSAddress);
|
||||
m_config->Write(m_name + KEY_MOBILE_GPS_PORT, long(m_mobileGPSPort));
|
||||
m_config->Write(m_name + KEY_WINDOW_X, long(m_x));
|
||||
m_config->Write(m_name + KEY_WINDOW_Y, long(m_y));
|
||||
m_config->Flush();
|
||||
|
|
@ -2647,6 +2691,9 @@ bool CIRCDDBGatewayConfig::write()
|
|||
buffer.Printf(wxT("%s=%d"), KEY_LOG_ENABLED.c_str(), m_logEnabled ? 1 : 0); file.AddLine(buffer);
|
||||
buffer.Printf(wxT("%s=%d"), KEY_DRATS_ENABLED.c_str(), m_dratsEnabled ? 1 : 0); file.AddLine(buffer);
|
||||
buffer.Printf(wxT("%s=%d"), KEY_DTMF_ENABLED.c_str(), m_dtmfEnabled ? 1 : 0); file.AddLine(buffer);
|
||||
buffer.Printf(wxT("%s=%d"), KEY_MOBILE_GPS_ENABLED.c_str(), m_mobileGPSEnabled ? 1 : 0); file.AddLine(buffer);
|
||||
buffer.Printf(wxT("%s=%s"), KEY_MOBILE_GPS_ADDRESS.c_str(), m_mobileGPSAddress.c_str()); file.AddLine(buffer);
|
||||
buffer.Printf(wxT("%s=%u"), KEY_MOBILE_GPS_PORT.c_str(), m_mobileGPSPort); file.AddLine(buffer);
|
||||
buffer.Printf(wxT("%s=%d"), KEY_WINDOW_X.c_str(), m_x); file.AddLine(buffer);
|
||||
buffer.Printf(wxT("%s=%d"), KEY_WINDOW_Y.c_str(), m_y); file.AddLine(buffer);
|
||||
|
||||
|
|
|
|||
|
|
@ -112,6 +112,9 @@ public:
|
|||
void getMiscellaneous(TEXT_LANG& language, bool& infoEnabled, bool& echoEnabled, bool& logEnabled, bool& dratsEnabled, bool& dtmfEnabled) const;
|
||||
void setMiscellaneous(TEXT_LANG language, bool infoEnabled, bool echoEnabled, bool logEnabled, bool dratsEnabled, bool dtmfEnabled);
|
||||
|
||||
void getMobileGPS(bool& enabled, wxString& address, unsigned int& port) const;
|
||||
void setMobileGPS(bool enabled, const wxString& address, unsigned int port);
|
||||
|
||||
void getPosition(int& x, int& y) const;
|
||||
void setPosition(int x, int y);
|
||||
|
||||
|
|
@ -305,6 +308,9 @@ private:
|
|||
bool m_logEnabled;
|
||||
bool m_dratsEnabled;
|
||||
bool m_dtmfEnabled;
|
||||
bool m_mobileGPSEnabled;
|
||||
wxString m_mobileGPSAddress;
|
||||
unsigned int m_mobileGPSPort;
|
||||
int m_x;
|
||||
int m_y;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2002,2003,2009,2011,2012,2018 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2002,2003,2009,2011,2012 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,20 +19,17 @@
|
|||
#include "Logger.h"
|
||||
|
||||
CLogger::CLogger(const wxString& directory, const wxString& name) :
|
||||
#if(defined(__WINDOWS__))
|
||||
m_day(0),
|
||||
#endif
|
||||
wxLog(),
|
||||
m_name(name),
|
||||
m_file(NULL),
|
||||
m_fileName()
|
||||
m_fileName(),
|
||||
m_day(0)
|
||||
{
|
||||
m_file = new wxFFile;
|
||||
|
||||
m_fileName.SetPath(directory);
|
||||
m_fileName.SetExt(wxT("log"));
|
||||
|
||||
#if(defined(__WINDOWS__))
|
||||
time_t timestamp;
|
||||
::time(×tamp);
|
||||
struct tm* tm = ::gmtime(×tamp);
|
||||
|
|
@ -42,9 +39,6 @@ m_fileName()
|
|||
|
||||
m_day = tm->tm_yday;
|
||||
m_fileName.SetName(text);
|
||||
#else
|
||||
m_fileName.SetName(m_name);
|
||||
#endif
|
||||
|
||||
bool ret = m_file->Open(m_fileName.GetFullPath(), wxT("a+t"));
|
||||
if (!ret) {
|
||||
|
|
@ -61,10 +55,11 @@ CLogger::~CLogger()
|
|||
delete m_file;
|
||||
}
|
||||
|
||||
void CLogger::DoLogRecord(wxLogLevel level, const wxString& msg, const wxLogRecordInfo& info)
|
||||
void CLogger::DoLog(wxLogLevel level, const wxChar* msg, time_t timestamp)
|
||||
{
|
||||
wxASSERT(m_file != NULL);
|
||||
wxASSERT(m_file->IsOpened());
|
||||
wxASSERT(msg != NULL);
|
||||
|
||||
wxString letter;
|
||||
|
||||
|
|
@ -80,23 +75,23 @@ void CLogger::DoLogRecord(wxLogLevel level, const wxString& msg, const wxLogReco
|
|||
default: letter = wxT("U"); break;
|
||||
}
|
||||
|
||||
struct tm* tm = ::gmtime(&info.timestamp);
|
||||
struct tm* tm = ::gmtime(×tamp);
|
||||
|
||||
wxString message;
|
||||
message.Printf(wxT("%s: %04d-%02d-%02d %02d:%02d:%02d: %s\n"), letter.c_str(), tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, msg.c_str());
|
||||
message.Printf(wxT("%s: %04d-%02d-%02d %02d:%02d:%02d: %s\n"), letter.c_str(), tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, msg);
|
||||
|
||||
logString(message, info.timestamp);
|
||||
DoLogString(message.c_str(), timestamp);
|
||||
|
||||
if (level == wxLOG_FatalError)
|
||||
::abort();
|
||||
}
|
||||
|
||||
void CLogger::logString(const wxString& msg, time_t timestamp)
|
||||
void CLogger::DoLogString(const wxChar* msg, time_t timestamp)
|
||||
{
|
||||
wxASSERT(m_file != NULL);
|
||||
wxASSERT(m_file->IsOpened());
|
||||
wxASSERT(msg != NULL);
|
||||
|
||||
#if(defined(__WINDOWS__))
|
||||
struct tm* tm = ::gmtime(×tamp);
|
||||
|
||||
int day = tm->tm_yday;
|
||||
|
|
@ -115,8 +110,8 @@ void CLogger::logString(const wxString& msg, time_t timestamp)
|
|||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
m_file->Write(msg);
|
||||
m_file->Write(wxString(msg));
|
||||
m_file->Flush();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2002,2003,2009,2011,2012,2018 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2002,2003,2009,2011,2012 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
|
||||
|
|
@ -22,24 +22,21 @@
|
|||
#include <wx/wx.h>
|
||||
#include <wx/ffile.h>
|
||||
#include <wx/filename.h>
|
||||
#include <wx/log.h>
|
||||
|
||||
class CLogger : public wxLog {
|
||||
public:
|
||||
CLogger(const wxString& directory, const wxString& name);
|
||||
virtual ~CLogger();
|
||||
|
||||
virtual void DoLogRecord(wxLogLevel level, const wxString& msg, const wxLogRecordInfo& info);
|
||||
virtual void DoLog(wxLogLevel level, const wxChar* msg, time_t timestamp);
|
||||
virtual void DoLogString(const wxChar* msg, time_t timestamp);
|
||||
|
||||
private:
|
||||
wxString m_name;
|
||||
wxFFile* m_file;
|
||||
wxFileName m_fileName;
|
||||
#if(defined(__WINDOWS__))
|
||||
int m_day;
|
||||
#endif
|
||||
|
||||
void logString(const wxString& msg, time_t timestamp);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2006-2014 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2006-2014,2018 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
|
||||
|
|
@ -37,6 +37,34 @@ m_fd(-1)
|
|||
#endif
|
||||
}
|
||||
|
||||
CUDPReaderWriter::CUDPReaderWriter(unsigned int port) :
|
||||
m_address(),
|
||||
m_port(port),
|
||||
m_addr(),
|
||||
m_fd(-1)
|
||||
{
|
||||
#if defined(__WINDOWS__)
|
||||
WSAData data;
|
||||
int wsaRet = ::WSAStartup(MAKEWORD(2, 2), &data);
|
||||
if (wsaRet != 0)
|
||||
wxLogError(wxT("Error from WSAStartup"));
|
||||
#endif
|
||||
}
|
||||
|
||||
CUDPReaderWriter::CUDPReaderWriter() :
|
||||
m_address(),
|
||||
m_port(0U),
|
||||
m_addr(),
|
||||
m_fd(-1)
|
||||
{
|
||||
#if defined(__WINDOWS__)
|
||||
WSAData data;
|
||||
int wsaRet = ::WSAStartup(MAKEWORD(2, 2), &data);
|
||||
if (wsaRet != 0)
|
||||
wxLogError(wxT("Error from WSAStartup"));
|
||||
#endif
|
||||
}
|
||||
|
||||
CUDPReaderWriter::~CUDPReaderWriter()
|
||||
{
|
||||
#if defined(__WINDOWS__)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2011,2013 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2009-2011,2013,2018 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
|
||||
|
|
@ -35,6 +35,8 @@
|
|||
class CUDPReaderWriter {
|
||||
public:
|
||||
CUDPReaderWriter(const wxString& address, unsigned int port);
|
||||
CUDPReaderWriter(unsigned int port);
|
||||
CUDPReaderWriter();
|
||||
~CUDPReaderWriter();
|
||||
|
||||
static in_addr lookup(const wxString& hostName);
|
||||
|
|
|
|||
68
Makefile
68
Makefile
|
|
@ -16,64 +16,64 @@ all: ircDDBGateway/ircddbgatewayd ircDDBGatewayConfig/ircddbgatewayconfig APRSTr
|
|||
StarNetServer/starnetserverd TextTransmit/texttransmitd TimerControl/timercontrold TimeServer/timeserverd VoiceTransmit/voicetransmitd
|
||||
|
||||
ircDDBGateway/ircddbgatewayd: Common/Common.a ircDDB/IRCDDB.a
|
||||
make -C ircDDBGateway
|
||||
$(MAKE) -C ircDDBGateway
|
||||
|
||||
ircDDBGatewayConfig/ircddbgatewayconfig: GUICommon/GUICommon.a Common/Common.a
|
||||
make -C ircDDBGatewayConfig
|
||||
$(MAKE) -C ircDDBGatewayConfig
|
||||
|
||||
APRSTransmit/aprstransmitd: Common/Common.a
|
||||
make -C APRSTransmit
|
||||
$(MAKE) -C APRSTransmit
|
||||
|
||||
RemoteControl/remotecontrold: Common/Common.a
|
||||
make -C RemoteControl
|
||||
$(MAKE) -C RemoteControl
|
||||
|
||||
StarNetServer/starnetserverd: Common/Common.a ircDDB/IRCDDB.a
|
||||
make -C StarNetServer
|
||||
$(MAKE) -C StarNetServer
|
||||
|
||||
TextTransmit/texttransmitd: Common/Common.a
|
||||
make -C TextTransmit
|
||||
$(MAKE) -C TextTransmit
|
||||
|
||||
TimerControl/timercontrold: Common/Common.a GUICommon/GUICommon.a
|
||||
make -C TimerControl
|
||||
$(MAKE) -C TimerControl
|
||||
|
||||
TimeServer/timeserverd: Common/Common.a GUICommon/GUICommon.a
|
||||
make -C TimeServer
|
||||
$(MAKE) -C TimeServer
|
||||
|
||||
VoiceTransmit/voicetransmitd: Common/Common.a
|
||||
make -C VoiceTransmit
|
||||
$(MAKE) -C VoiceTransmit
|
||||
|
||||
GUICommon/GUICommon.a:
|
||||
make -C GUICommon
|
||||
$(MAKE) -C GUICommon
|
||||
|
||||
Common/Common.a:
|
||||
make -C Common
|
||||
$(MAKE) -C Common
|
||||
|
||||
ircDDB/IRCDDB.a:
|
||||
make -C ircDDB
|
||||
$(MAKE) -C ircDDB
|
||||
|
||||
install: all
|
||||
make -C Data install
|
||||
make -C APRSTransmit install
|
||||
make -C ircDDBGateway install
|
||||
make -C RemoteControl install
|
||||
make -C StarNetServer install
|
||||
make -C TextTransmit install
|
||||
make -C TimerControl install
|
||||
make -C TimeServer install
|
||||
make -C VoiceTransmit install
|
||||
make -C ircDDBGatewayConfig install
|
||||
$(MAKE) -C Data install
|
||||
$(MAKE) -C APRSTransmit install
|
||||
$(MAKE) -C ircDDBGateway install
|
||||
$(MAKE) -C RemoteControl install
|
||||
$(MAKE) -C StarNetServer install
|
||||
$(MAKE) -C TextTransmit install
|
||||
$(MAKE) -C TimerControl install
|
||||
$(MAKE) -C TimeServer install
|
||||
$(MAKE) -C VoiceTransmit install
|
||||
$(MAKE) -C ircDDBGatewayConfig install
|
||||
|
||||
clean:
|
||||
make -C Common clean
|
||||
make -C ircDDB clean
|
||||
make -C GUICommon clean
|
||||
make -C APRSTransmit clean
|
||||
make -C ircDDBGateway clean
|
||||
make -C RemoteControl clean
|
||||
make -C StarNetServer clean
|
||||
make -C TextTransmit clean
|
||||
make -C TimerControl clean
|
||||
make -C TimeServer clean
|
||||
make -C VoiceTransmit clean
|
||||
make -C ircDDBGatewayConfig clean
|
||||
$(MAKE) -C Common clean
|
||||
$(MAKE) -C ircDDB clean
|
||||
$(MAKE) -C GUICommon clean
|
||||
$(MAKE) -C APRSTransmit clean
|
||||
$(MAKE) -C ircDDBGateway clean
|
||||
$(MAKE) -C RemoteControl clean
|
||||
$(MAKE) -C StarNetServer clean
|
||||
$(MAKE) -C TextTransmit clean
|
||||
$(MAKE) -C TimerControl clean
|
||||
$(MAKE) -C TimeServer clean
|
||||
$(MAKE) -C VoiceTransmit clean
|
||||
$(MAKE) -C ircDDBGatewayConfig clean
|
||||
|
||||
|
|
|
|||
68
MakefileGUI
68
MakefileGUI
|
|
@ -16,63 +16,63 @@ all: ircDDBGateway/ircddbgateway ircDDBGatewayConfig/ircddbgatewayconfig APRSTra
|
|||
StarNetServer/starnetserver TextTransmit/texttransmitd TimerControl/timercontrol TimeServer/timeserver VoiceTransmit/voicetransmitd
|
||||
|
||||
ircDDBGateway/ircddbgateway: GUICommon/GUICommon.a Common/Common.a ircDDB/IRCDDB.a
|
||||
make -C ircDDBGateway -f MakefileGUI
|
||||
$(MAKE) -C ircDDBGateway -f MakefileGUI
|
||||
|
||||
ircDDBGatewayConfig/ircddbgatewayconfig: GUICommon/GUICommon.a Common/Common.a
|
||||
make -C ircDDBGatewayConfig
|
||||
$(MAKE) -C ircDDBGatewayConfig
|
||||
|
||||
APRSTransmit/aprstransmitd: Common/Common.a
|
||||
make -C APRSTransmit
|
||||
$(MAKE) -C APRSTransmit
|
||||
|
||||
RemoteControl/remotecontrol: Common/Common.a
|
||||
make -C RemoteControl -f MakefileGUI
|
||||
$(MAKE) -C RemoteControl -f MakefileGUI
|
||||
|
||||
StarNetServer/starnetserver: Common/Common.a ircDDB/IRCDDB.a
|
||||
make -C StarNetServer -f MakefileGUI
|
||||
$(MAKE) -C StarNetServer -f MakefileGUI
|
||||
|
||||
TextTransmit/texttransmitd: Common/Common.a
|
||||
make -C TextTransmit
|
||||
$(MAKE) -C TextTransmit
|
||||
|
||||
TimerControl/timercontrol: Common/Common.a GUICommon/GUICommon.a
|
||||
make -C TimerControl -f MakefileGUI
|
||||
$(MAKE) -C TimerControl -f MakefileGUI
|
||||
|
||||
TimeServer/timeserver: Common/Common.a GUICommon/GUICommon.a
|
||||
make -C TimeServer -f MakefileGUI
|
||||
$(MAKE) -C TimeServer -f MakefileGUI
|
||||
|
||||
VoiceTransmit/voicetransmitd: Common/Common.a
|
||||
make -C VoiceTransmit
|
||||
$(MAKE) -C VoiceTransmit
|
||||
|
||||
GUICommon/GUICommon.a:
|
||||
make -C GUICommon
|
||||
$(MAKE) -C GUICommon
|
||||
|
||||
Common/Common.a:
|
||||
make -C Common
|
||||
$(MAKE) -C Common
|
||||
|
||||
ircDDB/IRCDDB.a:
|
||||
make -C ircDDB
|
||||
$(MAKE) -C ircDDB
|
||||
|
||||
install: all
|
||||
make -C Data install
|
||||
make -C APRSTransmit install
|
||||
make -C ircDDBGateway -f MakefileGUI install
|
||||
make -C RemoteControl -f MakefileGUI install
|
||||
make -C StarNetServer -f MakefileGUI install
|
||||
make -C TextTransmit install
|
||||
make -C TimerControl -f MakefileGUI install
|
||||
make -C TimeServer -f MakefileGUI install
|
||||
make -C VoiceTransmit install
|
||||
make -C ircDDBGatewayConfig install
|
||||
$(MAKE) -C Data install
|
||||
$(MAKE) -C APRSTransmit install
|
||||
$(MAKE) -C ircDDBGateway -f MakefileGUI install
|
||||
$(MAKE) -C RemoteControl -f MakefileGUI install
|
||||
$(MAKE) -C StarNetServer -f MakefileGUI install
|
||||
$(MAKE) -C TextTransmit install
|
||||
$(MAKE) -C TimerControl -f MakefileGUI install
|
||||
$(MAKE) -C TimeServer -f MakefileGUI install
|
||||
$(MAKE) -C VoiceTransmit install
|
||||
$(MAKE) -C ircDDBGatewayConfig install
|
||||
|
||||
clean:
|
||||
make -C Common clean
|
||||
make -C ircDDB clean
|
||||
make -C GUICommon clean
|
||||
make -C APRSTransmit clean
|
||||
make -C ircDDBGateway -f MakefileGUI clean
|
||||
make -C RemoteControl -f MakefileGUI clean
|
||||
make -C StarNetServer -f MakefileGUI clean
|
||||
make -C TextTransmit clean
|
||||
make -C TimerControl -f MakefileGUI clean
|
||||
make -C TimeServer -f MakefileGUI clean
|
||||
make -C VoiceTransmit clean
|
||||
make -C ircDDBGatewayConfig clean
|
||||
$(MAKE) -C Common clean
|
||||
$(MAKE) -C ircDDB clean
|
||||
$(MAKE) -C GUICommon clean
|
||||
$(MAKE) -C APRSTransmit clean
|
||||
$(MAKE) -C ircDDBGateway -f MakefileGUI clean
|
||||
$(MAKE) -C RemoteControl -f MakefileGUI clean
|
||||
$(MAKE) -C StarNetServer -f MakefileGUI clean
|
||||
$(MAKE) -C TextTransmit clean
|
||||
$(MAKE) -C TimerControl -f MakefileGUI clean
|
||||
$(MAKE) -C TimeServer -f MakefileGUI clean
|
||||
$(MAKE) -C VoiceTransmit clean
|
||||
$(MAKE) -C ircDDBGatewayConfig clean
|
||||
|
|
|
|||
|
|
@ -276,6 +276,12 @@ void CIRCDDBGatewayApp::createThread()
|
|||
m_config->getMiscellaneous(language, infoEnabled, echoEnabled, logEnabled, dratsEnabled, dtmfEnabled);
|
||||
wxLogInfo(wxT("Language: %d, info enabled: %d, echo enabled: %d, log enabled : %d, D-RATS enabled: %d, DTMF control enabled: %d"), int(language), int(infoEnabled), int(echoEnabled), int(logEnabled), int(dratsEnabled), int(dtmfEnabled));
|
||||
|
||||
bool mobileGPSEnabled;
|
||||
wxString mobileGPSAddress;
|
||||
unsigned int mobileGPSPort;
|
||||
m_config->getMobileGPS(mobileGPSEnabled, mobileGPSAddress, mobileGPSPort);
|
||||
wxLogInfo(wxT("Mobile GPS: %d, address: %s, port: %u"), int(mobileGPSEnabled), mobileGPSAddress.c_str(), mobileGPSPort);
|
||||
|
||||
CIcomRepeaterProtocolHandler* icomRepeaterHandler = NULL;
|
||||
CHBRepeaterProtocolHandler* hbRepeaterHandler = NULL;
|
||||
CDummyRepeaterProtocolHandler* dummyRepeaterHandler = NULL;
|
||||
|
|
@ -351,15 +357,23 @@ void CIRCDDBGatewayApp::createThread()
|
|||
wxLogInfo(wxT("Repeater 1 bands: %u %u %u"), band11, band12, band13);
|
||||
thread->addRepeater(callsign1, repeaterBand1, repeaterAddress1, repeaterPort1, repeaterType1, reflector1, atStartup1, reconnect1, dratsEnabled, frequency1, offset1, range1, latitude1, longitude1, agl1, description11, description12, url1, icomRepeaterHandler, band11, band12, band13);
|
||||
|
||||
if (aprs != NULL)
|
||||
aprs->setPort(callsign1, repeaterBand1, frequency1, offset1, range1, latitude1, longitude1, agl1);
|
||||
if (aprs != NULL) {
|
||||
if (mobileGPSEnabled)
|
||||
aprs->setPortMobile(callsign1, repeaterBand1, frequency1, offset1, range1, mobileGPSAddress, mobileGPSPort);
|
||||
else
|
||||
aprs->setPortFixed(callsign1, repeaterBand1, frequency1, offset1, range1, latitude1, longitude1, agl1);
|
||||
}
|
||||
|
||||
icomCount++;
|
||||
} else if (repeaterType1 == HW_HOMEBREW && hbRepeaterHandler != NULL) {
|
||||
thread->addRepeater(callsign1, repeaterBand1, repeaterAddress1, repeaterPort1, repeaterType1, reflector1, atStartup1, reconnect1, dratsEnabled, frequency1, offset1, range1, latitude1, longitude1, agl1, description11, description12, url1, hbRepeaterHandler);
|
||||
|
||||
if (aprs != NULL)
|
||||
aprs->setPort(callsign1, repeaterBand1, frequency1, offset1, range1, latitude1, longitude1, agl1);
|
||||
if (aprs != NULL) {
|
||||
if (mobileGPSEnabled)
|
||||
aprs->setPortMobile(callsign1, repeaterBand1, frequency1, offset1, range1, mobileGPSAddress, mobileGPSPort);
|
||||
else
|
||||
aprs->setPortFixed(callsign1, repeaterBand1, frequency1, offset1, range1, latitude1, longitude1, agl1);
|
||||
}
|
||||
} else if (repeaterType1 == HW_DUMMY && dummyRepeaterHandler != NULL) {
|
||||
thread->addRepeater(callsign1, repeaterBand1, repeaterAddress1, repeaterPort1, repeaterType1, reflector1, atStartup1, reconnect1, dratsEnabled, frequency1, offset1, range1, latitude1, longitude1, agl1, description11, description12, url1, dummyRepeaterHandler);
|
||||
}
|
||||
|
|
@ -439,15 +453,23 @@ void CIRCDDBGatewayApp::createThread()
|
|||
wxLogInfo(wxT("Repeater 2 bands: %u %u %u"), band21, band22, band23);
|
||||
thread->addRepeater(callsign2, repeaterBand2, repeaterAddress2, repeaterPort2, repeaterType2, reflector2, atStartup2, reconnect2, dratsEnabled, frequency2, offset2, range2, latitude2, longitude2, agl2, description21, description22, url2, icomRepeaterHandler, band21, band22, band23);
|
||||
|
||||
if (aprs != NULL)
|
||||
aprs->setPort(callsign2, repeaterBand2, frequency2, offset2, range2, latitude2, longitude2, agl2);
|
||||
if (aprs != NULL) {
|
||||
if (mobileGPSEnabled)
|
||||
aprs->setPortMobile(callsign2, repeaterBand2, frequency2, offset2, range2, mobileGPSAddress, mobileGPSPort);
|
||||
else
|
||||
aprs->setPortFixed(callsign2, repeaterBand2, frequency2, offset2, range2, latitude2, longitude2, agl2);
|
||||
}
|
||||
|
||||
icomCount++;
|
||||
} else if (repeaterType2 == HW_HOMEBREW && hbRepeaterHandler != NULL) {
|
||||
thread->addRepeater(callsign2, repeaterBand2, repeaterAddress2, repeaterPort2, repeaterType2, reflector2, atStartup2, reconnect2, dratsEnabled, frequency2, offset2, range2, latitude2, longitude2, agl2, description21, description22, url2, hbRepeaterHandler);
|
||||
|
||||
if (aprs != NULL)
|
||||
aprs->setPort(callsign2, repeaterBand2, frequency2, offset2, range2, latitude2, longitude2, agl2);
|
||||
if (aprs != NULL) {
|
||||
if (mobileGPSEnabled)
|
||||
aprs->setPortMobile(callsign2, repeaterBand2, frequency2, offset2, range2, mobileGPSAddress, mobileGPSPort);
|
||||
else
|
||||
aprs->setPortFixed(callsign2, repeaterBand2, frequency2, offset2, range2, latitude2, longitude2, agl2);
|
||||
}
|
||||
} else if (repeaterType2 == HW_DUMMY && dummyRepeaterHandler != NULL) {
|
||||
thread->addRepeater(callsign2, repeaterBand2, repeaterAddress2, repeaterPort2, repeaterType2, reflector2, atStartup2, reconnect2, dratsEnabled, frequency2, offset2, range2, latitude2, longitude2, agl2, description21, description22, url2, dummyRepeaterHandler);
|
||||
}
|
||||
|
|
@ -531,15 +553,23 @@ void CIRCDDBGatewayApp::createThread()
|
|||
wxLogInfo(wxT("Repeater 3 bands: %u %u %u"), band31, band32, band33);
|
||||
thread->addRepeater(callsign3, repeaterBand3, repeaterAddress3, repeaterPort3, repeaterType3, reflector3, atStartup3, reconnect3, dratsEnabled, frequency3, offset3, range3, latitude3, longitude3, agl3, description31, description32, url3, icomRepeaterHandler, band31, band32, band33);
|
||||
|
||||
if (aprs != NULL)
|
||||
aprs->setPort(callsign3, repeaterBand3, frequency3, offset3, range3, latitude3, longitude3, agl3);
|
||||
if (aprs != NULL) {
|
||||
if (mobileGPSEnabled)
|
||||
aprs->setPortMobile(callsign3, repeaterBand3, frequency3, offset3, range3, mobileGPSAddress, mobileGPSPort);
|
||||
else
|
||||
aprs->setPortFixed(callsign3, repeaterBand3, frequency3, offset3, range3, latitude3, longitude3, agl3);
|
||||
}
|
||||
|
||||
icomCount++;
|
||||
} else if (repeaterType3 == HW_HOMEBREW && hbRepeaterHandler != NULL) {
|
||||
thread->addRepeater(callsign3, repeaterBand3, repeaterAddress3, repeaterPort3, repeaterType3, reflector3, atStartup3, reconnect3, dratsEnabled, frequency3, offset3, range3, latitude3, longitude3, agl3, description31, description32, url3, hbRepeaterHandler);
|
||||
|
||||
if (aprs != NULL)
|
||||
aprs->setPort(callsign3, repeaterBand3, frequency3, offset3, range3, latitude3, longitude3, agl3);
|
||||
if (aprs != NULL) {
|
||||
if (mobileGPSEnabled)
|
||||
aprs->setPortMobile(callsign3, repeaterBand3, frequency3, offset3, range3, mobileGPSAddress, mobileGPSPort);
|
||||
else
|
||||
aprs->setPortFixed(callsign3, repeaterBand3, frequency3, offset3, range3, latitude3, longitude3, agl3);
|
||||
}
|
||||
} else if (repeaterType3 == HW_DUMMY && dummyRepeaterHandler != NULL) {
|
||||
thread->addRepeater(callsign3, repeaterBand3, repeaterAddress3, repeaterPort3, repeaterType3, reflector3, atStartup3, reconnect3, dratsEnabled, frequency3, offset3, range3, latitude3, longitude3, agl3, description31, description32, url3, dummyRepeaterHandler);
|
||||
}
|
||||
|
|
@ -627,15 +657,23 @@ void CIRCDDBGatewayApp::createThread()
|
|||
wxLogInfo(wxT("Repeater 4 bands: %u %u %u"), band41, band42, band43);
|
||||
thread->addRepeater(callsign4, repeaterBand4, repeaterAddress4, repeaterPort4, repeaterType4, reflector4, atStartup4, reconnect4, dratsEnabled, frequency4, offset4, range4, latitude4, longitude4, agl4, description41, description42, url4, icomRepeaterHandler, band41, band42, band43);
|
||||
|
||||
if (aprs != NULL)
|
||||
aprs->setPort(callsign4, repeaterBand4, frequency4, offset4, range4, latitude4, longitude4, agl4);
|
||||
if (aprs != NULL) {
|
||||
if (mobileGPSEnabled)
|
||||
aprs->setPortMobile(callsign4, repeaterBand4, frequency4, offset4, range4, mobileGPSAddress, mobileGPSPort);
|
||||
else
|
||||
aprs->setPortFixed(callsign4, repeaterBand4, frequency4, offset4, range4, latitude4, longitude4, agl4);
|
||||
}
|
||||
|
||||
icomCount++;
|
||||
} else if (repeaterType4 == HW_HOMEBREW && hbRepeaterHandler != NULL) {
|
||||
thread->addRepeater(callsign4, repeaterBand4, repeaterAddress4, repeaterPort4, repeaterType4, reflector4, atStartup4, reconnect4, dratsEnabled, frequency4, offset4, range4, latitude4, longitude4, agl4, description41, description42, url4, hbRepeaterHandler);
|
||||
|
||||
if (aprs != NULL)
|
||||
aprs->setPort(callsign4, repeaterBand4, frequency4, offset4, range4, latitude4, longitude4, agl4);
|
||||
if (aprs != NULL) {
|
||||
if (mobileGPSEnabled)
|
||||
aprs->setPortMobile(callsign4, repeaterBand4, frequency4, offset4, range4, mobileGPSAddress, mobileGPSPort);
|
||||
else
|
||||
aprs->setPortFixed(callsign4, repeaterBand4, frequency4, offset4, range4, latitude4, longitude4, agl4);
|
||||
}
|
||||
} else if (repeaterType4 == HW_DUMMY && dummyRepeaterHandler != NULL) {
|
||||
thread->addRepeater(callsign4, repeaterBand4, repeaterAddress4, repeaterPort4, repeaterType4, reflector4, atStartup4, reconnect4, dratsEnabled, frequency4, offset4, range4, latitude4, longitude4, agl4, description41, description42, url4, dummyRepeaterHandler);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ const wxChar* LOGDIR_OPTION = wxT("logdir");
|
|||
const wxChar* CONFDIR_OPTION = wxT("confdir");
|
||||
const wxChar* DAEMON_SWITCH = wxT("daemon");
|
||||
|
||||
const wxString LOG_BASE_NAME = wxT("ircddbgatewayd");
|
||||
const wxString LOG_BASE_NAME = wxT("ircDDBGateway");
|
||||
|
||||
static CIRCDDBGatewayAppD* m_gateway = NULL;
|
||||
|
||||
|
|
@ -265,6 +265,12 @@ bool CIRCDDBGatewayAppD::createThread()
|
|||
config.getMiscellaneous(language, infoEnabled, echoEnabled, logEnabled, dratsEnabled, dtmfEnabled);
|
||||
wxLogInfo(wxT("Language: %d, info enabled: %d, echo enabled: %d, log enabled : %d, D-RATS enabled: %d, DTMF control enabled: %d"), int(language), int(infoEnabled), int(echoEnabled), int(logEnabled), int(dratsEnabled), int(dtmfEnabled));
|
||||
|
||||
bool mobileGPSEnabled;
|
||||
wxString mobileGPSAddress;
|
||||
unsigned int mobileGPSPort;
|
||||
config.getMobileGPS(mobileGPSEnabled, mobileGPSAddress, mobileGPSPort);
|
||||
wxLogInfo(wxT("Mobile GPS: %d, address: %s, port: %u"), int(mobileGPSEnabled), mobileGPSAddress.c_str(), mobileGPSPort);
|
||||
|
||||
CIcomRepeaterProtocolHandler* icomRepeaterHandler = NULL;
|
||||
CHBRepeaterProtocolHandler* hbRepeaterHandler = NULL;
|
||||
CDummyRepeaterProtocolHandler* dummyRepeaterHandler = NULL;
|
||||
|
|
@ -340,15 +346,23 @@ bool CIRCDDBGatewayAppD::createThread()
|
|||
wxLogInfo(wxT("Repeater 1 bands: %u %u %u"), band11, band12, band13);
|
||||
m_thread->addRepeater(callsign1, repeaterBand1, repeaterAddress1, repeaterPort1, repeaterType1, reflector1, atStartup1, reconnect1, dratsEnabled, frequency1, offset1, range1, latitude1, longitude1, agl1, description11, description12, url1, icomRepeaterHandler, band11, band12, band13);
|
||||
|
||||
if (aprs != NULL)
|
||||
aprs->setPort(callsign1, repeaterBand1, frequency1, offset1, range1, latitude1, longitude1, agl1);
|
||||
if (aprs != NULL) {
|
||||
if (mobileGPSEnabled)
|
||||
aprs->setPortMobile(callsign1, repeaterBand1, frequency1, offset1, range1, mobileGPSAddress, mobileGPSPort);
|
||||
else
|
||||
aprs->setPortFixed(callsign1, repeaterBand1, frequency1, offset1, range1, latitude1, longitude1, agl1);
|
||||
}
|
||||
|
||||
icomCount++;
|
||||
} else if (repeaterType1 == HW_HOMEBREW && hbRepeaterHandler != NULL) {
|
||||
m_thread->addRepeater(callsign1, repeaterBand1, repeaterAddress1, repeaterPort1, repeaterType1, reflector1, atStartup1, reconnect1, dratsEnabled, frequency1, offset1, range1, latitude1, longitude1, agl1, description11, description12, url1, hbRepeaterHandler);
|
||||
|
||||
if (aprs != NULL)
|
||||
aprs->setPort(callsign1, repeaterBand1, frequency1, offset1, range1, latitude1, longitude1, agl1);
|
||||
if (aprs != NULL) {
|
||||
if (mobileGPSEnabled)
|
||||
aprs->setPortMobile(callsign1, repeaterBand1, frequency1, offset1, range1, mobileGPSAddress, mobileGPSPort);
|
||||
else
|
||||
aprs->setPortFixed(callsign1, repeaterBand1, frequency1, offset1, range1, latitude1, longitude1, agl1);
|
||||
}
|
||||
} else if (repeaterType1 == HW_DUMMY && dummyRepeaterHandler != NULL) {
|
||||
m_thread->addRepeater(callsign1, repeaterBand1, repeaterAddress1, repeaterPort1, repeaterType1, reflector1, atStartup1, reconnect1, dratsEnabled, frequency1, offset1, range1, latitude1, longitude1, agl1, description11, description12, url1, dummyRepeaterHandler);
|
||||
}
|
||||
|
|
@ -428,15 +442,23 @@ bool CIRCDDBGatewayAppD::createThread()
|
|||
wxLogInfo(wxT("Repeater 2 bands: %u %u %u"), band21, band22, band23);
|
||||
m_thread->addRepeater(callsign2, repeaterBand2, repeaterAddress2, repeaterPort2, repeaterType2, reflector2, atStartup2, reconnect2, dratsEnabled, frequency2, offset2, range2, latitude2, longitude2, agl2, description21, description22, url2, icomRepeaterHandler, band21, band22, band23);
|
||||
|
||||
if (aprs != NULL)
|
||||
aprs->setPort(callsign2, repeaterBand2, frequency2, offset2, range2, latitude2, longitude2, agl2);
|
||||
if (aprs != NULL) {
|
||||
if (mobileGPSEnabled)
|
||||
aprs->setPortMobile(callsign2, repeaterBand2, frequency2, offset2, range2, mobileGPSAddress, mobileGPSPort);
|
||||
else
|
||||
aprs->setPortFixed(callsign2, repeaterBand2, frequency2, offset2, range2, latitude2, longitude2, agl2);
|
||||
}
|
||||
|
||||
icomCount++;
|
||||
} else if (repeaterType2 == HW_HOMEBREW && hbRepeaterHandler != NULL) {
|
||||
m_thread->addRepeater(callsign2, repeaterBand2, repeaterAddress2, repeaterPort2, repeaterType2, reflector2, atStartup2, reconnect2, dratsEnabled, frequency2, offset2, range2, latitude2, longitude2, agl2, description21, description22, url2, hbRepeaterHandler);
|
||||
|
||||
if (aprs != NULL)
|
||||
aprs->setPort(callsign2, repeaterBand2, frequency2, offset2, range2, latitude2, longitude2, agl2);
|
||||
if (aprs != NULL) {
|
||||
if (mobileGPSEnabled)
|
||||
aprs->setPortMobile(callsign2, repeaterBand2, frequency2, offset2, range2, mobileGPSAddress, mobileGPSPort);
|
||||
else
|
||||
aprs->setPortFixed(callsign2, repeaterBand2, frequency2, offset2, range2, latitude2, longitude2, agl1);
|
||||
}
|
||||
} else if (repeaterType2 == HW_DUMMY && dummyRepeaterHandler != NULL) {
|
||||
m_thread->addRepeater(callsign2, repeaterBand2, repeaterAddress2, repeaterPort2, repeaterType2, reflector2, atStartup2, reconnect2, dratsEnabled, frequency2, offset2, range2, latitude2, longitude2, agl2, description21, description22, url2, dummyRepeaterHandler);
|
||||
}
|
||||
|
|
@ -520,15 +542,23 @@ bool CIRCDDBGatewayAppD::createThread()
|
|||
wxLogInfo(wxT("Repeater 3 bands: %u %u %u"), band31, band32, band33);
|
||||
m_thread->addRepeater(callsign3, repeaterBand3, repeaterAddress3, repeaterPort3, repeaterType3, reflector3, atStartup3, reconnect3, dratsEnabled, frequency3, offset3, range3, latitude3, longitude3, agl3, description31, description32, url3, icomRepeaterHandler, band31, band32, band33);
|
||||
|
||||
if (aprs != NULL)
|
||||
aprs->setPort(callsign3, repeaterBand3, frequency3, offset3, range3, latitude3, longitude3, agl3);
|
||||
if (aprs != NULL) {
|
||||
if (mobileGPSEnabled)
|
||||
aprs->setPortMobile(callsign3, repeaterBand3, frequency3, offset3, range3, mobileGPSAddress, mobileGPSPort);
|
||||
else
|
||||
aprs->setPortFixed(callsign3, repeaterBand3, frequency3, offset3, range3, latitude3, longitude3, agl3);
|
||||
}
|
||||
|
||||
icomCount++;
|
||||
} else if (repeaterType3 == HW_HOMEBREW && hbRepeaterHandler != NULL) {
|
||||
m_thread->addRepeater(callsign3, repeaterBand3, repeaterAddress3, repeaterPort3, repeaterType3, reflector3, atStartup3, reconnect3, dratsEnabled, frequency3, offset3, range3, latitude3, longitude3, agl3, description31, description32, url3, hbRepeaterHandler);
|
||||
|
||||
if (aprs != NULL)
|
||||
aprs->setPort(callsign3, repeaterBand3, frequency3, offset3, range3, latitude3, longitude3, agl3);
|
||||
if (aprs != NULL) {
|
||||
if (mobileGPSEnabled)
|
||||
aprs->setPortMobile(callsign3, repeaterBand3, frequency3, offset3, range3, mobileGPSAddress, mobileGPSPort);
|
||||
else
|
||||
aprs->setPortFixed(callsign3, repeaterBand3, frequency3, offset3, range3, latitude3, longitude3, agl3);
|
||||
}
|
||||
} else if (repeaterType3 == HW_DUMMY && dummyRepeaterHandler != NULL) {
|
||||
m_thread->addRepeater(callsign3, repeaterBand3, repeaterAddress3, repeaterPort3, repeaterType3, reflector3, atStartup3, reconnect3, dratsEnabled, frequency3, offset3, range3, latitude3, longitude3, agl3, description31, description32, url3, dummyRepeaterHandler);
|
||||
}
|
||||
|
|
@ -616,15 +646,23 @@ bool CIRCDDBGatewayAppD::createThread()
|
|||
wxLogInfo(wxT("Repeater 4 bands: %u %u %u"), band41, band42, band43);
|
||||
m_thread->addRepeater(callsign4, repeaterBand4, repeaterAddress4, repeaterPort4, repeaterType4, reflector4, atStartup4, reconnect4, dratsEnabled, frequency4, offset4, range4, latitude4, longitude4, agl4, description41, description42, url4, icomRepeaterHandler, band41, band42, band43);
|
||||
|
||||
if (aprs != NULL)
|
||||
aprs->setPort(callsign4, repeaterBand4, frequency4, offset4, range4, latitude4, longitude4, agl4);
|
||||
if (aprs != NULL) {
|
||||
if (mobileGPSEnabled)
|
||||
aprs->setPortMobile(callsign4, repeaterBand4, frequency4, offset4, range4, mobileGPSAddress, mobileGPSPort);
|
||||
else
|
||||
aprs->setPortFixed(callsign4, repeaterBand4, frequency4, offset4, range4, latitude4, longitude4, agl4);
|
||||
}
|
||||
|
||||
icomCount++;
|
||||
} else if (repeaterType4 == HW_HOMEBREW && hbRepeaterHandler != NULL) {
|
||||
m_thread->addRepeater(callsign4, repeaterBand4, repeaterAddress4, repeaterPort4, repeaterType4, reflector4, atStartup4, reconnect4, dratsEnabled, frequency4, offset4, range4, latitude4, longitude4, agl4, description41, description42, url4, hbRepeaterHandler);
|
||||
|
||||
if (aprs != NULL)
|
||||
aprs->setPort(callsign4, repeaterBand4, frequency4, offset4, range4, latitude4, longitude4, agl4);
|
||||
if (aprs != NULL) {
|
||||
if (mobileGPSEnabled)
|
||||
aprs->setPortMobile(callsign4, repeaterBand4, frequency4, offset4, range4, mobileGPSAddress, mobileGPSPort);
|
||||
else
|
||||
aprs->setPortFixed(callsign4, repeaterBand4, frequency4, offset4, range4, latitude4, longitude4, agl4);
|
||||
}
|
||||
} else if (repeaterType4 == HW_DUMMY && dummyRepeaterHandler != NULL) {
|
||||
m_thread->addRepeater(callsign4, repeaterBand4, repeaterAddress4, repeaterPort4, repeaterType4, reflector4, atStartup4, reconnect4, dratsEnabled, frequency4, offset4, range4, latitude4, longitude4, agl4, description41, description42, url4, dummyRepeaterHandler);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -719,6 +719,7 @@ void CIRCDDBGatewayThread::processIrcDDB()
|
|||
if (!address.IsEmpty()) {
|
||||
wxLogMessage(wxT("USER: %s %s %s %s"), user.c_str(), repeater.c_str(), gateway.c_str(), address.c_str());
|
||||
m_cache.updateUser(user, repeater, gateway, address, timestamp, DP_DEXTRA, false, false);
|
||||
m_g2Handler->punchUDPHole(address);
|
||||
} else {
|
||||
wxLogMessage(wxT("USER: %s NOT FOUND"), user.c_str());
|
||||
}
|
||||
|
|
@ -735,6 +736,7 @@ void CIRCDDBGatewayThread::processIrcDDB()
|
|||
if (!address.IsEmpty()) {
|
||||
wxLogMessage(wxT("REPEATER: %s %s %s"), repeater.c_str(), gateway.c_str(), address.c_str());
|
||||
m_cache.updateRepeater(repeater, gateway, address, DP_DEXTRA, false, false);
|
||||
m_g2Handler->punchUDPHole(address);
|
||||
} else {
|
||||
wxLogMessage(wxT("REPEATER: %s NOT FOUND"), repeater.c_str());
|
||||
}
|
||||
|
|
@ -752,6 +754,7 @@ void CIRCDDBGatewayThread::processIrcDDB()
|
|||
if (!address.IsEmpty()) {
|
||||
wxLogMessage(wxT("GATEWAY: %s %s"), gateway.c_str(), address.c_str());
|
||||
m_cache.updateGateway(gateway, address, DP_DEXTRA, false, false);
|
||||
m_g2Handler->punchUDPHole(address);
|
||||
} else {
|
||||
wxLogMessage(wxT("GATEWAY: %s NOT FOUND"), gateway.c_str());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue