David Brooke 2016-02-23 11:28:44 +00:00
commit 0894afc50c
4 zmienionych plików z 27 dodań i 16 usunięć

Wyświetl plik

@ -91,7 +91,8 @@ The global options are:
ServerPort=<port>. Opens a server socket which can have 1 client connected. Sends JSON telemetry and status information to that client. ServerPort=<port>. Opens a server socket which can have 1 client connected. Sends JSON telemetry and status information to that client.
Latitude=<decimal position> Latitude=<decimal position>
Longitude=<decimal position>. These let you tell the gateway your position, for uploading to habitat Longitude=<decimal position>. These let you tell the gateway your position, for uploading to habitat, so your listener icon appears on the map in the correct position.
Antenna=<antenna make/model>. Lets you specify your antenna make/model or type. This appears on the map if your listener icon is clicked on.
NetworkLED=<wiring pi pin> NetworkLED=<wiring pi pin>
InternetLED=<wiring pi pin> InternetLED=<wiring pi pin>

Wyświetl plik

@ -515,7 +515,7 @@ size_t write_data(void *buffer, size_t size, size_t nmemb, void *userp)
return size * nmemb; return size * nmemb;
} }
void UploadListenerTelemetry(char *callsign, float gps_lat, float gps_lon) void UploadListenerTelemetry(char *callsign, float gps_lat, float gps_lon, char *antenna)
{ {
int time_epoch = (int)time(NULL); int time_epoch = (int)time(NULL);
if (Config.EnableHabitat) if (Config.EnableHabitat)
@ -576,7 +576,7 @@ void UploadListenerTelemetry(char *callsign, float gps_lat, float gps_lon)
curl_easy_setopt(curl, CURLOPT_URL, "http://habitat.habhub.org/transition/listener_information"); curl_easy_setopt(curl, CURLOPT_URL, "http://habitat.habhub.org/transition/listener_information");
// Now specify the POST data // Now specify the POST data
sprintf(JsonData,"{\"latitude\": %f, \"longitude\": %f}", gps_lat, gps_lon); sprintf(JsonData, "{\"radio\": \"%s\", \"antenna\": \"%s\"}", "LoRa RFM98W", antenna);
sprintf(PostFields, "callsign=%s&time=%d&data=%s", Config.Tracker, time_epoch, JsonData); sprintf(PostFields, "callsign=%s&time=%d&data=%s", Config.Tracker, time_epoch, JsonData);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, PostFields); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, PostFields);
@ -1307,6 +1307,7 @@ void LoadConfigFile()
Config.ftpFolder[0] = '\0'; Config.ftpFolder[0] = '\0';
Config.latitude = -999; Config.latitude = -999;
Config.longitude = -999; Config.longitude = -999;
Config.antenna[0] = '\0';
if ((fp = fopen(filename, "r")) == NULL) if ((fp = fopen(filename, "r")) == NULL)
{ {
@ -1359,6 +1360,7 @@ void LoadConfigFile()
// Listener // Listener
Config.latitude = ReadFloat(fp, "Latitude"); Config.latitude = ReadFloat(fp, "Latitude");
Config.longitude = ReadFloat(fp, "Longitude"); Config.longitude = ReadFloat(fp, "Longitude");
ReadString(fp, "antenna", Config.antenna, sizeof(Config.antenna), 0);
// SMS upload to tracker // SMS upload to tracker
Config.SMSFolder[0] = '\0'; Config.SMSFolder[0] = '\0';
@ -2063,7 +2065,7 @@ int main(int argc, char **argv)
if ((Config.latitude > -90) && (Config.longitude > -90)) if ((Config.latitude > -90) && (Config.longitude > -90))
{ {
UploadListenerTelemetry(Config.Tracker, Config.latitude, Config.longitude); UploadListenerTelemetry(Config.Tracker, Config.latitude, Config.longitude, Config.antenna);
} }
while (run) while (run)

Wyświetl plik

@ -1,12 +1,13 @@
tracker=CALLSIGN tracker=M0RPI/5
EnableHabitat=Y EnableHabitat=Y
EnableSSDV=Y EnableSSDV=N
JPGFolder=ssdv JPGFolder=ssdv
LogTelemetry=Y LogTelemetry=N
CallingTimeout=60 CallingTimeout=60
#ServerPort=6004 ServerPort=6004
Latitude=51.95023 Latitude=51.95023
Longitude=-2.5445 Longitude=-2.5445
Antenna=Watson W-30
#SMSFolder=./ #SMSFolder=./
#NetworkLED=21 #NetworkLED=21
@ -14,14 +15,20 @@ Longitude=-2.5445
#ActivityLED_0=23 #ActivityLED_0=23
#ActivityLED_1=24 #ActivityLED_1=24
frequency_0=434.300 frequency_0=869.850
mode_0=1 mode_0=3
power_0=255
#bandwidth_0=125K
DIO0_0=31 DIO0_0=31
DIO5_0=26 DIO5_0=26
AFC_0=N AFC_0=N
UplinkTime_0=2
UplinkCycle_0=60
#frequency_1=434.400 #frequency_1=434.447
mode_1=1 #mode_1=1
DIO0_1=27 #DIO0_1=27
DIO5_1=26 #DIO5_1=26
AFC_1=Y #AFC_1=Y
#UplinkTime_1=5
#UplinkCycle_1=60

Wyświetl plik

@ -93,6 +93,7 @@ struct TConfig
int ServerPort; int ServerPort;
float latitude, longitude; float latitude, longitude;
char SMSFolder[64]; char SMSFolder[64];
char antenna[64];
}; };
extern struct TConfig Config; extern struct TConfig Config;