dl-fldigi/src/include/kmlserver.h

112 wiersze
3.5 KiB
C
Czysty Zwykły widok Historia

KML/Synop/RTTY/Navtex * Synop decoding in RTTY mode in reception buffer, in red. * Creation of KML file for Synop data. * Creation of KML file for Navtex messages. * User locator displayed in KML. * Multiline Synop and Navtex messages displayed in Adif logs. * Added flsynop program as stand alone Synop decoder. * Fixed Navtex default stations filename and Italian stations. * Fixed Navtex frequency error. * Added KML tab in configuration menu. * Added parameters files for Synop decoding. * Fixed CoordinateT type for different deserialization. * Less logging messages from subthreads, because they might crash. * Added try/catch blocks in main program. * Can reload previous KML files at startup. * Named WMO code tables in Synop decoding. * Synop data can be logged to Adif files. * flsynop can load kml files from one dir and save them elsewhere. * Added strreplace and strcapitalize. * Added Levenshtein distance for future use. * Added class QsoHelper to ease Adif logging. * East longitude positive, West negative. Fixes Navtex detection. * Chars '=' or ';' used as a Synop end-of-section marker. * Added option command in KML tab executed on KML file save. * Reverse mode now saved in configuration. * Comments in DOxygen syntax. * Kml snippet stored once only per placemark. * Code more compatible with Eclipse parsing. * Synop decoded text can be interleaved with 5-digits groups. * KML balloons can be in simple tables, matrices or plain text. * Adif messages are saved in the main thread. * Starts external command only if KML file was saved. * Maximum KML data retention time is ten years, default 0 is no limit. * Do not reload KML files when changing KML parameters. * User kml file does not grow at each fldigi start. * Relative humidity always parsed with Celsius temperature. * Empty KML files are created on startup if not there. * Prepared porting processes functions to Mingw. * Added script for FTP transfer of KML files. * Added synop_tool * Navtex now has reverse mode. * Data files can be updated from the Internet. * HTTP load without anymore because crash in Wine
2013-06-01 07:40:24 +00:00
// ----------------------------------------------------------------------------
// kmlserver.h -- KML Server
//
// Copyright (C) 2012
// Remi Chateauneu, F4ECW
//
// This file is part of fldigi.
//
// Fldigi is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Fldigi is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with fldigi. If not, see <http://www.gnu.org/licenses/>.
// ----------------------------------------------------------------------------
#ifndef _KMLSERVER_H
#define _KMLSERVER_H
#include <limits.h>
#include <string>
#include <vector>
#include <sstream>
#include <coordinate.h>
/// Keyhole Markup Language: This publishes a complete message, localisation+time+weather etc...
class KmlServer {
protected:
/// Counts the number of complete messages written.
int m_nb_broadcasts ;
int exit_kml_server;
int request_broadcast;
KML/Synop/RTTY/Navtex * Synop decoding in RTTY mode in reception buffer, in red. * Creation of KML file for Synop data. * Creation of KML file for Navtex messages. * User locator displayed in KML. * Multiline Synop and Navtex messages displayed in Adif logs. * Added flsynop program as stand alone Synop decoder. * Fixed Navtex default stations filename and Italian stations. * Fixed Navtex frequency error. * Added KML tab in configuration menu. * Added parameters files for Synop decoding. * Fixed CoordinateT type for different deserialization. * Less logging messages from subthreads, because they might crash. * Added try/catch blocks in main program. * Can reload previous KML files at startup. * Named WMO code tables in Synop decoding. * Synop data can be logged to Adif files. * flsynop can load kml files from one dir and save them elsewhere. * Added strreplace and strcapitalize. * Added Levenshtein distance for future use. * Added class QsoHelper to ease Adif logging. * East longitude positive, West negative. Fixes Navtex detection. * Chars '=' or ';' used as a Synop end-of-section marker. * Added option command in KML tab executed on KML file save. * Reverse mode now saved in configuration. * Comments in DOxygen syntax. * Kml snippet stored once only per placemark. * Code more compatible with Eclipse parsing. * Synop decoded text can be interleaved with 5-digits groups. * KML balloons can be in simple tables, matrices or plain text. * Adif messages are saved in the main thread. * Starts external command only if KML file was saved. * Maximum KML data retention time is ten years, default 0 is no limit. * Do not reload KML files when changing KML parameters. * User kml file does not grow at each fldigi start. * Relative humidity always parsed with Celsius temperature. * Empty KML files are created on startup if not there. * Prepared porting processes functions to Mingw. * Added script for FTP transfer of KML files. * Added synop_tool * Navtex now has reverse mode. * Data files can be updated from the Internet. * HTTP load without anymore because crash in Wine
2013-06-01 07:40:24 +00:00
public:
/// List of key-value pairs displayed for example in Google Earth balloons.
struct CustomDataT : public std::vector< std::pair< std::string, std::string > > {
/// Also used when reloading a KML file.
void Push( const char * k, const std::string & v );
/// TODO: Most of keys are duplicated. Should store them in a hash to reduce memory footprint.
void Push( const char * k, const char * v ) {
Push( k, std::string(v) );
}
/// This helper makes insertions simpler.
template< class Type >
void Push( const char * k, const Type & v ) {
std::stringstream strm ;
strm << v ;
Push( k, strm.str() );
}
};
KmlServer() : m_nb_broadcasts(0), exit_kml_server(0), request_broadcast(0) {}
KML/Synop/RTTY/Navtex * Synop decoding in RTTY mode in reception buffer, in red. * Creation of KML file for Synop data. * Creation of KML file for Navtex messages. * User locator displayed in KML. * Multiline Synop and Navtex messages displayed in Adif logs. * Added flsynop program as stand alone Synop decoder. * Fixed Navtex default stations filename and Italian stations. * Fixed Navtex frequency error. * Added KML tab in configuration menu. * Added parameters files for Synop decoding. * Fixed CoordinateT type for different deserialization. * Less logging messages from subthreads, because they might crash. * Added try/catch blocks in main program. * Can reload previous KML files at startup. * Named WMO code tables in Synop decoding. * Synop data can be logged to Adif files. * flsynop can load kml files from one dir and save them elsewhere. * Added strreplace and strcapitalize. * Added Levenshtein distance for future use. * Added class QsoHelper to ease Adif logging. * East longitude positive, West negative. Fixes Navtex detection. * Chars '=' or ';' used as a Synop end-of-section marker. * Added option command in KML tab executed on KML file save. * Reverse mode now saved in configuration. * Comments in DOxygen syntax. * Kml snippet stored once only per placemark. * Code more compatible with Eclipse parsing. * Synop decoded text can be interleaved with 5-digits groups. * KML balloons can be in simple tables, matrices or plain text. * Adif messages are saved in the main thread. * Starts external command only if KML file was saved. * Maximum KML data retention time is ten years, default 0 is no limit. * Do not reload KML files when changing KML parameters. * User kml file does not grow at each fldigi start. * Relative humidity always parsed with Celsius temperature. * Empty KML files are created on startup if not there. * Prepared porting processes functions to Mingw. * Added script for FTP transfer of KML files. * Added synop_tool * Navtex now has reverse mode. * Data files can be updated from the Internet. * HTTP load without anymore because crash in Wine
2013-06-01 07:40:24 +00:00
virtual ~KmlServer() {}
/// BEWARE: Will work until 2038.
static const time_t UniqueEvent = INT_MAX ;
/// This can for example go to a NMEA client.
virtual void Broadcast(
const std::string & category,
time_t evtTim,
const CoordinateT::Pair & refCoo,
double altitude,
const std::string & kml_name,
const std::string & styleNam,
const std::string & descrTxt,
const CustomDataT & custDat ) = 0;
/// Singleton.
static KmlServer * GetInstance(void);
/// Number of calls to Broadcast(). Debugging purpose only.
int NbBroadcasts(void) const { return m_nb_broadcasts; }
/// Debugging only, just to check what happens inside.
void ResetCounter() { m_nb_broadcasts = 0;}
virtual void Reset() = 0;
/// TODO: Maybe have one display style per category, instead of the same for all.
virtual void InitParams(
const std::string & kml_command,
const std::string & kml_dir,
double kml_merge = 10000,
int kml_retention = 0, // Keep all data.
int kml_refresh = 120,
int kml_balloon_style = 0) = 0;
virtual void ReloadKmlFiles() = 0;
/// Creates the process for the command to be run when KML data is saved.
static void SpawnProcess();
/// Stops the sub-thread, flush KML data to the files.
static void Exit();
static std::string Tm2Time( time_t tim );
/// No value means, now.
static std::string Tm2Time(void);
};
#endif // _KMLSERVER_H