]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATCDCL/atis.hxx
httpd: don't spam the console with debug messages
[flightgear.git] / src / ATCDCL / atis.hxx
index 0c6124b8d6be6ea9627d83d3daae4057769a0feb..525001fa01a006cfc3c0ff3d6c661905b7b07da1 100644 (file)
@@ -19,7 +19,6 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
-
 #ifndef _FG_ATIS_HXX
 #define _FG_ATIS_HXX
 
 
 #include <simgear/compiler.h>
 #include <simgear/timing/sg_time.hxx>
+#include <simgear/props/props.hxx>
 
 #include "ATC.hxx"
 
-//DCL - a complete guess for now.
-#define FG_ATIS_DEFAULT_RANGE 30
-       
+class FGAirport;
+
 typedef std::map<std::string,std::string> MSS;
 
 class FGATIS : public FGATC {
-       
-       //atc_type type;
-
-       // The actual ATIS transmission
-       // This is generated from the prevailing conditions when required.
-       // This is the version with markup, suitable for voice synthesis:
-       std::string transmission;
-       
-       // Same as above, but in a form more readable as text.
-       std::string transmission_readable;
-
-       // for failure modeling
-       std::string trans_ident;                // transmitted ident
-       double old_volume;
-       bool atis_failed;               // atis failed?
-       time_t msg_time;                // for moderating error messages
-       time_t cur_time;
-       int msg_OK;
-       int attention;
-       
-       bool _prev_display;             // Previous value of _display flag
-       MSS _remap;                     // abbreviations to be expanded
-
-       // Aircraft position
-       // ATIS is actually a special case in that unlike other ATC eg.tower it doesn't actually know about
-       // or the whereabouts of the aircraft it is transmitting to.  However, to ensure consistancy of
-       // operation with the other ATC classes the ATIS class must calculate range to the aircraft in order
-       // to decide whether to render the transmission - hence the users plane details must be stored.
-       //SGPropertyNode_ptr airplane_lon_node; 
-       //SGPropertyNode_ptr airplane_lat_node;
-       //SGPropertyNode_ptr airplane_elev_node; 
-       
-       public:
-       
-       FGATIS(void);
-       ~FGATIS(void);
-       virtual void Init();
-       void attend (int);
-
-       //run the ATIS instance
-       void Update(double dt);
-       
-       //inline void set_type(const atc_type tp) {type = tp;}
-       inline const std::string& get_trans_ident() { return trans_ident; }
-       inline void set_refname(const std::string& r) { refname = r; } 
-       
-       private:
-       
-       std::string refname;            // Holds the refname of a transmission in progress
-       
-       // Generate the ATIS transmission text:
-       int GenTransmission(const int regen, const int special);
-       
-       // Put the text into the property tree
-       // (and in debug mode, print it on the console):
-       void TreeOut(int msgOK);
-
-       friend std::istream& operator>> ( std::istream&, FGATIS& );
 
+    std::string        _name;
+    int                _num;
+
+    SGPropertyNode_ptr _root;
+    SGPropertyNode_ptr _volume;
+    SGPropertyNode_ptr _serviceable;
+    SGPropertyNode_ptr _operable;
+    SGPropertyNode_ptr _electrical;
+    SGPropertyNode_ptr _freq;
+    SGPropertyNode_ptr _atis;
+
+    // Pointers to current users position
+    SGPropertyNode_ptr _lon_node;
+    SGPropertyNode_ptr _lat_node;
+    SGPropertyNode_ptr _elev_node;
+
+    SGPropertyChangeCallback<FGATIS> _cb_attention;
+
+    // The actual ATIS transmission
+    // This is generated from the prevailing conditions when required.
+    // This is the version with markup, suitable for voice synthesis:
+    std::string transmission;
+
+    // Same as above, but in a form more readable as text.
+    std::string transmission_readable;
+
+    // for failure modeling
+    std::string trans_ident; // transmitted ident
+    double old_volume;
+    bool atis_failed;        // atis failed?
+    time_t msg_time;         // for moderating error messages
+    time_t cur_time;
+    int msg_OK;
+    bool _attention;
+    bool _check_transmission;
+
+    bool _prev_display;      // Previous value of _display flag
+    MSS _remap;              // abbreviations to be expanded
+
+    // internal periodic station search timer
+    double _time_before_search_sec;
+    int _last_frequency;
+
+    // temporary buffer for string conversions
+    char buf[100];
+
+    // data for the current ATIS report
+    struct
+    {
+        std::string phonetic_seq_string;
+        bool    US_CA;
+        bool    cavok;
+        bool    concise;
+        bool    ils;
+        int     temp;
+        int     dewpoint;
+        double  psl;
+        double  qnh;
+        double  rain_norm, snow_norm;
+        int     notam;
+        std::string hours,mins;
+    } _report;
+
+public:
+
+    FGATIS(const std::string& name, int num);
+
+    void init();
+    void reinit();
+
+    void attend(SGPropertyNode* node);
+
+    //run the ATIS instance
+    void update(double dt);
+
+    //inline void set_type(const atc_type tp) {type = tp;}
+    inline const std::string& get_trans_ident() { return trans_ident; }
+
+protected:
+    virtual FGATCVoice* GetVoicePointer();
+
+private:
+
+    void createReport       (const FGAirport* apt);
+
+    /** generate the ATIS transmission text */
+    bool genTransmission    (const int regen, bool forceUpdate);
+    void genTimeInfo        (void);
+    void genFacilityInfo    (void);
+    void genPrecipitationInfo(void);
+    bool genVisibilityInfo  (std::string& vis_info);
+    bool genCloudInfo       (std::string& cloud_info);
+    void genWindInfo        (void);
+    void genTemperatureInfo (void);
+    void genTransitionLevel (const FGAirport* apt);
+    void genPressureInfo    (void);
+    void genRunwayInfo      (const FGAirport* apt);
+    void genWarnings        (int position);
+
+    void addTemperature     (int Temp);
+
+    // Put the text into the property tree
+    // (and in debug mode, print it on the console):
+    void treeOut(int msgOK);
+
+    // Search the specified radio for stations on the same frequency and in range.
+    bool search(double dt);
+
+    friend std::istream& operator>> ( std::istream&, FGATIS& );
 };
 
 typedef int (FGATIS::*int_getter)() const;