added Access Point Mode param to CQnetITAP class

pull/14/head
Tom Early 6 years ago
parent 410d23276b
commit be05ccbf73

@ -54,7 +54,7 @@
#define CFG_DIR "/usr/local/etc" #define CFG_DIR "/usr/local/etc"
#endif #endif
const std::string GW_VERSION("QnetGateway-515"); const std::string GW_VERSION("QnetGateway-518");
static std::atomic<bool> keep_running(true); static std::atomic<bool> keep_running(true);
@ -2154,9 +2154,17 @@ void CQnetGateway::PlayFileThread(SECHO &edata)
fclose(fp); fclose(fp);
return; return;
} }
int mod = dsvt.hdr.rpt1[7] - 'A'; 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) { 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; return;
} }

@ -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... * CQnetITAP::GetITAPData() is based on some code that is...
* Copyright (C) 2011-2015,2018,2020 by Jonathan Naylor G4KLX * Copyright (C) 2011-2015,2018,2020 by Jonathan Naylor G4KLX
@ -45,7 +45,7 @@
#include "QnetConfigure.h" #include "QnetConfigure.h"
#include "Timer.h" #include "Timer.h"
#define ITAP_VERSION "QnetITAP-2.1.6" #define ITAP_VERSION "QnetITAP-518"
std::atomic<bool> CQnetITAP::keep_running(true); std::atomic<bool> CQnetITAP::keep_running(true);
@ -225,6 +225,7 @@ void CQnetITAP::Run(const char *cfgfile)
CTimer lastdataTimer; CTimer lastdataTimer;
CTimer pingTimer; CTimer pingTimer;
double pingtime = 0.001; double pingtime = 0.001;
const double ackwait = AP_MODE ? 0.4 : 0.06;
while (keep_running) { while (keep_running) {
@ -361,9 +362,8 @@ void CQnetITAP::Run(const char *cfgfile)
} }
} }
} else { // we are waiting on an acknowledgement } else { // we are waiting on an acknowledgement
if (ackTimer.time() >= 0.06) { if (ackTimer.time() >= ackwait) {
if (LOG_DEBUG) fprintf(stderr, "Icom failure suspected, restarting...\n");
fprintf(stderr, "Serial port communication error, restarting...\n");
close(serfd); close(serfd);
poll_counter = 0; poll_counter = 0;
pingtime = 0.001; pingtime = 0.001;
@ -493,9 +493,9 @@ bool CQnetITAP::ProcessITAP(const unsigned char *buf)
if (0 == memcmp(itap.header.r1, "DIRECT", 6)) { if (0 == memcmp(itap.header.r1, "DIRECT", 6)) {
// Terminal Mode! // Terminal Mode!
memcpy(dsvt.hdr.rpt1, RPTR.c_str(), 7); // build r1 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 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]) { 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! // 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. // Terminal Mode left justifies short commands.
@ -584,8 +584,7 @@ bool CQnetITAP::ReadConfig(const char *cfgFile)
RPTR_MOD = 'A' + assigned_module; RPTR_MOD = 'A' + assigned_module;
cfg.GetValue(itap_path+"_device", type, ITAP_DEVICE, 7, FILENAME_MAX); 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(itap_path+"_ap_mode", type, AP_MODE);
cfg.GetValue("gateway_modem2gate", estr, modem2gate, 1, FILENAME_MAX);
itap_path.append("_callsign"); itap_path.append("_callsign");
if (cfg.KeyExists(itap_path)) { if (cfg.KeyExists(itap_path)) {
@ -610,6 +609,8 @@ bool CQnetITAP::ReadConfig(const char *cfgFile)
RPTR.resize(CALL_SIZE, ' '); 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_qso", estr, LOG_QSO);
cfg.GetValue("log_debug", estr, LOG_DEBUG); cfg.GetValue("log_debug", estr, LOG_DEBUG);
return false; return false;

@ -128,6 +128,7 @@ private:
char RPTR_MOD; char RPTR_MOD;
std::string ITAP_DEVICE, RPTR; std::string ITAP_DEVICE, RPTR;
bool LOG_QSO, LOG_DEBUG; bool LOG_QSO, LOG_DEBUG;
bool AP_MODE;
// parameters // parameters
int serfd; int serfd;

@ -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_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_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
########################################################################################################################## ##########################################################################################################################
# #

@ -448,6 +448,7 @@ ModuleMenu () {
elif [[ "${!mod}" == 'itap' ]]; then elif [[ "${!mod}" == 'itap' ]]; then
echo -n "fr : Frequency in MHz = "; EvaluateVar {${mod},itap}_frequency echo -n "fr : Frequency in MHz = "; EvaluateVar {${mod},itap}_frequency
echo -n "dv : USB device path = "; EvaluateVar {${mod},itap}_device 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 elif [[ "${!mod}" == 'mmdvmhost' ]]; then
echo -n "tx : Transmit frequency, in MHz = "; EvaluateVar {${mod},mmdvmhost}_tx_frequency echo -n "tx : Transmit frequency, in MHz = "; EvaluateVar {${mod},mmdvmhost}_tx_frequency
echo -n "rx : Receive frequency, in MHz = "; EvaluateVar {${mod},mmdvmhost}_rx_frequency echo -n "rx : Receive frequency, in MHz = "; EvaluateVar {${mod},mmdvmhost}_rx_frequency
@ -478,6 +479,7 @@ ModuleMenu () {
eval ${mod}_link_at_start="'${value^^}'" eval ${mod}_link_at_start="'${value^^}'"
elif [[ "$key" == ac* ]]; then SetBooleanValue ${mod}_acknowledge "$value" elif [[ "$key" == ac* ]]; then SetBooleanValue ${mod}_acknowledge "$value"
elif [[ "$key" == ad* ]]; then eval ${mod}_ack_delay="$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" == ag* ]]; then eval ${mod}_agl="$value"
elif [[ "$key" == ar* ]]; then SetBooleanValue ${mod}_auto_link "$value" elif [[ "$key" == ar* ]]; then SetBooleanValue ${mod}_auto_link "$value"
elif [[ "$key" == cs* ]]; then eval ${mod}_callsign="${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}_{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}_{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}_{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} unset ${mod}
return return
elif [[ "$key" == u* ]]; then elif [[ "$key" == u* ]]; then
if [[ "$value" == ac* ]]; then unset ${mod}_acknowledge if [[ "$value" == ac* ]]; then unset ${mod}_acknowledge
elif [[ "$value" == ad* ]]; then unset ${mod}_ack_delay 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" == ar* ]]; then unset ${mod}_auto_link
elif [[ "$value" == ag* ]]; then unset ${mod}_agl elif [[ "$value" == ag* ]]; then unset ${mod}_agl
elif [[ "$value" == cs* ]]; then unset ${mod}_callsign elif [[ "$value" == cs* ]]; then unset ${mod}_callsign
@ -608,6 +611,7 @@ WriteCFGFile () {
elif [[ "${!p}" == "itap" ]]; then elif [[ "${!p}" == "itap" ]]; then
q=${p}_frequency; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_frequency; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile
q=${p}_device; [ -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 elif [[ "${!p}" == "mmdvmhost" ]]; then
q=${p}_tx_frequency; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_tx_frequency; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile
q=${p}_rx_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 do
clear clear
echo echo
echo " QnConfig Main Menu V#200326" echo " QnConfig Main Menu V#200518"
echo echo
echo -n "a : Module A - "; if [ -z $module_a ]; then echo "<EMPTY>"; else echo "${module_a^^}"; fi echo -n "a : Module A - "; if [ -z $module_a ]; then echo "<EMPTY>"; else echo "${module_a^^}"; fi
echo -n "b : Module B - "; if [ -z $module_b ]; then echo "<EMPTY>"; else echo "${module_b^^}"; fi echo -n "b : Module B - "; if [ -z $module_b ]; then echo "<EMPTY>"; else echo "${module_b^^}"; fi

Loading…
Cancel
Save

Powered by TurnKey Linux.