2016-01-14 18:45:04 +00:00
|
|
|
/*
|
2020-02-16 15:56:31 +00:00
|
|
|
* Copyright (C) 2015-2020 by Jonathan Naylor G4KLX
|
2016-01-14 18:45:04 +00:00
|
|
|
*
|
|
|
|
* 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 "MMDVMHost.h"
|
2020-05-27 11:07:21 +00:00
|
|
|
#include "NXDNKenwoodNetwork.h"
|
|
|
|
#include "NXDNIcomNetwork.h"
|
2016-12-21 19:58:46 +00:00
|
|
|
#include "RSSIInterpolator.h"
|
2016-10-06 17:38:16 +00:00
|
|
|
#include "SerialController.h"
|
2020-06-30 11:35:03 +00:00
|
|
|
#include "SerialModem.h"
|
|
|
|
#include "NullModem.h"
|
2016-01-14 18:45:04 +00:00
|
|
|
#include "Version.h"
|
|
|
|
#include "StopWatch.h"
|
|
|
|
#include "Defines.h"
|
2016-06-06 16:40:27 +00:00
|
|
|
#include "Thread.h"
|
2016-10-06 17:38:16 +00:00
|
|
|
#include "Log.h"
|
2017-03-10 04:22:33 +00:00
|
|
|
#include "GitVersion.h"
|
2016-01-14 18:45:04 +00:00
|
|
|
|
|
|
|
#include <cstdio>
|
2016-04-04 18:03:38 +00:00
|
|
|
#include <vector>
|
2016-01-14 18:45:04 +00:00
|
|
|
|
2018-07-04 18:00:51 +00:00
|
|
|
#include <cstdlib>
|
2016-01-14 18:45:04 +00:00
|
|
|
|
2016-01-14 19:58:16 +00:00
|
|
|
#if !defined(_WIN32) && !defined(_WIN64)
|
2016-05-05 17:06:05 +00:00
|
|
|
#include <sys/types.h>
|
2016-01-14 18:45:04 +00:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <signal.h>
|
2016-05-03 22:01:49 +00:00
|
|
|
#include <fcntl.h>
|
2016-05-04 19:06:15 +00:00
|
|
|
#include <pwd.h>
|
2016-05-03 22:01:49 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(_WIN32) || defined(_WIN64)
|
2016-05-05 16:56:18 +00:00
|
|
|
const char* DEFAULT_INI_FILE = "MMDVM.ini";
|
2016-05-03 22:01:49 +00:00
|
|
|
#else
|
2016-05-04 20:00:12 +00:00
|
|
|
const char* DEFAULT_INI_FILE = "/etc/MMDVM.ini";
|
2016-01-14 18:45:04 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
static bool m_killed = false;
|
2016-05-03 22:01:49 +00:00
|
|
|
static int m_signal = 0;
|
2016-01-14 18:45:04 +00:00
|
|
|
|
2016-01-14 19:58:16 +00:00
|
|
|
#if !defined(_WIN32) && !defined(_WIN64)
|
2016-05-03 22:01:49 +00:00
|
|
|
static void sigHandler(int signum)
|
2016-01-14 18:45:04 +00:00
|
|
|
{
|
2017-05-03 13:53:48 +00:00
|
|
|
m_killed = true;
|
|
|
|
m_signal = signum;
|
2016-01-14 18:45:04 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-01-23 17:54:23 +00:00
|
|
|
const char* HEADER1 = "This software is for use on amateur radio networks only,";
|
|
|
|
const char* HEADER2 = "it is to be used for educational purposes only. Its use on";
|
|
|
|
const char* HEADER3 = "commercial networks is strictly prohibited.";
|
2020-02-16 15:56:31 +00:00
|
|
|
const char* HEADER4 = "Copyright(C) 2015-2020 by Jonathan Naylor, G4KLX and others";
|
2016-01-14 18:45:04 +00:00
|
|
|
|
|
|
|
int main(int argc, char** argv)
|
|
|
|
{
|
2017-05-03 13:53:48 +00:00
|
|
|
const char* iniFile = DEFAULT_INI_FILE;
|
|
|
|
if (argc > 1) {
|
|
|
|
for (int currentArg = 1; currentArg < argc; ++currentArg) {
|
|
|
|
std::string arg = argv[currentArg];
|
|
|
|
if ((arg == "-v") || (arg == "--version")) {
|
|
|
|
::fprintf(stdout, "MMDVMHost version %s git #%.7s\n", VERSION, gitversion);
|
|
|
|
return 0;
|
|
|
|
} else if (arg.substr(0,1) == "-") {
|
|
|
|
::fprintf(stderr, "Usage: MMDVMHost [-v|--version] [filename]\n");
|
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
iniFile = argv[currentArg];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-01-14 18:45:04 +00:00
|
|
|
|
2016-01-14 19:58:16 +00:00
|
|
|
#if !defined(_WIN32) && !defined(_WIN64)
|
2017-06-08 09:17:00 +00:00
|
|
|
::signal(SIGINT, sigHandler);
|
2017-05-03 13:53:48 +00:00
|
|
|
::signal(SIGTERM, sigHandler);
|
|
|
|
::signal(SIGHUP, sigHandler);
|
2016-01-14 18:45:04 +00:00
|
|
|
#endif
|
|
|
|
|
2017-05-03 13:53:48 +00:00
|
|
|
int ret = 0;
|
2016-01-14 18:45:04 +00:00
|
|
|
|
2017-05-03 13:53:48 +00:00
|
|
|
do {
|
|
|
|
m_signal = 0;
|
2016-01-14 18:45:04 +00:00
|
|
|
|
2017-05-03 13:53:48 +00:00
|
|
|
CMMDVMHost* host = new CMMDVMHost(std::string(iniFile));
|
|
|
|
ret = host->run();
|
2016-05-03 22:01:49 +00:00
|
|
|
|
2017-05-03 13:53:48 +00:00
|
|
|
delete host;
|
2016-05-04 05:35:20 +00:00
|
|
|
|
2017-06-08 09:17:00 +00:00
|
|
|
if (m_signal == 2)
|
2017-06-08 10:44:01 +00:00
|
|
|
::LogInfo("MMDVMHost-%s exited on receipt of SIGINT", VERSION);
|
2017-06-08 09:17:00 +00:00
|
|
|
|
2017-05-03 13:53:48 +00:00
|
|
|
if (m_signal == 15)
|
2017-06-08 10:44:01 +00:00
|
|
|
::LogInfo("MMDVMHost-%s exited on receipt of SIGTERM", VERSION);
|
2016-05-04 05:35:20 +00:00
|
|
|
|
2017-05-03 13:53:48 +00:00
|
|
|
if (m_signal == 1)
|
2017-06-08 09:17:00 +00:00
|
|
|
::LogInfo("MMDVMHost-%s is restarting on receipt of SIGHUP", VERSION);
|
2017-05-03 13:53:48 +00:00
|
|
|
} while (m_signal == 1);
|
2016-05-03 22:01:49 +00:00
|
|
|
|
2017-05-03 13:53:48 +00:00
|
|
|
::LogFinalise();
|
2016-01-14 18:45:04 +00:00
|
|
|
|
2017-05-03 13:53:48 +00:00
|
|
|
return ret;
|
2016-01-14 18:45:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CMMDVMHost::CMMDVMHost(const std::string& confFile) :
|
|
|
|
m_conf(confFile),
|
|
|
|
m_modem(NULL),
|
2019-01-10 09:05:15 +00:00
|
|
|
m_dstar(NULL),
|
|
|
|
m_dmr(NULL),
|
|
|
|
m_ysf(NULL),
|
|
|
|
m_p25(NULL),
|
|
|
|
m_nxdn(NULL),
|
2020-10-14 15:16:54 +00:00
|
|
|
m_m17(NULL),
|
2019-01-10 14:03:23 +00:00
|
|
|
m_pocsag(NULL),
|
2020-05-07 15:08:58 +00:00
|
|
|
m_fm(NULL),
|
2020-06-08 15:33:20 +00:00
|
|
|
m_ax25(NULL),
|
2016-01-25 21:00:19 +00:00
|
|
|
m_dstarNetwork(NULL),
|
2016-01-14 18:45:04 +00:00
|
|
|
m_dmrNetwork(NULL),
|
2016-05-16 20:57:32 +00:00
|
|
|
m_ysfNetwork(NULL),
|
2016-09-14 06:41:37 +00:00
|
|
|
m_p25Network(NULL),
|
2018-01-15 21:03:34 +00:00
|
|
|
m_nxdnNetwork(NULL),
|
2020-10-14 15:16:54 +00:00
|
|
|
m_m17Network(NULL),
|
2018-06-07 17:46:03 +00:00
|
|
|
m_pocsagNetwork(NULL),
|
2020-05-07 15:08:58 +00:00
|
|
|
m_fmNetwork(NULL),
|
2020-06-08 15:33:20 +00:00
|
|
|
m_ax25Network(NULL),
|
2016-01-14 18:45:04 +00:00
|
|
|
m_display(NULL),
|
2016-02-02 18:17:36 +00:00
|
|
|
m_mode(MODE_IDLE),
|
2017-09-01 08:25:54 +00:00
|
|
|
m_dstarRFModeHang(10U),
|
|
|
|
m_dmrRFModeHang(10U),
|
|
|
|
m_ysfRFModeHang(10U),
|
|
|
|
m_p25RFModeHang(10U),
|
2018-01-11 19:35:33 +00:00
|
|
|
m_nxdnRFModeHang(10U),
|
2020-10-14 15:16:54 +00:00
|
|
|
m_m17RFModeHang(10U),
|
2020-05-11 11:59:28 +00:00
|
|
|
m_fmRFModeHang(10U),
|
2017-09-01 08:25:54 +00:00
|
|
|
m_dstarNetModeHang(3U),
|
|
|
|
m_dmrNetModeHang(3U),
|
|
|
|
m_ysfNetModeHang(3U),
|
|
|
|
m_p25NetModeHang(3U),
|
2018-01-11 19:35:33 +00:00
|
|
|
m_nxdnNetModeHang(3U),
|
2020-10-14 15:16:54 +00:00
|
|
|
m_m17NetModeHang(3U),
|
2018-06-07 17:46:03 +00:00
|
|
|
m_pocsagNetModeHang(3U),
|
2020-05-07 15:08:58 +00:00
|
|
|
m_fmNetModeHang(3U),
|
2016-02-02 18:17:36 +00:00
|
|
|
m_modeTimer(1000U),
|
2016-05-05 16:56:18 +00:00
|
|
|
m_dmrTXTimer(1000U),
|
2016-05-09 20:55:44 +00:00
|
|
|
m_cwIdTimer(1000U),
|
2016-03-07 19:45:19 +00:00
|
|
|
m_duplex(false),
|
2016-06-22 17:03:56 +00:00
|
|
|
m_timeout(180U),
|
2016-01-14 18:45:04 +00:00
|
|
|
m_dstarEnabled(false),
|
|
|
|
m_dmrEnabled(false),
|
2016-05-09 20:55:44 +00:00
|
|
|
m_ysfEnabled(false),
|
2016-09-08 17:38:59 +00:00
|
|
|
m_p25Enabled(false),
|
2018-01-11 19:35:33 +00:00
|
|
|
m_nxdnEnabled(false),
|
2020-10-14 15:16:54 +00:00
|
|
|
m_m17Enabled(false),
|
2018-06-07 17:46:03 +00:00
|
|
|
m_pocsagEnabled(false),
|
2020-04-09 21:02:47 +00:00
|
|
|
m_fmEnabled(false),
|
2020-06-08 15:33:20 +00:00
|
|
|
m_ax25Enabled(false),
|
2016-10-17 17:01:38 +00:00
|
|
|
m_cwIdTime(0U),
|
2018-01-17 21:21:25 +00:00
|
|
|
m_dmrLookup(NULL),
|
|
|
|
m_nxdnLookup(NULL),
|
2017-04-10 16:55:53 +00:00
|
|
|
m_callsign(),
|
2017-08-19 15:23:37 +00:00
|
|
|
m_id(0U),
|
2018-10-10 19:05:24 +00:00
|
|
|
m_cwCallsign(),
|
|
|
|
m_lockFileEnabled(false),
|
2018-11-06 12:14:57 +00:00
|
|
|
m_lockFileName(),
|
2019-01-22 14:38:38 +00:00
|
|
|
m_remoteControl(NULL),
|
|
|
|
m_fixedMode(false)
|
2016-01-14 18:45:04 +00:00
|
|
|
{
|
2020-09-20 20:31:32 +00:00
|
|
|
CUDPSocket::startup();
|
2016-01-14 18:45:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CMMDVMHost::~CMMDVMHost()
|
|
|
|
{
|
2020-09-20 20:31:32 +00:00
|
|
|
CUDPSocket::shutdown();
|
2016-01-14 18:45:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int CMMDVMHost::run()
|
|
|
|
{
|
|
|
|
bool ret = m_conf.read();
|
|
|
|
if (!ret) {
|
2016-05-14 22:26:16 +00:00
|
|
|
::fprintf(stderr, "MMDVMHost: cannot read the .ini file\n");
|
2016-01-14 18:45:04 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2016-05-03 22:01:49 +00:00
|
|
|
#if !defined(_WIN32) && !defined(_WIN64)
|
|
|
|
bool m_daemon = m_conf.getDaemon();
|
|
|
|
if (m_daemon) {
|
|
|
|
// Create new process
|
|
|
|
pid_t pid = ::fork();
|
2016-05-04 19:06:15 +00:00
|
|
|
if (pid == -1) {
|
2018-06-18 17:18:09 +00:00
|
|
|
::fprintf(stderr, "Couldn't fork() , exiting\n");
|
2017-05-03 13:53:48 +00:00
|
|
|
return -1;
|
|
|
|
} else if (pid != 0) {
|
2016-05-03 22:01:49 +00:00
|
|
|
exit(EXIT_SUCCESS);
|
2017-05-03 13:53:48 +00:00
|
|
|
}
|
2016-05-03 22:01:49 +00:00
|
|
|
|
|
|
|
// Create new session and process group
|
2016-05-04 19:06:15 +00:00
|
|
|
if (::setsid() == -1){
|
2018-06-18 17:18:09 +00:00
|
|
|
::fprintf(stderr, "Couldn't setsid(), exiting\n");
|
2017-05-03 13:53:48 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2016-05-03 22:01:49 +00:00
|
|
|
|
|
|
|
// Set the working directory to the root directory
|
2016-05-04 19:06:15 +00:00
|
|
|
if (::chdir("/") == -1){
|
2018-06-18 17:18:09 +00:00
|
|
|
::fprintf(stderr, "Couldn't cd /, exiting\n");
|
2017-05-03 13:53:48 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2016-05-03 22:01:49 +00:00
|
|
|
|
2018-07-03 02:01:19 +00:00
|
|
|
#if !defined(HD44780) && !defined(OLED) && !defined(_OPENWRT)
|
2018-06-18 17:18:09 +00:00
|
|
|
// If we are currently root...
|
2016-05-04 19:06:15 +00:00
|
|
|
if (getuid() == 0) {
|
2016-05-05 17:06:05 +00:00
|
|
|
struct passwd* user = ::getpwnam("mmdvm");
|
|
|
|
if (user == NULL) {
|
2018-06-18 17:18:09 +00:00
|
|
|
::fprintf(stderr, "Could not get the mmdvm user, exiting\n");
|
2016-05-05 17:06:05 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2017-05-03 13:53:48 +00:00
|
|
|
|
2016-05-05 17:06:05 +00:00
|
|
|
uid_t mmdvm_uid = user->pw_uid;
|
2017-05-03 13:53:48 +00:00
|
|
|
gid_t mmdvm_gid = user->pw_gid;
|
|
|
|
|
2018-06-18 17:18:09 +00:00
|
|
|
// Set user and group ID's to mmdvm:mmdvm
|
2017-05-03 13:53:48 +00:00
|
|
|
if (::setgid(mmdvm_gid) != 0) {
|
2018-06-18 17:18:09 +00:00
|
|
|
::fprintf(stderr, "Could not set mmdvm GID, exiting\n");
|
2017-05-03 13:53:48 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (::setuid(mmdvm_uid) != 0) {
|
2018-06-18 17:18:09 +00:00
|
|
|
::fprintf(stderr, "Could not set mmdvm UID, exiting\n");
|
2017-05-03 13:53:48 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2018-07-19 13:09:00 +00:00
|
|
|
// Double check it worked (AKA Paranoia)
|
2017-05-03 13:53:48 +00:00
|
|
|
if (::setuid(0) != -1){
|
2018-06-18 17:18:09 +00:00
|
|
|
::fprintf(stderr, "It's possible to regain root - something is wrong!, exiting\n");
|
2017-05-03 13:53:48 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2016-05-04 19:06:15 +00:00
|
|
|
}
|
2016-05-03 22:01:49 +00:00
|
|
|
}
|
2017-05-03 21:39:11 +00:00
|
|
|
#else
|
2018-07-03 02:01:19 +00:00
|
|
|
::fprintf(stderr, "Dropping root permissions in daemon mode is disabled.\n");
|
2017-05-03 21:39:11 +00:00
|
|
|
}
|
2016-05-05 08:47:54 +00:00
|
|
|
#endif
|
2016-05-03 22:01:49 +00:00
|
|
|
#endif
|
|
|
|
|
2020-05-09 11:47:26 +00:00
|
|
|
#if !defined(_WIN32) && !defined(_WIN64)
|
2020-10-31 21:35:09 +00:00
|
|
|
ret = ::LogInitialise(m_daemon, m_conf.getLogFilePath(), m_conf.getLogFileRoot(), m_conf.getLogFileLevel(), m_conf.getLogDisplayLevel(), m_conf.getLogFileRotate());
|
2020-05-09 11:47:26 +00:00
|
|
|
#else
|
2020-10-31 21:35:09 +00:00
|
|
|
ret = ::LogInitialise(false, m_conf.getLogFilePath(), m_conf.getLogFileRoot(), m_conf.getLogFileLevel(), m_conf.getLogDisplayLevel(), m_conf.getLogFileRotate());
|
2020-05-09 11:47:26 +00:00
|
|
|
#endif
|
2018-06-18 17:18:09 +00:00
|
|
|
if (!ret) {
|
|
|
|
::fprintf(stderr, "MMDVMHost: unable to open the log file\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2018-07-26 17:43:57 +00:00
|
|
|
#if !defined(_WIN32) && !defined(_WIN64)
|
|
|
|
if (m_daemon) {
|
|
|
|
::close(STDIN_FILENO);
|
|
|
|
::close(STDOUT_FILENO);
|
|
|
|
}
|
|
|
|
#endif
|
2018-06-18 17:18:09 +00:00
|
|
|
|
2016-01-14 18:45:04 +00:00
|
|
|
LogInfo(HEADER1);
|
|
|
|
LogInfo(HEADER2);
|
|
|
|
LogInfo(HEADER3);
|
2016-01-23 17:54:23 +00:00
|
|
|
LogInfo(HEADER4);
|
2016-01-14 18:45:04 +00:00
|
|
|
|
|
|
|
LogMessage("MMDVMHost-%s is starting", VERSION);
|
2017-03-09 20:55:41 +00:00
|
|
|
LogMessage("Built %s %s (GitID #%.7s)", __TIME__, __DATE__, gitversion);
|
2016-01-14 18:45:04 +00:00
|
|
|
|
|
|
|
readParams();
|
|
|
|
|
|
|
|
ret = createModem();
|
|
|
|
if (!ret)
|
|
|
|
return 1;
|
|
|
|
|
2020-11-10 09:58:10 +00:00
|
|
|
m_display = CDisplay::createDisplay(m_conf, m_modem);
|
2016-01-14 18:45:04 +00:00
|
|
|
|
2016-01-25 21:00:19 +00:00
|
|
|
if (m_dstarEnabled && m_conf.getDStarNetworkEnabled()) {
|
|
|
|
ret = createDStarNetwork();
|
|
|
|
if (!ret)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2016-01-18 21:24:41 +00:00
|
|
|
if (m_dmrEnabled && m_conf.getDMRNetworkEnabled()) {
|
2016-01-14 18:45:04 +00:00
|
|
|
ret = createDMRNetwork();
|
|
|
|
if (!ret)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2016-05-16 20:57:32 +00:00
|
|
|
if (m_ysfEnabled && m_conf.getFusionNetworkEnabled()) {
|
|
|
|
ret = createYSFNetwork();
|
|
|
|
if (!ret)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2016-09-14 06:41:37 +00:00
|
|
|
if (m_p25Enabled && m_conf.getP25NetworkEnabled()) {
|
|
|
|
ret = createP25Network();
|
|
|
|
if (!ret)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2018-01-15 21:03:34 +00:00
|
|
|
if (m_nxdnEnabled && m_conf.getNXDNNetworkEnabled()) {
|
|
|
|
ret = createNXDNNetwork();
|
|
|
|
if (!ret)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17Enabled && m_conf.getM17NetworkEnabled()) {
|
|
|
|
ret = createM17Network();
|
|
|
|
if (!ret)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2018-06-07 17:46:03 +00:00
|
|
|
if (m_pocsagEnabled && m_conf.getPOCSAGNetworkEnabled()) {
|
|
|
|
ret = createPOCSAGNetwork();
|
|
|
|
if (!ret)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_fmEnabled && m_conf.getFMNetworkEnabled()) {
|
|
|
|
ret = createFMNetwork();
|
|
|
|
if (!ret)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2020-06-08 15:33:20 +00:00
|
|
|
if (m_ax25Enabled && m_conf.getAX25NetworkEnabled()) {
|
|
|
|
ret = createAX25Network();
|
|
|
|
if (!ret)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2020-03-27 20:40:35 +00:00
|
|
|
sockaddr_storage transparentAddress;
|
|
|
|
unsigned int transparentAddrLen;
|
2018-03-22 07:13:13 +00:00
|
|
|
CUDPSocket* transparentSocket = NULL;
|
|
|
|
|
2018-08-13 18:39:16 +00:00
|
|
|
unsigned int sendFrameType = 0U;
|
2018-03-22 07:13:13 +00:00
|
|
|
if (m_conf.getTransparentEnabled()) {
|
|
|
|
std::string remoteAddress = m_conf.getTransparentRemoteAddress();
|
|
|
|
unsigned int remotePort = m_conf.getTransparentRemotePort();
|
|
|
|
unsigned int localPort = m_conf.getTransparentLocalPort();
|
2018-08-13 18:39:16 +00:00
|
|
|
sendFrameType = m_conf.getTransparentSendFrameType();
|
2018-03-22 07:13:13 +00:00
|
|
|
|
|
|
|
LogInfo("Transparent Data");
|
|
|
|
LogInfo(" Remote Address: %s", remoteAddress.c_str());
|
|
|
|
LogInfo(" Remote Port: %u", remotePort);
|
|
|
|
LogInfo(" Local Port: %u", localPort);
|
2018-08-13 18:39:16 +00:00
|
|
|
LogInfo(" Send Frame Type: %u", sendFrameType);
|
2018-03-22 07:13:13 +00:00
|
|
|
|
2020-09-06 11:54:08 +00:00
|
|
|
if (CUDPSocket::lookup(remoteAddress, remotePort, transparentAddress, transparentAddrLen) != 0) {
|
|
|
|
LogError("Unable to resolve the address of the Transparent Data source");
|
|
|
|
return 1;
|
|
|
|
}
|
2018-03-22 07:13:13 +00:00
|
|
|
|
|
|
|
transparentSocket = new CUDPSocket(localPort);
|
2020-09-06 11:54:08 +00:00
|
|
|
ret = transparentSocket->open(transparentAddress);
|
2018-03-22 07:13:13 +00:00
|
|
|
if (!ret) {
|
|
|
|
LogWarning("Could not open the Transparent data socket, disabling");
|
|
|
|
delete transparentSocket;
|
|
|
|
transparentSocket = NULL;
|
2018-09-13 18:35:12 +00:00
|
|
|
sendFrameType=0;
|
2018-03-22 07:13:13 +00:00
|
|
|
}
|
2018-09-13 18:35:12 +00:00
|
|
|
m_modem->setTransparentDataParams(sendFrameType);
|
2018-03-22 07:13:13 +00:00
|
|
|
}
|
|
|
|
|
2018-10-10 19:05:24 +00:00
|
|
|
if (m_conf.getLockFileEnabled()) {
|
2018-10-11 06:50:30 +00:00
|
|
|
m_lockFileEnabled = true;
|
|
|
|
m_lockFileName = m_conf.getLockFileName();
|
|
|
|
|
2018-10-10 19:05:24 +00:00
|
|
|
LogInfo("Lock File Parameters");
|
|
|
|
LogInfo(" Name: %s", m_lockFileName.c_str());
|
2018-10-11 06:50:30 +00:00
|
|
|
|
|
|
|
removeLockFile();
|
2018-10-10 19:05:24 +00:00
|
|
|
}
|
|
|
|
|
2016-05-09 20:55:44 +00:00
|
|
|
if (m_conf.getCWIdEnabled()) {
|
|
|
|
unsigned int time = m_conf.getCWIdTime();
|
2017-04-11 18:26:44 +00:00
|
|
|
m_cwCallsign = m_conf.getCWIdCallsign();
|
2016-05-09 20:55:44 +00:00
|
|
|
|
|
|
|
LogInfo("CW Id Parameters");
|
|
|
|
LogInfo(" Time: %u mins", time);
|
2017-04-11 18:26:44 +00:00
|
|
|
LogInfo(" Callsign: %s", m_cwCallsign.c_str());
|
2016-05-09 20:55:44 +00:00
|
|
|
|
2016-10-17 17:01:38 +00:00
|
|
|
m_cwIdTime = time * 60U;
|
|
|
|
|
|
|
|
m_cwIdTimer.setTimeout(m_cwIdTime / 4U);
|
2016-06-03 14:28:55 +00:00
|
|
|
m_cwIdTimer.start();
|
2016-05-09 20:55:44 +00:00
|
|
|
}
|
|
|
|
|
2017-01-05 19:15:10 +00:00
|
|
|
// For all modes we handle RSSI
|
|
|
|
std::string rssiMappingFile = m_conf.getModemRSSIMappingFile();
|
|
|
|
|
|
|
|
CRSSIInterpolator* rssi = new CRSSIInterpolator;
|
|
|
|
if (!rssiMappingFile.empty()) {
|
|
|
|
LogInfo("RSSI");
|
|
|
|
LogInfo(" Mapping File: %s", rssiMappingFile.c_str());
|
|
|
|
rssi->load(rssiMappingFile);
|
|
|
|
}
|
|
|
|
|
2016-09-12 22:26:05 +00:00
|
|
|
// For DMR and P25 we try to map IDs to callsigns
|
|
|
|
if (m_dmrEnabled || m_p25Enabled) {
|
2016-10-10 18:15:30 +00:00
|
|
|
std::string lookupFile = m_conf.getDMRIdLookupFile();
|
|
|
|
unsigned int reloadTime = m_conf.getDMRIdLookupTime();
|
2016-09-12 22:26:05 +00:00
|
|
|
|
2016-10-10 18:15:30 +00:00
|
|
|
LogInfo("DMR Id Lookups");
|
|
|
|
LogInfo(" File: %s", lookupFile.length() > 0U ? lookupFile.c_str() : "None");
|
|
|
|
if (reloadTime > 0U)
|
|
|
|
LogInfo(" Reload: %u hours", reloadTime);
|
|
|
|
|
2018-01-17 21:21:25 +00:00
|
|
|
m_dmrLookup = new CDMRLookup(lookupFile, reloadTime);
|
|
|
|
m_dmrLookup->read();
|
2016-09-12 22:26:05 +00:00
|
|
|
}
|
|
|
|
|
2016-01-14 18:45:04 +00:00
|
|
|
CStopWatch stopWatch;
|
|
|
|
stopWatch.start();
|
|
|
|
|
2016-01-27 20:01:50 +00:00
|
|
|
if (m_dstarEnabled) {
|
2017-06-14 10:54:44 +00:00
|
|
|
std::string module = m_conf.getDStarModule();
|
|
|
|
bool selfOnly = m_conf.getDStarSelfOnly();
|
2016-04-06 17:46:05 +00:00
|
|
|
std::vector<std::string> blackList = m_conf.getDStarBlackList();
|
2019-10-06 14:29:57 +00:00
|
|
|
std::vector<std::string> whiteList = m_conf.getDStarWhiteList();
|
2017-06-14 10:54:44 +00:00
|
|
|
bool ackReply = m_conf.getDStarAckReply();
|
|
|
|
unsigned int ackTime = m_conf.getDStarAckTime();
|
2018-09-14 10:30:48 +00:00
|
|
|
bool ackMessage = m_conf.getDStarAckMessage();
|
2017-06-14 10:54:44 +00:00
|
|
|
bool errorReply = m_conf.getDStarErrorReply();
|
2017-11-09 09:21:22 +00:00
|
|
|
bool remoteGateway = m_conf.getDStarRemoteGateway();
|
2017-09-01 08:25:54 +00:00
|
|
|
m_dstarRFModeHang = m_conf.getDStarModeHang();
|
2016-01-27 20:01:50 +00:00
|
|
|
|
2017-09-01 08:25:54 +00:00
|
|
|
LogInfo("D-Star RF Parameters");
|
2016-01-27 20:01:50 +00:00
|
|
|
LogInfo(" Module: %s", module.c_str());
|
2016-04-04 16:40:05 +00:00
|
|
|
LogInfo(" Self Only: %s", selfOnly ? "yes" : "no");
|
2017-06-10 12:18:18 +00:00
|
|
|
LogInfo(" Ack Reply: %s", ackReply ? "yes" : "no");
|
2018-09-14 10:30:48 +00:00
|
|
|
LogInfo(" Ack message: %s", ackMessage ? "RSSI" : "BER");
|
2017-06-14 10:54:44 +00:00
|
|
|
LogInfo(" Ack Time: %ums", ackTime);
|
2017-02-16 19:49:58 +00:00
|
|
|
LogInfo(" Error Reply: %s", errorReply ? "yes" : "no");
|
2017-11-09 09:21:22 +00:00
|
|
|
LogInfo(" Remote Gateway: %s", remoteGateway ? "yes" : "no");
|
2017-09-01 08:25:54 +00:00
|
|
|
LogInfo(" Mode Hang: %us", m_dstarRFModeHang);
|
2016-08-09 19:05:35 +00:00
|
|
|
|
2016-04-06 17:46:05 +00:00
|
|
|
if (blackList.size() > 0U)
|
|
|
|
LogInfo(" Black List: %u", blackList.size());
|
2019-10-06 14:29:57 +00:00
|
|
|
if (whiteList.size() > 0U)
|
|
|
|
LogInfo(" White List: %u", whiteList.size());
|
2016-01-27 20:01:50 +00:00
|
|
|
|
2019-10-06 14:15:25 +00:00
|
|
|
m_dstar = new CDStarControl(m_callsign, module, selfOnly, ackReply, ackTime, ackMessage, errorReply, blackList, whiteList, m_dstarNetwork, m_display, m_timeout, m_duplex, remoteGateway, rssi);
|
2016-01-27 20:01:50 +00:00
|
|
|
}
|
2016-01-14 18:45:04 +00:00
|
|
|
|
2019-11-05 12:44:56 +00:00
|
|
|
DMR_BEACONS dmrBeacons = DMR_BEACONS_OFF;
|
2018-01-16 18:35:29 +00:00
|
|
|
CTimer dmrBeaconIntervalTimer(1000U);
|
|
|
|
CTimer dmrBeaconDurationTimer(1000U);
|
|
|
|
|
2016-01-14 18:45:04 +00:00
|
|
|
if (m_dmrEnabled) {
|
2016-12-21 19:58:46 +00:00
|
|
|
unsigned int id = m_conf.getDMRId();
|
|
|
|
unsigned int colorCode = m_conf.getDMRColorCode();
|
|
|
|
bool selfOnly = m_conf.getDMRSelfOnly();
|
2017-02-27 20:17:55 +00:00
|
|
|
bool embeddedLCOnly = m_conf.getDMREmbeddedLCOnly();
|
|
|
|
bool dumpTAData = m_conf.getDMRDumpTAData();
|
2016-11-10 18:43:54 +00:00
|
|
|
std::vector<unsigned int> prefixes = m_conf.getDMRPrefixes();
|
2016-04-06 17:46:05 +00:00
|
|
|
std::vector<unsigned int> blackList = m_conf.getDMRBlackList();
|
2016-12-21 19:06:29 +00:00
|
|
|
std::vector<unsigned int> whiteList = m_conf.getDMRWhiteList();
|
2017-01-05 19:15:10 +00:00
|
|
|
std::vector<unsigned int> slot1TGWhiteList = m_conf.getDMRSlot1TGWhiteList();
|
|
|
|
std::vector<unsigned int> slot2TGWhiteList = m_conf.getDMRSlot2TGWhiteList();
|
2017-02-27 20:17:55 +00:00
|
|
|
unsigned int callHang = m_conf.getDMRCallHang();
|
2016-12-21 19:58:46 +00:00
|
|
|
unsigned int txHang = m_conf.getDMRTXHang();
|
2018-02-08 20:25:03 +00:00
|
|
|
unsigned int jitter = m_conf.getDMRNetworkJitter();
|
2017-09-01 08:25:54 +00:00
|
|
|
m_dmrRFModeHang = m_conf.getDMRModeHang();
|
2019-11-05 12:44:56 +00:00
|
|
|
dmrBeacons = m_conf.getDMRBeacons();
|
2019-11-17 02:57:58 +00:00
|
|
|
DMR_OVCM_TYPES ovcm = m_conf.getDMROVCM();
|
2016-01-14 18:45:04 +00:00
|
|
|
|
2017-09-01 08:25:54 +00:00
|
|
|
if (txHang > m_dmrRFModeHang)
|
|
|
|
txHang = m_dmrRFModeHang;
|
|
|
|
|
|
|
|
if (m_conf.getDMRNetworkEnabled()) {
|
|
|
|
if (txHang > m_dmrNetModeHang)
|
|
|
|
txHang = m_dmrNetModeHang;
|
|
|
|
}
|
2016-06-22 17:03:56 +00:00
|
|
|
|
|
|
|
if (callHang > txHang)
|
|
|
|
callHang = txHang;
|
|
|
|
|
2017-09-01 08:25:54 +00:00
|
|
|
LogInfo("DMR RF Parameters");
|
2016-01-14 18:45:04 +00:00
|
|
|
LogInfo(" Id: %u", id);
|
|
|
|
LogInfo(" Color Code: %u", colorCode);
|
2016-04-04 16:40:05 +00:00
|
|
|
LogInfo(" Self Only: %s", selfOnly ? "yes" : "no");
|
2017-01-16 12:10:23 +00:00
|
|
|
LogInfo(" Embedded LC Only: %s", embeddedLCOnly ? "yes" : "no");
|
2017-02-27 20:17:55 +00:00
|
|
|
LogInfo(" Dump Talker Alias Data: %s", dumpTAData ? "yes" : "no");
|
2016-04-04 18:03:38 +00:00
|
|
|
LogInfo(" Prefixes: %u", prefixes.size());
|
2018-07-19 13:09:00 +00:00
|
|
|
|
2016-04-06 17:46:05 +00:00
|
|
|
if (blackList.size() > 0U)
|
2016-07-10 20:37:11 +00:00
|
|
|
LogInfo(" Source ID Black List: %u", blackList.size());
|
2016-12-21 19:06:29 +00:00
|
|
|
if (whiteList.size() > 0U)
|
|
|
|
LogInfo(" Source ID White List: %u", whiteList.size());
|
2017-01-05 19:15:10 +00:00
|
|
|
if (slot1TGWhiteList.size() > 0U)
|
|
|
|
LogInfo(" Slot 1 TG White List: %u", slot1TGWhiteList.size());
|
|
|
|
if (slot2TGWhiteList.size() > 0U)
|
|
|
|
LogInfo(" Slot 2 TG White List: %u", slot2TGWhiteList.size());
|
2016-12-21 19:06:29 +00:00
|
|
|
|
2016-06-16 20:40:05 +00:00
|
|
|
LogInfo(" Call Hang: %us", callHang);
|
2016-05-05 16:56:18 +00:00
|
|
|
LogInfo(" TX Hang: %us", txHang);
|
2017-09-01 08:25:54 +00:00
|
|
|
LogInfo(" Mode Hang: %us", m_dmrRFModeHang);
|
2019-11-17 02:57:58 +00:00
|
|
|
if (ovcm == DMR_OVCM_OFF)
|
2019-11-16 15:06:26 +00:00
|
|
|
LogInfo(" OVCM: off");
|
2019-11-17 02:57:58 +00:00
|
|
|
else if (ovcm == DMR_OVCM_RX_ON)
|
|
|
|
LogInfo(" OVCM: on(rx only)");
|
|
|
|
else if (ovcm == DMR_OVCM_TX_ON)
|
|
|
|
LogInfo(" OVCM: on(tx only)");
|
|
|
|
else if (ovcm == DMR_OVCM_ON)
|
2019-11-16 15:06:26 +00:00
|
|
|
LogInfo(" OVCM: on");
|
2016-01-14 18:45:04 +00:00
|
|
|
|
2019-11-05 08:42:21 +00:00
|
|
|
switch (dmrBeacons) {
|
|
|
|
case DMR_BEACONS_NETWORK: {
|
|
|
|
unsigned int dmrBeaconDuration = m_conf.getDMRBeaconDuration();
|
2018-01-16 18:35:29 +00:00
|
|
|
|
2019-11-05 08:42:21 +00:00
|
|
|
LogInfo(" DMR Roaming Beacons Type: network");
|
|
|
|
LogInfo(" DMR Roaming Beacons Duration: %us", dmrBeaconDuration);
|
2018-01-16 18:35:29 +00:00
|
|
|
|
2019-11-05 08:42:21 +00:00
|
|
|
dmrBeaconDurationTimer.setTimeout(dmrBeaconDuration);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DMR_BEACONS_TIMED: {
|
|
|
|
unsigned int dmrBeaconInterval = m_conf.getDMRBeaconInterval();
|
|
|
|
unsigned int dmrBeaconDuration = m_conf.getDMRBeaconDuration();
|
|
|
|
|
|
|
|
LogInfo(" DMR Roaming Beacons Type: timed");
|
|
|
|
LogInfo(" DMR Roaming Beacons Interval: %us", dmrBeaconInterval);
|
|
|
|
LogInfo(" DMR Roaming Beacons Duration: %us", dmrBeaconDuration);
|
|
|
|
|
|
|
|
dmrBeaconDurationTimer.setTimeout(dmrBeaconDuration);
|
2018-01-16 18:35:29 +00:00
|
|
|
|
2019-11-05 08:42:21 +00:00
|
|
|
dmrBeaconIntervalTimer.setTimeout(dmrBeaconInterval);
|
|
|
|
dmrBeaconIntervalTimer.start();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
LogInfo(" DMR Roaming Beacons Type: off");
|
|
|
|
break;
|
2018-01-15 19:22:01 +00:00
|
|
|
}
|
|
|
|
|
2019-11-16 15:06:26 +00:00
|
|
|
m_dmr = new CDMRControl(id, colorCode, callHang, selfOnly, embeddedLCOnly, dumpTAData, prefixes, blackList, whiteList, slot1TGWhiteList, slot2TGWhiteList, m_timeout, m_modem, m_dmrNetwork, m_display, m_duplex, m_dmrLookup, rssi, jitter, ovcm);
|
2016-05-05 16:56:18 +00:00
|
|
|
|
|
|
|
m_dmrTXTimer.setTimeout(txHang);
|
2016-01-14 18:45:04 +00:00
|
|
|
}
|
|
|
|
|
2016-08-09 19:05:35 +00:00
|
|
|
if (m_ysfEnabled) {
|
2018-05-21 20:32:33 +00:00
|
|
|
bool lowDeviation = m_conf.getFusionLowDeviation();
|
|
|
|
bool remoteGateway = m_conf.getFusionRemoteGateway();
|
|
|
|
unsigned int txHang = m_conf.getFusionTXHang();
|
|
|
|
bool selfOnly = m_conf.getFusionSelfOnly();
|
|
|
|
m_ysfRFModeHang = m_conf.getFusionModeHang();
|
2016-08-09 19:05:35 +00:00
|
|
|
|
2017-09-01 08:25:54 +00:00
|
|
|
LogInfo("YSF RF Parameters");
|
2017-03-23 20:26:17 +00:00
|
|
|
LogInfo(" Low Deviation: %s", lowDeviation ? "yes" : "no");
|
2016-09-26 17:07:06 +00:00
|
|
|
LogInfo(" Remote Gateway: %s", remoteGateway ? "yes" : "no");
|
2018-05-21 20:32:33 +00:00
|
|
|
LogInfo(" TX Hang: %us", txHang);
|
2017-08-15 09:11:05 +00:00
|
|
|
LogInfo(" Self Only: %s", selfOnly ? "yes" : "no");
|
2017-09-01 08:25:54 +00:00
|
|
|
LogInfo(" Mode Hang: %us", m_ysfRFModeHang);
|
2016-08-09 19:05:35 +00:00
|
|
|
|
2019-01-10 09:05:15 +00:00
|
|
|
m_ysf = new CYSFControl(m_callsign, selfOnly, m_ysfNetwork, m_display, m_timeout, m_duplex, lowDeviation, remoteGateway, rssi);
|
2016-08-09 19:05:35 +00:00
|
|
|
}
|
2016-01-14 18:45:04 +00:00
|
|
|
|
2016-09-08 20:27:21 +00:00
|
|
|
if (m_p25Enabled) {
|
2020-05-06 16:10:23 +00:00
|
|
|
unsigned int id = m_conf.getP25Id();
|
|
|
|
unsigned int nac = m_conf.getP25NAC();
|
|
|
|
unsigned int txHang = m_conf.getP25TXHang();
|
|
|
|
bool uidOverride = m_conf.getP25OverrideUID();
|
|
|
|
bool selfOnly = m_conf.getP25SelfOnly();
|
|
|
|
bool remoteGateway = m_conf.getP25RemoteGateway();
|
|
|
|
m_p25RFModeHang = m_conf.getP25ModeHang();
|
2016-09-08 20:27:21 +00:00
|
|
|
|
2017-09-01 08:25:54 +00:00
|
|
|
LogInfo("P25 RF Parameters");
|
2017-08-15 09:30:05 +00:00
|
|
|
LogInfo(" Id: %u", id);
|
2017-08-19 15:23:37 +00:00
|
|
|
LogInfo(" NAC: $%03X", nac);
|
2017-03-29 19:46:27 +00:00
|
|
|
LogInfo(" UID Override: %s", uidOverride ? "yes" : "no");
|
2017-08-15 09:30:05 +00:00
|
|
|
LogInfo(" Self Only: %s", selfOnly ? "yes" : "no");
|
2017-11-09 09:21:22 +00:00
|
|
|
LogInfo(" Remote Gateway: %s", remoteGateway ? "yes" : "no");
|
2020-05-06 16:10:23 +00:00
|
|
|
LogInfo(" TX Hang: %us", txHang);
|
2017-09-01 08:25:54 +00:00
|
|
|
LogInfo(" Mode Hang: %us", m_p25RFModeHang);
|
2016-09-08 20:27:21 +00:00
|
|
|
|
2019-01-10 09:05:15 +00:00
|
|
|
m_p25 = new CP25Control(nac, id, selfOnly, uidOverride, m_p25Network, m_display, m_timeout, m_duplex, m_dmrLookup, remoteGateway, rssi);
|
2016-09-08 20:27:21 +00:00
|
|
|
}
|
|
|
|
|
2018-01-11 19:35:33 +00:00
|
|
|
if (m_nxdnEnabled) {
|
2018-01-17 21:21:25 +00:00
|
|
|
std::string lookupFile = m_conf.getNXDNIdLookupFile();
|
|
|
|
unsigned int reloadTime = m_conf.getNXDNIdLookupTime();
|
|
|
|
|
|
|
|
LogInfo("NXDN Id Lookups");
|
|
|
|
LogInfo(" File: %s", lookupFile.length() > 0U ? lookupFile.c_str() : "None");
|
|
|
|
if (reloadTime > 0U)
|
|
|
|
LogInfo(" Reload: %u hours", reloadTime);
|
|
|
|
|
|
|
|
m_nxdnLookup = new CNXDNLookup(lookupFile, reloadTime);
|
|
|
|
m_nxdnLookup->read();
|
|
|
|
|
2020-05-06 16:10:23 +00:00
|
|
|
unsigned int id = m_conf.getNXDNId();
|
|
|
|
unsigned int ran = m_conf.getNXDNRAN();
|
|
|
|
bool selfOnly = m_conf.getNXDNSelfOnly();
|
|
|
|
bool remoteGateway = m_conf.getNXDNRemoteGateway();
|
|
|
|
unsigned int txHang = m_conf.getNXDNTXHang();
|
|
|
|
m_nxdnRFModeHang = m_conf.getNXDNModeHang();
|
2018-01-11 19:35:33 +00:00
|
|
|
|
|
|
|
LogInfo("NXDN RF Parameters");
|
|
|
|
LogInfo(" Id: %u", id);
|
|
|
|
LogInfo(" RAN: %u", ran);
|
|
|
|
LogInfo(" Self Only: %s", selfOnly ? "yes" : "no");
|
|
|
|
LogInfo(" Remote Gateway: %s", remoteGateway ? "yes" : "no");
|
2020-05-06 16:10:23 +00:00
|
|
|
LogInfo(" TX Hang: %us", txHang);
|
2018-01-15 21:03:34 +00:00
|
|
|
LogInfo(" Mode Hang: %us", m_nxdnRFModeHang);
|
2018-01-11 19:35:33 +00:00
|
|
|
|
2019-01-10 09:05:15 +00:00
|
|
|
m_nxdn = new CNXDNControl(ran, id, selfOnly, m_nxdnNetwork, m_display, m_timeout, m_duplex, remoteGateway, m_nxdnLookup, rssi);
|
2018-01-11 19:35:33 +00:00
|
|
|
}
|
|
|
|
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17Enabled) {
|
2020-10-26 10:10:31 +00:00
|
|
|
bool selfOnly = m_conf.getM17SelfOnly();
|
|
|
|
bool allowEncryption = m_conf.getM17AllowEncryption();
|
|
|
|
unsigned int txHang = m_conf.getM17TXHang();
|
|
|
|
m_m17RFModeHang = m_conf.getM17ModeHang();
|
2020-10-14 15:16:54 +00:00
|
|
|
|
|
|
|
LogInfo("M17 RF Parameters");
|
|
|
|
LogInfo(" Self Only: %s", selfOnly ? "yes" : "no");
|
2020-10-26 10:10:31 +00:00
|
|
|
LogInfo(" Allow Encryption: %s", allowEncryption ? "yes" : "no");
|
2020-10-14 15:16:54 +00:00
|
|
|
LogInfo(" TX Hang: %us", txHang);
|
|
|
|
LogInfo(" Mode Hang: %us", m_m17RFModeHang);
|
|
|
|
|
2020-10-26 10:10:31 +00:00
|
|
|
m_m17 = new CM17Control(m_callsign, selfOnly, allowEncryption, m_m17Network, m_display, m_timeout, m_duplex, rssi);
|
2020-10-14 15:16:54 +00:00
|
|
|
}
|
|
|
|
|
2018-06-28 06:08:04 +00:00
|
|
|
CTimer pocsagTimer(1000U, 30U);
|
|
|
|
|
2018-06-12 18:40:49 +00:00
|
|
|
if (m_pocsagEnabled) {
|
|
|
|
unsigned int frequency = m_conf.getPOCSAGFrequency();
|
|
|
|
|
|
|
|
LogInfo("POCSAG RF Parameters");
|
|
|
|
LogInfo(" Frequency: %uHz", frequency);
|
|
|
|
|
2019-01-10 14:03:23 +00:00
|
|
|
m_pocsag = new CPOCSAGControl(m_pocsagNetwork, m_display);
|
2018-06-28 06:08:04 +00:00
|
|
|
|
2020-06-08 13:34:29 +00:00
|
|
|
if (m_pocsagNetwork != NULL)
|
|
|
|
pocsagTimer.start();
|
2018-06-12 18:40:49 +00:00
|
|
|
}
|
2018-06-07 17:46:03 +00:00
|
|
|
|
2020-06-09 13:32:05 +00:00
|
|
|
if (m_ax25Enabled) {
|
2020-07-01 09:59:46 +00:00
|
|
|
unsigned int txDelay = m_conf.getAX25TXDelay();
|
|
|
|
int rxTwist = m_conf.getAX25RXTwist();
|
|
|
|
unsigned int slotTime = m_conf.getAX25SlotTime();
|
|
|
|
unsigned int pPersist = m_conf.getAX25PPersist();
|
|
|
|
bool trace = m_conf.getAX25Trace();
|
2020-06-18 11:51:13 +00:00
|
|
|
|
2020-06-09 13:32:05 +00:00
|
|
|
LogInfo("AX.25 RF Parameters");
|
2020-06-27 21:47:54 +00:00
|
|
|
LogInfo(" TX Delay: %ums", txDelay);
|
2020-07-01 09:59:46 +00:00
|
|
|
LogInfo(" RX Twist: %d", rxTwist);
|
|
|
|
LogInfo(" Slot Time: %ums", slotTime);
|
|
|
|
LogInfo(" P-Persist: %u", pPersist);
|
2020-06-18 11:51:13 +00:00
|
|
|
LogInfo(" Trace: %s", trace ? "yes" : "no");
|
2020-06-09 13:32:05 +00:00
|
|
|
|
2020-06-21 13:15:37 +00:00
|
|
|
m_ax25 = new CAX25Control(m_ax25Network, trace);
|
2020-06-09 13:32:05 +00:00
|
|
|
}
|
2020-06-08 15:33:20 +00:00
|
|
|
|
2020-05-11 11:59:28 +00:00
|
|
|
if (m_fmEnabled) {
|
|
|
|
m_fmRFModeHang = m_conf.getFMModeHang();
|
|
|
|
|
2020-05-07 15:08:58 +00:00
|
|
|
m_fm = new CFMControl(m_fmNetwork);
|
2020-05-11 11:59:28 +00:00
|
|
|
}
|
2020-05-07 15:08:58 +00:00
|
|
|
|
2019-01-07 11:03:37 +00:00
|
|
|
bool remoteControlEnabled = m_conf.getRemoteControlEnabled();
|
|
|
|
if (remoteControlEnabled) {
|
2020-04-11 04:12:19 +00:00
|
|
|
std::string address = m_conf.getRemoteControlAddress();
|
2019-01-07 11:03:37 +00:00
|
|
|
unsigned int port = m_conf.getRemoteControlPort();
|
|
|
|
|
|
|
|
LogInfo("Remote Control Parameters");
|
2020-04-11 04:12:19 +00:00
|
|
|
LogInfo(" Address: %s", address.c_str());
|
2019-01-23 09:09:34 +00:00
|
|
|
LogInfo(" Port: %u", port);
|
2019-01-07 11:03:37 +00:00
|
|
|
|
2020-04-11 04:12:19 +00:00
|
|
|
m_remoteControl = new CRemoteControl(address, port);
|
2019-01-07 11:03:37 +00:00
|
|
|
|
2019-01-10 09:05:15 +00:00
|
|
|
ret = m_remoteControl->open();
|
2019-01-07 11:03:37 +00:00
|
|
|
if (!ret) {
|
2019-01-10 09:05:15 +00:00
|
|
|
delete m_remoteControl;
|
|
|
|
m_remoteControl = NULL;
|
2019-01-07 11:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-21 08:42:32 +00:00
|
|
|
setMode(MODE_IDLE);
|
2016-01-14 18:45:04 +00:00
|
|
|
|
2016-05-14 20:31:17 +00:00
|
|
|
LogMessage("MMDVMHost-%s is running", VERSION);
|
2016-05-12 17:04:50 +00:00
|
|
|
|
2016-01-14 18:45:04 +00:00
|
|
|
while (!m_killed) {
|
2020-11-10 09:58:10 +00:00
|
|
|
bool lockout = m_modem->hasLockout();
|
2018-10-10 19:05:24 +00:00
|
|
|
|
2020-11-10 09:58:10 +00:00
|
|
|
if (lockout && m_mode != MODE_LOCKOUT)
|
2016-03-03 21:45:20 +00:00
|
|
|
setMode(MODE_LOCKOUT);
|
2020-11-10 09:58:10 +00:00
|
|
|
else if (!lockout && m_mode == MODE_LOCKOUT)
|
2016-03-03 21:45:20 +00:00
|
|
|
setMode(MODE_IDLE);
|
|
|
|
|
2016-03-21 22:47:58 +00:00
|
|
|
bool error = m_modem->hasError();
|
|
|
|
if (error && m_mode != MODE_ERROR)
|
|
|
|
setMode(MODE_ERROR);
|
|
|
|
else if (!error && m_mode == MODE_ERROR)
|
|
|
|
setMode(MODE_IDLE);
|
|
|
|
|
2020-06-21 17:53:38 +00:00
|
|
|
unsigned char data[500U];
|
2016-01-14 18:45:04 +00:00
|
|
|
unsigned int len;
|
|
|
|
bool ret;
|
|
|
|
|
|
|
|
len = m_modem->readDStarData(data);
|
2019-01-10 21:50:57 +00:00
|
|
|
if (m_dstar != NULL && len > 0U) {
|
2016-02-02 18:17:36 +00:00
|
|
|
if (m_mode == MODE_IDLE) {
|
2019-01-10 09:05:15 +00:00
|
|
|
bool ret = m_dstar->writeModem(data, len);
|
2016-06-22 17:03:56 +00:00
|
|
|
if (ret) {
|
2017-09-01 08:25:54 +00:00
|
|
|
m_modeTimer.setTimeout(m_dstarRFModeHang);
|
2016-02-02 18:17:36 +00:00
|
|
|
setMode(MODE_DSTAR);
|
2016-06-22 17:03:56 +00:00
|
|
|
}
|
2016-02-02 18:17:36 +00:00
|
|
|
} else if (m_mode == MODE_DSTAR) {
|
2019-01-10 09:05:15 +00:00
|
|
|
m_dstar->writeModem(data, len);
|
2016-02-02 18:17:36 +00:00
|
|
|
m_modeTimer.start();
|
2016-03-07 19:45:19 +00:00
|
|
|
} else if (m_mode != MODE_LOCKOUT) {
|
2016-02-03 09:55:08 +00:00
|
|
|
LogWarning("D-Star modem data received when in mode %u", m_mode);
|
2016-01-14 18:45:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
len = m_modem->readDMRData1(data);
|
2019-01-10 09:05:15 +00:00
|
|
|
if (m_dmr != NULL && len > 0U) {
|
2016-02-02 18:17:36 +00:00
|
|
|
if (m_mode == MODE_IDLE) {
|
2016-03-07 19:45:19 +00:00
|
|
|
if (m_duplex) {
|
2019-01-10 09:05:15 +00:00
|
|
|
bool ret = m_dmr->processWakeup(data);
|
2016-05-05 16:56:18 +00:00
|
|
|
if (ret) {
|
2017-09-01 08:25:54 +00:00
|
|
|
m_modeTimer.setTimeout(m_dmrRFModeHang);
|
2016-03-07 19:45:19 +00:00
|
|
|
setMode(MODE_DMR);
|
2018-01-16 18:35:29 +00:00
|
|
|
dmrBeaconDurationTimer.stop();
|
2016-05-05 16:56:18 +00:00
|
|
|
}
|
2016-03-07 19:45:19 +00:00
|
|
|
} else {
|
2017-09-01 08:25:54 +00:00
|
|
|
m_modeTimer.setTimeout(m_dmrRFModeHang);
|
2016-02-02 18:17:36 +00:00
|
|
|
setMode(MODE_DMR);
|
2019-01-10 09:05:15 +00:00
|
|
|
m_dmr->writeModemSlot1(data, len);
|
2018-01-16 18:35:29 +00:00
|
|
|
dmrBeaconDurationTimer.stop();
|
2016-03-07 19:45:19 +00:00
|
|
|
}
|
2016-02-02 18:17:36 +00:00
|
|
|
} else if (m_mode == MODE_DMR) {
|
2016-05-05 16:56:18 +00:00
|
|
|
if (m_duplex && !m_modem->hasTX()) {
|
2019-01-10 09:05:15 +00:00
|
|
|
bool ret = m_dmr->processWakeup(data);
|
2016-05-05 16:56:18 +00:00
|
|
|
if (ret) {
|
|
|
|
m_modem->writeDMRStart(true);
|
|
|
|
m_dmrTXTimer.start();
|
|
|
|
}
|
|
|
|
} else {
|
2019-01-10 09:05:15 +00:00
|
|
|
bool ret = m_dmr->writeModemSlot1(data, len);
|
2017-03-12 19:06:47 +00:00
|
|
|
if (ret) {
|
2018-01-16 18:35:29 +00:00
|
|
|
dmrBeaconDurationTimer.stop();
|
2017-03-12 19:06:47 +00:00
|
|
|
m_modeTimer.start();
|
|
|
|
if (m_duplex)
|
|
|
|
m_dmrTXTimer.start();
|
|
|
|
}
|
2016-05-05 16:56:18 +00:00
|
|
|
}
|
2016-03-07 19:45:19 +00:00
|
|
|
} else if (m_mode != MODE_LOCKOUT) {
|
2016-02-03 09:55:08 +00:00
|
|
|
LogWarning("DMR modem data received when in mode %u", m_mode);
|
2016-01-14 18:45:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
len = m_modem->readDMRData2(data);
|
2019-01-10 09:05:15 +00:00
|
|
|
if (m_dmr != NULL && len > 0U) {
|
2016-02-02 18:17:36 +00:00
|
|
|
if (m_mode == MODE_IDLE) {
|
2016-03-07 19:45:19 +00:00
|
|
|
if (m_duplex) {
|
2019-01-10 09:05:15 +00:00
|
|
|
bool ret = m_dmr->processWakeup(data);
|
2016-05-05 16:56:18 +00:00
|
|
|
if (ret) {
|
2017-09-01 08:25:54 +00:00
|
|
|
m_modeTimer.setTimeout(m_dmrRFModeHang);
|
2016-03-07 19:45:19 +00:00
|
|
|
setMode(MODE_DMR);
|
2018-01-16 18:35:29 +00:00
|
|
|
dmrBeaconDurationTimer.stop();
|
2016-05-05 16:56:18 +00:00
|
|
|
}
|
2016-03-07 19:45:19 +00:00
|
|
|
} else {
|
2017-09-01 08:25:54 +00:00
|
|
|
m_modeTimer.setTimeout(m_dmrRFModeHang);
|
2016-02-02 18:17:36 +00:00
|
|
|
setMode(MODE_DMR);
|
2019-01-10 09:05:15 +00:00
|
|
|
m_dmr->writeModemSlot2(data, len);
|
2018-01-16 18:35:29 +00:00
|
|
|
dmrBeaconDurationTimer.stop();
|
2016-03-07 19:45:19 +00:00
|
|
|
}
|
2016-02-02 18:17:36 +00:00
|
|
|
} else if (m_mode == MODE_DMR) {
|
2016-05-05 16:56:18 +00:00
|
|
|
if (m_duplex && !m_modem->hasTX()) {
|
2019-01-10 09:05:15 +00:00
|
|
|
bool ret = m_dmr->processWakeup(data);
|
2016-05-05 16:56:18 +00:00
|
|
|
if (ret) {
|
|
|
|
m_modem->writeDMRStart(true);
|
|
|
|
m_dmrTXTimer.start();
|
|
|
|
}
|
|
|
|
} else {
|
2019-01-10 09:05:15 +00:00
|
|
|
bool ret = m_dmr->writeModemSlot2(data, len);
|
2017-03-12 19:06:47 +00:00
|
|
|
if (ret) {
|
2018-01-16 18:35:29 +00:00
|
|
|
dmrBeaconDurationTimer.stop();
|
2017-03-12 19:06:47 +00:00
|
|
|
m_modeTimer.start();
|
|
|
|
if (m_duplex)
|
|
|
|
m_dmrTXTimer.start();
|
|
|
|
}
|
2016-05-05 16:56:18 +00:00
|
|
|
}
|
2016-03-07 19:45:19 +00:00
|
|
|
} else if (m_mode != MODE_LOCKOUT) {
|
2016-02-03 09:55:08 +00:00
|
|
|
LogWarning("DMR modem data received when in mode %u", m_mode);
|
2016-01-14 18:45:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
len = m_modem->readYSFData(data);
|
2019-01-10 09:05:15 +00:00
|
|
|
if (m_ysf != NULL && len > 0U) {
|
2016-02-02 18:17:36 +00:00
|
|
|
if (m_mode == MODE_IDLE) {
|
2019-01-10 09:05:15 +00:00
|
|
|
bool ret = m_ysf->writeModem(data, len);
|
2016-06-22 17:03:56 +00:00
|
|
|
if (ret) {
|
2017-09-01 08:25:54 +00:00
|
|
|
m_modeTimer.setTimeout(m_ysfRFModeHang);
|
2016-02-02 18:17:36 +00:00
|
|
|
setMode(MODE_YSF);
|
2016-06-22 17:03:56 +00:00
|
|
|
}
|
2016-02-02 18:17:36 +00:00
|
|
|
} else if (m_mode == MODE_YSF) {
|
2019-01-10 09:05:15 +00:00
|
|
|
m_ysf->writeModem(data, len);
|
2016-02-02 18:17:36 +00:00
|
|
|
m_modeTimer.start();
|
2016-03-07 19:45:19 +00:00
|
|
|
} else if (m_mode != MODE_LOCKOUT) {
|
2016-02-03 09:55:08 +00:00
|
|
|
LogWarning("System Fusion modem data received when in mode %u", m_mode);
|
2016-01-14 18:45:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-08 20:27:21 +00:00
|
|
|
len = m_modem->readP25Data(data);
|
2019-01-10 09:05:15 +00:00
|
|
|
if (m_p25 != NULL && len > 0U) {
|
2016-09-08 20:27:21 +00:00
|
|
|
if (m_mode == MODE_IDLE) {
|
2019-01-10 09:05:15 +00:00
|
|
|
bool ret = m_p25->writeModem(data, len);
|
2016-09-08 20:27:21 +00:00
|
|
|
if (ret) {
|
2017-09-01 08:25:54 +00:00
|
|
|
m_modeTimer.setTimeout(m_p25RFModeHang);
|
2016-09-08 20:27:21 +00:00
|
|
|
setMode(MODE_P25);
|
|
|
|
}
|
|
|
|
} else if (m_mode == MODE_P25) {
|
2019-01-10 09:05:15 +00:00
|
|
|
m_p25->writeModem(data, len);
|
2016-09-08 20:27:21 +00:00
|
|
|
m_modeTimer.start();
|
|
|
|
} else if (m_mode != MODE_LOCKOUT) {
|
|
|
|
LogWarning("P25 modem data received when in mode %u", m_mode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-11 19:35:33 +00:00
|
|
|
len = m_modem->readNXDNData(data);
|
2019-01-10 09:05:15 +00:00
|
|
|
if (m_nxdn != NULL && len > 0U) {
|
2018-01-11 19:35:33 +00:00
|
|
|
if (m_mode == MODE_IDLE) {
|
2019-01-10 09:05:15 +00:00
|
|
|
bool ret = m_nxdn->writeModem(data, len);
|
2018-01-11 19:35:33 +00:00
|
|
|
if (ret) {
|
|
|
|
m_modeTimer.setTimeout(m_nxdnRFModeHang);
|
|
|
|
setMode(MODE_NXDN);
|
|
|
|
}
|
|
|
|
} else if (m_mode == MODE_NXDN) {
|
2019-01-10 09:05:15 +00:00
|
|
|
m_nxdn->writeModem(data, len);
|
2018-01-11 19:35:33 +00:00
|
|
|
m_modeTimer.start();
|
|
|
|
} else if (m_mode != MODE_LOCKOUT) {
|
|
|
|
LogWarning("NXDN modem data received when in mode %u", m_mode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-14 15:16:54 +00:00
|
|
|
len = m_modem->readM17Data(data);
|
|
|
|
if (m_m17 != NULL && len > 0U) {
|
|
|
|
if (m_mode == MODE_IDLE) {
|
|
|
|
bool ret = m_m17->writeModem(data, len);
|
|
|
|
if (ret) {
|
|
|
|
m_modeTimer.setTimeout(m_m17RFModeHang);
|
|
|
|
setMode(MODE_M17);
|
|
|
|
}
|
|
|
|
} else if (m_mode == MODE_M17) {
|
|
|
|
m_m17->writeModem(data, len);
|
|
|
|
m_modeTimer.start();
|
|
|
|
} else if (m_mode != MODE_LOCKOUT) {
|
|
|
|
LogWarning("M17 modem data received when in mode %u", m_mode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-07 15:08:58 +00:00
|
|
|
len = m_modem->readFMData(data);
|
2020-05-08 12:12:37 +00:00
|
|
|
if (m_fm != NULL && len > 0U) {
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_mode == MODE_IDLE) {
|
|
|
|
bool ret = m_fm->writeModem(data, len);
|
|
|
|
if (ret) {
|
2020-05-11 11:59:28 +00:00
|
|
|
m_modeTimer.setTimeout(m_fmRFModeHang);
|
2020-05-07 15:08:58 +00:00
|
|
|
setMode(MODE_FM);
|
|
|
|
}
|
|
|
|
} else if (m_mode == MODE_FM) {
|
|
|
|
m_fm->writeModem(data, len);
|
|
|
|
m_modeTimer.start();
|
|
|
|
} else if (m_mode != MODE_LOCKOUT) {
|
|
|
|
LogWarning("FM modem data received when in mode %u", m_mode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-08 15:33:20 +00:00
|
|
|
len = m_modem->readAX25Data(data);
|
|
|
|
if (m_ax25 != NULL && len > 0U) {
|
|
|
|
if (m_mode == MODE_IDLE || m_mode == MODE_FM) {
|
|
|
|
m_ax25->writeModem(data, len);
|
2020-11-06 15:43:12 +00:00
|
|
|
} else if (m_mode != MODE_LOCKOUT) {
|
2020-06-08 15:33:20 +00:00
|
|
|
LogWarning("NXDN modem data received when in mode %u", m_mode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-22 07:13:13 +00:00
|
|
|
len = m_modem->readTransparentData(data);
|
|
|
|
if (transparentSocket != NULL && len > 0U)
|
2020-03-27 20:40:35 +00:00
|
|
|
transparentSocket->write(data, len, transparentAddress, transparentAddrLen);
|
2018-03-22 07:13:13 +00:00
|
|
|
|
2019-01-22 14:38:38 +00:00
|
|
|
if (!m_fixedMode) {
|
|
|
|
if (m_modeTimer.isRunning() && m_modeTimer.hasExpired())
|
|
|
|
setMode(MODE_IDLE);
|
|
|
|
}
|
2016-01-14 18:45:04 +00:00
|
|
|
|
2019-01-10 21:50:57 +00:00
|
|
|
if (m_dstar != NULL) {
|
2016-01-25 19:59:37 +00:00
|
|
|
ret = m_modem->hasDStarSpace();
|
2016-01-14 18:45:04 +00:00
|
|
|
if (ret) {
|
2019-01-10 09:05:15 +00:00
|
|
|
len = m_dstar->readModem(data);
|
2016-02-03 09:55:08 +00:00
|
|
|
if (len > 0U) {
|
2016-06-22 17:03:56 +00:00
|
|
|
if (m_mode == MODE_IDLE) {
|
2017-09-01 08:25:54 +00:00
|
|
|
m_modeTimer.setTimeout(m_dstarNetModeHang);
|
2016-02-03 09:55:08 +00:00
|
|
|
setMode(MODE_DSTAR);
|
2016-06-22 17:03:56 +00:00
|
|
|
}
|
2016-03-07 19:45:19 +00:00
|
|
|
if (m_mode == MODE_DSTAR) {
|
2016-02-03 09:55:08 +00:00
|
|
|
m_modem->writeDStarData(data, len);
|
|
|
|
m_modeTimer.start();
|
2016-03-07 19:45:19 +00:00
|
|
|
} else if (m_mode != MODE_LOCKOUT) {
|
2016-02-03 09:55:08 +00:00
|
|
|
LogWarning("D-Star data received when in mode %u", m_mode);
|
|
|
|
}
|
2016-01-14 18:45:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-10 09:05:15 +00:00
|
|
|
if (m_dmr != NULL) {
|
2016-01-14 18:45:04 +00:00
|
|
|
ret = m_modem->hasDMRSpace1();
|
|
|
|
if (ret) {
|
2019-01-10 09:05:15 +00:00
|
|
|
len = m_dmr->readModemSlot1(data);
|
2016-02-03 09:55:08 +00:00
|
|
|
if (len > 0U) {
|
2016-06-22 17:03:56 +00:00
|
|
|
if (m_mode == MODE_IDLE) {
|
2017-09-01 08:25:54 +00:00
|
|
|
m_modeTimer.setTimeout(m_dmrNetModeHang);
|
2016-02-03 09:55:08 +00:00
|
|
|
setMode(MODE_DMR);
|
2016-06-22 17:03:56 +00:00
|
|
|
}
|
2016-03-07 19:45:19 +00:00
|
|
|
if (m_mode == MODE_DMR) {
|
2016-05-05 16:56:18 +00:00
|
|
|
if (m_duplex) {
|
|
|
|
m_modem->writeDMRStart(true);
|
|
|
|
m_dmrTXTimer.start();
|
|
|
|
}
|
2016-02-03 09:55:08 +00:00
|
|
|
m_modem->writeDMRData1(data, len);
|
2018-01-16 18:35:29 +00:00
|
|
|
dmrBeaconDurationTimer.stop();
|
2016-02-03 09:55:08 +00:00
|
|
|
m_modeTimer.start();
|
2016-03-07 19:45:19 +00:00
|
|
|
} else if (m_mode != MODE_LOCKOUT) {
|
2016-02-03 09:55:08 +00:00
|
|
|
LogWarning("DMR data received when in mode %u", m_mode);
|
|
|
|
}
|
2016-01-14 18:45:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = m_modem->hasDMRSpace2();
|
|
|
|
if (ret) {
|
2019-01-10 09:05:15 +00:00
|
|
|
len = m_dmr->readModemSlot2(data);
|
2016-02-03 09:55:08 +00:00
|
|
|
if (len > 0U) {
|
2016-06-22 17:03:56 +00:00
|
|
|
if (m_mode == MODE_IDLE) {
|
2017-09-01 08:25:54 +00:00
|
|
|
m_modeTimer.setTimeout(m_dmrNetModeHang);
|
2016-02-03 09:55:08 +00:00
|
|
|
setMode(MODE_DMR);
|
2016-06-22 17:03:56 +00:00
|
|
|
}
|
2016-03-07 19:45:19 +00:00
|
|
|
if (m_mode == MODE_DMR) {
|
2016-05-05 16:56:18 +00:00
|
|
|
if (m_duplex) {
|
|
|
|
m_modem->writeDMRStart(true);
|
|
|
|
m_dmrTXTimer.start();
|
|
|
|
}
|
2016-02-03 09:55:08 +00:00
|
|
|
m_modem->writeDMRData2(data, len);
|
2018-01-16 18:35:29 +00:00
|
|
|
dmrBeaconDurationTimer.stop();
|
2016-02-03 09:55:08 +00:00
|
|
|
m_modeTimer.start();
|
2016-03-07 19:45:19 +00:00
|
|
|
} else if (m_mode != MODE_LOCKOUT) {
|
2016-02-03 09:55:08 +00:00
|
|
|
LogWarning("DMR data received when in mode %u", m_mode);
|
|
|
|
}
|
2016-01-14 18:45:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-10 09:05:15 +00:00
|
|
|
if (m_ysf != NULL) {
|
2016-01-25 19:59:37 +00:00
|
|
|
ret = m_modem->hasYSFSpace();
|
2016-01-14 18:45:04 +00:00
|
|
|
if (ret) {
|
2019-01-10 09:05:15 +00:00
|
|
|
len = m_ysf->readModem(data);
|
2016-02-03 09:55:08 +00:00
|
|
|
if (len > 0U) {
|
2016-06-22 17:03:56 +00:00
|
|
|
if (m_mode == MODE_IDLE) {
|
2017-09-01 08:25:54 +00:00
|
|
|
m_modeTimer.setTimeout(m_ysfNetModeHang);
|
2016-02-03 09:55:08 +00:00
|
|
|
setMode(MODE_YSF);
|
2016-06-22 17:03:56 +00:00
|
|
|
}
|
2016-03-07 19:45:19 +00:00
|
|
|
if (m_mode == MODE_YSF) {
|
2016-02-03 09:55:08 +00:00
|
|
|
m_modem->writeYSFData(data, len);
|
|
|
|
m_modeTimer.start();
|
2016-03-07 19:45:19 +00:00
|
|
|
} else if (m_mode != MODE_LOCKOUT) {
|
2016-02-03 09:55:08 +00:00
|
|
|
LogWarning("System Fusion data received when in mode %u", m_mode);
|
|
|
|
}
|
2016-01-14 18:45:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-10 09:05:15 +00:00
|
|
|
if (m_p25 != NULL) {
|
2016-09-08 20:27:21 +00:00
|
|
|
ret = m_modem->hasP25Space();
|
|
|
|
if (ret) {
|
2019-01-10 09:05:15 +00:00
|
|
|
len = m_p25->readModem(data);
|
2016-09-08 20:27:21 +00:00
|
|
|
if (len > 0U) {
|
|
|
|
if (m_mode == MODE_IDLE) {
|
2017-09-01 08:25:54 +00:00
|
|
|
m_modeTimer.setTimeout(m_p25NetModeHang);
|
2016-09-08 20:27:21 +00:00
|
|
|
setMode(MODE_P25);
|
|
|
|
}
|
|
|
|
if (m_mode == MODE_P25) {
|
|
|
|
m_modem->writeP25Data(data, len);
|
|
|
|
m_modeTimer.start();
|
2017-09-01 08:25:54 +00:00
|
|
|
} else if (m_mode != MODE_LOCKOUT) {
|
2016-09-08 20:27:21 +00:00
|
|
|
LogWarning("P25 data received when in mode %u", m_mode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-10 09:05:15 +00:00
|
|
|
if (m_nxdn != NULL) {
|
2018-01-11 19:35:33 +00:00
|
|
|
ret = m_modem->hasNXDNSpace();
|
|
|
|
if (ret) {
|
2019-01-10 09:05:15 +00:00
|
|
|
len = m_nxdn->readModem(data);
|
2018-01-11 19:35:33 +00:00
|
|
|
if (len > 0U) {
|
|
|
|
if (m_mode == MODE_IDLE) {
|
|
|
|
m_modeTimer.setTimeout(m_nxdnNetModeHang);
|
|
|
|
setMode(MODE_NXDN);
|
|
|
|
}
|
|
|
|
if (m_mode == MODE_NXDN) {
|
|
|
|
m_modem->writeNXDNData(data, len);
|
|
|
|
m_modeTimer.start();
|
2018-01-16 20:10:35 +00:00
|
|
|
} else if (m_mode != MODE_LOCKOUT) {
|
2018-01-11 19:35:33 +00:00
|
|
|
LogWarning("NXDN data received when in mode %u", m_mode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17 != NULL) {
|
|
|
|
ret = m_modem->hasM17Space();
|
|
|
|
if (ret) {
|
|
|
|
len = m_m17->readModem(data);
|
|
|
|
if (len > 0U) {
|
|
|
|
if (m_mode == MODE_IDLE) {
|
|
|
|
m_modeTimer.setTimeout(m_m17NetModeHang);
|
|
|
|
setMode(MODE_M17);
|
|
|
|
}
|
|
|
|
if (m_mode == MODE_M17) {
|
|
|
|
m_modem->writeM17Data(data, len);
|
|
|
|
m_modeTimer.start();
|
|
|
|
} else if (m_mode != MODE_LOCKOUT) {
|
|
|
|
LogWarning("M17 data received when in mode %u", m_mode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-10 14:03:23 +00:00
|
|
|
if (m_pocsag != NULL) {
|
2018-06-07 17:46:03 +00:00
|
|
|
ret = m_modem->hasPOCSAGSpace();
|
|
|
|
if (ret) {
|
2019-01-10 14:03:23 +00:00
|
|
|
len = m_pocsag->readModem(data);
|
2018-06-07 17:46:03 +00:00
|
|
|
if (len > 0U) {
|
|
|
|
if (m_mode == MODE_IDLE) {
|
|
|
|
m_modeTimer.setTimeout(m_pocsagNetModeHang);
|
|
|
|
setMode(MODE_POCSAG);
|
|
|
|
}
|
|
|
|
if (m_mode == MODE_POCSAG) {
|
|
|
|
m_modem->writePOCSAGData(data, len);
|
|
|
|
m_modeTimer.start();
|
|
|
|
} else if (m_mode != MODE_LOCKOUT) {
|
|
|
|
LogWarning("POCSAG data received when in mode %u", m_mode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_fm != NULL) {
|
|
|
|
unsigned int space = m_modem->getFMSpace();
|
|
|
|
if (space > 0U) {
|
|
|
|
len = m_fm->readModem(data, space);
|
|
|
|
if (len > 0U) {
|
|
|
|
if (m_mode == MODE_IDLE) {
|
|
|
|
m_modeTimer.setTimeout(m_fmNetModeHang);
|
|
|
|
setMode(MODE_FM);
|
|
|
|
}
|
|
|
|
if (m_mode == MODE_FM) {
|
|
|
|
m_modem->writeFMData(data, len);
|
|
|
|
m_modeTimer.start();
|
|
|
|
} else if (m_mode != MODE_LOCKOUT) {
|
|
|
|
LogWarning("FM data received when in mode %u", m_mode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-21 17:53:38 +00:00
|
|
|
if (m_ax25 != NULL) {
|
|
|
|
ret = m_modem->hasAX25Space();
|
|
|
|
if (ret) {
|
|
|
|
len = m_ax25->readModem(data);
|
|
|
|
if (len > 0U) {
|
|
|
|
if (m_mode == MODE_IDLE || m_mode == MODE_FM) {
|
|
|
|
m_modem->writeAX25Data(data, len);
|
2020-06-25 12:41:19 +00:00
|
|
|
}
|
|
|
|
else if (m_mode != MODE_LOCKOUT) {
|
2020-06-21 17:53:38 +00:00
|
|
|
LogWarning("AX.25 data received when in mode %u", m_mode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-22 07:13:13 +00:00
|
|
|
if (transparentSocket != NULL) {
|
2020-03-27 20:40:35 +00:00
|
|
|
sockaddr_storage address;
|
|
|
|
unsigned int addrlen;
|
|
|
|
len = transparentSocket->read(data, 200U, address, addrlen);
|
2018-03-22 07:13:13 +00:00
|
|
|
if (len > 0U)
|
2018-09-13 18:35:12 +00:00
|
|
|
m_modem->writeTransparentData(data, len);
|
2018-03-22 07:13:13 +00:00
|
|
|
}
|
|
|
|
|
2019-01-10 09:05:15 +00:00
|
|
|
remoteControl();
|
2019-01-07 11:03:37 +00:00
|
|
|
|
2016-01-14 18:45:04 +00:00
|
|
|
unsigned int ms = stopWatch.elapsed();
|
2016-02-19 06:21:40 +00:00
|
|
|
stopWatch.start();
|
|
|
|
|
2016-05-09 17:14:27 +00:00
|
|
|
m_display->clock(ms);
|
|
|
|
|
2016-01-14 18:45:04 +00:00
|
|
|
m_modem->clock(ms);
|
2019-01-18 15:57:05 +00:00
|
|
|
|
2019-01-22 14:38:38 +00:00
|
|
|
if (!m_fixedMode)
|
|
|
|
m_modeTimer.clock(ms);
|
2016-02-19 06:21:40 +00:00
|
|
|
|
2019-01-10 09:05:15 +00:00
|
|
|
if (m_dstar != NULL)
|
|
|
|
m_dstar->clock();
|
|
|
|
if (m_dmr != NULL)
|
|
|
|
m_dmr->clock();
|
|
|
|
if (m_ysf != NULL)
|
|
|
|
m_ysf->clock(ms);
|
|
|
|
if (m_p25 != NULL)
|
|
|
|
m_p25->clock(ms);
|
|
|
|
if (m_nxdn != NULL)
|
|
|
|
m_nxdn->clock(ms);
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17 != NULL)
|
|
|
|
m_m17->clock(ms);
|
2019-01-10 14:03:23 +00:00
|
|
|
if (m_pocsag != NULL)
|
|
|
|
m_pocsag->clock(ms);
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_fm != NULL)
|
|
|
|
m_fm->clock(ms);
|
2016-02-19 06:21:40 +00:00
|
|
|
|
2016-01-26 19:56:10 +00:00
|
|
|
if (m_dstarNetwork != NULL)
|
|
|
|
m_dstarNetwork->clock(ms);
|
|
|
|
if (m_dmrNetwork != NULL)
|
|
|
|
m_dmrNetwork->clock(ms);
|
2016-05-16 20:57:32 +00:00
|
|
|
if (m_ysfNetwork != NULL)
|
|
|
|
m_ysfNetwork->clock(ms);
|
2016-09-14 06:41:37 +00:00
|
|
|
if (m_p25Network != NULL)
|
|
|
|
m_p25Network->clock(ms);
|
2018-01-15 21:03:34 +00:00
|
|
|
if (m_nxdnNetwork != NULL)
|
|
|
|
m_nxdnNetwork->clock(ms);
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17Network != NULL)
|
|
|
|
m_m17Network->clock(ms);
|
2018-06-07 17:46:03 +00:00
|
|
|
if (m_pocsagNetwork != NULL)
|
|
|
|
m_pocsagNetwork->clock(ms);
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_fmNetwork != NULL)
|
|
|
|
m_fmNetwork->clock(ms);
|
2016-01-14 18:45:04 +00:00
|
|
|
|
2016-05-09 20:55:44 +00:00
|
|
|
m_cwIdTimer.clock(ms);
|
|
|
|
if (m_cwIdTimer.isRunning() && m_cwIdTimer.hasExpired()) {
|
2019-01-22 14:38:38 +00:00
|
|
|
if (!m_modem->hasTX()){
|
2016-06-03 14:28:55 +00:00
|
|
|
LogDebug("sending CW ID");
|
2016-09-15 13:17:51 +00:00
|
|
|
m_display->writeCW();
|
2017-04-10 16:55:53 +00:00
|
|
|
m_modem->sendCWId(m_cwCallsign);
|
2016-06-03 14:28:55 +00:00
|
|
|
|
2016-10-17 17:01:38 +00:00
|
|
|
m_cwIdTimer.setTimeout(m_cwIdTime);
|
|
|
|
m_cwIdTimer.start();
|
2016-06-03 14:28:55 +00:00
|
|
|
}
|
2016-05-09 20:55:44 +00:00
|
|
|
}
|
|
|
|
|
2019-11-05 08:42:21 +00:00
|
|
|
switch (dmrBeacons) {
|
|
|
|
case DMR_BEACONS_TIMED:
|
|
|
|
dmrBeaconIntervalTimer.clock(ms);
|
|
|
|
if (dmrBeaconIntervalTimer.isRunning() && dmrBeaconIntervalTimer.hasExpired()) {
|
|
|
|
if ((m_mode == MODE_IDLE || m_mode == MODE_DMR) && !m_modem->hasTX()) {
|
|
|
|
if (!m_fixedMode && m_mode == MODE_IDLE)
|
|
|
|
setMode(MODE_DMR);
|
|
|
|
dmrBeaconIntervalTimer.start();
|
|
|
|
dmrBeaconDurationTimer.start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DMR_BEACONS_NETWORK:
|
|
|
|
if (m_dmrNetwork != NULL) {
|
|
|
|
bool beacon = m_dmrNetwork->wantsBeacon();
|
|
|
|
if (beacon) {
|
|
|
|
if ((m_mode == MODE_IDLE || m_mode == MODE_DMR) && !m_modem->hasTX()) {
|
|
|
|
if (!m_fixedMode && m_mode == MODE_IDLE)
|
|
|
|
setMode(MODE_DMR);
|
|
|
|
dmrBeaconDurationTimer.start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2018-01-15 19:22:01 +00:00
|
|
|
}
|
|
|
|
|
2018-01-16 18:35:29 +00:00
|
|
|
dmrBeaconDurationTimer.clock(ms);
|
|
|
|
if (dmrBeaconDurationTimer.isRunning() && dmrBeaconDurationTimer.hasExpired()) {
|
2019-01-22 14:38:38 +00:00
|
|
|
if (!m_fixedMode)
|
|
|
|
setMode(MODE_IDLE);
|
2018-01-16 18:35:29 +00:00
|
|
|
dmrBeaconDurationTimer.stop();
|
2016-01-14 19:58:16 +00:00
|
|
|
}
|
|
|
|
|
2016-05-05 16:56:18 +00:00
|
|
|
m_dmrTXTimer.clock(ms);
|
|
|
|
if (m_dmrTXTimer.isRunning() && m_dmrTXTimer.hasExpired()) {
|
|
|
|
m_modem->writeDMRStart(false);
|
|
|
|
m_dmrTXTimer.stop();
|
|
|
|
}
|
|
|
|
|
2018-06-28 06:08:04 +00:00
|
|
|
pocsagTimer.clock(ms);
|
|
|
|
if (pocsagTimer.isRunning() && pocsagTimer.hasExpired()) {
|
|
|
|
assert(m_pocsagNetwork != NULL);
|
|
|
|
m_pocsagNetwork->enable(m_mode == MODE_IDLE || m_mode == MODE_POCSAG);
|
|
|
|
pocsagTimer.start();
|
|
|
|
}
|
|
|
|
|
2016-06-06 16:40:27 +00:00
|
|
|
if (ms < 5U)
|
|
|
|
CThread::sleep(5U);
|
2016-01-14 18:45:04 +00:00
|
|
|
}
|
|
|
|
|
2018-08-15 16:17:42 +00:00
|
|
|
setMode(MODE_QUIT);
|
2016-01-14 18:45:04 +00:00
|
|
|
|
|
|
|
m_modem->close();
|
|
|
|
delete m_modem;
|
|
|
|
|
|
|
|
m_display->close();
|
|
|
|
delete m_display;
|
|
|
|
|
2018-01-17 21:21:25 +00:00
|
|
|
if (m_dmrLookup != NULL)
|
|
|
|
m_dmrLookup->stop();
|
|
|
|
|
|
|
|
if (m_nxdnLookup != NULL)
|
|
|
|
m_nxdnLookup->stop();
|
2016-10-10 18:15:30 +00:00
|
|
|
|
2016-01-25 21:00:19 +00:00
|
|
|
if (m_dstarNetwork != NULL) {
|
|
|
|
m_dstarNetwork->close();
|
|
|
|
delete m_dstarNetwork;
|
|
|
|
}
|
|
|
|
|
2016-01-14 18:45:04 +00:00
|
|
|
if (m_dmrNetwork != NULL) {
|
|
|
|
m_dmrNetwork->close();
|
|
|
|
delete m_dmrNetwork;
|
|
|
|
}
|
|
|
|
|
2016-05-16 20:57:32 +00:00
|
|
|
if (m_ysfNetwork != NULL) {
|
|
|
|
m_ysfNetwork->close();
|
|
|
|
delete m_ysfNetwork;
|
|
|
|
}
|
|
|
|
|
2016-09-14 06:41:37 +00:00
|
|
|
if (m_p25Network != NULL) {
|
|
|
|
m_p25Network->close();
|
|
|
|
delete m_p25Network;
|
|
|
|
}
|
|
|
|
|
2018-01-15 21:03:34 +00:00
|
|
|
if (m_nxdnNetwork != NULL) {
|
|
|
|
m_nxdnNetwork->close();
|
|
|
|
delete m_nxdnNetwork;
|
|
|
|
}
|
|
|
|
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17Network != NULL) {
|
|
|
|
m_m17Network->close();
|
|
|
|
delete m_m17Network;
|
|
|
|
}
|
|
|
|
|
2018-06-07 17:46:03 +00:00
|
|
|
if (m_pocsagNetwork != NULL) {
|
|
|
|
m_pocsagNetwork->close();
|
|
|
|
delete m_pocsagNetwork;
|
|
|
|
}
|
|
|
|
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_fmNetwork != NULL) {
|
|
|
|
m_fmNetwork->close();
|
|
|
|
delete m_fmNetwork;
|
|
|
|
}
|
|
|
|
|
2020-06-08 15:33:20 +00:00
|
|
|
if (m_ax25Network != NULL) {
|
|
|
|
m_ax25Network->close();
|
|
|
|
delete m_ax25Network;
|
|
|
|
}
|
|
|
|
|
2018-03-22 07:13:13 +00:00
|
|
|
if (transparentSocket != NULL) {
|
|
|
|
transparentSocket->close();
|
|
|
|
delete transparentSocket;
|
|
|
|
}
|
|
|
|
|
2019-01-10 09:05:15 +00:00
|
|
|
if (m_remoteControl != NULL) {
|
|
|
|
m_remoteControl->close();
|
|
|
|
delete m_remoteControl;
|
2019-01-07 11:03:37 +00:00
|
|
|
}
|
|
|
|
|
2019-01-10 09:05:15 +00:00
|
|
|
delete m_dstar;
|
|
|
|
delete m_dmr;
|
|
|
|
delete m_ysf;
|
|
|
|
delete m_p25;
|
|
|
|
delete m_nxdn;
|
2020-10-14 15:16:54 +00:00
|
|
|
delete m_m17;
|
2019-01-10 14:03:23 +00:00
|
|
|
delete m_pocsag;
|
2020-05-07 15:08:58 +00:00
|
|
|
delete m_fm;
|
2020-06-08 15:33:20 +00:00
|
|
|
delete m_ax25;
|
2016-01-14 18:45:04 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CMMDVMHost::createModem()
|
|
|
|
{
|
2018-06-12 18:40:49 +00:00
|
|
|
std::string port = m_conf.getModemPort();
|
2018-07-19 13:09:00 +00:00
|
|
|
std::string protocol = m_conf.getModemProtocol();
|
2020-05-23 12:03:55 +00:00
|
|
|
unsigned int speed = m_conf.getModemSpeed();
|
2018-07-19 13:09:00 +00:00
|
|
|
unsigned int address = m_conf.getModemAddress();
|
2018-06-12 18:40:49 +00:00
|
|
|
bool rxInvert = m_conf.getModemRXInvert();
|
|
|
|
bool txInvert = m_conf.getModemTXInvert();
|
|
|
|
bool pttInvert = m_conf.getModemPTTInvert();
|
|
|
|
unsigned int txDelay = m_conf.getModemTXDelay();
|
|
|
|
unsigned int dmrDelay = m_conf.getModemDMRDelay();
|
|
|
|
float rxLevel = m_conf.getModemRXLevel();
|
|
|
|
float cwIdTXLevel = m_conf.getModemCWIdTXLevel();
|
|
|
|
float dstarTXLevel = m_conf.getModemDStarTXLevel();
|
|
|
|
float dmrTXLevel = m_conf.getModemDMRTXLevel();
|
|
|
|
float ysfTXLevel = m_conf.getModemYSFTXLevel();
|
|
|
|
float p25TXLevel = m_conf.getModemP25TXLevel();
|
|
|
|
float nxdnTXLevel = m_conf.getModemNXDNTXLevel();
|
2020-10-14 15:16:54 +00:00
|
|
|
float m17TXLevel = m_conf.getModemM17TXLevel();
|
2018-06-12 18:40:49 +00:00
|
|
|
float pocsagTXLevel = m_conf.getModemPOCSAGTXLevel();
|
2020-04-12 14:10:51 +00:00
|
|
|
float fmTXLevel = m_conf.getModemFMTXLevel();
|
2020-06-20 20:28:39 +00:00
|
|
|
float ax25TXLevel = m_conf.getModemAX25TXLevel();
|
2018-06-12 18:40:49 +00:00
|
|
|
bool trace = m_conf.getModemTrace();
|
|
|
|
bool debug = m_conf.getModemDebug();
|
|
|
|
unsigned int colorCode = m_conf.getDMRColorCode();
|
|
|
|
bool lowDeviation = m_conf.getFusionLowDeviation();
|
2020-05-06 16:10:23 +00:00
|
|
|
unsigned int ysfTXHang = m_conf.getFusionTXHang();
|
|
|
|
unsigned int p25TXHang = m_conf.getP25TXHang();
|
|
|
|
unsigned int nxdnTXHang = m_conf.getNXDNTXHang();
|
2020-10-14 15:16:54 +00:00
|
|
|
unsigned int m17TXHang = m_conf.getM17TXHang();
|
2018-06-12 18:40:49 +00:00
|
|
|
unsigned int rxFrequency = m_conf.getRXFrequency();
|
|
|
|
unsigned int txFrequency = m_conf.getTXFrequency();
|
|
|
|
unsigned int pocsagFrequency = m_conf.getPOCSAGFrequency();
|
|
|
|
int rxOffset = m_conf.getModemRXOffset();
|
|
|
|
int txOffset = m_conf.getModemTXOffset();
|
|
|
|
int rxDCOffset = m_conf.getModemRXDCOffset();
|
|
|
|
int txDCOffset = m_conf.getModemTXDCOffset();
|
|
|
|
float rfLevel = m_conf.getModemRFLevel();
|
2020-06-20 20:28:39 +00:00
|
|
|
int rxTwist = m_conf.getAX25RXTwist();
|
2020-06-27 21:47:54 +00:00
|
|
|
unsigned int ax25TXDelay = m_conf.getAX25TXDelay();
|
2020-07-01 09:59:46 +00:00
|
|
|
unsigned int ax25SlotTime = m_conf.getAX25SlotTime();
|
|
|
|
unsigned int ax25PPersist = m_conf.getAX25PPersist();
|
2020-07-13 15:02:04 +00:00
|
|
|
bool useCOSAsLockout = m_conf.getModemUseCOSAsLockout();
|
2016-01-14 18:45:04 +00:00
|
|
|
|
|
|
|
LogInfo("Modem Parameters");
|
|
|
|
LogInfo(" Port: %s", port.c_str());
|
2020-05-23 15:49:21 +00:00
|
|
|
#if defined(__linux__)
|
2018-07-19 13:09:00 +00:00
|
|
|
LogInfo(" Protocol: %s", protocol.c_str());
|
2018-07-19 17:42:23 +00:00
|
|
|
if (protocol == "i2c")
|
2020-05-23 12:03:55 +00:00
|
|
|
LogInfo(" I2C Address: %02X", address);
|
2020-05-23 15:49:21 +00:00
|
|
|
else
|
|
|
|
#endif
|
2020-06-25 12:41:19 +00:00
|
|
|
LogInfo(" Speed: %u", speed);
|
2016-01-14 18:45:04 +00:00
|
|
|
LogInfo(" RX Invert: %s", rxInvert ? "yes" : "no");
|
|
|
|
LogInfo(" TX Invert: %s", txInvert ? "yes" : "no");
|
|
|
|
LogInfo(" PTT Invert: %s", pttInvert ? "yes" : "no");
|
2016-03-17 18:12:14 +00:00
|
|
|
LogInfo(" TX Delay: %ums", txDelay);
|
2017-06-14 15:44:23 +00:00
|
|
|
LogInfo(" RX Offset: %dHz", rxOffset);
|
|
|
|
LogInfo(" TX Offset: %dHz", txOffset);
|
2017-10-28 11:37:32 +00:00
|
|
|
LogInfo(" RX DC Offset: %d", rxDCOffset);
|
2017-08-20 11:07:57 +00:00
|
|
|
LogInfo(" TX DC Offset: %d", txDCOffset);
|
2017-12-30 15:05:11 +00:00
|
|
|
LogInfo(" RF Level: %.1f%%", rfLevel);
|
2016-03-21 21:50:45 +00:00
|
|
|
LogInfo(" DMR Delay: %u (%.1fms)", dmrDelay, float(dmrDelay) * 0.0416666F);
|
2017-06-02 15:34:55 +00:00
|
|
|
LogInfo(" RX Level: %.1f%%", rxLevel);
|
|
|
|
LogInfo(" CW Id TX Level: %.1f%%", cwIdTXLevel);
|
|
|
|
LogInfo(" D-Star TX Level: %.1f%%", dstarTXLevel);
|
|
|
|
LogInfo(" DMR TX Level: %.1f%%", dmrTXLevel);
|
|
|
|
LogInfo(" YSF TX Level: %.1f%%", ysfTXLevel);
|
|
|
|
LogInfo(" P25 TX Level: %.1f%%", p25TXLevel);
|
2018-01-11 19:35:33 +00:00
|
|
|
LogInfo(" NXDN TX Level: %.1f%%", nxdnTXLevel);
|
2020-10-14 15:16:54 +00:00
|
|
|
LogInfo(" M17 TX Level: %.1f%%", m17TXLevel);
|
2018-06-07 17:46:03 +00:00
|
|
|
LogInfo(" POCSAG TX Level: %.1f%%", pocsagTXLevel);
|
2020-04-12 14:10:51 +00:00
|
|
|
LogInfo(" FM TX Level: %.1f%%", fmTXLevel);
|
2020-06-20 20:28:39 +00:00
|
|
|
LogInfo(" AX.25 TX Level: %.1f%%", ax25TXLevel);
|
2017-06-14 15:44:23 +00:00
|
|
|
LogInfo(" TX Frequency: %uHz (%uHz)", txFrequency, txFrequency + txOffset);
|
2020-07-13 15:02:04 +00:00
|
|
|
LogInfo(" Use COS as Lockout: %s", useCOSAsLockout ? "yes" : "no");
|
2016-01-14 18:45:04 +00:00
|
|
|
|
2020-06-30 11:35:03 +00:00
|
|
|
if (port == "NullModem")
|
|
|
|
m_modem = new CNullModem;
|
|
|
|
else
|
2020-07-15 11:15:07 +00:00
|
|
|
m_modem = new CSerialModem(port, m_duplex, rxInvert, txInvert, pttInvert, txDelay, dmrDelay, useCOSAsLockout, trace, debug);
|
2020-05-23 12:03:55 +00:00
|
|
|
m_modem->setSerialParams(protocol, address, speed);
|
2020-11-06 15:43:12 +00:00
|
|
|
m_modem->setModeParams(m_dstarEnabled, m_dmrEnabled, m_ysfEnabled, m_p25Enabled, m_nxdnEnabled, m_m17Enabled, m_pocsagEnabled, m_fmEnabled, m_ax25Enabled);
|
|
|
|
m_modem->setLevels(rxLevel, cwIdTXLevel, dstarTXLevel, dmrTXLevel, ysfTXLevel, p25TXLevel, nxdnTXLevel, m17TXLevel, pocsagTXLevel, fmTXLevel, ax25TXLevel);
|
2020-04-19 14:36:29 +00:00
|
|
|
m_modem->setRFParams(rxFrequency, rxOffset, txFrequency, txOffset, txDCOffset, rxDCOffset, rfLevel, pocsagFrequency);
|
|
|
|
m_modem->setDMRParams(colorCode);
|
2020-05-06 16:10:23 +00:00
|
|
|
m_modem->setYSFParams(lowDeviation, ysfTXHang);
|
|
|
|
m_modem->setP25Params(p25TXHang);
|
|
|
|
m_modem->setNXDNParams(nxdnTXHang);
|
2020-10-14 15:16:54 +00:00
|
|
|
m_modem->setM17Params(m17TXHang);
|
2020-07-01 09:59:46 +00:00
|
|
|
m_modem->setAX25Params(rxTwist, ax25TXDelay, ax25SlotTime, ax25PPersist);
|
2020-04-19 14:36:29 +00:00
|
|
|
|
2020-04-18 13:59:19 +00:00
|
|
|
if (m_fmEnabled) {
|
2020-07-28 13:22:26 +00:00
|
|
|
std::string callsign = m_conf.getFMCallsign();
|
|
|
|
unsigned int callsignSpeed = m_conf.getFMCallsignSpeed();
|
|
|
|
unsigned int callsignFrequency = m_conf.getFMCallsignFrequency();
|
|
|
|
unsigned int callsignTime = m_conf.getFMCallsignTime();
|
|
|
|
unsigned int callsignHoldoff = m_conf.getFMCallsignHoldoff();
|
|
|
|
float callsignHighLevel = m_conf.getFMCallsignHighLevel();
|
|
|
|
float callsignLowLevel = m_conf.getFMCallsignLowLevel();
|
|
|
|
bool callsignAtStart = m_conf.getFMCallsignAtStart();
|
|
|
|
bool callsignAtEnd = m_conf.getFMCallsignAtEnd();
|
|
|
|
bool callsignAtLatch = m_conf.getFMCallsignAtLatch();
|
|
|
|
std::string rfAck = m_conf.getFMRFAck();
|
|
|
|
unsigned int ackSpeed = m_conf.getFMAckSpeed();
|
|
|
|
unsigned int ackFrequency = m_conf.getFMAckFrequency();
|
|
|
|
unsigned int ackMinTime = m_conf.getFMAckMinTime();
|
|
|
|
unsigned int ackDelay = m_conf.getFMAckDelay();
|
|
|
|
float ackLevel = m_conf.getFMAckLevel();
|
|
|
|
unsigned int timeout = m_conf.getFMTimeout();
|
|
|
|
float timeoutLevel = m_conf.getFMTimeoutLevel();
|
|
|
|
float ctcssFrequency = m_conf.getFMCTCSSFrequency();
|
|
|
|
unsigned int ctcssHighThreshold = m_conf.getFMCTCSSHighThreshold();
|
|
|
|
unsigned int ctcssLowThreshold = m_conf.getFMCTCSSLowThreshold();
|
|
|
|
float ctcssLevel = m_conf.getFMCTCSSLevel();
|
|
|
|
unsigned int kerchunkTime = m_conf.getFMKerchunkTime();
|
|
|
|
unsigned int hangTime = m_conf.getFMHangTime();
|
|
|
|
unsigned int accessMode = m_conf.getFMAccessMode();
|
|
|
|
bool cosInvert = m_conf.getFMCOSInvert();
|
|
|
|
bool noiseSquelch = m_conf.getFMNoiseSquelch();
|
|
|
|
unsigned int squelchHighThreshold = m_conf.getFMSquelchHighThreshold();
|
|
|
|
unsigned int squelchLowThreshold = m_conf.getFMSquelchLowThreshold();
|
|
|
|
unsigned int rfAudioBoost = m_conf.getFMRFAudioBoost();
|
|
|
|
float maxDevLevel = m_conf.getFMMaxDevLevel();
|
|
|
|
unsigned int modeHangTime = m_conf.getFMModeHang();
|
2020-04-18 13:59:19 +00:00
|
|
|
|
|
|
|
LogInfo("FM Parameters");
|
|
|
|
LogInfo(" Callsign: %s", callsign.c_str());
|
|
|
|
LogInfo(" Callsign Speed: %uWPM", callsignSpeed);
|
|
|
|
LogInfo(" Callsign Frequency: %uHz", callsignFrequency);
|
|
|
|
LogInfo(" Callsign Time: %umins", callsignTime);
|
|
|
|
LogInfo(" Callsign Holdoff: 1/%u", callsignHoldoff);
|
2020-04-22 20:51:43 +00:00
|
|
|
LogInfo(" Callsign High Level: %.1f%%", callsignHighLevel);
|
|
|
|
LogInfo(" Callsign Low Level: %.1f%%", callsignLowLevel);
|
2020-04-18 13:59:19 +00:00
|
|
|
LogInfo(" Callsign At Start: %s", callsignAtStart ? "yes" : "no");
|
|
|
|
LogInfo(" Callsign At End: %s", callsignAtEnd ? "yes" : "no");
|
2020-05-04 21:30:16 +00:00
|
|
|
LogInfo(" Callsign At Latch: %s", callsignAtLatch ? "yes" : "no");
|
2020-04-18 13:59:19 +00:00
|
|
|
LogInfo(" RF Ack: %s", rfAck.c_str());
|
|
|
|
LogInfo(" Ack Speed: %uWPM", ackSpeed);
|
|
|
|
LogInfo(" Ack Frequency: %uHz", ackFrequency);
|
|
|
|
LogInfo(" Ack Min Time: %us", ackMinTime);
|
|
|
|
LogInfo(" Ack Delay: %ums", ackDelay);
|
|
|
|
LogInfo(" Ack Level: %.1f%%", ackLevel);
|
|
|
|
LogInfo(" Timeout: %us", timeout);
|
|
|
|
LogInfo(" Timeout Level: %.1f%%", timeoutLevel);
|
|
|
|
LogInfo(" CTCSS Frequency: %.1fHz", ctcssFrequency);
|
2020-05-12 12:43:43 +00:00
|
|
|
LogInfo(" CTCSS High Threshold: %u", ctcssHighThreshold);
|
|
|
|
LogInfo(" CTCSS Low Threshold: %u", ctcssLowThreshold);
|
2020-04-18 13:59:19 +00:00
|
|
|
LogInfo(" CTCSS Level: %.1f%%", ctcssLevel);
|
|
|
|
LogInfo(" Kerchunk Time: %us", kerchunkTime);
|
|
|
|
LogInfo(" Hang Time: %us", hangTime);
|
2020-07-13 15:02:04 +00:00
|
|
|
LogInfo(" Access Mode: %u", accessMode);
|
2020-05-06 10:26:54 +00:00
|
|
|
LogInfo(" COS Invert: %s", cosInvert ? "yes" : "no");
|
2020-07-28 13:22:26 +00:00
|
|
|
|
|
|
|
LogInfo(" Noise Squelch: %s", noiseSquelch ? "yes" : "no");
|
|
|
|
if (noiseSquelch) {
|
|
|
|
LogInfo(" Squelch High Threshold: %u", squelchHighThreshold);
|
|
|
|
LogInfo(" Squelch Low Threshold: %u", squelchLowThreshold);
|
|
|
|
}
|
|
|
|
|
2020-04-28 13:39:14 +00:00
|
|
|
LogInfo(" RF Audio Boost: x%u", rfAudioBoost);
|
2020-04-25 21:43:14 +00:00
|
|
|
LogInfo(" Max. Deviation Level: %.1f%%", maxDevLevel);
|
2020-05-11 11:59:28 +00:00
|
|
|
LogInfo(" Mode Hang: %us", modeHangTime);
|
2020-04-18 13:59:19 +00:00
|
|
|
|
2020-05-04 21:30:16 +00:00
|
|
|
m_modem->setFMCallsignParams(callsign, callsignSpeed, callsignFrequency, callsignTime, callsignHoldoff, callsignHighLevel, callsignLowLevel, callsignAtStart, callsignAtEnd, callsignAtLatch);
|
2020-04-18 13:59:19 +00:00
|
|
|
m_modem->setFMAckParams(rfAck, ackSpeed, ackFrequency, ackMinTime, ackDelay, ackLevel);
|
2020-07-28 13:22:26 +00:00
|
|
|
m_modem->setFMMiscParams(timeout, timeoutLevel, ctcssFrequency, ctcssHighThreshold, ctcssLowThreshold, ctcssLevel, kerchunkTime, hangTime, accessMode, cosInvert, noiseSquelch, squelchHighThreshold, squelchLowThreshold, rfAudioBoost, maxDevLevel);
|
2020-05-07 20:49:18 +00:00
|
|
|
|
|
|
|
if (m_conf.getFMNetworkEnabled()) {
|
|
|
|
std::string extAck = m_conf.getFMExtAck();
|
|
|
|
unsigned int extAudioBoost = m_conf.getFMExtAudioBoost();
|
|
|
|
|
|
|
|
LogInfo(" Ext. Ack: %s", extAck.c_str());
|
|
|
|
LogInfo(" Ext. Audio Boost: x%u", extAudioBoost);
|
|
|
|
|
|
|
|
m_modem->setFMExtParams(extAck, extAudioBoost);
|
|
|
|
}
|
2020-04-18 13:59:19 +00:00
|
|
|
}
|
|
|
|
|
2016-01-14 18:45:04 +00:00
|
|
|
bool ret = m_modem->open();
|
|
|
|
if (!ret) {
|
|
|
|
delete m_modem;
|
|
|
|
m_modem = NULL;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-01-25 21:00:19 +00:00
|
|
|
bool CMMDVMHost::createDStarNetwork()
|
|
|
|
{
|
|
|
|
std::string gatewayAddress = m_conf.getDStarGatewayAddress();
|
2017-09-01 08:25:54 +00:00
|
|
|
unsigned int gatewayPort = m_conf.getDStarGatewayPort();
|
|
|
|
unsigned int localPort = m_conf.getDStarLocalPort();
|
|
|
|
bool debug = m_conf.getDStarNetworkDebug();
|
|
|
|
m_dstarNetModeHang = m_conf.getDStarNetworkModeHang();
|
2016-01-25 21:00:19 +00:00
|
|
|
|
|
|
|
LogInfo("D-Star Network Parameters");
|
|
|
|
LogInfo(" Gateway Address: %s", gatewayAddress.c_str());
|
|
|
|
LogInfo(" Gateway Port: %u", gatewayPort);
|
|
|
|
LogInfo(" Local Port: %u", localPort);
|
2017-09-01 08:25:54 +00:00
|
|
|
LogInfo(" Mode Hang: %us", m_dstarNetModeHang);
|
2016-01-25 21:00:19 +00:00
|
|
|
|
2016-03-08 17:26:51 +00:00
|
|
|
m_dstarNetwork = new CDStarNetwork(gatewayAddress, gatewayPort, localPort, m_duplex, VERSION, debug);
|
2016-01-25 21:00:19 +00:00
|
|
|
|
|
|
|
bool ret = m_dstarNetwork->open();
|
|
|
|
if (!ret) {
|
|
|
|
delete m_dstarNetwork;
|
|
|
|
m_dstarNetwork = NULL;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_dstarNetwork->enable(true);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-01-14 18:45:04 +00:00
|
|
|
bool CMMDVMHost::createDMRNetwork()
|
|
|
|
{
|
|
|
|
std::string address = m_conf.getDMRNetworkAddress();
|
|
|
|
unsigned int port = m_conf.getDMRNetworkPort();
|
2016-04-03 18:11:45 +00:00
|
|
|
unsigned int local = m_conf.getDMRNetworkLocal();
|
2016-01-14 18:45:04 +00:00
|
|
|
unsigned int id = m_conf.getDMRId();
|
|
|
|
std::string password = m_conf.getDMRNetworkPassword();
|
|
|
|
bool debug = m_conf.getDMRNetworkDebug();
|
2016-09-06 18:42:15 +00:00
|
|
|
unsigned int jitter = m_conf.getDMRNetworkJitter();
|
2016-02-15 20:36:05 +00:00
|
|
|
bool slot1 = m_conf.getDMRNetworkSlot1();
|
|
|
|
bool slot2 = m_conf.getDMRNetworkSlot2();
|
2016-09-05 16:40:43 +00:00
|
|
|
HW_TYPE hwType = m_modem->getHWType();
|
2017-09-01 08:25:54 +00:00
|
|
|
m_dmrNetModeHang = m_conf.getDMRNetworkModeHang();
|
2016-01-14 18:45:04 +00:00
|
|
|
|
|
|
|
LogInfo("DMR Network Parameters");
|
|
|
|
LogInfo(" Address: %s", address.c_str());
|
|
|
|
LogInfo(" Port: %u", port);
|
2016-04-03 18:11:45 +00:00
|
|
|
if (local > 0U)
|
|
|
|
LogInfo(" Local: %u", local);
|
|
|
|
else
|
|
|
|
LogInfo(" Local: random");
|
2016-09-06 18:42:15 +00:00
|
|
|
LogInfo(" Jitter: %ums", jitter);
|
2016-02-15 20:36:05 +00:00
|
|
|
LogInfo(" Slot 1: %s", slot1 ? "enabled" : "disabled");
|
|
|
|
LogInfo(" Slot 2: %s", slot2 ? "enabled" : "disabled");
|
2017-09-01 08:25:54 +00:00
|
|
|
LogInfo(" Mode Hang: %us", m_dmrNetModeHang);
|
2016-01-14 18:45:04 +00:00
|
|
|
|
2020-08-26 08:29:11 +00:00
|
|
|
m_dmrNetwork = new CDMRNetwork(address, port, local, id, m_duplex, VERSION, debug, slot1, slot2, hwType);
|
2016-11-03 19:27:52 +00:00
|
|
|
|
2017-08-20 11:07:57 +00:00
|
|
|
unsigned int rxFrequency = m_conf.getRXFrequency();
|
|
|
|
unsigned int txFrequency = m_conf.getTXFrequency();
|
2016-01-14 18:45:04 +00:00
|
|
|
unsigned int power = m_conf.getPower();
|
|
|
|
unsigned int colorCode = m_conf.getDMRColorCode();
|
2020-08-26 08:29:11 +00:00
|
|
|
|
2020-08-26 11:13:34 +00:00
|
|
|
LogInfo("Info Parameters");
|
2016-05-09 20:55:44 +00:00
|
|
|
LogInfo(" Callsign: %s", m_callsign.c_str());
|
2016-01-14 18:45:04 +00:00
|
|
|
LogInfo(" RX Frequency: %uHz", rxFrequency);
|
|
|
|
LogInfo(" TX Frequency: %uHz", txFrequency);
|
|
|
|
LogInfo(" Power: %uW", power);
|
|
|
|
|
2020-08-27 09:13:02 +00:00
|
|
|
m_dmrNetwork->setConfig(m_callsign, rxFrequency, txFrequency, power, colorCode);
|
2016-01-14 18:45:04 +00:00
|
|
|
|
|
|
|
bool ret = m_dmrNetwork->open();
|
|
|
|
if (!ret) {
|
|
|
|
delete m_dmrNetwork;
|
|
|
|
m_dmrNetwork = NULL;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-01-25 18:11:44 +00:00
|
|
|
m_dmrNetwork->enable(true);
|
|
|
|
|
2016-01-14 18:45:04 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-05-16 20:57:32 +00:00
|
|
|
bool CMMDVMHost::createYSFNetwork()
|
|
|
|
{
|
2020-08-26 08:29:11 +00:00
|
|
|
std::string myAddress = m_conf.getFusionNetworkMyAddress();
|
|
|
|
unsigned int myPort = m_conf.getFusionNetworkMyPort();
|
2017-11-09 22:17:25 +00:00
|
|
|
std::string gatewayAddress = m_conf.getFusionNetworkGatewayAddress();
|
|
|
|
unsigned int gatewayPort = m_conf.getFusionNetworkGatewayPort();
|
2020-08-26 08:29:11 +00:00
|
|
|
m_ysfNetModeHang = m_conf.getFusionNetworkModeHang();
|
|
|
|
bool debug = m_conf.getFusionNetworkDebug();
|
2016-05-16 20:57:32 +00:00
|
|
|
|
|
|
|
LogInfo("System Fusion Network Parameters");
|
2016-06-07 20:17:57 +00:00
|
|
|
LogInfo(" Local Address: %s", myAddress.c_str());
|
|
|
|
LogInfo(" Local Port: %u", myPort);
|
2017-11-09 22:17:25 +00:00
|
|
|
LogInfo(" Gateway Address: %s", gatewayAddress.c_str());
|
|
|
|
LogInfo(" Gateway Port: %u", gatewayPort);
|
2017-09-01 08:25:54 +00:00
|
|
|
LogInfo(" Mode Hang: %us", m_ysfNetModeHang);
|
2016-05-16 20:57:32 +00:00
|
|
|
|
2017-11-09 22:17:25 +00:00
|
|
|
m_ysfNetwork = new CYSFNetwork(myAddress, myPort, gatewayAddress, gatewayPort, m_callsign, debug);
|
2016-05-16 20:57:32 +00:00
|
|
|
|
|
|
|
bool ret = m_ysfNetwork->open();
|
|
|
|
if (!ret) {
|
|
|
|
delete m_ysfNetwork;
|
|
|
|
m_ysfNetwork = NULL;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_ysfNetwork->enable(true);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-09-14 06:41:37 +00:00
|
|
|
bool CMMDVMHost::createP25Network()
|
|
|
|
{
|
|
|
|
std::string gatewayAddress = m_conf.getP25GatewayAddress();
|
|
|
|
unsigned int gatewayPort = m_conf.getP25GatewayPort();
|
|
|
|
unsigned int localPort = m_conf.getP25LocalPort();
|
2017-09-01 08:25:54 +00:00
|
|
|
m_p25NetModeHang = m_conf.getP25NetworkModeHang();
|
2016-09-14 06:41:37 +00:00
|
|
|
bool debug = m_conf.getP25NetworkDebug();
|
|
|
|
|
|
|
|
LogInfo("P25 Network Parameters");
|
|
|
|
LogInfo(" Gateway Address: %s", gatewayAddress.c_str());
|
|
|
|
LogInfo(" Gateway Port: %u", gatewayPort);
|
|
|
|
LogInfo(" Local Port: %u", localPort);
|
2017-09-01 08:25:54 +00:00
|
|
|
LogInfo(" Mode Hang: %us", m_p25NetModeHang);
|
2016-09-14 06:41:37 +00:00
|
|
|
|
|
|
|
m_p25Network = new CP25Network(gatewayAddress, gatewayPort, localPort, debug);
|
|
|
|
|
|
|
|
bool ret = m_p25Network->open();
|
|
|
|
if (!ret) {
|
|
|
|
delete m_p25Network;
|
|
|
|
m_p25Network = NULL;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_p25Network->enable(true);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-01-15 21:03:34 +00:00
|
|
|
bool CMMDVMHost::createNXDNNetwork()
|
|
|
|
{
|
2020-05-27 11:07:21 +00:00
|
|
|
std::string protocol = m_conf.getNXDNNetworkProtocol();
|
2018-03-12 20:55:53 +00:00
|
|
|
std::string gatewayAddress = m_conf.getNXDNGatewayAddress();
|
|
|
|
unsigned int gatewayPort = m_conf.getNXDNGatewayPort();
|
|
|
|
std::string localAddress = m_conf.getNXDNLocalAddress();
|
|
|
|
unsigned int localPort = m_conf.getNXDNLocalPort();
|
|
|
|
m_nxdnNetModeHang = m_conf.getNXDNNetworkModeHang();
|
|
|
|
bool debug = m_conf.getNXDNNetworkDebug();
|
2018-01-15 21:03:34 +00:00
|
|
|
|
|
|
|
LogInfo("NXDN Network Parameters");
|
2020-05-27 11:07:21 +00:00
|
|
|
LogInfo(" Protocol: %s", protocol.c_str());
|
2018-03-12 20:55:53 +00:00
|
|
|
LogInfo(" Gateway Address: %s", gatewayAddress.c_str());
|
|
|
|
LogInfo(" Gateway Port: %u", gatewayPort);
|
|
|
|
LogInfo(" Local Address: %s", localAddress.c_str());
|
|
|
|
LogInfo(" Local Port: %u", localPort);
|
2018-01-15 21:03:34 +00:00
|
|
|
LogInfo(" Mode Hang: %us", m_nxdnNetModeHang);
|
|
|
|
|
2020-05-27 11:07:21 +00:00
|
|
|
if (protocol == "Kenwood")
|
|
|
|
m_nxdnNetwork = new CNXDNKenwoodNetwork(localAddress, localPort, gatewayAddress, gatewayPort, debug);
|
|
|
|
else
|
|
|
|
m_nxdnNetwork = new CNXDNIcomNetwork(localAddress, localPort, gatewayAddress, gatewayPort, debug);
|
2018-01-15 21:03:34 +00:00
|
|
|
|
|
|
|
bool ret = m_nxdnNetwork->open();
|
|
|
|
if (!ret) {
|
|
|
|
delete m_nxdnNetwork;
|
|
|
|
m_nxdnNetwork = NULL;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_nxdnNetwork->enable(true);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-10-14 15:16:54 +00:00
|
|
|
bool CMMDVMHost::createM17Network()
|
|
|
|
{
|
|
|
|
std::string gatewayAddress = m_conf.getM17GatewayAddress();
|
|
|
|
unsigned int gatewayPort = m_conf.getM17GatewayPort();
|
|
|
|
unsigned int localPort = m_conf.getM17LocalPort();
|
|
|
|
m_m17NetModeHang = m_conf.getM17NetworkModeHang();
|
|
|
|
bool debug = m_conf.getM17NetworkDebug();
|
|
|
|
|
|
|
|
LogInfo("M17 Network Parameters");
|
|
|
|
LogInfo(" Gateway Address: %s", gatewayAddress.c_str());
|
|
|
|
LogInfo(" Gateway Port: %u", gatewayPort);
|
|
|
|
LogInfo(" Local Port: %u", localPort);
|
|
|
|
LogInfo(" Mode Hang: %us", m_m17NetModeHang);
|
|
|
|
|
2020-11-01 16:07:36 +00:00
|
|
|
m_m17Network = new CM17Network(localPort, gatewayAddress, gatewayPort, debug);
|
2020-10-14 15:16:54 +00:00
|
|
|
bool ret = m_m17Network->open();
|
|
|
|
if (!ret) {
|
|
|
|
delete m_m17Network;
|
|
|
|
m_m17Network = NULL;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_m17Network->enable(true);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-06-07 17:46:03 +00:00
|
|
|
bool CMMDVMHost::createPOCSAGNetwork()
|
|
|
|
{
|
|
|
|
std::string gatewayAddress = m_conf.getPOCSAGGatewayAddress();
|
|
|
|
unsigned int gatewayPort = m_conf.getPOCSAGGatewayPort();
|
|
|
|
std::string localAddress = m_conf.getPOCSAGLocalAddress();
|
|
|
|
unsigned int localPort = m_conf.getPOCSAGLocalPort();
|
|
|
|
m_pocsagNetModeHang = m_conf.getPOCSAGNetworkModeHang();
|
|
|
|
bool debug = m_conf.getPOCSAGNetworkDebug();
|
|
|
|
|
|
|
|
LogInfo("POCSAG Network Parameters");
|
|
|
|
LogInfo(" Gateway Address: %s", gatewayAddress.c_str());
|
|
|
|
LogInfo(" Gateway Port: %u", gatewayPort);
|
|
|
|
LogInfo(" Local Address: %s", localAddress.c_str());
|
|
|
|
LogInfo(" Local Port: %u", localPort);
|
|
|
|
LogInfo(" Mode Hang: %us", m_pocsagNetModeHang);
|
|
|
|
|
|
|
|
m_pocsagNetwork = new CPOCSAGNetwork(localAddress, localPort, gatewayAddress, gatewayPort, debug);
|
|
|
|
|
|
|
|
bool ret = m_pocsagNetwork->open();
|
|
|
|
if (!ret) {
|
|
|
|
delete m_pocsagNetwork;
|
|
|
|
m_pocsagNetwork = NULL;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_pocsagNetwork->enable(true);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-05-07 15:08:58 +00:00
|
|
|
bool CMMDVMHost::createFMNetwork()
|
|
|
|
{
|
|
|
|
std::string gatewayAddress = m_conf.getFMGatewayAddress();
|
|
|
|
unsigned int gatewayPort = m_conf.getFMGatewayPort();
|
|
|
|
std::string localAddress = m_conf.getFMLocalAddress();
|
|
|
|
unsigned int localPort = m_conf.getFMLocalPort();
|
2020-07-27 09:38:07 +00:00
|
|
|
unsigned int sampleRate = m_conf.getFMSampleRate();
|
2020-05-07 15:08:58 +00:00
|
|
|
m_fmNetModeHang = m_conf.getFMNetworkModeHang();
|
|
|
|
bool debug = m_conf.getFMNetworkDebug();
|
|
|
|
|
|
|
|
LogInfo("FM Network Parameters");
|
|
|
|
LogInfo(" Gateway Address: %s", gatewayAddress.c_str());
|
|
|
|
LogInfo(" Gateway Port: %u", gatewayPort);
|
|
|
|
LogInfo(" Local Address: %s", localAddress.c_str());
|
|
|
|
LogInfo(" Local Port: %u", localPort);
|
2020-07-27 09:38:07 +00:00
|
|
|
LogInfo(" Sample Rate: %u", sampleRate);
|
2020-05-07 15:08:58 +00:00
|
|
|
LogInfo(" Mode Hang: %us", m_fmNetModeHang);
|
|
|
|
|
2020-07-27 09:38:07 +00:00
|
|
|
m_fmNetwork = new CFMNetwork(localAddress, localPort, gatewayAddress, gatewayPort, sampleRate, debug);
|
2020-05-07 15:08:58 +00:00
|
|
|
|
|
|
|
bool ret = m_fmNetwork->open();
|
|
|
|
if (!ret) {
|
|
|
|
delete m_fmNetwork;
|
|
|
|
m_fmNetwork = NULL;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_fmNetwork->enable(true);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-06-08 15:33:20 +00:00
|
|
|
bool CMMDVMHost::createAX25Network()
|
|
|
|
{
|
2020-06-25 12:41:19 +00:00
|
|
|
std::string port = m_conf.getAX25NetworkPort();
|
2020-06-21 13:15:37 +00:00
|
|
|
unsigned int speed = m_conf.getAX25NetworkSpeed();
|
2020-06-25 12:41:19 +00:00
|
|
|
bool debug = m_conf.getAX25NetworkDebug();
|
2020-06-08 15:33:20 +00:00
|
|
|
|
|
|
|
LogInfo("AX.25 Network Parameters");
|
2020-06-21 13:15:37 +00:00
|
|
|
LogInfo(" Port: %s", port.c_str());
|
|
|
|
LogInfo(" Speed: %u", speed);
|
2020-06-08 15:33:20 +00:00
|
|
|
|
2020-06-21 13:15:37 +00:00
|
|
|
m_ax25Network = new CAX25Network(port, speed, debug);
|
2020-06-08 15:33:20 +00:00
|
|
|
|
|
|
|
bool ret = m_ax25Network->open();
|
|
|
|
if (!ret) {
|
|
|
|
delete m_ax25Network;
|
|
|
|
m_ax25Network = NULL;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_ax25Network->enable(true);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-01-14 18:45:04 +00:00
|
|
|
void CMMDVMHost::readParams()
|
|
|
|
{
|
2018-06-07 17:46:03 +00:00
|
|
|
m_dstarEnabled = m_conf.getDStarEnabled();
|
|
|
|
m_dmrEnabled = m_conf.getDMREnabled();
|
|
|
|
m_ysfEnabled = m_conf.getFusionEnabled();
|
|
|
|
m_p25Enabled = m_conf.getP25Enabled();
|
|
|
|
m_nxdnEnabled = m_conf.getNXDNEnabled();
|
2020-10-14 15:16:54 +00:00
|
|
|
m_m17Enabled = m_conf.getM17Enabled();
|
2018-06-07 17:46:03 +00:00
|
|
|
m_pocsagEnabled = m_conf.getPOCSAGEnabled();
|
2020-04-09 21:02:47 +00:00
|
|
|
m_fmEnabled = m_conf.getFMEnabled();
|
2020-06-08 15:33:20 +00:00
|
|
|
m_ax25Enabled = m_conf.getAX25Enabled();
|
2018-06-07 17:46:03 +00:00
|
|
|
m_duplex = m_conf.getDuplex();
|
|
|
|
m_callsign = m_conf.getCallsign();
|
|
|
|
m_id = m_conf.getId();
|
|
|
|
m_timeout = m_conf.getTimeout();
|
2016-06-22 17:03:56 +00:00
|
|
|
|
|
|
|
LogInfo("General Parameters");
|
|
|
|
LogInfo(" Callsign: %s", m_callsign.c_str());
|
2017-08-19 15:23:37 +00:00
|
|
|
LogInfo(" Id: %u", m_id);
|
2016-06-22 17:03:56 +00:00
|
|
|
LogInfo(" Duplex: %s", m_duplex ? "yes" : "no");
|
|
|
|
LogInfo(" Timeout: %us", m_timeout);
|
|
|
|
LogInfo(" D-Star: %s", m_dstarEnabled ? "enabled" : "disabled");
|
|
|
|
LogInfo(" DMR: %s", m_dmrEnabled ? "enabled" : "disabled");
|
|
|
|
LogInfo(" YSF: %s", m_ysfEnabled ? "enabled" : "disabled");
|
2016-09-08 17:38:59 +00:00
|
|
|
LogInfo(" P25: %s", m_p25Enabled ? "enabled" : "disabled");
|
2018-01-11 19:35:33 +00:00
|
|
|
LogInfo(" NXDN: %s", m_nxdnEnabled ? "enabled" : "disabled");
|
2020-10-14 15:16:54 +00:00
|
|
|
LogInfo(" M17: %s", m_m17Enabled ? "enabled" : "disabled");
|
2018-06-07 17:46:03 +00:00
|
|
|
LogInfo(" POCSAG: %s", m_pocsagEnabled ? "enabled" : "disabled");
|
2020-04-09 21:02:47 +00:00
|
|
|
LogInfo(" FM: %s", m_fmEnabled ? "enabled" : "disabled");
|
2020-06-08 15:33:20 +00:00
|
|
|
LogInfo(" AX.25: %s", m_ax25Enabled ? "enabled" : "disabled");
|
2016-01-14 18:45:04 +00:00
|
|
|
}
|
|
|
|
|
2016-05-10 17:26:52 +00:00
|
|
|
void CMMDVMHost::setMode(unsigned char mode)
|
2016-02-02 18:17:36 +00:00
|
|
|
{
|
|
|
|
assert(m_modem != NULL);
|
|
|
|
assert(m_display != NULL);
|
|
|
|
|
|
|
|
switch (mode) {
|
|
|
|
case MODE_DSTAR:
|
2019-01-19 21:28:58 +00:00
|
|
|
if (m_dstarNetwork != NULL)
|
|
|
|
m_dstarNetwork->enable(true);
|
2016-02-02 18:17:36 +00:00
|
|
|
if (m_dmrNetwork != NULL)
|
|
|
|
m_dmrNetwork->enable(false);
|
2016-05-16 20:57:32 +00:00
|
|
|
if (m_ysfNetwork != NULL)
|
|
|
|
m_ysfNetwork->enable(false);
|
2016-09-14 06:41:37 +00:00
|
|
|
if (m_p25Network != NULL)
|
|
|
|
m_p25Network->enable(false);
|
2018-01-15 21:03:34 +00:00
|
|
|
if (m_nxdnNetwork != NULL)
|
|
|
|
m_nxdnNetwork->enable(false);
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17Network != NULL)
|
|
|
|
m_m17Network->enable(false);
|
2018-06-07 17:46:03 +00:00
|
|
|
if (m_pocsagNetwork != NULL)
|
|
|
|
m_pocsagNetwork->enable(false);
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_fmNetwork != NULL)
|
|
|
|
m_fmNetwork->enable(false);
|
2020-06-09 13:32:05 +00:00
|
|
|
if (m_ax25Network != NULL)
|
|
|
|
m_ax25Network->enable(false);
|
2019-01-19 21:28:58 +00:00
|
|
|
if (m_dstar != NULL)
|
|
|
|
m_dstar->enable(true);
|
2019-01-19 17:15:24 +00:00
|
|
|
if (m_dmr != NULL)
|
|
|
|
m_dmr->enable(false);
|
|
|
|
if (m_ysf != NULL)
|
|
|
|
m_ysf->enable(false);
|
|
|
|
if (m_p25 != NULL)
|
|
|
|
m_p25->enable(false);
|
|
|
|
if (m_nxdn != NULL)
|
|
|
|
m_nxdn->enable(false);
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17 != NULL)
|
|
|
|
m_m17->enable(false);
|
2019-01-19 17:15:24 +00:00
|
|
|
if (m_pocsag != NULL)
|
|
|
|
m_pocsag->enable(false);
|
2020-05-07 20:49:18 +00:00
|
|
|
if (m_fm != NULL)
|
|
|
|
m_fm->enable(false);
|
2020-06-09 13:32:05 +00:00
|
|
|
if (m_ax25 != NULL)
|
|
|
|
m_ax25->enable(false);
|
2016-02-02 18:17:36 +00:00
|
|
|
m_modem->setMode(MODE_DSTAR);
|
|
|
|
m_mode = MODE_DSTAR;
|
|
|
|
m_modeTimer.start();
|
2016-10-17 17:01:38 +00:00
|
|
|
m_cwIdTimer.stop();
|
2018-10-11 06:50:30 +00:00
|
|
|
createLockFile("D-Star");
|
2016-02-02 18:17:36 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MODE_DMR:
|
|
|
|
if (m_dstarNetwork != NULL)
|
|
|
|
m_dstarNetwork->enable(false);
|
2019-01-19 21:28:58 +00:00
|
|
|
if (m_dmrNetwork != NULL)
|
|
|
|
m_dmrNetwork->enable(true);
|
2016-05-16 20:57:32 +00:00
|
|
|
if (m_ysfNetwork != NULL)
|
|
|
|
m_ysfNetwork->enable(false);
|
2016-09-14 06:41:37 +00:00
|
|
|
if (m_p25Network != NULL)
|
|
|
|
m_p25Network->enable(false);
|
2018-01-15 21:03:34 +00:00
|
|
|
if (m_nxdnNetwork != NULL)
|
|
|
|
m_nxdnNetwork->enable(false);
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17Network != NULL)
|
|
|
|
m_m17Network->enable(false);
|
2018-06-07 17:46:03 +00:00
|
|
|
if (m_pocsagNetwork != NULL)
|
|
|
|
m_pocsagNetwork->enable(false);
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_fmNetwork != NULL)
|
|
|
|
m_fmNetwork->enable(false);
|
2020-06-09 13:32:05 +00:00
|
|
|
if (m_ax25Network != NULL)
|
|
|
|
m_ax25Network->enable(false);
|
2019-01-19 17:15:24 +00:00
|
|
|
if (m_dstar != NULL)
|
|
|
|
m_dstar->enable(false);
|
2019-01-19 21:28:58 +00:00
|
|
|
if (m_dmr != NULL)
|
|
|
|
m_dmr->enable(true);
|
2019-01-19 17:15:24 +00:00
|
|
|
if (m_ysf != NULL)
|
|
|
|
m_ysf->enable(false);
|
|
|
|
if (m_p25 != NULL)
|
|
|
|
m_p25->enable(false);
|
|
|
|
if (m_nxdn != NULL)
|
|
|
|
m_nxdn->enable(false);
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17 != NULL)
|
|
|
|
m_m17->enable(false);
|
2019-01-19 17:15:24 +00:00
|
|
|
if (m_pocsag != NULL)
|
|
|
|
m_pocsag->enable(false);
|
2020-05-07 20:49:18 +00:00
|
|
|
if (m_fm != NULL)
|
|
|
|
m_fm->enable(false);
|
2020-06-09 13:32:05 +00:00
|
|
|
if (m_ax25 != NULL)
|
|
|
|
m_ax25->enable(false);
|
2016-03-29 16:59:15 +00:00
|
|
|
m_modem->setMode(MODE_DMR);
|
2016-05-05 16:56:18 +00:00
|
|
|
if (m_duplex) {
|
2016-03-25 20:54:51 +00:00
|
|
|
m_modem->writeDMRStart(true);
|
2016-05-05 16:56:18 +00:00
|
|
|
m_dmrTXTimer.start();
|
|
|
|
}
|
2016-02-02 18:17:36 +00:00
|
|
|
m_mode = MODE_DMR;
|
|
|
|
m_modeTimer.start();
|
2016-10-17 17:01:38 +00:00
|
|
|
m_cwIdTimer.stop();
|
2018-10-11 06:50:30 +00:00
|
|
|
createLockFile("DMR");
|
2016-02-02 18:17:36 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MODE_YSF:
|
|
|
|
if (m_dstarNetwork != NULL)
|
|
|
|
m_dstarNetwork->enable(false);
|
|
|
|
if (m_dmrNetwork != NULL)
|
|
|
|
m_dmrNetwork->enable(false);
|
2019-01-19 21:28:58 +00:00
|
|
|
if (m_ysfNetwork != NULL)
|
|
|
|
m_ysfNetwork->enable(true);
|
2016-09-14 06:41:37 +00:00
|
|
|
if (m_p25Network != NULL)
|
|
|
|
m_p25Network->enable(false);
|
2018-01-15 21:03:34 +00:00
|
|
|
if (m_nxdnNetwork != NULL)
|
|
|
|
m_nxdnNetwork->enable(false);
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17Network != NULL)
|
|
|
|
m_m17Network->enable(false);
|
2018-06-07 17:46:03 +00:00
|
|
|
if (m_pocsagNetwork != NULL)
|
|
|
|
m_pocsagNetwork->enable(false);
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_fmNetwork != NULL)
|
|
|
|
m_fmNetwork->enable(false);
|
2020-06-09 13:32:05 +00:00
|
|
|
if (m_ax25Network != NULL)
|
|
|
|
m_ax25Network->enable(false);
|
2019-01-19 17:15:24 +00:00
|
|
|
if (m_dstar != NULL)
|
|
|
|
m_dstar->enable(false);
|
|
|
|
if (m_dmr != NULL)
|
|
|
|
m_dmr->enable(false);
|
2019-01-19 21:28:58 +00:00
|
|
|
if (m_ysf != NULL)
|
|
|
|
m_ysf->enable(true);
|
2019-01-19 17:15:24 +00:00
|
|
|
if (m_p25 != NULL)
|
|
|
|
m_p25->enable(false);
|
|
|
|
if (m_nxdn != NULL)
|
|
|
|
m_nxdn->enable(false);
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17 != NULL)
|
|
|
|
m_m17->enable(false);
|
2019-01-19 17:15:24 +00:00
|
|
|
if (m_pocsag != NULL)
|
|
|
|
m_pocsag->enable(false);
|
2020-05-07 20:49:18 +00:00
|
|
|
if (m_fm != NULL)
|
|
|
|
m_fm->enable(false);
|
2020-06-09 13:32:05 +00:00
|
|
|
if (m_ax25 != NULL)
|
|
|
|
m_ax25->enable(false);
|
2016-02-02 18:17:36 +00:00
|
|
|
m_modem->setMode(MODE_YSF);
|
|
|
|
m_mode = MODE_YSF;
|
|
|
|
m_modeTimer.start();
|
2016-10-17 17:01:38 +00:00
|
|
|
m_cwIdTimer.stop();
|
2018-10-11 06:50:30 +00:00
|
|
|
createLockFile("System Fusion");
|
2016-02-02 18:17:36 +00:00
|
|
|
break;
|
|
|
|
|
2016-09-08 17:38:59 +00:00
|
|
|
case MODE_P25:
|
|
|
|
if (m_dstarNetwork != NULL)
|
|
|
|
m_dstarNetwork->enable(false);
|
|
|
|
if (m_dmrNetwork != NULL)
|
|
|
|
m_dmrNetwork->enable(false);
|
|
|
|
if (m_ysfNetwork != NULL)
|
|
|
|
m_ysfNetwork->enable(false);
|
2019-01-19 21:28:58 +00:00
|
|
|
if (m_p25Network != NULL)
|
|
|
|
m_p25Network->enable(true);
|
2018-01-15 21:03:34 +00:00
|
|
|
if (m_nxdnNetwork != NULL)
|
|
|
|
m_nxdnNetwork->enable(false);
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17Network != NULL)
|
|
|
|
m_m17Network->enable(false);
|
2018-06-07 17:46:03 +00:00
|
|
|
if (m_pocsagNetwork != NULL)
|
|
|
|
m_pocsagNetwork->enable(false);
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_fmNetwork != NULL)
|
|
|
|
m_fmNetwork->enable(false);
|
2020-06-09 13:32:05 +00:00
|
|
|
if (m_ax25Network != NULL)
|
|
|
|
m_ax25Network->enable(false);
|
2019-01-19 17:15:24 +00:00
|
|
|
if (m_dstar != NULL)
|
|
|
|
m_dstar->enable(false);
|
|
|
|
if (m_dmr != NULL)
|
|
|
|
m_dmr->enable(false);
|
|
|
|
if (m_ysf != NULL)
|
|
|
|
m_ysf->enable(false);
|
2019-01-19 21:28:58 +00:00
|
|
|
if (m_p25 != NULL)
|
|
|
|
m_p25->enable(true);
|
2019-01-19 17:15:24 +00:00
|
|
|
if (m_nxdn != NULL)
|
|
|
|
m_nxdn->enable(false);
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17 != NULL)
|
|
|
|
m_m17->enable(false);
|
2019-01-19 17:15:24 +00:00
|
|
|
if (m_pocsag != NULL)
|
|
|
|
m_pocsag->enable(false);
|
2020-05-07 20:49:18 +00:00
|
|
|
if (m_fm != NULL)
|
|
|
|
m_fm->enable(false);
|
2020-06-09 13:32:05 +00:00
|
|
|
if (m_ax25 != NULL)
|
|
|
|
m_ax25->enable(false);
|
2016-09-08 17:38:59 +00:00
|
|
|
m_modem->setMode(MODE_P25);
|
|
|
|
m_mode = MODE_P25;
|
|
|
|
m_modeTimer.start();
|
2016-10-17 17:01:38 +00:00
|
|
|
m_cwIdTimer.stop();
|
2018-10-11 06:50:30 +00:00
|
|
|
createLockFile("P25");
|
2016-09-08 17:38:59 +00:00
|
|
|
break;
|
|
|
|
|
2018-01-11 19:35:33 +00:00
|
|
|
case MODE_NXDN:
|
|
|
|
if (m_dstarNetwork != NULL)
|
|
|
|
m_dstarNetwork->enable(false);
|
|
|
|
if (m_dmrNetwork != NULL)
|
|
|
|
m_dmrNetwork->enable(false);
|
|
|
|
if (m_ysfNetwork != NULL)
|
|
|
|
m_ysfNetwork->enable(false);
|
|
|
|
if (m_p25Network != NULL)
|
|
|
|
m_p25Network->enable(false);
|
2019-01-19 21:28:58 +00:00
|
|
|
if (m_nxdnNetwork != NULL)
|
|
|
|
m_nxdnNetwork->enable(true);
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17Network != NULL)
|
|
|
|
m_m17Network->enable(false);
|
2018-06-07 17:46:03 +00:00
|
|
|
if (m_pocsagNetwork != NULL)
|
|
|
|
m_pocsagNetwork->enable(false);
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_fmNetwork != NULL)
|
|
|
|
m_fmNetwork->enable(false);
|
2020-06-09 13:32:05 +00:00
|
|
|
if (m_ax25Network != NULL)
|
|
|
|
m_ax25Network->enable(false);
|
2019-01-19 17:15:24 +00:00
|
|
|
if (m_dstar != NULL)
|
|
|
|
m_dstar->enable(false);
|
|
|
|
if (m_dmr != NULL)
|
|
|
|
m_dmr->enable(false);
|
|
|
|
if (m_ysf != NULL)
|
|
|
|
m_ysf->enable(false);
|
|
|
|
if (m_p25 != NULL)
|
|
|
|
m_p25->enable(false);
|
2019-01-19 21:28:58 +00:00
|
|
|
if (m_nxdn != NULL)
|
|
|
|
m_nxdn->enable(true);
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17 != NULL)
|
|
|
|
m_m17->enable(false);
|
2019-01-19 17:15:24 +00:00
|
|
|
if (m_pocsag != NULL)
|
|
|
|
m_pocsag->enable(false);
|
2020-05-07 20:49:18 +00:00
|
|
|
if (m_fm != NULL)
|
|
|
|
m_fm->enable(false);
|
2020-06-09 13:32:05 +00:00
|
|
|
if (m_ax25 != NULL)
|
|
|
|
m_ax25->enable(false);
|
2018-01-11 19:35:33 +00:00
|
|
|
m_modem->setMode(MODE_NXDN);
|
|
|
|
m_mode = MODE_NXDN;
|
|
|
|
m_modeTimer.start();
|
|
|
|
m_cwIdTimer.stop();
|
2018-10-11 06:50:30 +00:00
|
|
|
createLockFile("NXDN");
|
2018-01-11 19:35:33 +00:00
|
|
|
break;
|
|
|
|
|
2020-10-14 15:16:54 +00:00
|
|
|
case MODE_M17:
|
|
|
|
if (m_dstarNetwork != NULL)
|
|
|
|
m_dstarNetwork->enable(false);
|
|
|
|
if (m_dmrNetwork != NULL)
|
|
|
|
m_dmrNetwork->enable(false);
|
|
|
|
if (m_ysfNetwork != NULL)
|
|
|
|
m_ysfNetwork->enable(false);
|
|
|
|
if (m_p25Network != NULL)
|
|
|
|
m_p25Network->enable(false);
|
|
|
|
if (m_nxdnNetwork != NULL)
|
|
|
|
m_nxdnNetwork->enable(false);
|
|
|
|
if (m_m17Network != NULL)
|
|
|
|
m_m17Network->enable(true);
|
|
|
|
if (m_pocsagNetwork != NULL)
|
|
|
|
m_pocsagNetwork->enable(false);
|
|
|
|
if (m_dstar != NULL)
|
|
|
|
m_dstar->enable(false);
|
|
|
|
if (m_dmr != NULL)
|
|
|
|
m_dmr->enable(false);
|
|
|
|
if (m_ysf != NULL)
|
|
|
|
m_ysf->enable(false);
|
|
|
|
if (m_p25 != NULL)
|
|
|
|
m_p25->enable(false);
|
|
|
|
if (m_nxdn != NULL)
|
|
|
|
m_nxdn->enable(false);
|
|
|
|
if (m_m17 != NULL)
|
|
|
|
m_m17->enable(true);
|
|
|
|
if (m_pocsag != NULL)
|
|
|
|
m_pocsag->enable(false);
|
|
|
|
m_modem->setMode(MODE_M17);
|
|
|
|
m_mode = MODE_M17;
|
|
|
|
m_modeTimer.start();
|
|
|
|
m_cwIdTimer.stop();
|
|
|
|
createLockFile("M17");
|
|
|
|
break;
|
|
|
|
|
2018-06-07 17:46:03 +00:00
|
|
|
case MODE_POCSAG:
|
|
|
|
if (m_dstarNetwork != NULL)
|
|
|
|
m_dstarNetwork->enable(false);
|
|
|
|
if (m_dmrNetwork != NULL)
|
|
|
|
m_dmrNetwork->enable(false);
|
|
|
|
if (m_ysfNetwork != NULL)
|
|
|
|
m_ysfNetwork->enable(false);
|
|
|
|
if (m_p25Network != NULL)
|
|
|
|
m_p25Network->enable(false);
|
|
|
|
if (m_nxdnNetwork != NULL)
|
|
|
|
m_nxdnNetwork->enable(false);
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17Network != NULL)
|
|
|
|
m_m17Network->enable(false);
|
2019-01-19 21:28:58 +00:00
|
|
|
if (m_pocsagNetwork != NULL)
|
|
|
|
m_pocsagNetwork->enable(true);
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_fmNetwork != NULL)
|
|
|
|
m_fmNetwork->enable(false);
|
2020-06-09 13:32:05 +00:00
|
|
|
if (m_ax25Network != NULL)
|
|
|
|
m_ax25Network->enable(false);
|
2019-01-19 17:15:24 +00:00
|
|
|
if (m_dstar != NULL)
|
|
|
|
m_dstar->enable(false);
|
|
|
|
if (m_dmr != NULL)
|
|
|
|
m_dmr->enable(false);
|
|
|
|
if (m_ysf != NULL)
|
|
|
|
m_ysf->enable(false);
|
|
|
|
if (m_p25 != NULL)
|
|
|
|
m_p25->enable(false);
|
|
|
|
if (m_nxdn != NULL)
|
|
|
|
m_nxdn->enable(false);
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17 != NULL)
|
|
|
|
m_m17->enable(false);
|
2019-01-19 21:28:58 +00:00
|
|
|
if (m_pocsag != NULL)
|
|
|
|
m_pocsag->enable(true);
|
2020-05-07 20:49:18 +00:00
|
|
|
if (m_fm != NULL)
|
|
|
|
m_fm->enable(false);
|
2020-06-09 13:32:05 +00:00
|
|
|
if (m_ax25 != NULL)
|
|
|
|
m_ax25->enable(false);
|
2018-06-07 17:46:03 +00:00
|
|
|
m_modem->setMode(MODE_POCSAG);
|
|
|
|
m_mode = MODE_POCSAG;
|
|
|
|
m_modeTimer.start();
|
|
|
|
m_cwIdTimer.stop();
|
2018-10-11 06:50:30 +00:00
|
|
|
createLockFile("POCSAG");
|
2018-06-07 17:46:03 +00:00
|
|
|
break;
|
|
|
|
|
2020-04-11 19:42:05 +00:00
|
|
|
case MODE_FM:
|
|
|
|
if (m_dstarNetwork != NULL)
|
|
|
|
m_dstarNetwork->enable(false);
|
|
|
|
if (m_dmrNetwork != NULL)
|
|
|
|
m_dmrNetwork->enable(false);
|
|
|
|
if (m_ysfNetwork != NULL)
|
|
|
|
m_ysfNetwork->enable(false);
|
|
|
|
if (m_p25Network != NULL)
|
|
|
|
m_p25Network->enable(false);
|
|
|
|
if (m_nxdnNetwork != NULL)
|
|
|
|
m_nxdnNetwork->enable(false);
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17Network != NULL)
|
|
|
|
m_m17Network->enable(false);
|
2020-04-11 19:42:05 +00:00
|
|
|
if (m_pocsagNetwork != NULL)
|
|
|
|
m_pocsagNetwork->enable(false);
|
2020-05-07 20:49:18 +00:00
|
|
|
if (m_fmNetwork != NULL)
|
2020-05-11 14:32:39 +00:00
|
|
|
m_fmNetwork->enable(true);
|
2020-06-09 13:32:05 +00:00
|
|
|
if (m_ax25Network != NULL)
|
|
|
|
m_ax25Network->enable(true);
|
2020-04-11 19:42:05 +00:00
|
|
|
if (m_dstar != NULL)
|
|
|
|
m_dstar->enable(false);
|
|
|
|
if (m_dmr != NULL)
|
|
|
|
m_dmr->enable(false);
|
|
|
|
if (m_ysf != NULL)
|
|
|
|
m_ysf->enable(false);
|
|
|
|
if (m_p25 != NULL)
|
|
|
|
m_p25->enable(false);
|
|
|
|
if (m_nxdn != NULL)
|
|
|
|
m_nxdn->enable(false);
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17 != NULL)
|
|
|
|
m_m17->enable(false);
|
2020-04-11 19:42:05 +00:00
|
|
|
if (m_pocsag != NULL)
|
|
|
|
m_pocsag->enable(false);
|
2020-05-07 20:49:18 +00:00
|
|
|
if (m_fm != NULL)
|
|
|
|
m_fm->enable(true);
|
2020-06-09 13:32:05 +00:00
|
|
|
if (m_ax25 != NULL)
|
|
|
|
m_ax25->enable(true);
|
2020-04-11 19:42:05 +00:00
|
|
|
if (m_mode == MODE_DMR && m_duplex && m_modem->hasTX()) {
|
|
|
|
m_modem->writeDMRStart(false);
|
|
|
|
m_dmrTXTimer.stop();
|
|
|
|
}
|
2020-05-11 14:32:39 +00:00
|
|
|
m_modem->setMode(MODE_FM);
|
2020-04-11 19:42:05 +00:00
|
|
|
m_display->setFM();
|
|
|
|
m_mode = MODE_FM;
|
2020-05-11 14:32:39 +00:00
|
|
|
m_modeTimer.start();
|
2020-04-11 19:42:05 +00:00
|
|
|
m_cwIdTimer.stop();
|
|
|
|
createLockFile("FM");
|
|
|
|
break;
|
|
|
|
|
2016-03-03 18:01:01 +00:00
|
|
|
case MODE_LOCKOUT:
|
|
|
|
if (m_dstarNetwork != NULL)
|
|
|
|
m_dstarNetwork->enable(false);
|
|
|
|
if (m_dmrNetwork != NULL)
|
|
|
|
m_dmrNetwork->enable(false);
|
2016-05-16 20:57:32 +00:00
|
|
|
if (m_ysfNetwork != NULL)
|
|
|
|
m_ysfNetwork->enable(false);
|
2016-09-14 06:41:37 +00:00
|
|
|
if (m_p25Network != NULL)
|
|
|
|
m_p25Network->enable(false);
|
2018-01-15 21:03:34 +00:00
|
|
|
if (m_nxdnNetwork != NULL)
|
|
|
|
m_nxdnNetwork->enable(false);
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17Network != NULL)
|
|
|
|
m_m17Network->enable(false);
|
2018-06-07 17:46:03 +00:00
|
|
|
if (m_pocsagNetwork != NULL)
|
|
|
|
m_pocsagNetwork->enable(false);
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_fmNetwork != NULL)
|
|
|
|
m_fmNetwork->enable(false);
|
2020-06-09 13:32:05 +00:00
|
|
|
if (m_ax25Network != NULL)
|
|
|
|
m_ax25Network->enable(false);
|
2019-01-19 17:15:24 +00:00
|
|
|
if (m_dstar != NULL)
|
|
|
|
m_dstar->enable(false);
|
|
|
|
if (m_dmr != NULL)
|
|
|
|
m_dmr->enable(false);
|
|
|
|
if (m_ysf != NULL)
|
|
|
|
m_ysf->enable(false);
|
|
|
|
if (m_p25 != NULL)
|
|
|
|
m_p25->enable(false);
|
|
|
|
if (m_nxdn != NULL)
|
|
|
|
m_nxdn->enable(false);
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17 != NULL)
|
|
|
|
m_m17->enable(false);
|
2019-01-19 17:15:24 +00:00
|
|
|
if (m_pocsag != NULL)
|
|
|
|
m_pocsag->enable(false);
|
2020-05-07 20:49:18 +00:00
|
|
|
if (m_fm != NULL)
|
|
|
|
m_fm->enable(false);
|
2020-06-09 13:32:05 +00:00
|
|
|
if (m_ax25 != NULL)
|
|
|
|
m_ax25->enable(false);
|
2016-05-05 16:56:18 +00:00
|
|
|
if (m_mode == MODE_DMR && m_duplex && m_modem->hasTX()) {
|
2016-03-03 18:01:01 +00:00
|
|
|
m_modem->writeDMRStart(false);
|
2016-05-05 16:56:18 +00:00
|
|
|
m_dmrTXTimer.stop();
|
|
|
|
}
|
2016-03-29 16:59:15 +00:00
|
|
|
m_modem->setMode(MODE_IDLE);
|
2016-03-03 18:01:01 +00:00
|
|
|
m_display->setLockout();
|
|
|
|
m_mode = MODE_LOCKOUT;
|
|
|
|
m_modeTimer.stop();
|
2016-05-09 20:55:44 +00:00
|
|
|
m_cwIdTimer.stop();
|
2018-10-11 06:50:30 +00:00
|
|
|
removeLockFile();
|
2016-03-03 18:01:01 +00:00
|
|
|
break;
|
|
|
|
|
2016-03-21 22:47:58 +00:00
|
|
|
case MODE_ERROR:
|
2016-05-10 17:26:52 +00:00
|
|
|
LogMessage("Mode set to Error");
|
2016-03-21 22:47:58 +00:00
|
|
|
if (m_dstarNetwork != NULL)
|
|
|
|
m_dstarNetwork->enable(false);
|
|
|
|
if (m_dmrNetwork != NULL)
|
|
|
|
m_dmrNetwork->enable(false);
|
2016-05-16 20:57:32 +00:00
|
|
|
if (m_ysfNetwork != NULL)
|
|
|
|
m_ysfNetwork->enable(false);
|
2016-09-14 06:41:37 +00:00
|
|
|
if (m_p25Network != NULL)
|
|
|
|
m_p25Network->enable(false);
|
2018-01-15 21:03:34 +00:00
|
|
|
if (m_nxdnNetwork != NULL)
|
|
|
|
m_nxdnNetwork->enable(false);
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17Network != NULL)
|
|
|
|
m_m17Network->enable(false);
|
2018-06-07 17:46:03 +00:00
|
|
|
if (m_pocsagNetwork != NULL)
|
|
|
|
m_pocsagNetwork->enable(false);
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_fmNetwork != NULL)
|
|
|
|
m_fmNetwork->enable(false);
|
2020-06-09 13:32:05 +00:00
|
|
|
if (m_ax25Network != NULL)
|
|
|
|
m_ax25Network->enable(false);
|
2019-01-19 17:15:24 +00:00
|
|
|
if (m_dstar != NULL)
|
|
|
|
m_dstar->enable(false);
|
|
|
|
if (m_dmr != NULL)
|
|
|
|
m_dmr->enable(false);
|
|
|
|
if (m_ysf != NULL)
|
|
|
|
m_ysf->enable(false);
|
|
|
|
if (m_p25 != NULL)
|
|
|
|
m_p25->enable(false);
|
|
|
|
if (m_nxdn != NULL)
|
|
|
|
m_nxdn->enable(false);
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17 != NULL)
|
|
|
|
m_m17->enable(false);
|
2019-01-19 17:15:24 +00:00
|
|
|
if (m_pocsag != NULL)
|
|
|
|
m_pocsag->enable(false);
|
2020-05-07 20:49:18 +00:00
|
|
|
if (m_fm != NULL)
|
|
|
|
m_fm->enable(false);
|
2020-06-09 13:32:05 +00:00
|
|
|
if (m_ax25 != NULL)
|
|
|
|
m_ax25->enable(false);
|
2016-05-05 16:56:18 +00:00
|
|
|
if (m_mode == MODE_DMR && m_duplex && m_modem->hasTX()) {
|
|
|
|
m_modem->writeDMRStart(false);
|
|
|
|
m_dmrTXTimer.stop();
|
|
|
|
}
|
2016-03-21 22:47:58 +00:00
|
|
|
m_display->setError("MODEM");
|
|
|
|
m_mode = MODE_ERROR;
|
|
|
|
m_modeTimer.stop();
|
2016-05-09 20:55:44 +00:00
|
|
|
m_cwIdTimer.stop();
|
2018-10-11 06:50:30 +00:00
|
|
|
removeLockFile();
|
2016-03-21 22:47:58 +00:00
|
|
|
break;
|
|
|
|
|
2016-02-02 18:17:36 +00:00
|
|
|
default:
|
|
|
|
if (m_dstarNetwork != NULL)
|
|
|
|
m_dstarNetwork->enable(true);
|
|
|
|
if (m_dmrNetwork != NULL)
|
|
|
|
m_dmrNetwork->enable(true);
|
2016-05-16 20:57:32 +00:00
|
|
|
if (m_ysfNetwork != NULL)
|
|
|
|
m_ysfNetwork->enable(true);
|
2016-09-14 06:41:37 +00:00
|
|
|
if (m_p25Network != NULL)
|
|
|
|
m_p25Network->enable(true);
|
2018-01-15 21:03:34 +00:00
|
|
|
if (m_nxdnNetwork != NULL)
|
2018-02-08 00:19:51 +00:00
|
|
|
m_nxdnNetwork->enable(true);
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17Network != NULL)
|
|
|
|
m_m17Network->enable(true);
|
2018-06-07 17:46:03 +00:00
|
|
|
if (m_pocsagNetwork != NULL)
|
|
|
|
m_pocsagNetwork->enable(true);
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_fmNetwork != NULL)
|
|
|
|
m_fmNetwork->enable(true);
|
2020-06-09 13:32:05 +00:00
|
|
|
if (m_ax25Network != NULL)
|
|
|
|
m_ax25Network->enable(true);
|
2019-01-19 17:15:24 +00:00
|
|
|
if (m_dstar != NULL)
|
2019-01-19 21:28:58 +00:00
|
|
|
m_dstar->enable(true);
|
2019-01-19 17:15:24 +00:00
|
|
|
if (m_dmr != NULL)
|
2019-01-19 21:28:58 +00:00
|
|
|
m_dmr->enable(true);
|
2019-01-19 17:15:24 +00:00
|
|
|
if (m_ysf != NULL)
|
2019-01-19 21:28:58 +00:00
|
|
|
m_ysf->enable(true);
|
2019-01-19 17:15:24 +00:00
|
|
|
if (m_p25 != NULL)
|
2019-01-19 21:28:58 +00:00
|
|
|
m_p25->enable(true);
|
2019-01-19 17:15:24 +00:00
|
|
|
if (m_nxdn != NULL)
|
2019-01-19 21:28:58 +00:00
|
|
|
m_nxdn->enable(true);
|
2020-10-14 15:16:54 +00:00
|
|
|
if (m_m17 != NULL)
|
|
|
|
m_m17->enable(true);
|
2019-01-19 17:15:24 +00:00
|
|
|
if (m_pocsag != NULL)
|
2019-01-19 21:28:58 +00:00
|
|
|
m_pocsag->enable(true);
|
2020-05-07 20:49:18 +00:00
|
|
|
if (m_fm != NULL)
|
|
|
|
m_fm->enable(true);
|
2020-06-09 13:32:05 +00:00
|
|
|
if (m_ax25 != NULL)
|
|
|
|
m_ax25->enable(true);
|
2016-05-05 16:56:18 +00:00
|
|
|
if (m_mode == MODE_DMR && m_duplex && m_modem->hasTX()) {
|
2016-02-02 18:17:36 +00:00
|
|
|
m_modem->writeDMRStart(false);
|
2016-05-05 16:56:18 +00:00
|
|
|
m_dmrTXTimer.stop();
|
|
|
|
}
|
2016-03-29 16:59:15 +00:00
|
|
|
m_modem->setMode(MODE_IDLE);
|
2017-03-07 13:39:41 +00:00
|
|
|
if (m_mode == MODE_ERROR) {
|
2016-05-12 17:04:50 +00:00
|
|
|
m_modem->sendCWId(m_callsign);
|
2016-10-17 17:01:38 +00:00
|
|
|
m_cwIdTimer.setTimeout(m_cwIdTime);
|
|
|
|
m_cwIdTimer.start();
|
|
|
|
} else {
|
|
|
|
m_cwIdTimer.setTimeout(m_cwIdTime / 4U);
|
2016-05-12 17:04:50 +00:00
|
|
|
m_cwIdTimer.start();
|
|
|
|
}
|
2016-02-02 18:17:36 +00:00
|
|
|
m_display->setIdle();
|
2018-10-11 06:50:30 +00:00
|
|
|
if (mode == MODE_QUIT)
|
2018-08-15 16:17:42 +00:00
|
|
|
m_display->setQuit();
|
2016-02-02 18:17:36 +00:00
|
|
|
m_mode = MODE_IDLE;
|
|
|
|
m_modeTimer.stop();
|
2018-10-10 19:05:24 +00:00
|
|
|
removeLockFile();
|
2016-02-02 18:17:36 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2018-10-10 19:05:24 +00:00
|
|
|
|
2018-10-11 06:50:30 +00:00
|
|
|
void CMMDVMHost::createLockFile(const char* mode) const
|
2018-10-10 19:05:24 +00:00
|
|
|
{
|
|
|
|
if (m_lockFileEnabled) {
|
2018-10-11 06:50:30 +00:00
|
|
|
FILE* fp = ::fopen(m_lockFileName.c_str(), "wt");
|
|
|
|
if (fp != NULL) {
|
|
|
|
::fprintf(fp, "%s\n", mode);
|
2018-10-10 19:05:24 +00:00
|
|
|
::fclose(fp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-11 06:50:30 +00:00
|
|
|
void CMMDVMHost::removeLockFile() const
|
2018-10-10 19:05:24 +00:00
|
|
|
{
|
2018-10-11 06:50:30 +00:00
|
|
|
if (m_lockFileEnabled)
|
|
|
|
::remove(m_lockFileName.c_str());
|
2018-10-10 19:05:24 +00:00
|
|
|
}
|
2018-10-11 06:50:30 +00:00
|
|
|
|
2019-01-10 09:05:15 +00:00
|
|
|
void CMMDVMHost::remoteControl()
|
|
|
|
{
|
2019-01-11 13:02:33 +00:00
|
|
|
if (m_remoteControl == NULL)
|
2019-01-10 09:05:15 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
REMOTE_COMMAND command = m_remoteControl->getCommand();
|
2019-01-22 14:56:15 +00:00
|
|
|
switch (command) {
|
2019-01-10 09:05:15 +00:00
|
|
|
case RCD_MODE_IDLE:
|
2019-01-22 14:38:38 +00:00
|
|
|
m_fixedMode = false;
|
|
|
|
setMode(MODE_IDLE);
|
2019-01-10 09:05:15 +00:00
|
|
|
break;
|
|
|
|
case RCD_MODE_LOCKOUT:
|
2019-01-22 14:38:38 +00:00
|
|
|
m_fixedMode = false;
|
|
|
|
setMode(MODE_LOCKOUT);
|
2019-01-10 09:05:15 +00:00
|
|
|
break;
|
|
|
|
case RCD_MODE_DSTAR:
|
2019-01-22 14:38:38 +00:00
|
|
|
if (m_dstar != NULL)
|
|
|
|
processModeCommand(MODE_DSTAR, m_dstarRFModeHang);
|
2019-01-10 09:05:15 +00:00
|
|
|
break;
|
|
|
|
case RCD_MODE_DMR:
|
2019-01-22 14:56:15 +00:00
|
|
|
if (m_dmr != NULL)
|
2019-01-22 14:38:38 +00:00
|
|
|
processModeCommand(MODE_DMR, m_dmrRFModeHang);
|
2019-01-10 09:05:15 +00:00
|
|
|
break;
|
|
|
|
case RCD_MODE_YSF:
|
2019-01-22 14:38:38 +00:00
|
|
|
if (m_ysf != NULL)
|
|
|
|
processModeCommand(MODE_YSF, m_ysfRFModeHang);
|
2019-01-10 09:05:15 +00:00
|
|
|
break;
|
|
|
|
case RCD_MODE_P25:
|
2019-01-22 14:38:38 +00:00
|
|
|
if (m_p25 != NULL)
|
|
|
|
processModeCommand(MODE_P25, m_p25RFModeHang);
|
2019-01-10 09:05:15 +00:00
|
|
|
break;
|
|
|
|
case RCD_MODE_NXDN:
|
2019-01-22 14:38:38 +00:00
|
|
|
if (m_nxdn != NULL)
|
|
|
|
processModeCommand(MODE_NXDN, m_nxdnRFModeHang);
|
2019-01-10 09:05:15 +00:00
|
|
|
break;
|
2020-10-14 15:16:54 +00:00
|
|
|
case RCD_MODE_M17:
|
|
|
|
if (m_m17 != NULL)
|
|
|
|
processModeCommand(MODE_M17, m_m17RFModeHang);
|
|
|
|
break;
|
2020-05-02 20:40:55 +00:00
|
|
|
case RCD_MODE_FM:
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_fmEnabled)
|
2020-05-02 20:40:55 +00:00
|
|
|
processModeCommand(MODE_FM, 0);
|
|
|
|
break;
|
|
|
|
case RCD_ENABLE_DSTAR:
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_dstar != NULL && !m_dstarEnabled)
|
2020-05-02 20:40:55 +00:00
|
|
|
processEnableCommand(m_dstarEnabled, true);
|
2020-06-25 12:41:19 +00:00
|
|
|
if (m_dstarNetwork != NULL)
|
|
|
|
m_dstarNetwork->enable(true);
|
2020-05-02 20:40:55 +00:00
|
|
|
break;
|
|
|
|
case RCD_ENABLE_DMR:
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_dmr != NULL && !m_dmrEnabled)
|
2020-05-02 20:40:55 +00:00
|
|
|
processEnableCommand(m_dmrEnabled, true);
|
2020-06-25 12:41:19 +00:00
|
|
|
if (m_dmrNetwork != NULL)
|
|
|
|
m_dmrNetwork->enable(true);
|
2020-05-02 20:40:55 +00:00
|
|
|
break;
|
|
|
|
case RCD_ENABLE_YSF:
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_ysf != NULL && !m_ysfEnabled)
|
2020-05-02 20:40:55 +00:00
|
|
|
processEnableCommand(m_ysfEnabled, true);
|
2020-06-25 12:41:19 +00:00
|
|
|
if (m_ysfNetwork != NULL)
|
|
|
|
m_ysfNetwork->enable(true);
|
2020-05-02 20:40:55 +00:00
|
|
|
break;
|
|
|
|
case RCD_ENABLE_P25:
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_p25 != NULL && !m_p25Enabled)
|
2020-05-02 20:40:55 +00:00
|
|
|
processEnableCommand(m_p25Enabled, true);
|
2020-06-25 12:41:19 +00:00
|
|
|
if (m_p25Network != NULL)
|
|
|
|
m_p25Network->enable(true);
|
2020-05-02 20:40:55 +00:00
|
|
|
break;
|
|
|
|
case RCD_ENABLE_NXDN:
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_nxdn != NULL && !m_nxdnEnabled)
|
2020-05-02 20:40:55 +00:00
|
|
|
processEnableCommand(m_nxdnEnabled, true);
|
2020-06-25 12:41:19 +00:00
|
|
|
if (m_nxdnNetwork != NULL)
|
|
|
|
m_nxdnNetwork->enable(true);
|
2020-05-02 20:40:55 +00:00
|
|
|
break;
|
2020-10-14 15:16:54 +00:00
|
|
|
case RCD_ENABLE_M17:
|
|
|
|
if (m_m17 != NULL && m_m17Enabled == false)
|
|
|
|
processEnableCommand(m_m17Enabled, true);
|
|
|
|
if (m_m17Network != NULL)
|
|
|
|
m_m17Network->enable(true);
|
|
|
|
break;
|
2020-05-02 20:40:55 +00:00
|
|
|
case RCD_ENABLE_FM:
|
2020-06-08 15:33:20 +00:00
|
|
|
if (!m_fmEnabled)
|
2020-05-02 20:40:55 +00:00
|
|
|
processEnableCommand(m_fmEnabled, true);
|
|
|
|
break;
|
2020-06-08 15:33:20 +00:00
|
|
|
case RCD_ENABLE_AX25:
|
|
|
|
if (!m_ax25Enabled)
|
|
|
|
processEnableCommand(m_ax25Enabled, true);
|
|
|
|
break;
|
2020-05-02 20:40:55 +00:00
|
|
|
case RCD_DISABLE_DSTAR:
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_dstar != NULL && m_dstarEnabled)
|
2020-05-02 20:40:55 +00:00
|
|
|
processEnableCommand(m_dstarEnabled, false);
|
2020-06-25 12:41:19 +00:00
|
|
|
if (m_dstarNetwork != NULL)
|
|
|
|
m_dstarNetwork->enable(false);
|
2020-05-02 20:40:55 +00:00
|
|
|
break;
|
|
|
|
case RCD_DISABLE_DMR:
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_dmr != NULL && m_dmrEnabled)
|
2020-05-02 20:40:55 +00:00
|
|
|
processEnableCommand(m_dmrEnabled, false);
|
2020-06-25 12:41:19 +00:00
|
|
|
if (m_dmrNetwork != NULL)
|
|
|
|
m_dmrNetwork->enable(false);
|
2020-05-02 20:40:55 +00:00
|
|
|
break;
|
|
|
|
case RCD_DISABLE_YSF:
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_ysf != NULL && m_ysfEnabled)
|
2020-05-02 20:40:55 +00:00
|
|
|
processEnableCommand(m_ysfEnabled, false);
|
2020-06-25 12:41:19 +00:00
|
|
|
if (m_ysfNetwork != NULL)
|
|
|
|
m_ysfNetwork->enable(false);
|
2020-05-02 20:40:55 +00:00
|
|
|
break;
|
|
|
|
case RCD_DISABLE_P25:
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_p25 != NULL && m_p25Enabled)
|
2020-05-02 20:40:55 +00:00
|
|
|
processEnableCommand(m_p25Enabled, false);
|
2020-06-25 12:41:19 +00:00
|
|
|
if (m_p25Network != NULL)
|
|
|
|
m_p25Network->enable(false);
|
2020-05-02 20:40:55 +00:00
|
|
|
break;
|
|
|
|
case RCD_DISABLE_NXDN:
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_nxdn != NULL && m_nxdnEnabled)
|
2020-05-02 20:40:55 +00:00
|
|
|
processEnableCommand(m_nxdnEnabled, false);
|
2020-06-25 12:41:19 +00:00
|
|
|
if (m_nxdnNetwork != NULL)
|
|
|
|
m_nxdnNetwork->enable(false);
|
2020-05-02 20:40:55 +00:00
|
|
|
break;
|
2020-10-14 15:16:54 +00:00
|
|
|
case RCD_DISABLE_M17:
|
|
|
|
if (m_m17 != NULL && m_m17Enabled == true)
|
|
|
|
processEnableCommand(m_m17Enabled, false);
|
|
|
|
if (m_m17Network != NULL)
|
|
|
|
m_m17Network->enable(false);
|
|
|
|
break;
|
2020-05-02 20:40:55 +00:00
|
|
|
case RCD_DISABLE_FM:
|
2020-05-07 15:08:58 +00:00
|
|
|
if (m_fmEnabled)
|
2020-05-02 20:40:55 +00:00
|
|
|
processEnableCommand(m_fmEnabled, false);
|
|
|
|
break;
|
2020-06-08 15:33:20 +00:00
|
|
|
case RCD_DISABLE_AX25:
|
|
|
|
if (m_ax25Enabled == true)
|
|
|
|
processEnableCommand(m_ax25Enabled, false);
|
|
|
|
break;
|
2019-01-22 21:33:49 +00:00
|
|
|
case RCD_PAGE:
|
|
|
|
if (m_pocsag != NULL) {
|
|
|
|
unsigned int ric = m_remoteControl->getArgUInt(0U);
|
|
|
|
std::string text;
|
|
|
|
for (unsigned int i = 1U; i < m_remoteControl->getArgCount(); i++) {
|
|
|
|
if (i > 1U)
|
|
|
|
text += " ";
|
|
|
|
text += m_remoteControl->getArgString(i);
|
|
|
|
}
|
|
|
|
m_pocsag->sendPage(ric, text);
|
|
|
|
}
|
2020-10-14 15:16:54 +00:00
|
|
|
break;
|
2020-05-05 18:24:29 +00:00
|
|
|
case RCD_CW:
|
2020-05-05 18:30:56 +00:00
|
|
|
setMode(MODE_IDLE); // Force the modem to go idle so that we can send the CW text.
|
2020-06-09 13:32:05 +00:00
|
|
|
if (!m_modem->hasTX()) {
|
2020-10-14 15:16:54 +00:00
|
|
|
std::string cwtext;
|
2020-06-09 13:32:05 +00:00
|
|
|
for (unsigned int i = 0U; i < m_remoteControl->getArgCount(); i++) {
|
|
|
|
if (i > 0U)
|
|
|
|
cwtext += " ";
|
|
|
|
cwtext += m_remoteControl->getArgString(i);
|
|
|
|
}
|
|
|
|
m_display->writeCW();
|
|
|
|
m_modem->sendCWId(cwtext);
|
2020-10-14 15:16:54 +00:00
|
|
|
}
|
|
|
|
break;
|
2019-01-10 09:05:15 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2019-01-22 14:38:38 +00:00
|
|
|
|
|
|
|
void CMMDVMHost::processModeCommand(unsigned char mode, unsigned int timeout)
|
|
|
|
{
|
|
|
|
m_fixedMode = false;
|
|
|
|
m_modeTimer.setTimeout(timeout);
|
|
|
|
|
|
|
|
if (m_remoteControl->getArgCount() > 0U) {
|
|
|
|
if (m_remoteControl->getArgString(0U) == "fixed") {
|
|
|
|
m_fixedMode = true;
|
|
|
|
} else {
|
|
|
|
unsigned int t = m_remoteControl->getArgUInt(0U);
|
|
|
|
if (t > 0U)
|
|
|
|
m_modeTimer.setTimeout(t);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
setMode(mode);
|
|
|
|
}
|
2020-05-02 20:40:55 +00:00
|
|
|
|
|
|
|
void CMMDVMHost::processEnableCommand(bool& mode, bool enabled)
|
|
|
|
{
|
|
|
|
LogDebug("Setting mode current=%s new=%s",mode ? "true" : "false",enabled ? "true" : "false");
|
2020-10-14 15:16:54 +00:00
|
|
|
|
|
|
|
mode = enabled;
|
|
|
|
|
2020-11-06 15:43:12 +00:00
|
|
|
m_modem->setModeParams(m_dstarEnabled, m_dmrEnabled, m_ysfEnabled, m_p25Enabled, m_nxdnEnabled, m_m17Enabled, m_pocsagEnabled, m_fmEnabled, m_ax25Enabled);
|
2020-05-02 20:40:55 +00:00
|
|
|
if (!m_modem->writeConfig())
|
|
|
|
LogError("Cannot write Config to MMDVM");
|
|
|
|
}
|