#include <simgear/structure/subsystem_mgr.hxx>
#include <simgear/environment/metar.hxx>
-#ifdef ENABLE_THREADS
+#if defined(ENABLE_THREADS) && ENABLE_THREADS
# include <simgear/threads/SGThread.hxx>
# include <simgear/threads/SGQueue.hxx>
#endif
class SGPropertyNode;
#include "environment.hxx"
+#include "fgmetar.hxx"
\f
virtual void setEnvironment (FGEnvironment * environment);
- virtual FGEnvironment * getEnvironment () const { return _environment; }
+ virtual const FGEnvironment * getEnvironment () const { return _environment; }
virtual void setLongitudeDeg (double lon_deg);
virtual void setLatitudeDeg (double lat_deg);
};
-// A convenience wrapper around SGMetar
+// A convenience wrapper around FGMetar
struct FGMetarResult {
string icao;
- SGMetar *m;
+ FGMetar *m;
};
\f
/**
- * Interplation controller using the SGMetar class
+ * Interplation controller using the FGMetar class
*/
class FGMetarEnvironmentCtrl : public FGEnvironmentCtrl
{
SGPropertyNode *proxy_host;
SGPropertyNode *proxy_port;
SGPropertyNode *proxy_auth;
+ SGPropertyNode *metar_max_age;
FGMetarResult fetch_data( const string &icao );
- virtual void update_metar_properties( SGMetar *m );
+ virtual void update_metar_properties( const FGMetar *m );
void update_env_config();
private:
-#ifdef ENABLE_THREADS
+#if defined(ENABLE_THREADS) && ENABLE_THREADS
/**
* FIFO queue which holds a pointer to the fetched metar data.
*/
queue < FGMetarResult > result_queue;
#endif
-#ifdef ENABLE_THREADS
+#if defined(ENABLE_THREADS) && ENABLE_THREADS
/**
* This class represents the thread of execution responsible for
* fetching the metar data.
~MetarThread() {}
/**
- * Fetched the metar data from the NOAA.
+ * Fetche the metar data from the NOAA.
*/
void run();
* Thread cleanup handler.
*/
friend void metar_cleanup_handler( void* );
+
#endif // ENABLE_THREADS
+
+ int _error_count;
+ double _dt;
+ double _error_dt;
};
#endif // _ENVIRONMENT_CTRL_HXX