diff --git a/QnetGateway.cpp b/QnetGateway.cpp index 5db675e..4ab93a7 100644 --- a/QnetGateway.cpp +++ b/QnetGateway.cpp @@ -54,7 +54,7 @@ #define CFG_DIR "/usr/local/etc" #endif -const std::string GW_VERSION("QnetGateway-515"); +const std::string GW_VERSION("QnetGateway-518"); static std::atomic keep_running(true); @@ -2154,9 +2154,17 @@ void CQnetGateway::PlayFileThread(SECHO &edata) fclose(fp); return; } + int mod = dsvt.hdr.rpt1[7] - 'A'; + + if (! Rptr.mod[mod].defined) { + fprintf(stderr, "Module %c is not configured, erasing file %s\n", mod+'A', edata.file); + unlink(edata.file); + return; + } + if (mod<0 || mod>2) { - fprintf(stderr, "unknown module suffix '%s'\n", dsvt.hdr.rpt1); + fprintf(stderr, "Unknown module suffix '%s'\n", dsvt.hdr.rpt1); return; } diff --git a/QnetITAP.cpp b/QnetITAP.cpp index 0ea9b6b..23cdc69 100644 --- a/QnetITAP.cpp +++ b/QnetITAP.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 by Thomas A. Early N7TAE + * Copyright (C) 2018-2020 by Thomas A. Early N7TAE * * CQnetITAP::GetITAPData() is based on some code that is... * Copyright (C) 2011-2015,2018,2020 by Jonathan Naylor G4KLX @@ -45,7 +45,7 @@ #include "QnetConfigure.h" #include "Timer.h" -#define ITAP_VERSION "QnetITAP-2.1.6" +#define ITAP_VERSION "QnetITAP-518" std::atomic CQnetITAP::keep_running(true); @@ -225,6 +225,7 @@ void CQnetITAP::Run(const char *cfgfile) CTimer lastdataTimer; CTimer pingTimer; double pingtime = 0.001; + const double ackwait = AP_MODE ? 0.4 : 0.06; while (keep_running) { @@ -361,9 +362,8 @@ void CQnetITAP::Run(const char *cfgfile) } } } else { // we are waiting on an acknowledgement - if (ackTimer.time() >= 0.06) { - if (LOG_DEBUG) - fprintf(stderr, "Serial port communication error, restarting...\n"); + if (ackTimer.time() >= ackwait) { + fprintf(stderr, "Icom failure suspected, restarting...\n"); close(serfd); poll_counter = 0; pingtime = 0.001; @@ -493,9 +493,9 @@ bool CQnetITAP::ProcessITAP(const unsigned char *buf) if (0 == memcmp(itap.header.r1, "DIRECT", 6)) { // Terminal Mode! memcpy(dsvt.hdr.rpt1, RPTR.c_str(), 7); // build r1 - dsvt.hdr.rpt1[7] = RPTR_MOD; // with module + dsvt.hdr.rpt1[7] = RPTR_MOD; // with module memcpy(dsvt.hdr.rpt2, RPTR.c_str(), 7); // build r2 - dsvt.hdr.rpt2[7] = 'G'; // with gateway + dsvt.hdr.rpt2[7] = 'G'; // with gateway if (' '==itap.header.ur[2] && ' '!=itap.header.ur[0]) { // it's a command because it has as space in the 3rd position, we have to right-justify it! // Terminal Mode left justifies short commands. @@ -584,8 +584,7 @@ bool CQnetITAP::ReadConfig(const char *cfgFile) RPTR_MOD = 'A' + assigned_module; cfg.GetValue(itap_path+"_device", type, ITAP_DEVICE, 7, FILENAME_MAX); - cfg.GetValue("gateway_gate2modem"+std::string(1, 'a'+assigned_module), estr, gate2modem, 1, FILENAME_MAX); - cfg.GetValue("gateway_modem2gate", estr, modem2gate, 1, FILENAME_MAX); + cfg.GetValue(itap_path+"_ap_mode", type, AP_MODE); itap_path.append("_callsign"); if (cfg.KeyExists(itap_path)) { @@ -610,6 +609,8 @@ bool CQnetITAP::ReadConfig(const char *cfgFile) RPTR.resize(CALL_SIZE, ' '); } + cfg.GetValue(std::string("gateway_gate2modem")+std::string(1, 'a'+assigned_module), estr, gate2modem, 1, FILENAME_MAX); + cfg.GetValue("gateway_modem2gate", estr, modem2gate, 1, FILENAME_MAX); cfg.GetValue("log_qso", estr, LOG_QSO); cfg.GetValue("log_debug", estr, LOG_DEBUG); return false; diff --git a/QnetITAP.h b/QnetITAP.h index dbcca21..6133dc7 100644 --- a/QnetITAP.h +++ b/QnetITAP.h @@ -128,6 +128,7 @@ private: char RPTR_MOD; std::string ITAP_DEVICE, RPTR; bool LOG_QSO, LOG_DEBUG; + bool AP_MODE; // parameters int serfd; diff --git a/defaults b/defaults index 96f0948..1b5195d 100644 --- a/defaults +++ b/defaults @@ -140,6 +140,7 @@ mmdvmmodem_tx_level=128 # range is 0-255 # itap_device='/dev/ttyUSB0' # where the serial-to-USB cable show up itap_frequency=0 # in MHz, not required for either mode, for AP mode, the simplex frequency is set on your radio +itap_ap_mode=false # Set to true if you are operating in Access Point Mode ########################################################################################################################## # diff --git a/qnconfig b/qnconfig index 14b5f81..9cf59c5 100755 --- a/qnconfig +++ b/qnconfig @@ -448,6 +448,7 @@ ModuleMenu () { elif [[ "${!mod}" == 'itap' ]]; then echo -n "fr : Frequency in MHz = "; EvaluateVar {${mod},itap}_frequency echo -n "dv : USB device path = "; EvaluateVar {${mod},itap}_device + echo -n "ap : Set to true if using Access Point Mode = "; EvaluateVar {${mod},itap}_ap_mode elif [[ "${!mod}" == 'mmdvmhost' ]]; then echo -n "tx : Transmit frequency, in MHz = "; EvaluateVar {${mod},mmdvmhost}_tx_frequency echo -n "rx : Receive frequency, in MHz = "; EvaluateVar {${mod},mmdvmhost}_rx_frequency @@ -478,6 +479,7 @@ ModuleMenu () { eval ${mod}_link_at_start="'${value^^}'" elif [[ "$key" == ac* ]]; then SetBooleanValue ${mod}_acknowledge "$value" elif [[ "$key" == ad* ]]; then eval ${mod}_ack_delay="$value" + elif [[ "$key" == ap* ]]; then SetBooleanValue ${mod}_ap_mode "$value" elif [[ "$key" == ag* ]]; then eval ${mod}_agl="$value" elif [[ "$key" == ar* ]]; then SetBooleanValue ${mod}_auto_link "$value" elif [[ "$key" == cs* ]]; then eval ${mod}_callsign="${value^^}" @@ -512,12 +514,13 @@ ModuleMenu () { unset ${mod}_{link_at_start,callsign,{,rx_,tx_}frequency,offset,range,agl} unset ${mod}_{inactivity,packet_wait,acknowledge,ack_delay,power,squelch,serial_number,rf_o{n,ff},{r,t}x_level} unset ${mod}_{duplex,tx_delay,rqst_count,{tx,rx,ptt}_invert,device,internal_ip,{gateway,local}_port} - unset ${mod}_{tx_offset,rx_offset,auto_link} + unset ${mod}_{tx_offset,rx_offset,auto_link,ap_mode} unset ${mod} return elif [[ "$key" == u* ]]; then if [[ "$value" == ac* ]]; then unset ${mod}_acknowledge elif [[ "$value" == ad* ]]; then unset ${mod}_ack_delay + elif [[ "$value" == ap* ]]; then unset ${mod}_ap_mode elif [[ "$value" == ar* ]]; then unset ${mod}_auto_link elif [[ "$value" == ag* ]]; then unset ${mod}_agl elif [[ "$value" == cs* ]]; then unset ${mod}_callsign @@ -608,6 +611,7 @@ WriteCFGFile () { elif [[ "${!p}" == "itap" ]]; then q=${p}_frequency; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_device; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile + q=${p}_ap_mode; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile elif [[ "${!p}" == "mmdvmhost" ]]; then q=${p}_tx_frequency; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_rx_frequency; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile @@ -725,7 +729,7 @@ while [[ "$ans" != q* ]] do clear echo - echo " QnConfig Main Menu V#200326" + echo " QnConfig Main Menu V#200518" echo echo -n "a : Module A - "; if [ -z $module_a ]; then echo ""; else echo "${module_a^^}"; fi echo -n "b : Module B - "; if [ -z $module_b ]; then echo ""; else echo "${module_b^^}"; fi