diff --git a/DVAPDongle.h b/DVAPDongle.h index 0c2c542..777d591 100644 --- a/DVAPDongle.h +++ b/DVAPDongle.h @@ -1,6 +1,6 @@ #pragma once /* - * Copyright 2017 by Thomas Early, N7TAE + * Copyright 2017,2020 by Thomas Early, N7TAE * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ enum REPLY_TYPE { }; #pragma pack(push,1) -typedef struct dvp_register_tag { +using SDVAP_REGISTER = struct dvp_register_tag { uint16_t header; union { uint8_t nul; @@ -80,7 +80,7 @@ typedef struct dvp_register_tag { }; } frame; }; -} SDVAP_REGISTER; +}; #pragma pack(pop) class CDVAPDongle diff --git a/QnetGateway.cpp b/QnetGateway.cpp index 63ed611..95237a8 100644 --- a/QnetGateway.cpp +++ b/QnetGateway.cpp @@ -50,7 +50,7 @@ #include "QnetGateway.h" #include "Utilities.h" -const std::string IRCDDB_VERSION("QnetGateway-9.2"); +const std::string GW_VERSION("QnetGateway-9.3"); extern void dstar_dv_init(); extern int dstar_dv_decode(const unsigned char *d, int data[3]); @@ -251,11 +251,11 @@ bool CQnetGateway::ReadConfig(char *cfgFile) rptr.mod[m].defined = false; } else { printf("Found Module: %s = '%s'\n", path.c_str(), type.c_str()); - if (0 == type.compare("dvap")) { rptr.mod[m].package_version.assign(IRCDDB_VERSION+".DVAP"); } - else if (0 == type.compare("dvrptr")) { rptr.mod[m].package_version.assign(IRCDDB_VERSION+".DVRPTR"); } - else if (0 == type.compare("mmdvmhost")) { rptr.mod[m].package_version.assign(IRCDDB_VERSION+".Relay"); } - else if (0 == type.compare("mmdvmmodem")) { rptr.mod[m].package_version.assign(IRCDDB_VERSION+".Modem"); } - else if (0 == type.compare("itap")) { rptr.mod[m].package_version.assign(IRCDDB_VERSION+".ITAP"); } + if (0 == type.compare("dvap")) { rptr.mod[m].package_version.assign(GW_VERSION+".DVAP"); } + else if (0 == type.compare("dvrptr")) { rptr.mod[m].package_version.assign(GW_VERSION+".DVRPTR"); } + else if (0 == type.compare("mmdvmhost")) { rptr.mod[m].package_version.assign(GW_VERSION+".Relay"); } + else if (0 == type.compare("mmdvmmodem")) { rptr.mod[m].package_version.assign(GW_VERSION+".Modem"); } + else if (0 == type.compare("itap")) { rptr.mod[m].package_version.assign(GW_VERSION+".ITAP"); } else { printf("module type '%s' is invalid\n", type.c_str()); return true; @@ -304,6 +304,8 @@ bool CQnetGateway::ReadConfig(char *cfgFile) cfg.GetValue(path+"desc1", estr, rptr.mod[m].desc1, 0, 20); cfg.GetValue(path+"desc2", estr, rptr.mod[m].desc2, 0, 20); cfg.GetValue(path+"url", estr, rptr.mod[m].url, 0, 80); + if (rptr.mod[m].desc1.empty()) rptr.mod[m].desc2.assign(GW_VERSION); + if (rptr.mod[m].desc2.empty()) rptr.mod[m].desc2.assign("by N7TAE"); rptr.mod[m].desc = trim_copy(rptr.mod[m].desc1) + " " + trim_copy(rptr.mod[m].desc2); } } @@ -1973,7 +1975,7 @@ void CQnetGateway::Process() if (keep_running) printf("get_irc_data thread[%d] started\n", i); - ii[i]->kickWatchdog(IRCDDB_VERSION); + ii[i]->kickWatchdog(GW_VERSION); } } @@ -2528,7 +2530,7 @@ bool CQnetGateway::Init(char *cfgfile) for (int j=0; j<2; j++) { if (ircddb[j].ip.empty()) continue; - ii[j] = new CIRCDDB(ircddb[j].ip, ircddb[j].port, owner, IRCDDB_PASSWORD[j], IRCDDB_VERSION.c_str()); + ii[j] = new CIRCDDB(ircddb[j].ip, ircddb[j].port, owner, IRCDDB_PASSWORD[j], GW_VERSION.c_str()); bool ok = ii[j]->open(); if (!ok) { printf("%s open failed\n", ircddb[j].ip.c_str()); @@ -2904,7 +2906,7 @@ bool CQnetGateway::verify_gps_csum(char *gps_text, char *csum_text) int main(int argc, char **argv) { - printf("VERSION %s\n", IRCDDB_VERSION.c_str()); + printf("VERSION %s\n", GW_VERSION.c_str()); if (argc != 2) { printf("usage: %s qn.cfg\n", argv[0]); return 1; diff --git a/QnetGateway.h b/QnetGateway.h index 11d39b8..b1f227c 100644 --- a/QnetGateway.h +++ b/QnetGateway.h @@ -30,13 +30,13 @@ #define CALL_SIZE 8 #define MAX_DTMF_BUF 32 -typedef struct to_remote_g2_tag { +using STOREMOTEG2 = struct to_remote_g2_tag { unsigned short streamid; CSockAddress toDstar; time_t last_time; -} STOREMOTEG2; +}; -typedef struct torepeater_tag { +using STOREPEATER = struct torepeater_tag { // help with header re-generation SDSVT saved_hdr; // repeater format CSockAddress saved_addr; @@ -45,9 +45,9 @@ typedef struct torepeater_tag { CSockAddress addr; time_t last_time; unsigned char sequence; -} STOREPEATER; +}; -typedef struct band_txt_tag { +using SBANDTXT = struct band_txt_tag { unsigned short streamID; unsigned char flags[3]; char lh_mycall[CALL_SIZE + 1]; @@ -73,7 +73,7 @@ typedef struct band_txt_tag { int num_dv_frames; int num_dv_silent_frames; int num_bit_errors; -} SBANDTXT; +}; class CQnetGateway { public: diff --git a/QnetITAP.h b/QnetITAP.h index ee05743..faec024 100644 --- a/QnetITAP.h +++ b/QnetITAP.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 by Thomas A. Early N7TAE + * Copyright (C) 2018-2020 by Thomas A. Early N7TAE * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,7 +43,7 @@ enum REPLY_TYPE { // Icom Terminal and Access Point Mode data structure #pragma pack(push, 1) -typedef struct itap_tag { +using SITAP = struct itap_tag { unsigned char length; // 41 for header // 16 for voice @@ -73,7 +73,7 @@ typedef struct itap_tag { unsigned char text[3]; } voice; }; -} SITAP; +}; #pragma pack(pop) class CFrame diff --git a/QnetLink.h b/QnetLink.h index 308eb48..77fb87b 100644 --- a/QnetLink.h +++ b/QnetLink.h @@ -41,12 +41,12 @@ #define TIMEOUT 50 #define LH_MAX_SIZE 39 -typedef struct refdsvt_tag { +using SREFDSVT = struct refdsvt_tag { unsigned char head[2]; SDSVT dsvt; -} SREFDSVT; +}; -typedef struct to_remote_g2_tag { +using STOREMOTE = struct to_remote_g2_tag { char cs[CALL_SIZE + 1]; CSockAddress addr; char from_mod, to_mod; @@ -54,17 +54,17 @@ typedef struct to_remote_g2_tag { bool auto_link, is_connected; unsigned short in_streamid; // incoming from remote systems unsigned short out_streamid; // outgoing to remote systems -} STOREMOTE; +}; // This is the data payload in the map: inbound_list // This is for inbound dongles -typedef struct inbound_tag { +using SINBOUND = struct inbound_tag { char call[CALL_SIZE + 1]; // the callsign of the remote CSockAddress addr; // IP and port of remote short countdown; // if countdown expires, the connection is terminated char mod; // A B C This user talked on this module char client; // dvap, dvdongle -} SINBOUND; +}; class CQnetLink { public: diff --git a/QnetModem.h b/QnetModem.h index 88db4e9..9e6d72c 100644 --- a/QnetModem.h +++ b/QnetModem.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Thomas A. Early N7TAE + * Copyright (C) 2019-2020 by Thomas A. Early N7TAE * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -59,15 +59,15 @@ enum class EHardwareType { // Icom Terminal and Access Point Mode data structure #pragma pack(push, 1) -typedef struct version_tag { +using SVERSION = struct version_tag { unsigned char start; unsigned char length; unsigned char type; unsigned char protocol; unsigned char version[251]; -} SVERSION; +}; -typedef struct mmodem_tag { +using SMODEM = struct mmodem_tag { unsigned char start; // always 0xEOU unsigned char length; // 3 - 255 unsigned char type; @@ -149,7 +149,7 @@ typedef struct mmodem_tag { unsigned char text[3]; } voice; }; -} SMODEM; +}; #pragma pack(pop) class CFrame diff --git a/QnetTypeDefs.h b/QnetTypeDefs.h index 02a0bbc..40f38e2 100644 --- a/QnetTypeDefs.h +++ b/QnetTypeDefs.h @@ -1,6 +1,6 @@ #pragma once /* - * Copyright 2017-2019 by Thomas Early, N7TAE + * Copyright 2017-2020 by Thomas Early, N7TAE * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ // for communicating with the g2 gateway on the internal port #pragma pack(push, 1) // used internally by Icom stacks -typedef struct dstr_tag { +using SDSTR = struct dstr_tag { unsigned char pkt_id[4]; // 0 "DSTR" unsigned short counter; // 4 unsigned char flag[3]; // 6 { 0x73, 0x12, 0x00 } @@ -60,12 +60,12 @@ typedef struct dstr_tag { }; } vpkt; }; -} SDSTR; +}; #pragma pack(pop) // for the g2 external port and between QnetGateway programs #pragma pack(push, 1) -typedef struct dsvt_tag { +using SDSVT = struct dsvt_tag { unsigned char title[4]; // 0 "DSVT" unsigned char config; // 4 0x10 is hdr 0x20 is vasd unsigned char flaga[3]; // 5 zeros @@ -88,12 +88,12 @@ typedef struct dsvt_tag { unsigned char text[3]; // 24 } vasd; // voice and slow data total 27 }; -} SDSVT; +}; #pragma pack(pop) // for mmdvm #pragma pack(push, 1) -typedef struct dsrp_tag { // offset size +using SDSRP = struct dsrp_tag { // offset size unsigned char title[4]; // "DSRP" 0 unsigned char tag; // Poll : 0xA 4 // Header : busy ? 0x22 : 0x20 @@ -121,12 +121,12 @@ typedef struct dsrp_tag { // offset size unsigned char ambe[12]; // voice + slow data 9 21 } voice; }; -} SDSRP; +}; #pragma pack(pop) #pragma pack(push, 1) -typedef struct link_family_tag { +using SLINKFAMILY = struct link_family_tag { char title[4]; int family[3]; -} SLINKFAMILY; +}; #pragma pack(pop) diff --git a/SEcho.h b/SEcho.h index 5594ff8..03ac3b3 100644 --- a/SEcho.h +++ b/SEcho.h @@ -1,6 +1,6 @@ #pragma once /* - * Copyright 2018-2019 by Thomas Early, N7TAE + * Copyright 2018-2020 by Thomas Early, N7TAE * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -typedef struct echo_tag { +using SECHO = struct echo_tag { bool is_linked; time_t last_time; unsigned short streamid; @@ -25,4 +25,4 @@ typedef struct echo_tag { char message[24]; SDSVT header; // only used in qnlink (qngateway writes the header to the file) char file[FILENAME_MAX + 1]; -} SECHO; +}; diff --git a/aprs.h b/aprs.h index 29ce301..0c533bc 100644 --- a/aprs.h +++ b/aprs.h @@ -30,26 +30,26 @@ enum aprs_level { al_none, al_$1, al_$2, al_c1, al_r1, al_c2, al_csum1, al_csum2 enum slow_level { sl_first, sl_second }; -typedef struct portip_tag { +using SPORTIP = struct portip_tag { std::string ip; int port; -} SPORTIP; +}; -typedef struct rptr_tag{ +using SRPTR = struct aprs_info { SPORTIP aprs; std::string aprs_filter; int aprs_hash; int aprs_interval; /* 0=A, 1=B, 2=C */ - struct mod_tag { + struct aprs_module { std::string call; /* KJ4NHF-B */ bool defined; std::string band; /* 23cm ... */ double frequency, offset, latitude, longitude, range, agl; std::string desc1, desc2, desc, url, package_version; } mod[3]; -} SRPTR; +}; class CAPRS { public: diff --git a/defaults b/defaults index 78213db..5258d16 100644 --- a/defaults +++ b/defaults @@ -61,8 +61,8 @@ gateway_gate2modemb_d='gate2modemb' gateway_gate2modemc_d='gate2modemc' gateway_latitude_d=0 # you can leave this unspecified for a mobile rig gateway_longitude_d=0 # like the latitude -gateway_desc1_d='QnetGateway' # maximum of 20 characters, most special symbols are not allowed -gateway_desc2_d='by N7TAE' # just like desc1 +gateway_desc1_d='' # maximum of 20 characters, most special symbols are not allowed +gateway_desc2_d='' # just like desc1 gateway_url_d='github.com/n7tae/QnetGateway' # 80 characters max gateway_find_route_d='' # CSV list of route(s) to load on boot-up (prevents the "not in cache" message) diff --git a/example.php b/example.php index 75ddabd..29b9ca8 100644 --- a/example.php +++ b/example.php @@ -99,7 +99,7 @@ function LastHeardPage() { echo 'Last Heard:
', "\n"; - $rstr = 'MyCall Sfx URCall Module Gateway Time
'; + $rstr = 'MyCall/Sfx URCall Module Gateway Last Time
'; echo str_replace(' ', ' ', $rstr), "\n"; echo '

', "\n"; $dbname = GetCFGValue('dashboard_sql_filename'); @@ -108,7 +108,8 @@ if ($stmnt = $db->prepare()) { if ($result = $stmnt->execute()) { while ($row = $result->FetchArray(SQLITE3_NUM)) { - $rstr = $row[0].'/'.$row[1].' '.$row[2].' '.$row[3].' '.$row[4].' '.SecToStrstring($row[4]).'
'; + $cs = str_pad($trim($row[0])./.$trim($row[1]), 13); + $rstr = $cs.' '.$row[2].' '.$row[3].' '.$row[4].' '.SecToStrstring($row[4]).'
'; echo str_replace(' ', ' ', $rstr), "\n"; } $result->finalize();