From 07333a776ad37b8dbc31877ea5663d779b41a88e Mon Sep 17 00:00:00 2001 From: David Dee Date: Tue, 25 Sep 2018 17:29:12 -0600 Subject: [PATCH] Added ability to disable APRS-IS updating (via internet) --- http.cpp | 9 +++++++++ init.cpp | 2 ++ picrumbs.conf.example | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/http.cpp b/http.cpp index 35e24a7..14bcc97 100755 --- a/http.cpp +++ b/http.cpp @@ -9,6 +9,7 @@ extern bool tnc_debug; extern bool fh_debug; // LOCAL VARS +bool aprsis_enable; // APRS-IS Enable/Disable string aprsis_server; // APRS-IS server name/IP unsigned short int aprsis_port; // APRS-IS port number string aprsis_proxy; // HTTP proxy to use for APRS-IS @@ -28,6 +29,14 @@ bool send_aprsis_http(const char* source, int source_ssid, const char* destinati stringstream buff; string aprsis_postdata; // we'll build this in a string since stringstream seems to drop newlines + + if (aprsis_enable == 0) { + if (tnc_debug || curl_debug) { + printf("APRS-IS disabled. Not sending.\n"); + } + return 1; + } + // first, build the TNC2 packet buff << "user " << aprsis_user << " pass " << aprsis_pass << " vers PiCrumbs " << VERSION; aprsis_postdata = buff.str(); diff --git a/init.cpp b/init.cpp index b1e96b8..4badae1 100755 --- a/init.cpp +++ b/init.cpp @@ -39,6 +39,7 @@ extern unsigned char gpio_hf_en; // gpio pin for hf enable extern unsigned char gpio_vhf_en; // gpio pin for vhf enable extern string predict_path; // path to PREDICT program extern bool gpio_enable; // can we use gpio pins +extern bool aprsis_enable; // APRS-IS enable extern string aprsis_server; // APRS-IS server name/IP extern unsigned short int aprsis_port; // APRS-IS port number extern string aprsis_proxy; // HTTP proxy to use for APRS-IS @@ -262,6 +263,7 @@ void init(int argc, char* argv[]) { // read config, set up serial ports, etc unsigned short int hamlib_model = readconfig.GetInteger("radio", "model", 1); // dummy rig as default if (hamlib_enable) radio_retune = readconfig.GetBoolean("radio", "retune", "false"); // don't try to retune if hamlib is not enabled // aprs-is config + aprsis_enable = readconfig.GetBoolean("aprsis", "enable", "false"); aprsis_server = readconfig.Get("aprsis", "server", "rotate.aprs2.net"); aprsis_port = readconfig.GetInteger("aprsis", "port", 8080); aprsis_proxy = readconfig.Get("aprsis", "proxy", ""); diff --git a/picrumbs.conf.example b/picrumbs.conf.example index 8e66393..12453c2 100755 --- a/picrumbs.conf.example +++ b/picrumbs.conf.example @@ -77,6 +77,7 @@ path = ; APRS-IS settings [aprsis] +enable = false ; server: name or ip address of an aprs-is server that supports http server = rotate.aprs2.net ; port: http port of this server, usually 8080. @@ -133,4 +134,4 @@ proto = 4 ; psk_freq: psk63 audio frequency psk_freq = 2100 ; psk_vol: psk63 volume (in percent) -psk_vol = 100 \ No newline at end of file +psk_vol = 100