X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FInstrumentation%2Fnavradio.hxx;h=a03ccb739aa0b5e7337ed91d5ad203dfd9a3ed33;hb=bb2b03c7e392e107aeaf7dbc4eecc59064b28512;hp=61072d06a62acbc3a531a8095f05144f53946720;hpb=1ad71dbbe07ae3814fbaa1ce541de520054665d8;p=flightgear.git diff --git a/src/Instrumentation/navradio.hxx b/src/Instrumentation/navradio.hxx index 61072d06a..a03ccb739 100644 --- a/src/Instrumentation/navradio.hxx +++ b/src/Instrumentation/navradio.hxx @@ -16,7 +16,7 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // // $Id$ @@ -43,77 +43,108 @@ class FGNavRadio : public SGSubsystem SGInterpTable *low_tbl; SGInterpTable *high_tbl; - SGPropertyNode *lon_node; - SGPropertyNode *lat_node; - SGPropertyNode *alt_node; - SGPropertyNode *bus_power; - SGPropertyNode *nav_serviceable; - SGPropertyNode *cdi_serviceable, *gs_serviceable, *tofrom_serviceable; + SGPropertyNode_ptr lon_node; + SGPropertyNode_ptr lat_node; + SGPropertyNode_ptr alt_node; + SGPropertyNode_ptr bus_power_node; + + // property inputs + SGPropertyNode_ptr is_valid_node; // is station data valid (may be way out + // of range.) + SGPropertyNode_ptr power_btn_node; + SGPropertyNode_ptr freq_node; // primary freq + SGPropertyNode_ptr alt_freq_node; // standby freq + SGPropertyNode_ptr sel_radial_node; // selected radial + SGPropertyNode_ptr vol_btn_node; + SGPropertyNode_ptr ident_btn_node; + SGPropertyNode_ptr audio_btn_node; + SGPropertyNode_ptr backcourse_node; + SGPropertyNode_ptr nav_serviceable_node; + SGPropertyNode_ptr cdi_serviceable_node; + SGPropertyNode_ptr gs_serviceable_node; + SGPropertyNode_ptr tofrom_serviceable_node; + + // property outputs + SGPropertyNode_ptr fmt_freq_node; // formated frequency + SGPropertyNode_ptr fmt_alt_freq_node; // formated alternate frequency + SGPropertyNode_ptr heading_node; // true heading to nav station + SGPropertyNode_ptr radial_node; // current radial we are on (taking + // into consideration the vor station + // alignment which likely doesn't + // match the magnetic alignment + // exactly.) + SGPropertyNode_ptr recip_radial_node; // radial_node(val) + 180 (for + // convenience) + SGPropertyNode_ptr target_radial_true_node; + // true heading of selected radial + SGPropertyNode_ptr target_auto_hdg_node; + // suggested autopilot heading + // to intercept selected radial + SGPropertyNode_ptr time_to_intercept; // estimated time to intecept selected + // radial at current speed and heading + SGPropertyNode_ptr to_flag_node; + SGPropertyNode_ptr from_flag_node; + SGPropertyNode_ptr inrange_node; + SGPropertyNode_ptr signal_quality_norm_node; + SGPropertyNode_ptr cdi_deflection_node; + SGPropertyNode_ptr cdi_xtrack_error_node; + SGPropertyNode_ptr cdi_xtrack_hdg_err_node; + SGPropertyNode_ptr has_gs_node; + SGPropertyNode_ptr loc_node; + SGPropertyNode_ptr loc_dist_node; + SGPropertyNode_ptr gs_deflection_node; + SGPropertyNode_ptr gs_rate_of_climb_node; + SGPropertyNode_ptr gs_dist_node; + SGPropertyNode_ptr nav_id_node; + SGPropertyNode_ptr id_c1_node; + SGPropertyNode_ptr id_c2_node; + SGPropertyNode_ptr id_c3_node; + SGPropertyNode_ptr id_c4_node; + + // gps slaving support + SGPropertyNode_ptr nav_slaved_to_gps_node; + SGPropertyNode_ptr gps_cdi_deflection_node; + SGPropertyNode_ptr gps_to_flag_node; + SGPropertyNode_ptr gps_from_flag_node; + + // internal (private) values string last_nav_id; bool last_nav_vor; - int nav_play_count; - time_t nav_last_time; + int play_count; + time_t last_time; int index; // used for property binding string nav_fx_name; string dme_fx_name; - bool need_update; - - bool power_btn; - bool audio_btn; - - string nav_id; - string nav_trans_ident; - bool nav_valid; - bool nav_inrange; - bool nav_has_dme; - bool nav_has_gs; - bool nav_loc; - double nav_freq; - double nav_alt_freq; - string fmt_freq; // formated frequency - string fmt_alt_freq; // formated alternate frequency - double nav_heading; // true heading to nav station - double nav_radial; // current radial we are on (taking - // into consideration the vor station - // alignment which likely doesn't - // match the magnetic alignment - // exactly.) - double nav_sel_radial; - double nav_target_radial; - double nav_target_radial_true; - double nav_target_auto_hdg; - double nav_loclon; - double nav_loclat; - double nav_x; - double nav_y; - double nav_z; - double nav_loc_dist; - double nav_gslon; - double nav_gslat; + string trans_ident; + bool is_valid; + bool has_dme; + double radial; + double target_radial; + double loc_lon; + double loc_lat; + SGVec3d nav_xyz; + double gs_lon; + double gs_lat; double nav_elev; // use gs elev if available - double nav_gs_x; - double nav_gs_y; - double nav_gs_z; - sgdVec3 gs_base_vec; - double nav_gs_dist; - double nav_gs_dist_signed; - double nav_gs_rate_of_climb; + SGVec3d gs_xyz; + SGVec3d gs_base_vec; + double gs_dist_signed; SGTimeStamp prev_time; SGTimeStamp curr_time; - double nav_range; - double nav_effective_range; - double nav_target_gs; - double nav_twist; - double nav_vol_btn; - bool nav_ident_btn; + double range; + double effective_range; + double target_gs; + double twist; double horiz_vel; double last_x; + double last_loc_dist; + double last_xtrack_error; - string name; - int num; + string _name; + int _num; // internal periodic station search timer double _time_before_search_sec; @@ -138,94 +169,6 @@ public: // Update nav/adf radios based on current postition void search (); -/* - inline void set_bind_index( int i ) { - index = i; - sprintf( nav_fx_name, "nav%d-vor-ident", index ); - sprintf( dme_fx_name, "dme%d-vor-ident", index ); - } -*/ - - // NavCom Setters - inline void set_power_btn( bool val ) { power_btn = val; } - inline void set_audio_btn( bool val ) { audio_btn = val; } - - // NAV Setters - inline void set_nav_freq( double freq ) { - nav_freq = freq; need_update = true; - } - inline void set_fmt_freq( const char *freq ) { fmt_freq = freq; } - inline void set_nav_alt_freq( double freq ) { nav_alt_freq = freq; } - inline void set_fmt_alt_freq( const char *freq ) { fmt_alt_freq = freq; } - inline void set_nav_sel_radial( double radial ) { - nav_sel_radial = radial; need_update = true; - } - inline void set_nav_vol_btn( double val ) { - if ( val < 0.0 ) val = 0.0; - if ( val > 1.0 ) val = 1.0; - nav_vol_btn = val; - } - inline void set_nav_ident_btn( bool val ) { nav_ident_btn = val; } - - // NavCom Accessors - inline bool has_power() const { - return power_btn && (bus_power->getDoubleValue() > 1.0); - } - inline bool get_power_btn() const { return power_btn; } - inline bool get_audio_btn() const { return audio_btn; } - - // NAV Accessors - inline double get_nav_freq () const { return nav_freq; } - inline const char *get_fmt_freq () const { return fmt_freq.c_str(); } - inline double get_nav_alt_freq () const { return nav_alt_freq; } - inline const char *get_fmt_alt_freq () const { - return fmt_alt_freq.c_str(); - } - inline double get_nav_sel_radial() const { return nav_sel_radial; } - inline double get_nav_target_radial() const { return nav_target_radial; } - inline double get_nav_target_radial_true() const { - return nav_target_radial_true; - } - inline double get_nav_target_auto_hdg() const { - return nav_target_auto_hdg; - } - - // Calculated values. - inline bool get_nav_inrange() const { return nav_inrange; } - bool get_nav_to_flag () const; - bool get_nav_from_flag () const; - inline bool get_nav_has_dme() const { return nav_has_dme; } - inline bool get_nav_dme_inrange () const { - return nav_inrange && nav_has_dme; - } - inline bool get_nav_has_gs() const { return nav_has_gs; } - inline bool get_nav_loc() const { return nav_loc; } - inline double get_nav_loclon() const { return nav_loclon; } - inline double get_nav_loclat() const { return nav_loclat; } - inline double get_nav_loc_dist() const { return nav_loc_dist; } - inline double get_nav_gslon() const { return nav_gslon; } - inline double get_nav_gslat() const { return nav_gslat; } - inline double get_nav_gs_dist() const { return nav_gs_dist; } - inline double get_nav_gs_dist_signed() const { return nav_gs_dist_signed; } - inline double get_nav_gs_rate_of_climb() const { - return nav_gs_rate_of_climb; - } - inline double get_nav_elev() const { return nav_elev; } - double get_nav_heading() const; - double get_nav_radial() const; - double get_nav_reciprocal_radial() const; - inline double get_nav_target_gs() const { return nav_target_gs; } - inline double get_nav_twist() const { return nav_twist; } - double get_nav_cdi_deflection() const; - double get_nav_cdi_xtrack_error() const; - double get_nav_gs_deflection() const; - inline double get_nav_vol_btn() const { return nav_vol_btn; } - inline bool get_nav_ident_btn() const { return nav_ident_btn; } - inline const char * get_nav_id() const { return nav_id.c_str(); } - inline int get_nav_id_c1() const { return nav_id.c_str()[0]; } - inline int get_nav_id_c2() const { return nav_id.c_str()[1]; } - inline int get_nav_id_c3() const { return nav_id.c_str()[2]; } - inline int get_nav_id_c4() const { return nav_id.c_str()[3]; } };