// TODO - turn it off if user switches to another freq - keep track of where in message we are etc.
if(_transmit) {
//cout << "transmit\n";
- double user_freq0 = fgGetDouble("/radios/comm[0]/frequencies/selected-mhz");
- double user_freq1 = fgGetDouble("/radios/comm[1]/frequencies/selected-mhz");
+ double user_freq0 = fgGetDouble("/instrumentation/comm[0]/frequencies/selected-mhz");
+ double user_freq1 = fgGetDouble("/instrumentation/comm[1]/frequencies/selected-mhz");
_counter = 0.0;
_max_count = 5.0; // FIXME - hardwired length of message - need to calculate it!
SGSoundSample* simple = new SGSoundSample(buf, len, 8000, false);
// TODO - at the moment the volume is always set off comm1
// and can't be changed after the transmission has started.
- simple->set_volume(5.0 * fgGetDouble("/radios/comm[0]/volume"));
+ simple->set_volume(5.0 * fgGetDouble("/instrumentation/comm[0]/volume"));
globals->get_soundmgr()->add(simple, refname);
if(repeating) {
globals->get_soundmgr()->play_looped(refname);
= new SGSoundSample(buf, len, 8000, false);
// TODO - at the moment the volume is always set off comm1
// and can't be changed after the transmission has started.
- simple->set_volume(5.0 * fgGetDouble("/radios/comm[0]/volume"));
+ simple->set_volume(5.0 * fgGetDouble("/instrumentation/comm[0]/volume"));
globals->get_soundmgr()->add(simple, refname);
if(repeating) {
globals->get_soundmgr()->play_looped(refname);
void FGATCMgr::init() {
//cout << "ATCMgr::init called..." << endl;
- comm_node[0] = fgGetNode("/radios/comm[0]/frequencies/selected-mhz", true);
- comm_node[1] = fgGetNode("/radios/comm[1]/frequencies/selected-mhz", true);
+ comm_node[0] = fgGetNode("/instrumentation/comm[0]/frequencies/selected-mhz", true);
+ comm_node[1] = fgGetNode("/instrumentation/comm[1]/frequencies/selected-mhz", true);
lon_node = fgGetNode("/position/longitude-deg", true);
lat_node = fgGetNode("/position/latitude-deg", true);
elev_node = fgGetNode("/position/altitude-ft", true);
//Constructor
FGApproach::FGApproach(){
- comm1_node = fgGetNode("/radios/comm[0]/frequencies/selected-mhz", true);
- comm2_node = fgGetNode("/radios/comm[1]/frequencies/selected-mhz", true);
+ comm1_node = fgGetNode("/instrumentation/comm[0]/frequencies/selected-mhz", true);
+ comm2_node = fgGetNode("/instrumentation/comm[1]/frequencies/selected-mhz", true);
_type = APPROACH;
hud_scal.cxx hud_tbi.cxx \
navcom.cxx navcom.hxx \
panel.cxx panel.hxx \
- panel_io.cxx panel_io.hxx \
- radiostack.cxx radiostack.hxx
+ panel_io.cxx panel_io.hxx
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src
+++ /dev/null
-// radiostack.cxx -- class to manage an instance of the radio stack
-//
-// Written by Curtis Olson, started April 2000.
-//
-// Copyright (C) 2000 Curtis L. Olson - http://www.flightgear.org/~curt
-//
-// This program 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 2 of the
-// License, or (at your option) any later version.
-//
-// This program 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 this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-// $Id$
-
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h> // snprintf
-
-#include <simgear/compiler.h>
-#include <simgear/math/sg_random.h>
-
-#include <Aircraft/aircraft.hxx>
-#include <Navaids/navlist.hxx>
-
-#include "radiostack.hxx"
-
-#include <string>
-SG_USING_STD(string);
-
-
-FGRadioStack *current_radiostack;
-
-
-// Constructor
-FGRadioStack::FGRadioStack() {
-}
-
-
-// Destructor
-FGRadioStack::~FGRadioStack()
-{
- //adf.unbind();
- //beacon.unbind();
- navcom1.unbind();
- navcom2.unbind();
- //xponder.unbind();
-}
-
-
-void
-FGRadioStack::init ()
-{
- navcom1.set_bind_index( 0 );
- navcom1.init();
-
- navcom2.set_bind_index( 1 );
- navcom2.init();
-
- //adf.init();
- //beacon.init();
- //xponder.init();
-
- search();
- update(0); // FIXME: use dt
-
- // Search radio database once per second
- globals->get_event_mgr()->addTask( "fgRadioSearch()", current_radiostack,
- &FGRadioStack::search, 1 );
-}
-
-
-void
-FGRadioStack::bind ()
-{
- //adf.bind();
- //beacon.bind();
- //dme.bind();
- navcom1.set_bind_index( 0 );
- navcom1.bind();
- navcom2.set_bind_index( 1 );
- navcom2.bind();
- //xponder.bind();
-}
-
-
-void
-FGRadioStack::unbind ()
-{
- //adf.unbind();
- //beacon.unbind();
- //dme.unbind();
- navcom1.unbind();
- navcom2.unbind();
- //xponder.unbind();
-}
-
-
-// Update the various nav values based on position and valid tuned in navs
-void
-FGRadioStack::update(double dt)
-{
- //adf.update( dt );
- //beacon.update( dt );
- navcom1.update( dt );
- navcom2.update( dt );
- //dme.update( dt ); // dme is updated after the navcom's
- //xponder.update( dt );
-}
-
-
-// Update current nav/adf radio stations based on current postition
-void FGRadioStack::search()
-{
- //adf.search();
- //beacon.search();
- navcom1.search();
- navcom2.search();
- //dme.search();
- //xponder.search();
-}
+++ /dev/null
-// radiostack.hxx -- class to manage an instance of the radio stack
-//
-// Written by Curtis Olson, started April 2000.
-//
-// Copyright (C) 2000 Curtis L. Olson - http://www.flightgear.org/~curt
-//
-// This program 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 2 of the
-// License, or (at your option) any later version.
-//
-// This program 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 this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-// $Id$
-
-
-#ifndef _FG_RADIOSTACK_HXX
-#define _FG_RADIOSTACK_HXX
-
-
-#include <Main/fg_props.hxx>
-
-#include <simgear/compiler.h>
-#include <simgear/structure/subsystem_mgr.hxx>
-#include <simgear/math/interpolater.hxx>
-#include <simgear/timing/timestamp.hxx>
-
-#include <Navaids/navlist.hxx>
-#include <Sound/beacon.hxx>
-#include <Sound/morse.hxx>
-
-//#include "dme.hxx"
-//#include "kt_70.hxx" // Transponder
-//#include "marker_beacon.hxx"
-#include "navcom.hxx"
-
-
-class FGRadioStack : public SGSubsystem
-{
- //FGDME dme;
- //FGKR_87 adf; // King KR 87 Digital ADF model
- //FGKT_70 xponder; // Bendix/King KT 70 Panel-Mounted Transponder
- //FGMarkerBeacon beacon;
- FGNavCom navcom1;
- FGNavCom navcom2;
-
-public:
-
- FGRadioStack();
- ~FGRadioStack();
-
- void init ();
- void bind ();
- void unbind ();
- void update (double dt);
-
- // Update nav/adf radios based on current postition
- void search ();
-
- //inline FGDME *get_dme() { return &dme; }
- inline FGNavCom *get_navcom1() { return &navcom1; }
- inline FGNavCom *get_navcom2() { return &navcom2; }
-};
-
-
-extern FGRadioStack *current_radiostack;
-
-#endif // _FG_RADIOSTACK_HXX
cdi_serviceable = (node->getChild("cdi", 0, true))
->getChild("serviceable", 0, true);
gs_serviceable = (node->getChild("gs", 0, true))
- ->getNode("serviceable");
+ ->getChild("serviceable");
tofrom_serviceable = (node->getChild("to-from", 0, true))
->getChild("serviceable", 0, true);
+
+ std::ostringstream temp;
+ temp << name << "nav-ident" << num;
+ nav_fx_name = temp.str();
+ temp << name << "dme-ident" << num;
+ dme_fx_name = temp.str();
}
void
fgTie( (branch + "/radials/target-radial-deg").c_str(),
this, &FGNavRadio::get_nav_target_radial_true );
+ fgTie( (branch + "/radials/reciprocal-radial-deg").c_str(),
+ this, &FGNavRadio::get_nav_reciprocal_radial );
+
+ fgTie( (branch + "/radials/target-radial2-deg").c_str(),
+ this, &FGNavRadio::get_nav_target_radial );
+
fgTie( (branch + "/radials/target-auto-hdg-deg").c_str(),
this, &FGNavRadio::get_nav_target_auto_hdg );
fgTie( (branch + "/gs-needle-deflection").c_str(),
this, &FGNavRadio::get_nav_gs_deflection );
+ fgTie( (branch + "/gs-distance").c_str(),
+ this, &FGNavRadio::get_nav_gs_dist_signed );
+
+ fgTie( (branch + "/nav-distance").c_str(),
+ this, &FGNavRadio::get_nav_loc_dist );
+
fgTie( (branch + "/nav-id").c_str(),
this, &FGNavRadio::get_nav_id );
time_t nav_last_time;
int index; // used for property binding
- char nav_fx_name[256];
- char dme_fx_name[256];
+ string nav_fx_name;
+ string dme_fx_name;
bool need_update;
// 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; }
#include <Autopilot/route_mgr.hxx>
#include <Autopilot/xmlauto.hxx>
#include <Cockpit/cockpit.hxx>
-#include <Cockpit/radiostack.hxx>
#include <Cockpit/panel.hxx>
#include <Cockpit/panel_io.hxx>
#ifdef ENABLE_SP_FMDS
#include <Scenery/tilemgr.hxx>
#include <Scripting/NasalSys.hxx>
#include <Sound/fg_fx.hxx>
+#include <Sound/beacon.hxx>
+#include <Sound/morse.hxx>
#include <Systems/system_mgr.hxx>
#include <Time/light.hxx>
#include <Time/moonpos.hxx>
- ////////////////////////////////////////////////////////////////////
- // Initialize the radio stack subsystem.
- ////////////////////////////////////////////////////////////////////
- current_radiostack = new FGRadioStack;
- current_radiostack->init();
- current_radiostack->bind();
-
-
////////////////////////////////////////////////////////////////////
// Initialize the cockpit subsystem
////////////////////////////////////////////////////////////////////
#include <Include/general.hxx>
#include <Cockpit/cockpit.hxx>
-#include <Cockpit/radiostack.hxx>
#include <Cockpit/hud.hxx>
#include <Model/panelnode.hxx>
#include <Model/modelmgr.hxx>
#include <Model/acmodel.hxx>
#include <Scenery/scenery.hxx>
#include <Scenery/tilemgr.hxx>
+#include <Sound/beacon.hxx>
+#include <Sound/morse.hxx>
#include <FDM/flight.hxx>
#include <FDM/UIUCModel/uiuc_aircraftdir.h>
// #include <FDM/ADA.hxx>
globals->get_time_params()->getLst(),
cur_fdm_state->get_Latitude() );
- // Update radio stack model
- current_radiostack->update(delta_time_sec);
}
#include <Aircraft/aircraft.hxx>
#include <Cockpit/panel.hxx>
#include <Cockpit/cockpit.hxx>
-#include <Cockpit/radiostack.hxx>
#include <Cockpit/hud.hxx>
#include <Model/panelnode.hxx>
#include <Model/modelmgr.hxx>
init_config();
SG_LOG( SG_IO, SG_ALERT,
- "Initializing ATC 610x hardware, please wait ..." );
+ "Initializing ATC hardware, please wait ..." );
- snprintf( lock_file, 256, "/proc/atc610x/board%d/lock", board );
snprintf( analog_in_file, 256, "/proc/atc610x/board%d/analog_in", board );
snprintf( radios_file, 256, "/proc/atc610x/board%d/radios", board );
snprintf( switches_file, 256, "/proc/atc610x/board%d/switches", board );
// Open the /proc files
/////////////////////////////////////////////////////////////////////
- lock_fd = ::open( lock_file, O_RDWR );
- if ( lock_fd == -1 ) {
- SG_LOG( SG_IO, SG_ALERT, "errno = " << errno );
- char msg[256];
- snprintf( msg, 256, "Error opening %s", lock_file );
- perror( msg );
- exit( -1 );
- }
-
analog_in_fd = ::open( analog_in_file, O_RDONLY );
if ( analog_in_fd == -1 ) {
SG_LOG( SG_IO, SG_ALERT, "errno = " << errno );
/////////////////////////////////////////////////////////////////////
SG_LOG( SG_IO, SG_ALERT,
- "Done initializing ATC 610x hardware." );
+ "Done initializing ATC hardware." );
is_open = true;
int result;
- result = ::close( lock_fd );
- if ( result == -1 ) {
- SG_LOG( SG_IO, SG_ALERT, "errno = " << errno );
- char msg[256];
- snprintf( msg, 256, "Error closing %s", lock_file );
- perror( msg );
- exit( -1 );
- }
-
result = ::close( analog_in_fd );
if ( result == -1 ) {
SG_LOG( SG_IO, SG_ALERT, "errno = " << errno );
int board;
SGPath config;
- int lock_fd;
int analog_in_fd;
int radios_fd;
int switches_fd;
- char lock_file[256];
char analog_in_file[256];
- char lamps_file[256];
char radios_file[256];
- char stepper_file[256];
char switches_file[256];
unsigned char analog_in_bytes[ATC_ANAL_IN_BYTES];
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/io/iochannel.hxx>
-#include <Cockpit/radiostack.hxx>
+
#include <FDM/flight.hxx>
#include <Main/globals.hxx>
+#include <Main/fg_props.hxx>
+#include <Main/fg_init.hxx>
#include "atlas.hxx"
static SGPropertyNode *adf_freq
= fgGetNode("/instrumentation/kr-87/outputs/selected-khz", true);
+ static SGPropertyNode *nav_freq
+ = fgGetNode("/instrumentation/nav/frequencies/selected-mhz", false);
+ static SGPropertyNode *nav_sel_radial
+ = fgGetNode("/instrumentation/van/radials/selected-deg", false);
char rmc[256], gga[256], patla[256];
char rmc_sum[10], gga_sum[10], patla_sum[10];
sprintf( gga_sum, "%02X", calc_atlas_cksum(gga) );
sprintf( patla, "PATLA,%.2f,%.1f,%.2f,%.1f,%.0f",
- current_radiostack->get_navcom1()->get_nav_freq(),
- current_radiostack->get_navcom1()->get_nav_sel_radial(),
- current_radiostack->get_navcom1()->get_nav_freq(),
- current_radiostack->get_navcom1()->get_nav_sel_radial(),
+ nav_freq->getDoubleValue(),
+ nav_sel_radial->getDoubleValue(),
+ nav_freq->getDoubleValue(),
+ nav_sel_radial->getDoubleValue(),
adf_freq->getDoubleValue() );
sprintf( patla_sum, "%02X", calc_atlas_cksum(patla) );
#include <simgear/io/iochannel.hxx>
#include <simgear/timing/sg_time.hxx>
-#include <Cockpit/radiostack.hxx>
#include <FDM/flight.hxx>
#include <Time/tmp.hxx>
#include <Main/fg_props.hxx>
void FGProps2NetGUI( FGNetGUI *net ) {
+ static SGPropertyNode *nav_freq
+ = fgGetNode("/instrumentation/nav/frequencies/selected-mhz", false);
+ static SGPropertyNode *nav_target_radial
+ = fgGetNode("/instrumentation/nav/radials/target-radial2-deg", false);
+ static SGPropertyNode *nav_inrange
+ = fgGetNode("instrumentation/nav/in-range", false);
+ static SGPropertyNode *nav_loc
+ = fgGetNode("instrumentation/nav/nav-loc", false);
+ static SGPropertyNode *nav_gs_dist_signed
+ = fgGetNode("instrumentation/nav/gs-distance", false);
+ static SGPropertyNode *nav_loc_dist
+ = fgGetNode("instrumentation/nav/nav-distance", false);
+ static SGPropertyNode *nav_reciprocal_radial
+ = fgGetNode("instrumentation/nav/reciprocal-radial-deg", false);
+ static SGPropertyNode *nav_gs_deflection
+ = fgGetNode("instrumentation/nav/gs-needle-deflection", false);
int i;
// Version sanity checking
net->ground_elev = globals->get_scenery()->get_cur_elev();
// Approach
- net->tuned_freq = current_radiostack->get_navcom1()->get_nav_freq();
- net->nav_radial = current_radiostack->get_navcom1()->get_nav_target_radial();
- net->in_range = current_radiostack->get_navcom1()->get_nav_inrange();
+ net->tuned_freq = nav_freq->getDoubleValue();
+ net->nav_radial = nav_target_radial->getDoubleValue();
+ net->in_range = nav_inrange->getBoolValue();
- if ( current_radiostack->get_navcom1()->get_nav_loc() ) {
+ if ( nav_loc->getBoolValue() ) {
// is an ILS
net->dist_nm
- = current_radiostack->get_navcom1()->get_nav_gs_dist_signed()
+ = nav_gs_dist_signed->getDoubleValue()
* SG_METER_TO_NM;
} else {
// is a VOR
- net->dist_nm = current_radiostack->get_navcom1()->get_nav_loc_dist()
+ net->dist_nm = nav_loc_dist->getDoubleValue()
* SG_METER_TO_NM;
}
net->course_deviation_deg
- = current_radiostack->get_navcom1()->get_nav_reciprocal_radial()
- - current_radiostack->get_navcom1()->get_nav_target_radial();
+ = nav_reciprocal_radial->getDoubleValue()
+ - nav_target_radial->getDoubleValue();
+
if ( net->course_deviation_deg < -1000.0
|| net->course_deviation_deg > 1000.0 )
{
? -net->course_deviation_deg - 180.0
: -net->course_deviation_deg + 180.0 );
- if ( current_radiostack->get_navcom1()->get_nav_loc() ) {
+ if ( nav_loc->getBoolValue() ) {
// is an ILS
net->gs_deviation_deg
- = current_radiostack->get_navcom1()->get_nav_gs_deflection()
+ = nav_gs_deflection->getDoubleValue()
/ 5.0;
} else {
// is an ILS
#include "opengc.hxx"
#include <FDM/flight.hxx>
#include <Main/globals.hxx>
-#include <Cockpit/radiostack.hxx>
#include <Controls/controls.hxx>
#include <Main/fg_props.hxx>