From c6d085da28c7b29f3c8f17442d54df116ea867cf Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Mon, 14 May 2018 22:36:02 +0100 Subject: [PATCH] Add the Linux Makefiles. --- Common/Makefile | 20 + DStarRepeater/DStarRepeaterApp.cpp | 6 +- DStarRepeater/DStarRepeaterApp.h | 6 +- DStarRepeater/DStarRepeaterD.cpp | 565 ------------------ DStarRepeater/DStarRepeaterD.h | 52 -- DStarRepeater/DStarRepeaterFrame.cpp | 4 +- DStarRepeater/DStarRepeaterTRXThread.cpp | 20 +- DStarRepeater/Makefile | 14 + .../DStarRepeaterConfigApp.cpp | 4 +- DStarRepeaterConfig/DStarRepeaterConfigApp.h | 4 +- .../DStarRepeaterConfigFrame.cpp | 4 +- DStarRepeaterConfig/Makefile | 100 +--- GUICommon/Makefile | 13 + Makefile | 29 + 14 files changed, 113 insertions(+), 728 deletions(-) create mode 100644 Common/Makefile delete mode 100644 DStarRepeater/DStarRepeaterD.cpp delete mode 100644 DStarRepeater/DStarRepeaterD.h create mode 100644 DStarRepeater/Makefile create mode 100644 GUICommon/Makefile create mode 100644 Makefile diff --git a/Common/Makefile b/Common/Makefile new file mode 100644 index 0000000..54e6ed9 --- /dev/null +++ b/Common/Makefile @@ -0,0 +1,20 @@ +OBJECTS = AMBEFEC.o AnnouncementUnit.o ArduinoController.o BeaconUnit.o CallsignList.o CCITTChecksum.o CCITTChecksumReverse.o \ + DStarGMSKDemodulator.o DStarGMSKModulator.o DStarRepeaterConfig.o DStarScrambler.o DummyController.o DVAPController.o \ + DVMegaController.o DVRPTRV1Controller.o DVRPTRV2Controller.o DVRPTRV3Controller.o DVTOOLFileReader.o DVTOOLFileWriter.o \ + ExternalController.o FIRFilter.o GatewayProtocolHandler.o GMSKController.o GMSKModem.o GMSKModemLibUsb.o Golay.o \ + HardwareController.o HeaderData.o K8055Controller.o LogEvent.o Logger.o MMDVMController.o Modem.o OutputQueue.o \ + RepeaterProtocolHandler.o SerialDataController.o SerialLineController.o SerialPortSelector.o SlowDataDecoder.o SlowDataEncoder.o \ + SoundCardController.o SoundCardReaderWriter.o SplitController.o TCPReaderWriter.o Timer.o UDPReaderWriter.o \ + URIUSBController.o Utils.o + +all: Common.a + +Common.a: $(OBJECTS) + $(AR) rcs Common.a $(OBJECTS) + +%.o: %.cpp + $(CXX) $(CFLAGS) -c -o $@ $< + +clean: + $(RM) Common.a *.o *.d *.bak *~ + diff --git a/DStarRepeater/DStarRepeaterApp.cpp b/DStarRepeater/DStarRepeaterApp.cpp index ff80d73..af969e0 100644 --- a/DStarRepeater/DStarRepeaterApp.cpp +++ b/DStarRepeater/DStarRepeaterApp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2015 by Jonathan Naylor G4KLX + * Copyright (C) 2011-2015,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 @@ -52,7 +52,7 @@ #include "Version.h" #include "Logger.h" -IMPLEMENT_APP(CDStarRepeaterApp) +wxIMPLEMENT_APP(CDStarRepeaterApp); wxDEFINE_EVENT(wxEVT_THREAD_COMMAND, wxThreadEvent); @@ -73,10 +73,10 @@ const wxString LOG_BASE_NAME = "dstarrepeaterd"; #endif CDStarRepeaterApp::CDStarRepeaterApp() : +wxApp(), #if (wxUSE_GUI == 1) m_frame(NULL), #endif -wxApp(), m_name(), m_nolog(false), m_gui(false), diff --git a/DStarRepeater/DStarRepeaterApp.h b/DStarRepeater/DStarRepeaterApp.h index 0e8e90e..6c29dc8 100644 --- a/DStarRepeater/DStarRepeaterApp.h +++ b/DStarRepeater/DStarRepeaterApp.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011,2012,2013 by Jonathan Naylor G4KLX + * Copyright (C) 2011,2012,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 @@ -76,7 +76,7 @@ private: CDStarRepeaterConfig* m_config; wxSingleInstanceChecker* m_checker; wxLogChain* m_logChain; - wxString m_commandLine[6]; + wxString m_commandLine[6]; void createThread(); @@ -85,6 +85,6 @@ private: wxDECLARE_EVENT_TABLE(); }; -DECLARE_APP(CDStarRepeaterApp) +wxDECLARE_APP(CDStarRepeaterApp); #endif diff --git a/DStarRepeater/DStarRepeaterD.cpp b/DStarRepeater/DStarRepeaterD.cpp deleted file mode 100644 index 8c84863..0000000 --- a/DStarRepeater/DStarRepeaterD.cpp +++ /dev/null @@ -1,565 +0,0 @@ -/* - * Copyright (C) 2011-2015 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 "DStarRepeaterTXRXThread.h" -#include "RepeaterProtocolHandler.h" -#include "DStarRepeaterTRXThread.h" -#include "DStarRepeaterRXThread.h" -#include "DStarRepeaterTXThread.h" -#include "SerialLineController.h" -#include "DStarRepeaterConfig.h" -#include "SoundCardController.h" -#include "DVRPTRV1Controller.h" -#include "DVRPTRV2Controller.h" -#include "DVRPTRV3Controller.h" -#include "ArduinoController.h" -#include "DVMegaController.h" -#include "MMDVMController.h" -#include "URIUSBController.h" -#include "K8055Controller.h" -#include "DummyController.h" -#include "SplitController.h" -#include "DStarRepeaterD.h" -#include "DVAPController.h" -#include "GMSKController.h" -#if defined(GPIO) -#include "GPIOController.h" -#endif -#include "CallsignList.h" -#include "DStarDefines.h" -#include "Version.h" -#include "Logger.h" - -#include -#include -#include -#include - -#include -#include -#include -#include - -const wxChar* NAME_PARAM = wxT("Repeater Name"); -const wxChar* NOLOGGING_SWITCH = wxT("nolog"); -const wxChar* LOGDIR_OPTION = wxT("logdir"); -const wxChar* CONFDIR_OPTION = wxT("confdir"); -const wxChar* AUDIODIR_OPTION = wxT("audiodir"); -const wxChar* DAEMON_SWITCH = wxT("daemon"); - -const wxString LOG_BASE_NAME = wxT("dstarrepeaterd"); - -static CDStarRepeaterD* m_repeater = NULL; - -static void handler(int signum) -{ - m_repeater->kill(); -} - -int main(int argc, char** argv) -{ - bool res = ::wxInitialize(); - if (!res) { - ::fprintf(stderr, "dstarrepeaterd: failed to initialise the wxWidgets library, exiting\n"); - return -1; - } - - wxCmdLineParser parser(argc, argv); - parser.AddSwitch(NOLOGGING_SWITCH, wxEmptyString, wxEmptyString, wxCMD_LINE_PARAM_OPTIONAL); - parser.AddSwitch(DAEMON_SWITCH, wxEmptyString, wxEmptyString, wxCMD_LINE_PARAM_OPTIONAL); - parser.AddOption(LOGDIR_OPTION, wxEmptyString, wxEmptyString, wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL); - parser.AddOption(CONFDIR_OPTION, wxEmptyString, wxEmptyString, wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL); - parser.AddOption(AUDIODIR_OPTION, wxEmptyString, wxEmptyString, wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL); - parser.AddParam(NAME_PARAM, wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL); - - int cmd = parser.Parse(); - if (cmd != 0) { - ::wxUninitialize(); - return 0; - } - - bool nolog = parser.Found(NOLOGGING_SWITCH); - bool daemon = parser.Found(DAEMON_SWITCH); - - wxString logDir; - bool found = parser.Found(LOGDIR_OPTION, &logDir); - if (!found) - logDir.Clear(); - - wxString confDir; - found = parser.Found(CONFDIR_OPTION, &confDir); - if (!found) - confDir = wxT(CONF_DIR); - - wxString audioDir; - found = parser.Found(AUDIODIR_OPTION, &audioDir); - if (!found) - audioDir = ::wxGetHomeDir(); - - wxString name; - if (parser.GetParamCount() > 0U) - name = parser.GetParam(0U); - - if (daemon) { - pid_t pid = ::fork(); - - if (pid < 0) { - ::fprintf(stderr, "dstarrepeaterd: error in fork(), exiting\n"); - ::wxUninitialize(); - return 1; - } - - // If this is the parent, exit - if (pid > 0) - return 0; - - // We are the child from here onwards - ::setsid(); - - if(::chdir("/") == -1) - ::fprintf(stderr, "dstarrepeaterd: error changing directory: %s\n", strerror(errno)); - - ::umask(0); - } - - wxString pidFileName; - if (!name.IsEmpty()) - pidFileName.Printf(wxT("/var/run/dstarrepeater_%s.pid"), name.c_str()); - else - pidFileName = wxT("/var/run/dstarrepeater.pid"); - pidFileName.Replace(wxT(" "), wxT("_")); - - char fileName[128U]; - ::memset(fileName, 0x00U, 128U); - for (unsigned int i = 0U; i < pidFileName.Len(); i++) - fileName[i] = pidFileName.GetChar(i); - - FILE* fp = ::fopen(fileName, "wt"); - if (fp != NULL) { - ::fprintf(fp, "%u\n", ::getpid()); - ::fclose(fp); - } - - ::signal(SIGUSR1, handler); - - m_repeater = new CDStarRepeaterD(nolog, logDir, confDir, audioDir, name); - - if (!m_repeater->init()) { - ::wxUninitialize(); - return 1; - } - - m_repeater->run(); - - delete m_repeater; - - ::unlink(fileName); - - ::wxUninitialize(); - - return 0; -} - -CDStarRepeaterD::CDStarRepeaterD(bool nolog, const wxString& logDir, const wxString& confDir, const wxString& audioDir, const wxString& name) : -m_name(name), -m_nolog(nolog), -m_logDir(logDir), -m_confDir(confDir), -m_audioDir(audioDir), -m_thread(NULL), -m_checker(NULL) -{ -} - -CDStarRepeaterD::~CDStarRepeaterD() -{ -} - -bool CDStarRepeaterD::init() -{ - if (!m_nolog) { - wxString logBaseName = LOG_BASE_NAME; - if (!m_name.IsEmpty()) { - logBaseName.Append(wxT("_")); - logBaseName.Append(m_name); - } - - if (m_logDir.IsEmpty()) - m_logDir = wxT(LOG_DIR); - - wxLog* log = new CLogger(m_logDir, logBaseName); - wxLog::SetActiveTarget(log); - } else { - new wxLogNull; - } - - wxString appName; - if (!m_name.IsEmpty()) - appName = APPLICATION_NAME + wxT(" ") + m_name; - else - appName = APPLICATION_NAME; - appName.Replace(wxT(" "), wxT("_")); - - m_checker = new wxSingleInstanceChecker(appName, wxT("/tmp")); - bool ret = m_checker->IsAnotherRunning(); - if (ret) { - wxLogError(wxT("Another copy of the D-Star Repeater is running, exiting")); - return false; - } - - wxLogInfo(wxT("Starting ") + APPLICATION_NAME + wxT(" daemon - ") + VERSION); - - // Log the version of wxWidgets and the Operating System - wxLogInfo(wxT("Using wxWidgets %d.%d.%d on %s"), wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER, ::wxGetOsDescription().c_str()); - - return createThread(); -} - -void CDStarRepeaterD::run() -{ - m_thread->run(); - - delete m_checker; - - wxLogInfo(APPLICATION_NAME + wxT(" is exiting")); -} - -bool CDStarRepeaterD::createThread() -{ - CDStarRepeaterConfig config(m_confDir, CONFIG_FILE_NAME, m_name); - - wxString callsign, gateway; - DSTAR_MODE mode; - ACK_TYPE ack; - bool restriction, rpt1Validation, dtmfBlanking, errorReply; - config.getCallsign(callsign, gateway, mode, ack, restriction, rpt1Validation, dtmfBlanking, errorReply); - - wxString modemType; - config.getModem(modemType); - - // DVAP can only do simplex, force the mode accordingly - if (modemType.IsSameAs(wxT("DVAP"))) { - if (mode == MODE_DUPLEX) { - wxLogInfo(wxT("DVAP: changing mode from DUPLEX to SIMPLEX")); - mode = MODE_SIMPLEX; - } else if (mode == MODE_TXANDRX) { - wxLogInfo(wxT("DVAP: changing mode from TX_AND_RX to RX_ONLY")); - mode = MODE_RXONLY; - } - } - - switch (mode) { - case MODE_RXONLY: - m_thread = new CDStarRepeaterRXThread(modemType); - break; - case MODE_TXONLY: - m_thread = new CDStarRepeaterTXThread(modemType); - break; - case MODE_TXANDRX: - m_thread = new CDStarRepeaterTXRXThread(modemType); - break; - default: - m_thread = new CDStarRepeaterTRXThread(modemType); - break; - } - - m_thread->setCallsign(callsign, gateway, mode, ack, restriction, rpt1Validation, dtmfBlanking, errorReply); - wxLogInfo(wxT("Callsign set to \"%s\", gateway set to \"%s\", mode: %d, ack: %d, restriction: %d, RPT1 validation: %d, DTMF blanking: %d, Error reply: %d"), callsign.c_str(), gateway.c_str(), int(mode), int(ack), int(restriction), int(rpt1Validation), int(dtmfBlanking), int(errorReply)); - - wxString gatewayAddress, localAddress, name; - unsigned int gatewayPort, localPort; - config.getNetwork(gatewayAddress, gatewayPort, localAddress, localPort, name); - wxLogInfo(wxT("Gateway set to %s:%u, local set to %s:%u, name set to \"%s\""), gatewayAddress.c_str(), gatewayPort, localAddress.c_str(), localPort, name.c_str()); - - if (!gatewayAddress.IsEmpty()) { - bool local = gatewayAddress.IsSameAs(wxT("127.0.0.1")); - - CRepeaterProtocolHandler* handler = new CRepeaterProtocolHandler(gatewayAddress, gatewayPort, localAddress, localPort, name); - - bool res = handler->open(); - if (!res) { - wxLogError(wxT("Cannot open the protocol handler")); - return false; - } - - m_thread->setProtocolHandler(handler, local); - } - - unsigned int timeout, ackTime; - config.getTimes(timeout, ackTime); - m_thread->setTimes(timeout, ackTime); - wxLogInfo(wxT("Timeout set to %u secs, ack time set to %u ms"), timeout, ackTime); - - unsigned int beaconTime; - wxString beaconText; - bool beaconVoice; - TEXT_LANG language; - config.getBeacon(beaconTime, beaconText, beaconVoice, language); - if (mode == MODE_GATEWAY) - beaconTime = 0U; - m_thread->setBeacon(beaconTime, beaconText, beaconVoice, language); - wxLogInfo(wxT("Beacon set to %u mins, text set to \"%s\", voice set to %d, language set to %d"), beaconTime / 60U, beaconText.c_str(), int(beaconVoice), int(language)); - - bool announcementEnabled; - unsigned int announcementTime; - wxString announcementRecordRPT1, announcementRecordRPT2; - wxString announcementDeleteRPT1, announcementDeleteRPT2; - config.getAnnouncement(announcementEnabled, announcementTime, announcementRecordRPT1, announcementRecordRPT2, announcementDeleteRPT1, announcementDeleteRPT2); - if (mode == MODE_GATEWAY) - announcementEnabled = false; - m_thread->setAnnouncement(announcementEnabled, announcementTime, announcementRecordRPT1, announcementRecordRPT2, announcementDeleteRPT1, announcementDeleteRPT2); - wxLogInfo(wxT("Announcement enabled: %d, time: %u mins, record RPT1: \"%s\", record RPT2: \"%s\", delete RPT1: \"%s\", delete RPT2: \"%s\""), int(announcementEnabled), announcementTime / 60U, announcementRecordRPT1.c_str(), announcementRecordRPT2.c_str(), announcementDeleteRPT1.c_str(), announcementDeleteRPT2.c_str()); - - wxLogInfo(wxT("Modem type set to \"%s\""), modemType.c_str()); - - CModem* modem = NULL; - if (modemType.IsSameAs(wxT("DVAP"))) { - wxString port; - unsigned int frequency; - int power, squelch; - config.getDVAP(port, frequency, power, squelch); - wxLogInfo(wxT("DVAP: port: %s, frequency: %u Hz, power: %d dBm, squelch: %d dBm"), port.c_str(), frequency, power, squelch); - modem = new CDVAPController(port, frequency, power, squelch); - } else if (modemType.IsSameAs(wxT("DV-RPTR V1"))) { - wxString port; - bool rxInvert, txInvert, channel; - unsigned int modLevel, txDelay; - config.getDVRPTR1(port, rxInvert, txInvert, channel, modLevel, txDelay); - wxLogInfo(wxT("DV-RPTR V1, port: %s, RX invert: %d, TX invert: %d, channel: %s, mod level: %u%%, TX delay: %u ms"), port.c_str(), int(rxInvert), int(txInvert), channel ? wxT("B") : wxT("A"), modLevel, txDelay); - modem = new CDVRPTRV1Controller(port, wxEmptyString, rxInvert, txInvert, channel, modLevel, txDelay); - } else if (modemType.IsSameAs(wxT("DV-RPTR V2"))) { - CONNECTION_TYPE connType; - wxString usbPort, address; - bool txInvert; - unsigned int port, modLevel, txDelay; - config.getDVRPTR2(connType, usbPort, address, port, txInvert, modLevel, txDelay); - wxLogInfo(wxT("DV-RPTR V2, type: %d, address: %s:%u, TX invert: %d, mod level: %u%%, TX delay: %u ms"), int(connType), address.c_str(), port, int(txInvert), modLevel, txDelay); - switch (connType) { - case CT_USB: - modem = new CDVRPTRV2Controller(usbPort, wxEmptyString, txInvert, modLevel, mode == MODE_DUPLEX || mode == MODE_TXANDRX, callsign, txDelay); - break; - case CT_NETWORK: - modem = new CDVRPTRV2Controller(address, port, txInvert, modLevel, mode == MODE_DUPLEX || mode == MODE_TXANDRX, callsign, txDelay); - break; - } - } else if (modemType.IsSameAs(wxT("DV-RPTR V3"))) { - CONNECTION_TYPE connType; - wxString usbPort, address; - bool txInvert; - unsigned int port, modLevel, txDelay; - config.getDVRPTR3(connType, usbPort, address, port, txInvert, modLevel, txDelay); - wxLogInfo(wxT("DV-RPTR V3, type: %d, address: %s:%u, TX invert: %d, mod level: %u%%, TX delay: %u ms"), int(connType), address.c_str(), port, int(txInvert), modLevel, txDelay); - switch (connType) { - case CT_USB: - modem = new CDVRPTRV3Controller(usbPort, wxEmptyString, txInvert, modLevel, mode == MODE_DUPLEX || mode == MODE_TXANDRX, callsign, txDelay); - break; - case CT_NETWORK: - modem = new CDVRPTRV3Controller(address, port, txInvert, modLevel, mode == MODE_DUPLEX || mode == MODE_TXANDRX, callsign, txDelay); - break; - } - } else if (modemType.IsSameAs(wxT("DVMEGA"))) { - wxString port; - DVMEGA_VARIANT variant; - bool rxInvert, txInvert; - unsigned int txDelay, rxFrequency, txFrequency, power; - config.getDVMEGA(port, variant, rxInvert, txInvert, txDelay, rxFrequency, txFrequency, power); - wxLogInfo(wxT("DVMEGA, port: %s, variant: %d, RX invert: %d, TX invert: %d, TX delay: %u ms, rx frequency: %u Hz, tx frequency: %u Hz, power: %u %%"), port.c_str(), int(variant), int(rxInvert), int(txInvert), txDelay, rxFrequency, txFrequency, power); - switch (variant) { - case DVMV_MODEM: - modem = new CDVMegaController(port, wxEmptyString, rxInvert, txInvert, txDelay); - break; - case DVMV_RADIO_2M: - case DVMV_RADIO_70CM: - case DVMV_RADIO_2M_70CM: - modem = new CDVMegaController(port, wxEmptyString, txDelay, rxFrequency, txFrequency, power); - break; - default: - wxLogError(wxT("Unknown DVMEGA variant - %d"), int(variant)); - break; - } - } else if (modemType.IsSameAs(wxT("GMSK Modem"))) { - USB_INTERFACE iface; - unsigned int address; - config.getGMSK(iface, address); - wxLogInfo(wxT("GMSK, interface: %d, address: %04X"), int(iface), address); - modem = new CGMSKController(iface, address, mode == MODE_DUPLEX || mode == MODE_TXANDRX); - } else if (modemType.IsSameAs(wxT("Sound Card"))) { - wxString rxDevice, txDevice; - bool rxInvert, txInvert; - wxFloat32 rxLevel, txLevel; - unsigned int txDelay, txTail; - config.getSoundCard(rxDevice, txDevice, rxInvert, txInvert, rxLevel, txLevel, txDelay, txTail); - wxLogInfo(wxT("Sound Card, devices: %s:%s, invert: %d:%d, levels: %.2f:%.2f, tx delay: %u ms, tx tail: %u ms"), rxDevice.c_str(), txDevice.c_str(), int(rxInvert), int(txInvert), rxLevel, txLevel, txDelay, txTail); - modem = new CSoundCardController(rxDevice, txDevice, rxInvert, txInvert, rxLevel, txLevel, txDelay, txTail); - } else if (modemType.IsSameAs(wxT("MMDVM"))) { - wxString port; - bool rxInvert, txInvert, pttInvert; - unsigned int txDelay, rxLevel, txLevel; - config.getMMDVM(port, rxInvert, txInvert, pttInvert, txDelay, rxLevel, txLevel); - wxLogInfo(wxT("MMDVM, port: %s, RX invert: %d, TX invert: %d, PTT invert: %d, TX delay: %u ms, RX level: %u%%, TX level: %u%%"), port.c_str(), int(rxInvert), int(txInvert), int(pttInvert), txDelay, rxLevel, txLevel); - modem = new CMMDVMController(port, wxEmptyString, rxInvert, txInvert, pttInvert, txDelay, rxLevel, txLevel); - } else if (modemType.IsSameAs(wxT("Split"))) { - wxString localAddress; - unsigned int localPort; - wxArrayString transmitterNames, receiverNames; - unsigned int timeout; - config.getSplit(localAddress, localPort, transmitterNames, receiverNames, timeout); - wxLogInfo(wxT("Split, local: %s:%u, timeout: %u ms"), localAddress.c_str(), localPort, timeout); - for (unsigned int i = 0U; i < transmitterNames.GetCount(); i++) { - wxString name = transmitterNames.Item(i); - if (!name.IsEmpty()) - wxLogInfo(wxT("\tTX %u name: %s"), i + 1U, name.c_str()); - } - for (unsigned int i = 0U; i < receiverNames.GetCount(); i++) { - wxString name = receiverNames.Item(i); - if (!name.IsEmpty()) - wxLogInfo(wxT("\tRX %u name: %s"), i + 1U, name.c_str()); - } - modem = new CSplitController(localAddress, localPort, transmitterNames, receiverNames, timeout); - } else { - wxLogError(wxT("Unknown modem type: %s"), modemType.c_str()); - } - - if (modem != NULL) { - bool res = modem->start(); - if (!res) - wxLogError(wxT("Cannot open the D-Star modem")); - else - m_thread->setModem(modem); - } - - wxString controllerType; - unsigned int portConfig, activeHangTime; - bool pttInvert; - config.getController(controllerType, portConfig, pttInvert, activeHangTime); - wxLogInfo(wxT("Controller set to %s, config: %u, PTT invert: %d, active hang time: %u ms"), controllerType.c_str(), portConfig, int(pttInvert), activeHangTime); - - CExternalController* controller = NULL; - - wxString port; - if (controllerType.StartsWith(wxT("Velleman K8055 - "), &port)) { - unsigned long num; - port.ToULong(&num); - controller = new CExternalController(new CK8055Controller(num), pttInvert); - } else if (controllerType.StartsWith(wxT("URI USB - "), &port)) { - unsigned long num; - port.ToULong(&num); - controller = new CExternalController(new CURIUSBController(num, true), pttInvert); - } else if (controllerType.StartsWith(wxT("Serial - "), &port)) { - controller = new CExternalController(new CSerialLineController(port, portConfig), pttInvert); - } else if (controllerType.StartsWith(wxT("Arduino - "), &port)) { - controller = new CExternalController(new CArduinoController(port), pttInvert); -#if defined(GPIO) - } else if (controllerType.IsSameAs(wxT("GPIO"))) { - controller = new CExternalController(new CGPIOController(portConfig), pttInvert); -#endif - } else { - controller = new CExternalController(new CDummyController, pttInvert); - } - - bool res = controller->open(); - if (!res) - wxLogError(wxT("Cannot open the hardware interface - %s"), controllerType.c_str()); - else - m_thread->setController(controller, activeHangTime); - - bool out1, out2, out3, out4; - config.getOutputs(out1, out2, out3, out4); - m_thread->setOutputs(out1, out2, out3, out4); - wxLogInfo(wxT("Output 1 = %d, output 2 = %d, output 3 = %d, output 4 = %d"), out1, out2, out3, out4); - - bool enabled; - wxString rpt1Callsign, rpt2Callsign; - wxString shutdown, startup; - wxString status1, status2, status3, status4, status5; - wxString command1, command1Line, command2, command2Line; - wxString command3, command3Line, command4, command4Line; - wxString command5, command5Line, command6, command6Line; - wxString output1, output2, output3, output4; - config.getControl(enabled, rpt1Callsign, rpt2Callsign, shutdown, startup, status1, status2, status3, status4, status5, command1, command1Line, command2, command2Line, command3, command3Line, command4, command4Line, command5, command5Line, command6, command6Line, output1, output2, output3, output4); - m_thread->setControl(enabled, rpt1Callsign, rpt2Callsign, shutdown, startup, status1, status2, status3, status4, status5, command1, command1Line, command2, command2Line, command3, command3Line, command4, command4Line, command5, command5Line, command6, command6Line, output1, output2, output3, output4); - wxLogInfo(wxT("Control: enabled: %d, RPT1: %s, RPT2: %s, shutdown: %s, startup: %s, status1: %s, status2: %s, status3: %s, status4: %s, status5: %s, command1: %s = %s, command2: %s = %s, command3: %s = %s, command4: %s = %s, command5: %s = %s, command6: %s = %s, output1: %s, output2: %s, output3: %s, output4: %s"), enabled, rpt1Callsign.c_str(), rpt2Callsign.c_str(), shutdown.c_str(), startup.c_str(), status1.c_str(), status2.c_str(), status3.c_str(), status4.c_str(), status5.c_str(), command1.c_str(), command1Line.c_str(), command2.c_str(), command2Line.c_str(), command3.c_str(), command3Line.c_str(), command4.c_str(), command4Line.c_str(), command5.c_str(), command5Line.c_str(), command6.c_str(), command6Line.c_str(), output1.c_str(), output2.c_str(), output3.c_str(), output4.c_str()); - - bool logging; - config.getLogging(logging); - m_thread->setLogging(logging, m_audioDir); - wxLogInfo(wxT("Frame logging set to %d, in %s"), int(logging), m_audioDir.c_str()); - - wxFileName wlFilename(wxFileName::GetHomeDir(), PRIMARY_WHITELIST_FILE_NAME); - bool exists = wlFilename.FileExists(); - - if (!exists) { - wlFilename.Assign(wxFileName::GetHomeDir(), SECONDARY_WHITELIST_FILE_NAME); - exists = wlFilename.FileExists(); - } - - if (exists) { - CCallsignList* list = new CCallsignList(wlFilename.GetFullPath()); - bool res = list->load(); - if (!res) { - wxLogError(wxT("Unable to open white list file - %s"), wlFilename.GetFullPath().c_str()); - delete list; - } else { - wxLogInfo(wxT("%u callsigns loaded into the white list"), list->getCount()); - m_thread->setWhiteList(list); - } - } - - wxFileName blFilename(wxFileName::GetHomeDir(), PRIMARY_BLACKLIST_FILE_NAME); - exists = blFilename.FileExists(); - - if (!exists) { - blFilename.Assign(wxFileName::GetHomeDir(), SECONDARY_BLACKLIST_FILE_NAME); - exists = blFilename.FileExists(); - } - - if (exists) { - CCallsignList* list = new CCallsignList(blFilename.GetFullPath()); - bool res = list->load(); - if (!res) { - wxLogError(wxT("Unable to open black list file - %s"), blFilename.GetFullPath().c_str()); - delete list; - } else { - wxLogInfo(wxT("%u callsigns loaded into the black list"), list->getCount()); - m_thread->setBlackList(list); - } - } - - wxFileName glFilename(wxFileName::GetHomeDir(), GREYLIST_FILE_NAME); - exists = glFilename.FileExists(); - if (exists) { - CCallsignList* list = new CCallsignList(glFilename.GetFullPath()); - bool res = list->load(); - if (!res) { - wxLogError(wxT("Unable to open grey list file - %s"), glFilename.GetFullPath().c_str()); - delete list; - } else { - wxLogInfo(wxT("%u callsigns loaded into the grey list"), list->getCount()); - m_thread->setGreyList(list); - } - } - - return true; -} - -void CDStarRepeaterD::kill() -{ - wxASSERT(m_thread != NULL); - - m_thread->kill(); -} diff --git a/DStarRepeater/DStarRepeaterD.h b/DStarRepeater/DStarRepeaterD.h deleted file mode 100644 index 61fef9f..0000000 --- a/DStarRepeater/DStarRepeaterD.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2011,2012,2013 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 DStarRepeaterD_H -#define DStarRepeaterD_H - -#include "DStarRepeaterThread.h" -#include "DStarRepeaterDefs.h" - -#include -#include - -class CDStarRepeaterD { - -public: - CDStarRepeaterD(bool nolog, const wxString& logDir, const wxString& confDir, const wxString& audioDir, const wxString& name); - ~CDStarRepeaterD(); - - bool init(); - - void run(); - - void kill(); - -private: - wxString m_name; - bool m_nolog; - wxString m_logDir; - wxString m_confDir; - wxString m_audioDir; - IDStarRepeaterThread* m_thread; - wxSingleInstanceChecker* m_checker; - - bool createThread(); -}; - -#endif diff --git a/DStarRepeater/DStarRepeaterFrame.cpp b/DStarRepeater/DStarRepeaterFrame.cpp index 173a00e..c41a54c 100644 --- a/DStarRepeater/DStarRepeaterFrame.cpp +++ b/DStarRepeater/DStarRepeaterFrame.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2015 by Jonathan Naylor G4KLX + * Copyright (C) 2011-2015,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 @@ -443,7 +443,7 @@ void CDStarRepeaterFrame::onAbout(wxCommandEvent&) { wxAboutDialogInfo info; info.AddDeveloper(wxT("Jonathan Naylor, G4KLX")); - info.SetCopyright(wxT("(C) 2013-2015 using GPL v2 or later")); + info.SetCopyright(wxT("(C) 2013-2018 using GPL v2 or later")); info.SetName(APPLICATION_NAME); info.SetVersion(VERSION); info.SetDescription(_("This program allows a computer with a suitable\nmodem to act as a D-Star repeater.")); diff --git a/DStarRepeater/DStarRepeaterTRXThread.cpp b/DStarRepeater/DStarRepeaterTRXThread.cpp index 0292133..f238001 100644 --- a/DStarRepeater/DStarRepeaterTRXThread.cpp +++ b/DStarRepeater/DStarRepeaterTRXThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2016 by Jonathan Naylor G4KLX + * Copyright (C) 2011-2016,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 @@ -442,17 +442,17 @@ void CDStarRepeaterTRXThread::setControl(bool enabled, m_controlCommand = command; m_controlOutput = outputs; - for(int i = 0; i < m_controlCommand.GetCount(); ++i) { + for (size_t i = 0; i < m_controlCommand.GetCount(); ++i) { m_controlCommand[i].Append(' ', LONG_CALLSIGN_LENGTH); m_controlCommand[i].Truncate(LONG_CALLSIGN_LENGTH); } - for(int i = 0; i < m_controlStatus.GetCount(); ++i) { + for (size_t i = 0; i < m_controlStatus.GetCount(); ++i) { m_controlStatus[i].Append(' ', LONG_CALLSIGN_LENGTH); m_controlStatus[i].Truncate(LONG_CALLSIGN_LENGTH); } - for(int i = 0; i < m_controlOutput.GetCount(); ++i) { + for (size_t i = 0; i < m_controlOutput.GetCount(); ++i) { m_controlOutput[i].Append(' ', LONG_CALLSIGN_LENGTH); m_controlOutput[i].Truncate(LONG_CALLSIGN_LENGTH); } @@ -1785,8 +1785,8 @@ bool CDStarRepeaterTRXThread::checkControl(const CHeaderData& header) if (!m_controlRPT1.IsSameAs(header.getRptCall1()) || !m_controlRPT2.IsSameAs(header.getRptCall2())) return false; - for(int i = 0; i < m_controlCommand.GetCount(); ++i) { - if(m_controlCommand[i].IsSameAs(header.getYourCall())) { + for (size_t i = 0; i < m_controlCommand.GetCount(); ++i) { + if (m_controlCommand[i].IsSameAs(header.getYourCall())) { wxThreadEvent evt(wxEVT_THREAD, wxEVT_THREAD_COMMAND); evt.SetInt(i); wxTheApp->QueueEvent(evt.Clone()); @@ -1795,8 +1795,8 @@ bool CDStarRepeaterTRXThread::checkControl(const CHeaderData& header) } } - for(int i = 0; i < m_controlStatus.GetCount(); ++i) { - if(m_controlStatus[i].IsSameAs(header.getYourCall())) { + for (size_t i = 0; i < m_controlStatus.GetCount(); ++i) { + if (m_controlStatus[i].IsSameAs(header.getYourCall())) { wxLogMessage(wxT("Status %d requested by %s/%s"), i, header.getMyCall1().c_str(), header.getMyCall2().c_str()); @@ -1805,8 +1805,8 @@ bool CDStarRepeaterTRXThread::checkControl(const CHeaderData& header) } } - for(int i = 0; i < m_controlOutput.GetCount(); ++i) { - if(m_controlOutput[i].IsSameAs(header.getYourCall())) { + for (size_t i = 0; i < m_controlOutput.GetCount(); ++i) { + if (m_controlOutput[i].IsSameAs(header.getYourCall())) { wxLogMessage(wxT("Output %d requested by %s/%s"), i, header.getMyCall1().c_str(), header.getMyCall2().c_str()); diff --git a/DStarRepeater/Makefile b/DStarRepeater/Makefile new file mode 100644 index 0000000..e5c6f2b --- /dev/null +++ b/DStarRepeater/Makefile @@ -0,0 +1,14 @@ +OBJECTS = DStarRepeaterApp.o DStarRepeaterFrame.o DStarRepeaterLogger.o DStarRepeaterRXThread.o DStarRepeaterStatusData.o \ + DStarRepeaterThread.o DStarRepeaterTRXThread.o DStarRepeaterTXRXThread.o DStarRepeaterTXThread.o + +all: dstarrepeater + +dstarrepeater: $(OBJECTS) + $(CXX) $(OBJECTS) ../Common/Common.a $(LDFLAGS) $(LIBS) -o dstarrepeater + +%.o: %.cpp + $(CXX) $(CFLAGS) -I../Common -c -o $@ $< + +clean: + $(RM) dstarrepeater *.o *.d *.bak *~ + diff --git a/DStarRepeaterConfig/DStarRepeaterConfigApp.cpp b/DStarRepeaterConfig/DStarRepeaterConfigApp.cpp index 2567784..10a01c7 100644 --- a/DStarRepeaterConfig/DStarRepeaterConfigApp.cpp +++ b/DStarRepeaterConfig/DStarRepeaterConfigApp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2014 by Jonathan Naylor G4KLX + * Copyright (C) 2011-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 @@ -23,7 +23,7 @@ #include #include -IMPLEMENT_APP(CDStarRepeaterConfigApp) +wxIMPLEMENT_APP(CDStarRepeaterConfigApp); const wxChar* NAME_PARAM = wxT("Repeater Name"); const wxChar* CONFDIR_OPTION = wxT("confdir"); diff --git a/DStarRepeaterConfig/DStarRepeaterConfigApp.h b/DStarRepeaterConfig/DStarRepeaterConfigApp.h index 0013955..0fac17e 100644 --- a/DStarRepeaterConfig/DStarRepeaterConfigApp.h +++ b/DStarRepeaterConfig/DStarRepeaterConfigApp.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011,2012,2013 by Jonathan Naylor G4KLX + * Copyright (C) 2011,2012,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 @@ -42,6 +42,6 @@ private: CDStarRepeaterConfigFrame* m_frame; }; -DECLARE_APP(CDStarRepeaterConfigApp) +wxDECLARE_APP(CDStarRepeaterConfigApp); #endif diff --git a/DStarRepeaterConfig/DStarRepeaterConfigFrame.cpp b/DStarRepeaterConfig/DStarRepeaterConfigFrame.cpp index 6fd8f39..db1debc 100644 --- a/DStarRepeaterConfig/DStarRepeaterConfigFrame.cpp +++ b/DStarRepeaterConfig/DStarRepeaterConfigFrame.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2015 by Jonathan Naylor G4KLX + * Copyright (C) 2011-2015,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 @@ -196,7 +196,7 @@ void CDStarRepeaterConfigFrame::onAbout(wxCommandEvent& event) { wxAboutDialogInfo info; info.AddDeveloper(wxT("Jonathan Naylor, G4KLX")); - info.SetCopyright(wxT("(C) 2013,2014.2015 using GPL v2 or later")); + info.SetCopyright(wxT("(C) 2013-2018 using GPL v2 or later")); info.SetName(APPLICATION_NAME); info.SetVersion(VERSION); info.SetDescription(_("This program configures the D-Star Repeater.")); diff --git a/DStarRepeaterConfig/Makefile b/DStarRepeaterConfig/Makefile index d9b92db..186d345 100644 --- a/DStarRepeaterConfig/Makefile +++ b/DStarRepeaterConfig/Makefile @@ -1,92 +1,18 @@ -all: dstarrepeaterconfig +OBJECTS = DStarRepeaterConfigActiveHangSet.o DStarRepeaterConfigAnnouncementSet.o DStarRepeaterConfigApp.o DStarRepeaterConfigBeaconSet.o \ + DStarRepeaterConfigCallsignSet.o DStarRepeaterConfigControl1Set.o DStarRepeaterConfigControl2Set.o \ + DStarRepeaterConfigControllerSet.o DStarRepeaterConfigDVAPSet.o DStarRepeaterConfigDVMegaSet.o DStarRepeaterConfigDVRPTR1Set.o \ + DStarRepeaterConfigDVRPTR2Set.o DStarRepeaterConfigDVRPTR3Set.o DStarRepeaterConfigFrame.o DStarRepeaterConfigGMSKSet.o \ + DStarRepeaterConfigMMDVMSet.o DStarRepeaterConfigModemSet.o DStarRepeaterConfigNetworkSet.o DStarRepeaterConfigSoundCardSet.o \ + DStarRepeaterConfigSplitSet.o DStarRepeaterConfigTimesSet.o -CFLAGS := -I../Common -I../GUICommon $(CFLAGS) +all: dstarrepeaterconfig -dstarrepeaterconfig: DStarRepeaterConfigActiveHangSet.o DStarRepeaterConfigAnnouncementSet.o DStarRepeaterConfigApp.o DStarRepeaterConfigBeaconSet.o \ - DStarRepeaterConfigCallsignSet.o DStarRepeaterConfigControl1Set.o DStarRepeaterConfigControl2Set.o DStarRepeaterConfigControllerSet.o \ - DStarRepeaterConfigDVAPSet.o DStarRepeaterConfigDVMegaSet.o DStarRepeaterConfigDVRPTR1Set.o DStarRepeaterConfigDVRPTR2Set.o \ - DStarRepeaterConfigDVRPTR3Set.o DStarRepeaterConfigFrame.o DStarRepeaterConfigGMSKSet.o DStarRepeaterConfigModemSet.o DStarRepeaterConfigNetworkSet.o \ - DStarRepeaterConfigSoundCardSet.o DStarRepeaterConfigSplitSet.o DStarRepeaterConfigTimesSet.o DStarRepeaterConfigMMDVMSet.o ../Common/Common.a \ - ../GUICommon/GUICommon.a - $(CC) $(LDFLAGS) -o dstarrepeaterconfig DStarRepeaterConfigActiveHangSet.o DStarRepeaterConfigAnnouncementSet.o DStarRepeaterConfigApp.o \ - DStarRepeaterConfigBeaconSet.o DStarRepeaterConfigCallsignSet.o DStarRepeaterConfigControl1Set.o DStarRepeaterConfigControl2Set.o \ - DStarRepeaterConfigControllerSet.o DStarRepeaterConfigDVAPSet.o DStarRepeaterConfigDVMegaSet.o DStarRepeaterConfigDVRPTR1Set.o \ - DStarRepeaterConfigDVRPTR2Set.o DStarRepeaterConfigDVRPTR3Set.o DStarRepeaterConfigFrame.o DStarRepeaterConfigGMSKSet.o DStarRepeaterConfigModemSet.o \ - DStarRepeaterConfigNetworkSet.o DStarRepeaterConfigSoundCardSet.o DStarRepeaterConfigSplitSet.o DStarRepeaterConfigTimesSet.o \ - DStarRepeaterConfigMMDVMSet.o ../Common/Common.a ../GUICommon/GUICommon.a $(LIBS) +dstarrepeaterconfig: $(OBJECTS) + $(CXX) $(OBJECTS) ../GUICommon/GUICommon.a ../Common/Common.a $(LDFLAGS) $(LIBS) -o dstarrepeaterconfig -DStarRepeaterConfigActiveHangSet.o: DStarRepeaterConfigActiveHangSet.cpp DStarRepeaterConfigActiveHangSet.h - $(CC) $(CFLAGS) -c DStarRepeaterConfigActiveHangSet.cpp - -DStarRepeaterConfigAnnouncementSet.o: DStarRepeaterConfigAnnouncementSet.cpp DStarRepeaterConfigAnnouncementSet.h ../GUICommon/CallsignTextCtrl.h \ - ../Common/DStarDefines.h - $(CC) $(CFLAGS) -c DStarRepeaterConfigAnnouncementSet.cpp - -DStarRepeaterConfigApp.o: DStarRepeaterConfigApp.cpp DStarRepeaterConfigApp.h DStarRepeaterConfigFrame.h DStarRepeaterConfigDefs.h ../Common/DStarDefines.h \ - ../Common/Version.h - $(CC) $(CFLAGS) -c DStarRepeaterConfigApp.cpp - -DStarRepeaterConfigBeaconSet.o: DStarRepeaterConfigBeaconSet.cpp DStarRepeaterConfigBeaconSet.h ../GUICommon/MessageTextCtrl.h ../Common/DStarDefines.h - $(CC) $(CFLAGS) -c DStarRepeaterConfigBeaconSet.cpp - -DStarRepeaterConfigCallsignSet.o: DStarRepeaterConfigCallsignSet.cpp DStarRepeaterConfigCallsignSet.h ../GUICommon/CallsignTextCtrl.h ../Common/DStarDefines.h - $(CC) $(CFLAGS) -c DStarRepeaterConfigCallsignSet.cpp - -DStarRepeaterConfigControl1Set.o: DStarRepeaterConfigControl1Set.cpp DStarRepeaterConfigControl1Set.h ../GUICommon/CallsignTextCtrl.h ../Common/DStarDefines.h - $(CC) $(CFLAGS) -c DStarRepeaterConfigControl1Set.cpp - -DStarRepeaterConfigControl2Set.o: DStarRepeaterConfigControl2Set.cpp DStarRepeaterConfigControl2Set.h ../GUICommon/CallsignTextCtrl.h ../Common/DStarDefines.h - $(CC) $(CFLAGS) -c DStarRepeaterConfigControl2Set.cpp - -DStarRepeaterConfigControllerSet.o: DStarRepeaterConfigControllerSet.cpp DStarRepeaterConfigControllerSet.h ../Common/SerialPortSelector.h - $(CC) $(CFLAGS) -c DStarRepeaterConfigControllerSet.cpp - -DStarRepeaterConfigDVAPSet.o: DStarRepeaterConfigDVAPSet.cpp DStarRepeaterConfigDVAPSet.h ../Common/SerialPortSelector.h ../Common/DStarDefines.h - $(CC) $(CFLAGS) -c DStarRepeaterConfigDVAPSet.cpp - -DStarRepeaterConfigDVMegaSet.o: DStarRepeaterConfigDVMegaSet.cpp DStarRepeaterConfigDVMegaSet.h ../Common/SerialPortSelector.h ../Common/DStarDefines.h - $(CC) $(CFLAGS) -c DStarRepeaterConfigDVMegaSet.cpp - -DStarRepeaterConfigDVRPTR1Set.o: DStarRepeaterConfigDVRPTR1Set.cpp DStarRepeaterConfigDVRPTR1Set.h ../Common/SerialPortSelector.h ../Common/DStarDefines.h - $(CC) $(CFLAGS) -c DStarRepeaterConfigDVRPTR1Set.cpp - -DStarRepeaterConfigDVRPTR2Set.o: DStarRepeaterConfigDVRPTR2Set.cpp DStarRepeaterConfigDVRPTR2Set.h ../Common/SerialPortSelector.h ../Common/DStarDefines.h - $(CC) $(CFLAGS) -c DStarRepeaterConfigDVRPTR2Set.cpp - -DStarRepeaterConfigDVRPTR3Set.o: DStarRepeaterConfigDVRPTR3Set.cpp DStarRepeaterConfigDVRPTR3Set.h ../Common/SerialPortSelector.h ../Common/DStarDefines.h - $(CC) $(CFLAGS) -c DStarRepeaterConfigDVRPTR3Set.cpp - -DStarRepeaterConfigFrame.o: DStarRepeaterConfigFrame.cpp DStarRepeaterConfigFrame.h DStarRepeaterConfigDefs.h DStarRepeaterConfigControllerSet.h \ - DStarRepeaterConfigModemSet.h DStarRepeaterConfigTimesSet.h DStarRepeaterConfigCallsignSet.h DStarRepeaterConfigNetworkSet.h \ - DStarRepeaterConfigBeaconSet.h DStarRepeaterConfigAnnouncementSet.h DStarRepeaterConfigControl1Set.h DStarRepeaterConfigControl2Set.h \ - ../Common/DStarRepeaterConfig.h ../Common/DStarDefines.h ../Common/Version.h - $(CC) $(CFLAGS) -c DStarRepeaterConfigFrame.cpp - -DStarRepeaterConfigGMSKSet.o: DStarRepeaterConfigGMSKSet.cpp DStarRepeaterConfigGMSKSet.h ../Common/DStarDefines.h - $(CC) $(CFLAGS) -c DStarRepeaterConfigGMSKSet.cpp - -DStarRepeaterConfigMMDVMSet.o: DStarRepeaterConfigMMDVMSet.cpp DStarRepeaterConfigMMDVMSet.h ../Common/SerialPortSelector.h ../Common/DStarDefines.h - $(CC) $(CFLAGS) -c DStarRepeaterConfigMMDVMSet.cpp - -DStarRepeaterConfigModemSet.o: DStarRepeaterConfigModemSet.cpp DStarRepeaterConfigModemSet.h DStarRepeaterConfigDefs.h DStarRepeaterConfigSoundCardSet.h \ - DStarRepeaterConfigDVRPTR1Set.h DStarRepeaterConfigDVRPTR2Set.h DStarRepeaterConfigDVRPTR3Set.h DStarRepeaterConfigModemSet.h \ - DStarRepeaterConfigGMSKSet.h DStarRepeaterConfigDVAPSet.h DStarRepeaterConfigDVMegaSet.h DStarRepeaterConfigSplitSet.h ../Common/DStarDefines.h - $(CC) $(CFLAGS) -c DStarRepeaterConfigModemSet.cpp - -DStarRepeaterConfigNetworkSet.o: DStarRepeaterConfigNetworkSet.cpp DStarRepeaterConfigNetworkSet.h ../GUICommon/AddressTextCtrl.h ../GUICommon/PortTextCtrl.h - $(CC) $(CFLAGS) -c DStarRepeaterConfigNetworkSet.cpp - -DStarRepeaterConfigSplitSet.o: DStarRepeaterConfigSplitSet.cpp DStarRepeaterConfigSplitSet.h ../GUICommon/AddressTextCtrl.h ../GUICommon/PortTextCtrl.h - $(CC) $(CFLAGS) -c DStarRepeaterConfigSplitSet.cpp - -DStarRepeaterConfigSoundCardSet.o: DStarRepeaterConfigSoundCardSet.cpp DStarRepeaterConfigSoundCardSet.h ../Common/SoundCardReaderWriter.h ../Common/DStarDefines.h - $(CC) $(CFLAGS) -c DStarRepeaterConfigSoundCardSet.cpp - -DStarRepeaterConfigTimesSet.o: DStarRepeaterConfigTimesSet.cpp DStarRepeaterConfigTimesSet.h - $(CC) $(CFLAGS) -c DStarRepeaterConfigTimesSet.cpp - -install: all - install -g bin -o root -m 0775 dstarrepeaterconfig $(BINDIR) +%.o: %.cpp + $(CXX) $(CFLAGS) -I../GUICommon -I../Common -c -o $@ $< clean: - rm -f core dstarrepeaterconfig *.o *~ *.bak + $(RM) dstarrepeaterconfig *.o *.d *.bak *~ + diff --git a/GUICommon/Makefile b/GUICommon/Makefile new file mode 100644 index 0000000..cd9a158 --- /dev/null +++ b/GUICommon/Makefile @@ -0,0 +1,13 @@ +OBJECTS = AddressTextCtrl.o CallsignTextCtrl.o MessageTextCtrl.o PortTextCtrl.o RestrictedTextCtrl.o + +all: GUICommon.a + +GUICommon.a: $(OBJECTS) + $(AR) rcs GUICommon.a $(OBJECTS) + +%.o: %.cpp + $(CXX) $(CFLAGS) -c -o $@ $< + +clean: + $(RM) GUICommon.a *.o *.d *.bak *~ + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d3ee9c4 --- /dev/null +++ b/Makefile @@ -0,0 +1,29 @@ +export DATADIR := "/usr/local/etc" +export LOGDIR := "/var/log" +export CONFDIR := "/etc" + +export CXX := $(shell wx-config --cxx) +export CFLAGS := -g -O2 -Wall $(shell wx-config --cxxflags) -DLOG_DIR='$(LOGDIR)' -DCONF_DIR='$(CONFDIR)' -DDATA_DIR='$(DATADIR)' +export LIBS := $(shell wx-config --libs adv,core) -lasound -lusb-1.0 +export LDFLAGS := -g + +all: DStarRepeater/dstarrepeater DStarRepeaterConfig/dstarrepeaterconfig + +DStarRepeater/dstarrepeater: Common/Common.a + make -C DStarRepeater dstarrepeater + +DStarRepeaterConfig/dstarrepeaterconfig: GUICommon/GUICommon.a Common/Common.a + make -C DStarRepeaterConfig + +GUICommon/GUICommon.a: + make -C GUICommon + +Common/Common.a: + make -C Common + +clean: + make -C Common clean + make -C GUICommon clean + make -C DStarRepeater clean + make -C DStarRepeaterConfig clean +