FlightGear next
FGATCController Class Referenceabstract

class FGATCController NOTE: this class serves as an abstraction layer for all sorts of ATC controllers. More...

#include <ATCController.hxx>

Inherited by EnRouteController, FGApproachController, FGGroundController, FGStartupController, and FGTowerController.

Public Types

enum  AtcMsgId {
  MSG_ANNOUNCE_ENGINE_START , MSG_REQUEST_ENGINE_START , MSG_PERMIT_ENGINE_START , MSG_DENY_ENGINE_START ,
  MSG_ACKNOWLEDGE_ENGINE_START , MSG_REQUEST_PUSHBACK_CLEARANCE , MSG_PERMIT_PUSHBACK_CLEARANCE , MSG_HOLD_PUSHBACK_CLEARANCE ,
  MSG_ACKNOWLEDGE_SWITCH_GROUND_FREQUENCY , MSG_INITIATE_CONTACT , MSG_ACKNOWLEDGE_INITIATE_CONTACT , MSG_REQUEST_TAXI_CLEARANCE ,
  MSG_ISSUE_TAXI_CLEARANCE , MSG_ACKNOWLEDGE_TAXI_CLEARANCE , MSG_HOLD_POSITION , MSG_ACKNOWLEDGE_HOLD_POSITION ,
  MSG_RESUME_TAXI , MSG_ACKNOWLEDGE_RESUME_TAXI , MSG_REPORT_RUNWAY_HOLD_SHORT , MSG_ACKNOWLEDGE_REPORT_RUNWAY_HOLD_SHORT ,
  MSG_CLEARED_FOR_TAKEOFF , MSG_ACKNOWLEDGE_CLEARED_FOR_TAKEOFF , MSG_SWITCH_TOWER_FREQUENCY , MSG_ACKNOWLEDGE_SWITCH_TOWER_FREQUENCY ,
  MSG_ARRIVAL , MSG_ACKNOWLEDGE_ARRIVAL , MSG_HOLD , MSG_ACKNOWLEDGE_HOLD ,
  MSG_CLEARED_TO_LAND , MSG_ACKNOWLEDGE_CLEARED_TO_LAND , MSG_TAXI_PARK , MSG_ACKNOWLEDGE_TAXI_PARK
}
 
enum  AtcMsgDir { ATC_AIR_TO_GROUND , ATC_GROUND_TO_AIR }
 

Public Member Functions

 FGATCController ()
 
virtual ~FGATCController ()
 
void init ()
 
void setAirportGroundRadar (SGSharedPtr< AirportGroundRadar > groundRadar)
 
virtual void announcePosition (int id, FGAIFlightPlan *intendedRoute, int currentRoute, double lat, double lon, double hdg, double spd, double alt, double radius, int leg, FGAIAircraft *aircraft)=0
 
virtual void updateAircraftInformation (int id, SGGeod geod, double heading, double speed, double alt, double dt)=0
 
bool checkTransmissionState (int minState, int MaxState, TrafficVectorIterator i, time_t now, AtcMsgId msgId, AtcMsgDir msgDir)
 
SGSharedPtr< FGTrafficRecordgetRecord (int id) const
 
virtual void handover (SGSharedPtr< FGTrafficRecord > aiObject, int leg)
 We share the traffic record much like real life.
 
virtual void signOff (int id)
 Sign off the aircraft with the id from this controller.
 
bool hasInstruction (int id)
 
FGATCInstruction getInstruction (int id)
 
bool hasActiveTraffic ()
 
TrafficVectorgetActiveTraffic ()
 
double getDt ()
 
void setDt (double dt)
 
void transmit (FGTrafficRecord *rec, FGAirportDynamics *parent, AtcMsgId msgId, AtcMsgDir msgDir, bool audible)
 
std::string getGateName (FGAIAircraft *aircraft)
 
virtual void render (bool)=0
 
virtual std::string getName () const =0
 
virtual void update (double)=0
 

Protected Member Functions

std::string formatATCFrequency3_2 (int)
 
std::string genTransponderCode (const std::string &fltRules)
 
bool isUserAircraft (FGAIAircraft *)
 
void clearTrafficControllers ()
 
TrafficVectorIterator searchActiveTraffic (int id) const
 Search activeTraffic vector to find matching id.
 
void eraseDeadTraffic ()
 
virtual int getFrequency ()=0
 Returns the frequency to be used.
 

Protected Attributes

bool _isDestroying = false
 
bool initialized
 
bool available
 
time_t lastTransmission
 
TrafficVector activeTraffic
 
std::default_random_engine generator
 
double dt_count
 
osg::Group * group
 
FGAirportDynamicsparent = nullptr
 
SGSharedPtr< AirportGroundRadarairportGroundRadar
 

Detailed Description

class FGATCController NOTE: this class serves as an abstraction layer for all sorts of ATC controllers.

Definition at line 71 of file ATCController.hxx.

Member Enumeration Documentation

◆ AtcMsgDir

Enumerator
ATC_AIR_TO_GROUND 
ATC_GROUND_TO_AIR 

Definition at line 135 of file ATCController.hxx.

◆ AtcMsgId

Enumerator
MSG_ANNOUNCE_ENGINE_START 
MSG_REQUEST_ENGINE_START 
MSG_PERMIT_ENGINE_START 
MSG_DENY_ENGINE_START 
MSG_ACKNOWLEDGE_ENGINE_START 
MSG_REQUEST_PUSHBACK_CLEARANCE 
MSG_PERMIT_PUSHBACK_CLEARANCE 
MSG_HOLD_PUSHBACK_CLEARANCE 
MSG_ACKNOWLEDGE_SWITCH_GROUND_FREQUENCY 
MSG_INITIATE_CONTACT 
MSG_ACKNOWLEDGE_INITIATE_CONTACT 
MSG_REQUEST_TAXI_CLEARANCE 
MSG_ISSUE_TAXI_CLEARANCE 
MSG_ACKNOWLEDGE_TAXI_CLEARANCE 
MSG_HOLD_POSITION 
MSG_ACKNOWLEDGE_HOLD_POSITION 
MSG_RESUME_TAXI 
MSG_ACKNOWLEDGE_RESUME_TAXI 
MSG_REPORT_RUNWAY_HOLD_SHORT 
MSG_ACKNOWLEDGE_REPORT_RUNWAY_HOLD_SHORT 
MSG_CLEARED_FOR_TAKEOFF 
MSG_ACKNOWLEDGE_CLEARED_FOR_TAKEOFF 
MSG_SWITCH_TOWER_FREQUENCY 
MSG_ACKNOWLEDGE_SWITCH_TOWER_FREQUENCY 
MSG_ARRIVAL 
MSG_ACKNOWLEDGE_ARRIVAL 
MSG_HOLD 
MSG_ACKNOWLEDGE_HOLD 
MSG_CLEARED_TO_LAND 
MSG_ACKNOWLEDGE_CLEARED_TO_LAND 
MSG_TAXI_PARK 
MSG_ACKNOWLEDGE_TAXI_PARK 

Definition at line 100 of file ATCController.hxx.

Constructor & Destructor Documentation

◆ FGATCController()

FGATCController::FGATCController ( )

Definition at line 51 of file ATCController.cxx.

◆ ~FGATCController()

FGATCController::~FGATCController ( )
virtual

Definition at line 61 of file ATCController.cxx.

Member Function Documentation

◆ announcePosition()

virtual void FGATCController::announcePosition ( int id,
FGAIFlightPlan * intendedRoute,
int currentRoute,
double lat,
double lon,
double hdg,
double spd,
double alt,
double radius,
int leg,
FGAIAircraft * aircraft )
pure virtual

◆ checkTransmissionState()

bool FGATCController::checkTransmissionState ( int minState,
int MaxState,
TrafficVectorIterator i,
time_t now,
AtcMsgId msgId,
AtcMsgDir msgDir )

Definition at line 95 of file ATCController.cxx.

◆ clearTrafficControllers()

void FGATCController::clearTrafficControllers ( )
protected

Definition at line 592 of file ATCController.cxx.

◆ eraseDeadTraffic()

void FGATCController::eraseDeadTraffic ( )
protected

Definition at line 558 of file ATCController.cxx.

◆ formatATCFrequency3_2()

string FGATCController::formatATCFrequency3_2 ( int freq)
protected

Definition at line 530 of file ATCController.cxx.

◆ genTransponderCode()

string FGATCController::genTransponderCode ( const std::string & fltRules)
protected

Definition at line 543 of file ATCController.cxx.

◆ getActiveTraffic()

TrafficVector & FGATCController::getActiveTraffic ( )
inline

Definition at line 165 of file ATCController.hxx.

◆ getDt()

double FGATCController::getDt ( )
inline

Definition at line 169 of file ATCController.hxx.

◆ getFrequency()

virtual int FGATCController::getFrequency ( )
protectedpure virtual

Returns the frequency to be used.

Implemented in EnRouteController.

◆ getGateName()

string FGATCController::getGateName ( FGAIAircraft * aircraft)

Definition at line 85 of file ATCController.cxx.

◆ getInstruction()

FGATCInstruction FGATCController::getInstruction ( int id)

Definition at line 510 of file ATCController.cxx.

◆ getName()

virtual std::string FGATCController::getName ( ) const
pure virtual

◆ getRecord()

SGSharedPtr< FGTrafficRecord > FGATCController::getRecord ( int id) const

Definition at line 426 of file ATCController.cxx.

◆ handover()

void FGATCController::handover ( SGSharedPtr< FGTrafficRecord > aiObject,
int leg )
virtual

We share the traffic record much like real life.

It gets handed from one controller to the next.

Parameters
aiObject
leg

Reimplemented in FGGroundController.

Definition at line 443 of file ATCController.cxx.

◆ hasActiveTraffic()

bool FGATCController::hasActiveTraffic ( )
inline

Definition at line 162 of file ATCController.hxx.

◆ hasInstruction()

bool FGATCController::hasInstruction ( int id)

Definition at line 495 of file ATCController.cxx.

◆ init()

void FGATCController::init ( )

Definition at line 71 of file ATCController.cxx.

◆ isUserAircraft()

bool FGATCController::isUserAircraft ( FGAIAircraft * ac)
protected

Definition at line 90 of file ATCController.cxx.

◆ render()

virtual void FGATCController::render ( bool )
pure virtual

◆ searchActiveTraffic()

TrafficVectorIterator FGATCController::searchActiveTraffic ( int id) const
protected

Search activeTraffic vector to find matching id.

Parameters
idinteger to search for in the vector
Returns
the matching item OR activeTraffic.end()

Definition at line 582 of file ATCController.cxx.

◆ setAirportGroundRadar()

void FGATCController::setAirportGroundRadar ( SGSharedPtr< AirportGroundRadar > groundRadar)

Definition at line 80 of file ATCController.cxx.

◆ setDt()

void FGATCController::setDt ( double dt)
inline

Definition at line 172 of file ATCController.hxx.

◆ signOff()

void FGATCController::signOff ( int id)
virtual

Sign off the aircraft with the id from this controller.

Parameters
idthe id of the aircraft

Reimplemented in FGTowerController.

Definition at line 462 of file ATCController.cxx.

◆ transmit()

void FGATCController::transmit ( FGTrafficRecord * rec,
FGAirportDynamics * parent,
AtcMsgId msgId,
AtcMsgDir msgDir,
bool audible )

Definition at line 125 of file ATCController.cxx.

◆ update()

virtual void FGATCController::update ( double )
pure virtual

◆ updateAircraftInformation()

virtual void FGATCController::updateAircraftInformation ( int id,
SGGeod geod,
double heading,
double speed,
double alt,
double dt )
pure virtual

Member Data Documentation

◆ _isDestroying

bool FGATCController::_isDestroying = false
protected

Definition at line 78 of file ATCController.hxx.

◆ activeTraffic

TrafficVector FGATCController::activeTraffic
protected

Definition at line 82 of file ATCController.hxx.

◆ airportGroundRadar

SGSharedPtr<AirportGroundRadar> FGATCController::airportGroundRadar
protected

Definition at line 88 of file ATCController.hxx.

◆ available

bool FGATCController::available
protected

Definition at line 80 of file ATCController.hxx.

◆ dt_count

double FGATCController::dt_count
protected

Definition at line 84 of file ATCController.hxx.

◆ generator

std::default_random_engine FGATCController::generator
protected

Definition at line 83 of file ATCController.hxx.

◆ group

osg::Group* FGATCController::group
protected

Definition at line 85 of file ATCController.hxx.

◆ initialized

bool FGATCController::initialized
protected

Definition at line 79 of file ATCController.hxx.

◆ lastTransmission

time_t FGATCController::lastTransmission
protected

Definition at line 81 of file ATCController.hxx.

◆ parent

FGAirportDynamics* FGATCController::parent = nullptr
protected

Definition at line 86 of file ATCController.hxx.


The documentation for this class was generated from the following files: