From 1db97cfbc5f105e2c3b34494d75dac8387d9c534 Mon Sep 17 00:00:00 2001 From: Mat Burnham Date: Fri, 19 Mar 2021 22:23:22 +0000 Subject: [PATCH] Allow custom specification of radio as well as antenna. --- README.md | 6 ++++++ gateway-sample.txt | 3 ++- gateway.c | 1 + global.h | 1 + listener.c | 6 +++--- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0c90220..7cba78c 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ The configuration is in the file gateway.txt. Example: ServerPort=6004 Latitude=51.95023 Longitude=-2.5445 + Radio=LoRa RFM98W Antenna=868MHz Yagi frequency_0=434.347 @@ -121,6 +122,7 @@ The global options are: Latitude= Longitude=. These let you tell the gateway your position, for uploading to habitat, so your listener icon appears on the map in the correct position. + Radio=. Lets you specify your radio/board make/model or type. This appears on the map if your listener icon is clicked on. Antenna=. Lets you specify your antenna make/model or type. This appears on the map if your listener icon is clicked on. NetworkLED= @@ -250,6 +252,10 @@ Many thanks to David Brooke for coding this feature and the AFC. Change History ============== +19/03/2021 - V1.8.43mbb +-------------------- + Added radio setting to gateway.txt + 07/03/2021 - V1.8.43 -------------------- diff --git a/gateway-sample.txt b/gateway-sample.txt index 3a2787a..f5779aa 100644 --- a/gateway-sample.txt +++ b/gateway-sample.txt @@ -4,7 +4,8 @@ tracker=YOUR_CALLSIGN Latitude=0.0 Longitude=0.0 -Antenna=Watson W-50 +Radio=Your radio +Antenna=Your antenna ##### Config Options ##### diff --git a/gateway.c b/gateway.c index 28c5f82..d4bcd60 100644 --- a/gateway.c +++ b/gateway.c @@ -2083,6 +2083,7 @@ void LoadConfigFile(void) // Listener RegisterConfigDouble(MainSection, -1, "Latitude", &Config.latitude, NULL); RegisterConfigDouble(MainSection, -1, "Longitude", &Config.longitude, NULL); + RegisterConfigString(MainSection, -1, "radio", Config.radio, sizeof(Config.radio), NULL); RegisterConfigString(MainSection, -1, "antenna", Config.antenna, sizeof(Config.antenna), NULL); // Dev mode diff --git a/global.h b/global.h index 908c0dd..a61d9a3 100644 --- a/global.h +++ b/global.h @@ -138,6 +138,7 @@ struct TConfig int HABChannel; // LoRa Channel for uplink int DataPort; // Raw received data packet port char SMSFolder[64]; + char radio[64]; char antenna[64]; int EnableDev; char UplinkCode[64]; diff --git a/listener.c b/listener.c index f47f1c8..0c94785 100644 --- a/listener.c +++ b/listener.c @@ -13,7 +13,7 @@ size_t write_data( void *buffer, size_t size, size_t nmemb, void *userp ) return size * nmemb; } -void UploadListenerTelemetry( char *callsign, time_t gps_time, float gps_lat, float gps_lon, char *antenna ) +void UploadListenerTelemetry( char *callsign, time_t gps_time, float gps_lat, float gps_lon, char *radio, char *antenna ) { char time_string[20]; struct tm * time_info; @@ -82,7 +82,7 @@ void UploadListenerTelemetry( char *callsign, time_t gps_time, float gps_lat, fl // Now specify the POST data sprintf( JsonData, "{\"radio\": \"%s\", \"antenna\": \"%s\"}", - "LoRa RFM98W", antenna ); + radio, antenna ); sprintf( PostFields, "callsign=%s&time=%d&data=%s", callsign, (int)gps_time, JsonData ); curl_easy_setopt( curl, CURLOPT_POSTFIELDS, PostFields ); @@ -112,7 +112,7 @@ void *ListenerLoop(void *ptr) { if (LoopPeriod > LISTENER_UPDATE_INTERVAL*60*1000) { - UploadListenerTelemetry( Config.Tracker, time(NULL), Config.latitude, Config.longitude, Config.antenna ); + UploadListenerTelemetry( Config.Tracker, time(NULL), Config.latitude, Config.longitude, Config.radio, Config.antenna ); LoopPeriod = 0; }