1
0
Fork 0

adding changed files for previous commit.

This commit is contained in:
Durk Talsma 2011-04-03 17:58:16 +02:00
parent 48bb176e87
commit 52b0baace1
9 changed files with 78 additions and 54 deletions

View file

@ -1088,12 +1088,12 @@ string FGAIAircraft::atGate() {
void FGAIAircraft::handleATCRequests() { void FGAIAircraft::handleATCRequests() {
//TODO implement NullController for having no ATC to save the conditionals //TODO implement NullController for having no ATC to save the conditionals
if (controller) { if (controller) {
controller->update(getID(), controller->updateAircraftInformation(getID(),
pos.getLatitudeDeg(), pos.getLatitudeDeg(),
pos.getLongitudeDeg(), pos.getLongitudeDeg(),
hdg, hdg,
speed, speed,
altitude_ft, dt); altitude_ft, dt);
processATC(controller->getInstruction(getID())); processATC(controller->getInstruction(getID()));
} }
} }

View file

@ -2,6 +2,7 @@ include(FlightGearComponent)
set(SOURCES set(SOURCES
atis_mgr.cxx atis_mgr.cxx
atc_mgr.cxx
trafficcontrol.cxx trafficcontrol.cxx
) )

View file

@ -2,6 +2,8 @@ noinst_LIBRARIES = libATC.a
libATC_a_SOURCES = \ libATC_a_SOURCES = \
atis_mgr.cxx atis_mgr.hxx \ atis_mgr.cxx atis_mgr.hxx \
atcdialog.cxx atcdialog.hxx \
atc_mgr.cxx atc_mgr.hxx \
trafficcontrol.cxx trafficcontrol.hxx trafficcontrol.cxx trafficcontrol.hxx
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src

View file

@ -27,6 +27,7 @@
#include <algorithm> #include <algorithm>
#include "trafficcontrol.hxx" #include "trafficcontrol.hxx"
#include "atc_mgr.hxx"
#include <AIModel/AIAircraft.hxx> #include <AIModel/AIAircraft.hxx>
#include <AIModel/AIFlightPlan.hxx> #include <AIModel/AIFlightPlan.hxx>
#include <AIModel/performancedata.hxx> #include <AIModel/performancedata.hxx>
@ -447,9 +448,17 @@ bool FGATCInstruction::hasInstruction()
FGATCController::FGATCController() FGATCController::FGATCController()
{ {
cerr << "running FGATController constructor" << endl;
dt_count = 0; dt_count = 0;
available = true; available = true;
lastTransmission = 0; lastTransmission = 0;
FGATCManager *mgr = (FGATCManager*) globals->get_subsystem("ATC");
mgr->addController(this);
}
FGATCController::~FGATCController()
{
cerr << "running FGATController destructor" << endl;
} }
string FGATCController::getGateName(FGAIAircraft * ref) string FGATCController::getGateName(FGAIAircraft * ref)
@ -709,9 +718,9 @@ void FGTowerController::announcePosition(int id,
} }
} }
void FGTowerController::update(int id, double lat, double lon, void FGTowerController::updateAircraftInformation(int id, double lat, double lon,
double heading, double speed, double alt, double heading, double speed, double alt,
double dt) double dt)
{ {
TrafficVectorIterator i = activeTraffic.begin(); TrafficVectorIterator i = activeTraffic.begin();
// Search whether the current id has an entry // Search whether the current id has an entry
@ -978,9 +987,9 @@ void FGStartupController::signOff(int id)
} }
} }
void FGStartupController::update(int id, double lat, double lon, void FGStartupController::updateAircraftInformation(int id, double lat, double lon,
double heading, double speed, double alt, double heading, double speed, double alt,
double dt) double dt)
{ {
TrafficVectorIterator i = activeTraffic.begin(); TrafficVectorIterator i = activeTraffic.begin();
// Search search if the current id has an entry // Search search if the current id has an entry
@ -1160,9 +1169,9 @@ void FGApproachController::announcePosition(int id,
} }
} }
void FGApproachController::update(int id, double lat, double lon, void FGApproachController::updateAircraftInformation(int id, double lat, double lon,
double heading, double speed, double alt, double heading, double speed, double alt,
double dt) double dt)
{ {
TrafficVectorIterator i = activeTraffic.begin(); TrafficVectorIterator i = activeTraffic.begin();
// Search search if the current id has an entry // Search search if the current id has an entry

View file

@ -31,6 +31,8 @@
// There is probably a better include than sg_geodesy to get the SG_NM_TO_METER... // There is probably a better include than sg_geodesy to get the SG_NM_TO_METER...
#include <simgear/math/sg_geodesy.hxx> #include <simgear/math/sg_geodesy.hxx>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <simgear/structure/SGReferenced.hxx>
#include <simgear/structure/SGSharedPtr.hxx>
@ -257,14 +259,14 @@ public:
ATC_AIR_TO_GROUND, ATC_AIR_TO_GROUND,
ATC_GROUND_TO_AIR } AtcMsgDir; ATC_GROUND_TO_AIR } AtcMsgDir;
FGATCController(); FGATCController();
virtual ~FGATCController() {}; virtual ~FGATCController();
virtual void announcePosition(int id, FGAIFlightPlan *intendedRoute, int currentRoute, virtual void announcePosition(int id, FGAIFlightPlan *intendedRoute, int currentRoute,
double lat, double lon, double lat, double lon,
double hdg, double spd, double alt, double radius, int leg, double hdg, double spd, double alt, double radius, int leg,
FGAIAircraft *aircraft) = 0; FGAIAircraft *aircraft) = 0;
virtual void signOff(int id) = 0; virtual void signOff(int id) = 0;
virtual void update(int id, double lat, double lon, virtual void updateAircraftInformation(int id, double lat, double lon,
double heading, double speed, double alt, double dt) = 0; double heading, double speed, double alt, double dt) = 0;
virtual bool hasInstruction(int id) = 0; virtual bool hasInstruction(int id) = 0;
virtual FGATCInstruction getInstruction(int id) = 0; virtual FGATCInstruction getInstruction(int id) = 0;
@ -291,7 +293,7 @@ public:
double hdg, double spd, double alt, double radius, int leg, double hdg, double spd, double alt, double radius, int leg,
FGAIAircraft *aircraft); FGAIAircraft *aircraft);
virtual void signOff(int id); virtual void signOff(int id);
virtual void update(int id, double lat, double lon, virtual void updateAircraftInformation(int id, double lat, double lon,
double heading, double speed, double alt, double dt); double heading, double speed, double alt, double dt);
virtual bool hasInstruction(int id); virtual bool hasInstruction(int id);
virtual FGATCInstruction getInstruction(int id); virtual FGATCInstruction getInstruction(int id);
@ -319,7 +321,7 @@ public:
double hdg, double spd, double alt, double radius, int leg, double hdg, double spd, double alt, double radius, int leg,
FGAIAircraft *aircraft); FGAIAircraft *aircraft);
virtual void signOff(int id); virtual void signOff(int id);
virtual void update(int id, double lat, double lon, virtual void updateAircraftInformation(int id, double lat, double lon,
double heading, double speed, double alt, double dt); double heading, double speed, double alt, double dt);
virtual bool hasInstruction(int id); virtual bool hasInstruction(int id);
virtual FGATCInstruction getInstruction(int id); virtual FGATCInstruction getInstruction(int id);
@ -346,7 +348,7 @@ public:
double hdg, double spd, double alt, double radius, int leg, double hdg, double spd, double alt, double radius, int leg,
FGAIAircraft *aircraft); FGAIAircraft *aircraft);
virtual void signOff(int id); virtual void signOff(int id);
virtual void update(int id, double lat, double lon, virtual void updateAircraftInformation(int id, double lat, double lon,
double heading, double speed, double alt, double dt); double heading, double speed, double alt, double dt);
virtual bool hasInstruction(int id); virtual bool hasInstruction(int id);
virtual FGATCInstruction getInstruction(int id); virtual FGATCInstruction getInstruction(int id);

View file

@ -46,6 +46,7 @@ FGATCDialog *current_atcdialog;
// For the command manager - maybe eventually this should go in the built in command list // For the command manager - maybe eventually this should go in the built in command list
static bool do_ATC_dialog(const SGPropertyNode* arg) { static bool do_ATC_dialog(const SGPropertyNode* arg) {
cerr << "Running ATCDCL do_ATC_dialog" << endl;
current_atcdialog->PopupDialog(); current_atcdialog->PopupDialog();
return(true); return(true);
} }
@ -101,39 +102,39 @@ FGATCDialog::~FGATCDialog() {
void FGATCDialog::Init() { void FGATCDialog::Init() {
// Add ATC-dialog to the command list // Add ATC-dialog to the command list
globals->get_commands()->addCommand("ATC-dialog", do_ATC_dialog); //globals->get_commands()->addCommand("ATC-dialog", do_ATC_dialog);
// Add ATC-freq-search to the command list // Add ATC-freq-search to the command list
globals->get_commands()->addCommand("ATC-freq-search", do_ATC_freq_search); //globals->get_commands()->addCommand("ATC-freq-search", do_ATC_freq_search);
// initialize properties polled in Update() // initialize properties polled in Update()
globals->get_props()->setStringValue("/sim/atc/freq-airport", ""); //globals->get_props()->setStringValue("/sim/atc/freq-airport", "");
globals->get_props()->setIntValue("/sim/atc/transmission-num", -1); //globals->get_props()->setIntValue("/sim/atc/transmission-num", -1);
} }
void FGATCDialog::Update(double dt) { void FGATCDialog::Update(double dt) {
static SGPropertyNode_ptr airport = globals->get_props()->getNode("/sim/atc/freq-airport", true); //static SGPropertyNode_ptr airport = globals->get_props()->getNode("/sim/atc/freq-airport", true);
string s = airport->getStringValue(); //string s = airport->getStringValue();
if (!s.empty()) { //if (!s.empty()) {
airport->setStringValue(""); // airport->setStringValue("");
FreqDisplay(s); // FreqDisplay(s);
} //}
static SGPropertyNode_ptr trans_num = globals->get_props()->getNode("/sim/atc/transmission-num", true); //static SGPropertyNode_ptr trans_num = globals->get_props()->getNode("/sim/atc/transmission-num", true);
int n = trans_num->getIntValue(); //int n = trans_num->getIntValue();
if (n >= 0) { //if (n >= 0) {
trans_num->setIntValue(-1); // trans_num->setIntValue(-1);
PopupCallback(n); // PopupCallback(n);
} //}
if(_callbackPending) { //if(_callbackPending) {
if(_callbackTimer > _callbackWait) { // if(_callbackTimer > _callbackWait) {
_callbackPtr->ReceiveUserCallback(_callbackCode); // _callbackPtr->ReceiveUserCallback(_callbackCode);
_callbackPtr->NotifyTransmissionFinished(fgGetString("/sim/user/callsign")); // _callbackPtr->NotifyTransmissionFinished(fgGetString("/sim/user/callsign"));
_callbackPending = false; // _callbackPending = false;
} else { // } else {
_callbackTimer += dt; // _callbackTimer += dt;
} // }
} //}
} }
// Add an entry // Add an entry

View file

@ -510,9 +510,9 @@ void FGGroundNetwork::signOff(int id)
} }
} }
void FGGroundNetwork::update(int id, double lat, double lon, void FGGroundNetwork::updateAircraftInformation(int id, double lat, double lon,
double heading, double speed, double alt, double heading, double speed, double alt,
double dt) double dt)
{ {
// Check whether aircraft are on hold due to a preceding pushback. If so, make sure to // Check whether aircraft are on hold due to a preceding pushback. If so, make sure to
// Transmit air-to-ground "Ready to taxi request: // Transmit air-to-ground "Ready to taxi request:

View file

@ -269,7 +269,7 @@ public:
double lat, double lon, double hdg, double spd, double alt, double lat, double lon, double hdg, double spd, double alt,
double radius, int leg, FGAIAircraft *aircraft); double radius, int leg, FGAIAircraft *aircraft);
virtual void signOff(int id); virtual void signOff(int id);
virtual void update(int id, double lat, double lon, double heading, double speed, double alt, double dt); virtual void updateAircraftInformation(int id, double lat, double lon, double heading, double speed, double alt, double dt);
virtual bool hasInstruction(int id); virtual bool hasInstruction(int id);
virtual FGATCInstruction getInstruction(int id); virtual FGATCInstruction getInstruction(int id);

View file

@ -77,6 +77,7 @@
#include <ATCDCL/ATCmgr.hxx> #include <ATCDCL/ATCmgr.hxx>
#include <ATCDCL/commlist.hxx> #include <ATCDCL/commlist.hxx>
#include <ATC/atis_mgr.hxx> #include <ATC/atis_mgr.hxx>
#include <ATC/atc_mgr.hxx>
#include <Autopilot/route_mgr.hxx> #include <Autopilot/route_mgr.hxx>
#include <Autopilot/autopilotgroup.hxx> #include <Autopilot/autopilotgroup.hxx>
@ -1384,6 +1385,10 @@ bool fgInitSubsystems() {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Initialise the ATC Manager // Initialise the ATC Manager
// Note that this is old stuff, but might be necessesary for the
// current ATIS implementation. Therefore, leave it in here
// until the ATIS system is ported over to make use of the ATIS
// sub system infrastructure.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
SG_LOG(SG_GENERAL, SG_INFO, " ATC Manager"); SG_LOG(SG_GENERAL, SG_INFO, " ATC Manager");
@ -1391,7 +1396,11 @@ bool fgInitSubsystems() {
globals->get_ATC_mgr()->init(); globals->get_ATC_mgr()->init();
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Initialise the ATIS Manager // Initialize the ATC subsystem
////////////////////////////////////////////////////////////////////
globals->add_subsystem("ATC", new FGATCManager, SGSubsystemMgr::POST_FDM);
////////////////////////////////////////////////////////////////////
// Initialise the ATIS Subsystem
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
globals->add_subsystem("atis", new FGAtisManager, SGSubsystemMgr::POST_FDM); globals->add_subsystem("atis", new FGAtisManager, SGSubsystemMgr::POST_FDM);