diff --git a/.gitignore b/.gitignore
index 1ac421c..c97fc04 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,9 @@
*.o
+*.d
dvap_rptr
dvrptr
g2_link
g2_ircddb
g2link_test
g2link_test_audio
+mmdvm_modem
diff --git a/Makefile b/Makefile
index 1c05c25..98313fe 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,4 @@
+# Copyright (c) 2018 by Thomas A. Early N7TAE
#
# 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
@@ -11,160 +12,130 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-#
# locations for the executibles and other files are set here
# NOTE: IF YOU CHANGE THESE, YOU WILL NEED TO UPDATE THE service.* FILES AND
-# SOME OF THE *.sh FILES TOO!
+# if you change these locations, make sure the sgs.service file is updated!
BINDIR=/usr/local/bin
CFGDIR=/usr/local/etc
-LOGDIR=/var/log
-
-CPPFLAGS=-W -Wall -I/usr/include -std=c++11
-LDFLAGS=-L/usr/lib -lconfig++
-
-PROGRAMS=g2_ircddb g2_link dvap_rptr dvrptr g2link_test g2link_test_audio
-
-IRCDDBOBJS = IRCDDB.o IRCClient.o IRCReceiver.o IRCMessageQueue.o IRCProtocol.o IRCMessage.o IRCDDBApp.o IRCutils.o golay23.o dstar_dv.o aprs.o
-
-all : $(PROGRAMS)
-
-g2_ircddb : g2_ircddb.cpp $(IRCDDBOBJS) aprs.h g2_typedefs.h versions.h g2_ircddb.h
- g++ $(CPPFLAGS) -o g2_ircddb g2_ircddb.cpp $(IRCDDBOBJS) $(LDFLAGS) -pthread
-g2_link : g2_link.cpp versions.h
- g++ $(CPPFLAGS) -o g2_link g2_link.cpp -lrt -lconfig++ -pthread
+# use this if you want debugging help in the case of a crash
+#CPPFLAGS=-g -ggdb -W -Wall -std=c++11 -DCFG_DIR=\"$(CFGDIR)\"
-dvap_rptr : dvap_rptr.cpp DVAPDongle.o dstar_dv.o golay23.o DVAPDongle.h g2_typedefs.h versions.h
- g++ $(CPPFLAGS) -o dvap_rptr dvap_rptr.cpp DVAPDongle.o golay23.o dstar_dv.o -I/usr/include -L/usr/lib -lrt -lconfig++ -pthread
+# or, you can choose this for a much smaller executable without debugging help
+CPPFLAGS=-W -Wall -std=c++11
-dvrptr : dvrptr.cpp dstar_dv.o golay23.o
- g++ $(CPPFLAGS) -o dvrptr dvrptr.cpp golay23.o dstar_dv.o -I/usr/include -L/usr/lib -lconfig++ -lrt
+LDFLAGS=-L/usr/lib -lconfig++ -lrt
-IRCutils.o : IRCutils.cpp IRCutils.h
- g++ -c $(CPPFLAGS) IRCutils.cpp
+DSTROBJS = dstar_dv.o golay23.o
+IRCOBJS = IRCDDB.o IRCClient.o IRCReceiver.o IRCMessageQueue.o IRCProtocol.o IRCMessage.o IRCDDBApp.o IRCutils.o $(DSTROBJS)
+SRCS = $(wildcard *.cpp)
+OBJS = $(SRCS:.cpp=.o)
+DEPS = $(SRCS:.cpp=.d)
+PROGRAMS=g2_ircddb g2_link dvap_rptr dvrptr g2link_test g2link_test_audio mmdvm_modem
-IRCDDB.o : IRCDDB.cpp IRCDDB.h IRCutils.h
- g++ -c $(CPPFLAGS) IRCDDB.cpp
-
-IRCClient.o : IRCClient.cpp IRCClient.h IRCutils.h
- g++ -c $(CPPFLAGS) IRCClient.cpp
-
-IRCReceiver.o : IRCReceiver.cpp IRCReceiver.h IRCMessageQueue.h IRCutils.h
- g++ -c $(CPPFLAGS) IRCReceiver.cpp
-
-IRCMessageQueue.o : IRCMessageQueue.cpp IRCMessageQueue.h IRCMessage.h
- g++ -c $(CPPFLAGS) IRCMessageQueue.cpp
-
-IRCProtocol.o : IRCProtocol.cpp IRCProtocol.h IRCutils.h
- g++ -c $(CPPFLAGS) IRCProtocol.cpp
+all : $(PROGRAMS)
-IRCMessage.o : IRCMessage.cpp IRCMessage.h
- g++ -c $(CPPFLAGS) IRCMessage.cpp
+g2_ircddb : $(IRCOBJS) g2_ircddb.o aprs.o
+ g++ $(CPPFLAGS) -o g2_ircddb g2_ircddb.o aprs.o $(IRCOBJS) $(LDFLAGS) -pthread
-IRCDDBApp.o : IRCDDBApp.cpp IRCDDBApp.h IRCutils.h
- g++ -c $(CPPFLAGS) IRCDDBApp.cpp
+g2_link : g2_link.o
+ g++ $(CPPFLAGS) -o g2_link g2_link.o $(LDFLAGS) -pthread
-aprs.o : aprs.cpp aprs.h
- g++ -c $(CPPFLAGS) aprs.cpp
+mmdvm_modem : mmdvm_modem.o
+ g++ $(CPPFLAGS) -o mmdvm_modem mmdvm_modem.o $(LDFLAGS) -pthread
-DVAPDongle.o : DVAPDongle.cpp DVAPDongle.h
- g++ -c $(CPPFLAGS) DVAPDongle.cpp
+dvap_rptr : dvap_rptr.o DVAPDongle.o $(DSTROBJS)
+ g++ $(CPPFLAGS) -o dvap_rptr dvap_rptr.o DVAPDongle.o $(DSTROBJS) $(LDFLAGS) -pthread
-golay23.o : golay23.cpp golay23.h
- g++ -c $(CPPFLAGS) golay23.cpp
+dvrptr : dvrptr.o $(DSTROBJS)
+ g++ $(CPPFLAGS) -o dvrptr dvrptr.o $(DSTROBJS) $(LDFLAGS)
-dstar_dv.o : dstar_dv.cpp dstar_dv.h golay23.h
- g++ -c $(CPPFLAGS) dstar_dv.cpp
+g2link_test : g2link_test.o
+ g++ $(CPPFLAGS) -o g2link_test g2link_test.o -lrt
-g2link_test : g2link_test.cpp
- g++ $(CPPFLAGS) -o g2link_test g2link_test.cpp -lrt
+g2link_test_audio : g2link_test_audio.o
+ g++ $(CPPFLAGS) -o g2link_test_audio g2link_test_audio.o -lrt
-g2link_test_audio : g2link_test_audio.cpp
- g++ $(CPPFLAGS) -o g2link_test_audio g2link_test_audio.cpp -lrt
+%.o : %.cpp
+ g++ $(CPPFLAGS) -MMD -MD -c $< -o $@
-IRCApplication.h : IRCMessageQueue.h
-IRCClient.h : IRCReceiver.h IRCMessageQueue.h IRCProtocol.h IRCApplication.h
-IRCDDBApp.h : IRCDDB.h IRCApplication.h
-IRCMessageQueue.h : IRCMessage.h
-IRCProtocol.h : IRCMessageQueue.h IRCApplication.h
-IRCReceiver.h : IRCMessageQueue.h
+.PHONY: clean
-clean :
- /bin/rm -f *.o
+clean:
+ $(RM) $(OBJS) $(DEPS) $(PROGRAMS)
-realclean :
- /bin/rm -f *.o $(PROGRAMS)
+-include $(DEPS)
installdvap : dvap_rptr g2_link g2_ircddb
######### g2_ircddb #########
/bin/cp -f g2_ircddb $(BINDIR)
/bin/cp -f g2.cfg $(CFGDIR)
/bin/cp -f service.g2_ircddb /etc/init.d/g2_ircddb
- /usr/sbin/update-rc.d g2_ircddb defaults
- /usr/sbin/update-rc.d g2_ircddb enable
+# /usr/sbin/update-rc.d g2_ircddb defaults
+# /usr/sbin/update-rc.d g2_ircddb enable
######### g2_link #########
/bin/cp -f g2_link $(BINDIR)
/bin/cp -f announce/*.dat $(CFGDIR)
/bin/cp -f gwys.txt $(CFGDIR)
/bin/cp -f exec_?.sh $(CFGDIR)
/bin/cp -f service.g2_link /etc/init.d/g2_link
- /usr/sbin/update-rc.d g2_link defaults
- /usr/sbin/update-rc.d g2_link enable
+# /usr/sbin/update-rc.d g2_link defaults
+# /usr/sbin/update-rc.d g2_link enable
######### dvap_rptr #########
/bin/cp -f dvap_rptr $(BINDIR)
/bin/cp -f dvap_rptr.sh $(BINDIR)
/bin/cp -f service.dvap_rptr /etc/init.d/dvap_rptr
- /usr/sbin/update-rc.d dvap_rptr defaults
- /usr/sbin/update-rc.d dvap_rptr enable
+# /usr/sbin/update-rc.d dvap_rptr defaults
+# /usr/sbin/update-rc.d dvap_rptr enable
installdvrptr : dvrptr g2_link g2_ircddb
######### g2_ircddb #########
/bin/cp -f g2_ircddb $(BINDIR)
/bin/cp -f g2.cfg $(CFGDIR)
/bin/cp -f service.g2_ircddb /etc/init.d/g2_ircddb
- /usr/sbin/update-rc.d g2_ircddb defaults
- /usr/sbin/update-rc.d g2_ircddb enable
+# /usr/sbin/update-rc.d g2_ircddb defaults
+# /usr/sbin/update-rc.d g2_ircddb enable
######### g2_link #########
/bin/cp -f g2_link $(BINDIR)
/bin/cp -f announce/*.dat $(CFGDIR)
/bin/cp -f gwys.txt $(CFGDIR)
/bin/cp -f exec_?.sh $(CFGDIR)
/bin/cp -f service.g2_link /etc/init.d/g2_link
- /usr/sbin/update-rc.d g2_link defaults
- /usr/sbin/update-rc.d g2_link enable
+# /usr/sbin/update-rc.d g2_link defaults
+# /usr/sbin/update-rc.d g2_link enable
######### dvrptr ##########
/bin/cp -f dvrptr $(BINDIR)
/bin/cp -f dvrptr.sh $(BINDIR)
/bin/cp -f service.dvrptr /etc/init.d/dvrptr
- /usr/sbin/update-rc.d dvrptr defaults
- /usr/sbin/update-rc.d dvrptr enable
+# /usr/sbin/update-rc.d dvrptr defaults
+# /usr/sbin/update-rc.d dvrptr enable
installdtmfs : g2link_test
/bin/cp -f g2link_test $(BINDIR)
/bin/cp -f proc_g2_ircddb_dtmfs.sh $(BINDIR)
/bin/cp -f service.proc_g2_ircddb_dtmfs /etc/init.d/proc_g2_ircddb_dtmfs
- /usr/sbin/update-rc.d proc_g2_ircddb_dtmfs defaults
- /usr/sbin/update-rc.d proc_g2_ircddb_dtmfs enable
+# /usr/sbin/update-rc.d proc_g2_ircddb_dtmfs defaults
+# /usr/sbin/update-rc.d proc_g2_ircddb_dtmfs enable
uninstalldtmfs:
- /usr/sbin/service proc_g2_ircddb_dtmfs stop
- /bin/rm -f /etc/init.d/proc_g2_ircddb_dtmfs
- /usr/sbin/update-rc.d proc_g2_ircddb_dtmfs remove
+# /usr/sbin/service proc_g2_ircddb_dtmfs stop
+# /bin/rm -f /etc/init.d/proc_g2_ircddb_dtmfs
+# /usr/sbin/update-rc.d proc_g2_ircddb_dtmfs remove
/bin/rm -f $(BINDIR)/proc_g2_ircddb_dtmfs.sh
/bin/rm -f $(BINDIR)/g2link_test
uninstalldvap :
######### g2_ircddb #########
- /usr/sbin/service g2_ircddb stop
- /bin/rm -f /etc/init.d/g2_ircddb
- /usr/sbin/update-rc.d g2_ircddb remove
+# /usr/sbin/service g2_ircddb stop
+# /bin/rm -f /etc/init.d/g2_ircddb
+# /usr/sbin/update-rc.d g2_ircddb remove
/bin/rm -f $(BINDIR)/g2_ircddb
/bin/rm -f $(CFGDIR)/g2.cfg
######### g2_link #########
- /usr/sbin/service g2_link stop
- /bin/rm -f /etc/init.d/g2_link
- /usr/sbin/update-rc.d g2_link remove
+# /usr/sbin/service g2_link stop
+# /bin/rm -f /etc/init.d/g2_link
+# /usr/sbin/update-rc.d g2_link remove
/bin/rm -f $(BINDIR)/g2_link
/bin/rm -f $(CFGDIR)/already_linked.dat
/bin/rm -f $(CFGDIR)/already_unlinked.dat
@@ -177,23 +148,23 @@ uninstalldvap :
/bin/rm -f $(CFGDIR)/exec_?.sh
/bin/rm -f /var/log/g2_link.log
######### dvap_rptr #########
- /usr/sbin/service dvap_rptr stop
- /bin/rm -f /etc/init.d/dvap_rptr
- /usr/sbin/update-rc.d dvap_rptr remove
- /bin/rm -f $(BINDIR)/dvap_rptr
- /bin/rm -f $(BINDIR)/dvap_rptr.sh
+# /usr/sbin/service dvap_rptr stop
+# /bin/rm -f /etc/init.d/dvap_rptr
+# /usr/sbin/update-rc.d dvap_rptr remove
+# /bin/rm -f $(BINDIR)/dvap_rptr
+# /bin/rm -f $(BINDIR)/dvap_rptr.sh
uninstalldvrptr:
######### g2_ircddb #########
- /usr/sbin/service g2_ircddb stop
- /bin/rm -f /etc/init.d/g2_ircddb
- /usr/sbin/update-rc.d g2_ircddb remove
- /bin/rm -f $(BINDIR)/g2_ircddb
- /bin/rm -f $(CFGDIR)/g2.cfg
+# /usr/sbin/service g2_ircddb stop
+# /bin/rm -f /etc/init.d/g2_ircddb
+# /usr/sbin/update-rc.d g2_ircddb remove
+# /bin/rm -f $(BINDIR)/g2_ircddb
+# /bin/rm -f $(CFGDIR)/g2.cfg
######### g2_link #########
- /usr/sbin/service g2_link stop
- /bin/rm -f /etc/init.d/g2_link
- /usr/sbin/update-rc.d g2_link remove
+# /usr/sbin/service g2_link stop
+# /bin/rm -f /etc/init.d/g2_link
+# /usr/sbin/update-rc.d g2_link remove
/bin/rm -f $(BINDIR)/g2_link
/bin/rm -f $(CFGDIR)/already_linked.dat
/bin/rm -f $(CFGDIR)/already_unlinked.dat
@@ -206,8 +177,8 @@ uninstalldvrptr:
/bin/rm -f $(CFGDIR)/exec_?.sh
/bin/rm -f /var/log/g2_link.log
######### dvrptr ##########
- /usr/sbin/service dvrptr stop
- /bin/rm -f /etc/init.d/dvrptr
- /usr/sbin/update-rc.d dvrtpr remove
+# /usr/sbin/service dvrptr stop
+# /bin/rm -f /etc/init.d/dvrptr
+# /usr/sbin/update-rc.d dvrtpr remove
/bin/rm -f $(BINDIR)/dvrptr
/bin/rm -f $(BINDIR)/dvrptr.sh
diff --git a/dvap_rptr.cpp b/dvap_rptr.cpp
index 95f631a..3c9c83a 100644
--- a/dvap_rptr.cpp
+++ b/dvap_rptr.cpp
@@ -320,7 +320,7 @@ static int read_config(const char *cfgFile)
return 1;
}
- get_value(cfg, "gateway.internal.port", G2_PORT, 10000, 65535, 19000);
+ get_value(cfg, "gateway.internal.port", G2_PORT, 10000, 65535, 20010);
if (get_value(cfg, std::string(dvap_path+".serial_number").c_str(), value, 8, 10, "APXXXXXX"))
strcpy(DVP_SERIAL, value.c_str());
diff --git a/dvrptr.cpp b/dvrptr.cpp
index a1c953a..48176ea 100644
--- a/dvrptr.cpp
+++ b/dvrptr.cpp
@@ -1903,7 +1903,7 @@ static int read_config(const char *cfgFile)
logdata("%s.callsign is not defined!\n", path.c_str());
return 1;
}
-
+
if (cfg.lookupValue("ircddb.login", value)) {
int l = value.length();
if (l<3 || l>CALL_SIZE-2) {
@@ -1976,7 +1976,7 @@ static int read_config(const char *cfgFile)
return 1;
}
- get_value(cfg, "gateway.internal.port", GATEWAY_PORT, 10000, 65535, 19000);
+ get_value(cfg, "gateway.internal.port", GATEWAY_PORT, 10000, 65535, 20010);
get_value(cfg, std::string(path+".rf_tx_level").c_str(), RF_AUDIO_Level, 1, 100, 80);
diff --git a/g2.everything.cfg b/g2.everything.cfg
index 8f92122..527cc7f 100644
--- a/g2.everything.cfg
+++ b/g2.everything.cfg
@@ -21,7 +21,7 @@ gateway = {
internal = {
# ip = "0.0.0.0"
-# port = 19000
+# port = 20010
}
}
diff --git a/g2_ircddb.cpp b/g2_ircddb.cpp
index 423d34d..84ee53b 100644
--- a/g2_ircddb.cpp
+++ b/g2_ircddb.cpp
@@ -314,7 +314,7 @@ bool CG2_ircddb::read_config(char *cfgFile)
if (! get_value(cfg, "gateway.internal.ip", g2_internal.ip, 7, IP_SIZE, "0.0.0.0"))
return true;
- get_value(cfg, "gateway.internal.port", g2_internal.port, 16000, 65535, 19000);
+ get_value(cfg, "gateway.internal.port", g2_internal.port, 16000, 65535, 20010);
if (! get_value(cfg, "g2_link.outgoing_ip", g2_link.ip, 7, IP_SIZE, "127.0.0.1"))
return true;
diff --git a/g2link_test.cpp b/g2link_test.cpp
index 6f33088..f875113 100644
--- a/g2link_test.cpp
+++ b/g2link_test.cpp
@@ -148,10 +148,10 @@ int main(int argc, char **argv)
if (argc != 10) {
printf("Usage: g2link_test \n");
- printf("Example: g2link_test 127.0.0.1 19000 \"HELLO\" KJ4NHF B 20 2 KI4LKF XRF005AL\n");
+ printf("Example: g2link_test 127.0.0.1 20010 \"HELLO\" KJ4NHF B 20 2 KI4LKF XRF005AL\n");
printf("Where...\n\n");
printf(" 127.0.0.1 is the G2 INTERNAL IP of the G2 gateway\n");
- printf(" 19000 is the the G2 INTERNAL port of the G2 gateway\n");
+ printf(" 20010 is the the G2 INTERNAL port of the G2 gateway\n");
printf(" HELLO is the text message that we will send, no more than 20 characters\n");
printf(" Note: the text message will be converted to UPPERCASE\n");
printf(" KJ4NHF is your dstar repeater callsign\n");
diff --git a/g2link_test_audio.cpp b/g2link_test_audio.cpp
index 7f5d7c6..7672b64 100644
--- a/g2link_test_audio.cpp
+++ b/g2link_test_audio.cpp
@@ -133,10 +133,10 @@ int main(int argc, char **argv)
if (argc != 10) {
printf("Usage: g2link_test_audio \n");
- printf("Example: g2link_test_audio 127.0.0.1 19000 somefile.dvtool KJ4NHF B 19 2 KI4LKF CQCQCQ\n");
+ printf("Example: g2link_test_audio 127.0.0.1 20010 somefile.dvtool KJ4NHF B 19 2 KI4LKF CQCQCQ\n");
printf("Where...\n");
printf(" 127.0.0.1 is the IP address of the local G2\n");
- printf(" 19000 is the port of the INTERNAL G2\n");
+ printf(" 20010 is the port of the INTERNAL G2\n");
printf(" somefile.dvtool is a dvtool file\n");
printf(" KJ4NHF is your G2 callsign, dont use KJ4NHF\n");
printf(" B is one of your modules\n");
diff --git a/mmdvm_modem.cpp b/mmdvm_modem.cpp
new file mode 100644
index 0000000..7563419
--- /dev/null
+++ b/mmdvm_modem.cpp
@@ -0,0 +1,262 @@
+/*
+ * Copyright (C) 2018 by Thomas A. Early N7TAE
+ *
+ * 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
+#include
+#include
+#include
+#include
+#include
+
+#include "versions.h"
+#include "mmdvm_modem.h"
+
+std::atomic CMMDVMModem::keep_running(true);
+
+CMMDVMModem::CMMDVMModem()
+{
+}
+
+CMMDVMModem::~CMMDVMModem()
+{
+}
+
+bool CMMDVMModem::Initialize(const char *cfgfile)
+{
+ if (ReadConfig(cfgfile))
+ return true;
+
+ struct sigaction act;
+ act.sa_handler = &CMMDVMModem::SignalCatch;
+ sigemptyset(&act.sa_mask);
+ if (sigaction(SIGTERM, &act, 0) != 0) {
+ printf("sigaction-TERM failed, error=%d\n", errno);
+ return true;
+ }
+ if (sigaction(SIGHUP, &act, 0) != 0) {
+ printf("sigaction-HUP failed, error=%d\n", errno);
+ return true;
+ }
+ if (sigaction(SIGINT, &act, 0) != 0) {
+ printf("sigaction-INT failed, error=%d\n", errno);
+ return true;
+ }
+
+// dstar_dv_init();
+
+ try {
+ mmdvm_future = std::async(std::launch::async, &CMMDVMModem::ProcessMMDVM, this);
+ } catch (const std::exception &e) {
+ printf("Unable to start ReadDVAPThread(). Exception: %s\n", e.what());
+ keep_running = false;
+ }
+ printf("Started ProcessMMDVM() thread\n");
+
+ return false;
+}
+
+void CMMDVMModem::ProcessGateway()
+{
+}
+
+void CMMDVMModem::ProcessMMDVM()
+{
+}
+
+bool CMMDVMModem::GetValue(const Config &cfg, const char *path, int &value, const int min, const int max, const int default_value)
+{
+ if (cfg.lookupValue(path, value)) {
+ if (value < min || value > max)
+ value = default_value;
+ } else
+ value = default_value;
+ printf("%s = [%d]\n", path, value);
+ return true;
+}
+
+bool CMMDVMModem::GetValue(const Config &cfg, const char *path, double &value, const double min, const double max, const double default_value)
+{
+ if (cfg.lookupValue(path, value)) {
+ if (value < min || value > max)
+ value = default_value;
+ } else
+ value = default_value;
+ printf("%s = [%lg]\n", path, value);
+ return true;
+}
+
+bool CMMDVMModem::GetValue(const Config &cfg, const char *path, bool &value, const bool default_value)
+{
+ if (! cfg.lookupValue(path, value))
+ value = default_value;
+ printf("%s = [%s]\n", path, value ? "true" : "false");
+ return true;
+}
+
+bool CMMDVMModem::GetValue(const Config &cfg, const char *path, std::string &value, int min, int max, const char *default_value)
+{
+ if (cfg.lookupValue(path, value)) {
+ int l = value.length();
+ if (lmax) {
+ printf("%s value '%s' is wrong size\n", path, value.c_str());
+ return false;
+ }
+ } else
+ value = default_value;
+ printf("%s = [%s]\n", path, value.c_str());
+ return true;
+}
+
+// process configuration file and return true if there was a problem
+bool CMMDVMModem::ReadConfig(const char *cfgFile)
+{
+ Config cfg;
+
+ printf("Reading file %s\n", cfgFile);
+ // Read the file. If there is an error, report it and exit.
+ try {
+ cfg.readFile(cfgFile);
+ }
+ catch(const FileIOException &fioex) {
+ printf("Can't read %s\n", cfgFile);
+ return true;
+ }
+ catch(const ParseException &pex) {
+ printf("Parse error at %s:%d - %s\n", pex.getFile(), pex.getLine(), pex.getError());
+ return true;
+ }
+
+ std::string mmdvm_path, value;
+ int i;
+ for (i=0; i<3; i++) {
+ mmdvm_path = "module.";
+ mmdvm_path += ('a' + i);
+ if (cfg.lookupValue(mmdvm_path + ".type", value)) {
+ if (0 == strcasecmp(value.c_str(), "mmdvm"))
+ break;
+ }
+ }
+ if (i >= 3) {
+ printf("mmdvm not defined in any module!\n");
+ return true;
+ }
+ RPTR_MOD = 'A' + i;
+
+ if (cfg.lookupValue(std::string(mmdvm_path+".callsign").c_str(), value) || cfg.lookupValue("ircddb.login", value)) {
+ int l = value.length();
+ if (l<3 || l>CALL_SIZE-2) {
+ printf("Call '%s' is invalid length!\n", value.c_str());
+ return true;
+ } else {
+ for (i=0; iCALL_SIZE-2) {
+ printf("Call '%s' is invalid length!\n", value.c_str());
+ return true;
+ } else {
+ for (i=0; i
+#include
+#include
+
+#include
+
+using namespace libconfig;
+
+#define CALL_SIZE 8
+#define IP_SIZE 15
+
+class CMMDVMModem
+{
+public:
+ // functions
+ CMMDVMModem();
+ ~CMMDVMModem();
+ bool Initialize(const char *cfgfile);
+ void ProcessGateway();
+
+ // data
+ static std::atomic keep_running;
+ std::future mmdvm_future;
+
+private:
+ // functions
+ void ProcessMMDVM();
+ static void SignalCatch(int signum);
+
+ // read configuration file
+ bool ReadConfig(const char *);
+ bool GetValue(const Config &cfg, const char *path, int &value, const int min, const int max, const int default_value);
+ bool GetValue(const Config &cfg, const char *path, double &value, const double min, const double max, const double default_value);
+ bool GetValue(const Config &cfg, const char *path, bool &value, const bool default_value);
+ bool GetValue(const Config &cfg, const char *path, std::string &value, const int min, const int max, const char *default_value);
+
+ // config data
+ char RPTR_MOD;
+ char RPTR[CALL_SIZE + 1];
+ char OWNER[CALL_SIZE + 1];
+ char RPTR_VIRTUAL_IP[IP_SIZE + 1];
+ char G2_INTERNAL_IP[IP_SIZE + 1];
+ unsigned short RPTR_PORT, G2_PORT;
+ int WAIT_FOR_PACKETS, DELAY_BEFORE, DELAY_BETWEEN;
+ bool RPTR_ACK;
+
+ // parameters
+};
diff --git a/versions.h b/versions.h
index 3008f9c..d7bcb92 100644
--- a/versions.h
+++ b/versions.h
@@ -3,4 +3,4 @@
#define LINK_VERSION "5.1.2"
#define DVAP_VERSION "linux-dvap_rptr-5.1.1"
#define DVRPTR_VERSION "linux-dvrptr-5.1.0"
-#define MMDVM_VERSION "mmdvm-dvmega-0.0.0"
+#define MMDVM_VERSION "mmdvm-dvmega-0.1.0"