]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/navradio.hxx
Pull Sound-manager out of FGGlobals
[flightgear.git] / src / Instrumentation / navradio.hxx
index 84e877abe15609de79762f64f2f53aa9c0b7943e..c731f1d2b7a3c896c2efce7c7035a1831d92931e 100644 (file)
 #ifndef _FG_NAVRADIO_HXX
 #define _FG_NAVRADIO_HXX
 
-
+#include <Navaids/navaids_fwd.hxx>
 #include <Main/fg_props.hxx>
-#include "Sound/morse.hxx"
 
 #include <simgear/compiler.h>
 #include <simgear/structure/subsystem_mgr.hxx>
 #include <simgear/timing/timestamp.hxx>
 
-// forward decls
-class SGInterpTable;
-
-class FGNavRecord;
-typedef SGSharedPtr<FGNavRecord> FGNavRecordPtr;
+class SGSampleGroup;
 
-class FGNavRadio : public SGSubsystem
+class FGNavRadio : public SGSubsystem, public SGPropertyChangeListener
 {
-    FGMorse morse;
-
-    SGInterpTable *term_tbl;
-    SGInterpTable *low_tbl;
-    SGInterpTable *high_tbl;
-
-    SGPropertyNode_ptr lon_node;
-    SGPropertyNode_ptr lat_node;
-    SGPropertyNode_ptr alt_node;
+    SGPropertyNode_ptr _radio_node;
     SGPropertyNode_ptr bus_power_node;
 
     // property inputs
@@ -57,6 +44,7 @@ class FGNavRadio : public SGSubsystem
     SGPropertyNode_ptr power_btn_node;
     SGPropertyNode_ptr freq_node;       // primary freq
     SGPropertyNode_ptr alt_freq_node;   // standby freq
+    SGPropertyNode_ptr is_loc_freq_node;// is the primary freq a loc/gs (paired) freq?
     SGPropertyNode_ptr sel_radial_node; // selected radial
     SGPropertyNode_ptr vol_btn_node;
     SGPropertyNode_ptr ident_btn_node;
@@ -66,7 +54,6 @@ class FGNavRadio : public SGSubsystem
     SGPropertyNode_ptr cdi_serviceable_node;
     SGPropertyNode_ptr gs_serviceable_node;
     SGPropertyNode_ptr tofrom_serviceable_node;
-    SGPropertyNode_ptr dme_serviceable_node;
     
     // property outputs
     SGPropertyNode_ptr fmt_freq_node;     // formated frequency
@@ -100,6 +87,7 @@ class FGNavRadio : public SGSubsystem
     SGPropertyNode_ptr gs_deflection_node;
     SGPropertyNode_ptr gs_deflection_deg_node;
     SGPropertyNode_ptr gs_deflection_norm_node;
+    SGPropertyNode_ptr gs_direct_node;
     SGPropertyNode_ptr gs_rate_of_climb_node;
     SGPropertyNode_ptr gs_rate_of_climb_fpm_node;
     SGPropertyNode_ptr gs_dist_node;
@@ -120,49 +108,45 @@ class FGNavRadio : public SGSubsystem
     SGPropertyNode_ptr gps_xtrack_error_nm_node;
     SGPropertyNode_ptr _magvarNode;
     
+    // realism setting, are false courses and GS lobes enabled?
+    SGPropertyNode_ptr falseCoursesEnabledNode;
+
     // internal (private) values
 
+    bool _operable; ///< is the unit serviceable, on, powered, etc
     int play_count;
-    time_t last_time;
-    FGNavRecordPtr _navaid;
-    FGNavRecordPtr _gs;
+    bool _nav_search;
+    double _last_freq;
+    FGNavRecordRef _navaid;
+    FGNavRecordRef _gs;
     
-    string nav_fx_name;
-    string dme_fx_name;
-
     double target_radial;
-    SGTimeStamp prev_time;
-    SGTimeStamp curr_time;
     double effective_range;
     double target_gs;
     double twist;
     double horiz_vel;
     double last_x;
-    double last_loc_dist;
     double last_xtrack_error;
     double xrate_ms;
     double _localizerWidth; // cached localizer width in degrees
     
-    string _name;
+    std::string _name;
     int _num;
 
     // internal periodic station search timer
     double _time_before_search_sec;
 
-    SGVec3d _gsCart, _gsAxis, _gsVertical;
+    SGVec3d _gsCart, _gsAxis, _gsVertical, _gsBaseline;
 
-    FGNavRecordPtr _dme;
-    bool _dmeInRange;
-    
     // CDI properties
     bool _toFlag, _fromFlag;
     double _cdiDeflection;
     double _cdiCrossTrackErrorM;
     double _gsNeedleDeflection;
     double _gsNeedleDeflectionNorm;
-    
-    // realism setting, are false courses and GS lobes enabled?
-    bool _falseCoursesEnabled;
+    double _gsDirect;
+
+    class AudioIdent * _audioIdent;
     
     bool updateWithPower(double aDt);
 
@@ -174,35 +158,37 @@ class FGNavRadio : public SGSubsystem
     double adjustILSRange( double stationElev, double aircraftElev,
                           double offsetDegrees, double distance );
 
-    void updateAudio();
-    void audioNavidChanged();
+    void updateAudio( double dt );
 
     void updateReceiver(double dt);
-    void updateDME(const SGVec3d& aircraft);
     void updateGlideSlope(double dt, const SGVec3d& aircraft, double signal_quality_norm);
     void updateGPSSlaved();
     void updateCDI(double dt);
     
     void clearOutputs();
 
-    /**
-     * Compute the localizer width in degrees - see implementation for 
-     * more information on the relevant standards and formulae.
-     */
-    double localizerWidth(FGNavRecord* aLOC);
     FGNavRecord* findPrimaryNavaid(const SGGeod& aPos, double aFreqMHz);
+    
+    /// accessor for tied, read-only 'operable' property
+    bool isOperable() const
+      { return _operable; }
+      
+  // implement SGPropertyChangeListener
+    virtual void valueChanged (SGPropertyNode * prop);
 public:
 
     FGNavRadio(SGPropertyNode *node);
     ~FGNavRadio();
 
     void init ();
+    void reinit ();
     void bind ();
     void unbind ();
     void update (double dt);
 
     // Update nav/adf radios based on current postition
     void search ();
+    void updateNav();
 };