LTAPI
API to access LiveTraffic's aircraft information
LTAPIAircraft Class Reference

Represents one aircraft as controlled by LiveTraffic. More...

#include <LTAPI.h>

Classes

struct  LTAPIBulkData
 Bulk data transfer structur for communication with LTAPI. More...
 
struct  LTAPIBulkInfoTexts
 Bulk text transfer structur for communication with LTAPI. More...
 
struct  LTLights
 Structure to return plane's lights status. More...
 

Public Types

enum  LTFlightPhase {
  FPH_UNKNOWN = 0 , FPH_PARKED = 5 , FPH_TAXI = 10 , FPH_TAKE_OFF = 20 ,
  FPH_TO_ROLL , FPH_ROTATE , FPH_LIFT_OFF , FPH_INITIAL_CLIMB ,
  FPH_CLIMB = 30 , FPH_CRUISE = 40 , FPH_DESCEND = 50 , FPH_APPROACH = 60 ,
  FPH_FINAL , FPH_LANDING = 70 , FPH_FLARE , FPH_TOUCH_DOWN ,
  FPH_ROLL_OUT , FPH_STOPPED_ON_RWY
}
 Flight phase, definition copied from LiveTraffic. More...
 

Public Member Functions

 LTAPIAircraft ()
 
virtual ~LTAPIAircraft ()
 
virtual bool updateAircraft (const LTAPIBulkData &__bulk, size_t __inSize)
 Updates the aircraft with fresh numerical values, called from LTAPIConnect::UpdateAcList()
 
virtual bool updateAircraft (const LTAPIBulkInfoTexts &__info, size_t __inSize)
 Updates the aircraft with fresh textual information, called from LTAPIConnect::UpdateAcList()
 
bool isUpdated () const
 Helper in update loop to detected removed aircrafts.
 
void resetUpdated ()
 Helper in update loop, resets bUpdated flag.
 
virtual void toggleCamera (bool bCameraActive, SPtrLTAPIAircraft spPrevAc)
 Called when LiveTraffic toggles its aircraft camera, override in your class to handle event.
 
void setCameraAc ()
 Declare the aircraft the one under the camera (e.g. if your plugin is a camera plugin and now views this aircraft)
 
std::string getKey () const
 Unique key for this aircraft, usually ICAO transponder hex code.
 
std::string getRegistration () const
 tail number like "D-AISD"
 
std::string getModelIcao () const
 ICAO aircraft type like "A321".
 
std::string getAcClass () const
 a/c class like "L2J"
 
std::string getWtc () const
 wake turbulence category like H,M,L/M,L
 
std::string getOpIcao () const
 ICAO-code of operator like "DLH".
 
std::string getMan () const
 human-readable manufacturer like "Airbus"
 
std::string getModel () const
 human-readable a/c model like "A321-231"
 
std::string getCatDescr () const
 human-readable category description
 
std::string getOp () const
 human-readable operator like "Lufthansa"
 
std::string getCslModel () const
 name of CSL model used for actual rendering of plane
 
std::string getCallSign () const
 call sign like "DLH56C"
 
std::string getSquawk () const
 squawk code (as text) like "1000"
 
std::string getFlightNumber () const
 flight number like "LH1113"
 
std::string getOrigin () const
 origin airport (IATA or ICAO) like "MAD" or "LEMD"
 
std::string getDestination () const
 destination airport (IATA or ICAO) like "FRA" or "EDDF"
 
std::string getTrackedBy () const
 name of channel deliverying the underlying tracking data
 
std::string getDescription () const
 some reasonable descriptive string formed from the above, like an identifier, type, form/to
 
double getLat () const
 [°] latitude
 
double getLon () const
 [°] longitude
 
double getAltFt () const
 [ft] altitude
 
float getHeading () const
 [°] heading
 
float getTrack () const
 [°] track over ground
 
float getRoll () const
 [°] roll: positive right
 
float getPitch () const
 [°] pitch: positive up
 
float getSpeedKn () const
 [kt] ground speed
 
float getVSIft () const
 [ft/minute] vertical speed, positive up
 
float getTerrainFt () const
 [ft] terrain altitude beneath plane
 
float getHeightFt () const
 [ft] height AGL
 
bool isOnGnd () const
 Is plane on ground?
 
LTFlightPhase getPhase () const
 flight phase
 
std::string getPhaseStr () const
 flight phase as string
 
bool isVisible () const
 aircraft visible?
 
float getFlaps () const
 flap position: 0.0 retracted, 1.0 fully extended
 
float getGear () const
 gear position: 0.0 retracted, 1.0 fully extended
 
float getReversers () const
 reversers position: 0.0 closed, 1.0 fully opened
 
LTLights getLights () const
 all plane's lights
 
bool isOnCamera () const
 is currently seen on LiveTraffic's internal camera view?
 
float getBearing () const
 [°] to current camera position
 
float getDistNm () const
 [nm] distance to current camera
 
int getMultiIdx () const
 multiplayer index if plane reported via sim/multiplayer/position dataRefs, 0 if not
 
void getLocalCoord (double &x, double &y, double &z) const
 lat/lon/alt converted to local coordinates
 

Static Public Member Functions

static LTAPIAircraftCreateNewObject ()
 Standard object creation callback.
 

Protected Attributes

LTAPIBulkData bulk
 numerical plane's data
 
LTAPIBulkInfoTexts info
 textual plane's data
 
bool bUpdated = false
 update helper, gets reset before updates, set during updates, stays false if not updated
 

Detailed Description

Represents one aircraft as controlled by LiveTraffic.

You can derive subclasses from this class if you want to add information specific to you app. Then you would need to provide a callback function fCreateAcObject to LTAPIConnect so that you create new aircraft objects when required by LTAPIConnect.

Member Enumeration Documentation

◆ LTFlightPhase

Flight phase, definition copied from LiveTraffic.

Enumerator
FPH_UNKNOWN 

used for initializations

FPH_PARKED 

Parked at startup position.

FPH_TAXI 

Taxiing.

FPH_TAKE_OFF 

Group of status for take-off:

FPH_TO_ROLL 

Take-off roll.

FPH_ROTATE 

Rotating.

FPH_LIFT_OFF 

Lift-off, until "gear-up" height.

FPH_INITIAL_CLIMB 

Initial climb, until "flaps-up" height.

FPH_CLIMB 

Regular climbout.

FPH_CRUISE 

Cruising, no altitude change.

FPH_DESCEND 

Descend, more then 100ft/min descend.

FPH_APPROACH 

Approach, below "flaps-down" height.

FPH_FINAL 

Final, below "gear-down" height.

FPH_LANDING 

Group of status for landing:

FPH_FLARE 

Flare, when reaching "flare " height.

FPH_TOUCH_DOWN 

The one cycle when plane touches down, don't rely on catching it...it's really one cycle only.

FPH_ROLL_OUT 

Roll-out after touch-down until reaching taxi speed or stopping.

FPH_STOPPED_ON_RWY 

Stopped on runway because ran out of tracking data, plane will disappear soon.

Constructor & Destructor Documentation

◆ LTAPIAircraft()

LTAPIAircraft::LTAPIAircraft ( )

◆ ~LTAPIAircraft()

virtual LTAPIAircraft::~LTAPIAircraft ( )
virtual

Member Function Documentation

◆ CreateNewObject()

static LTAPIAircraft * LTAPIAircraft::CreateNewObject ( )
inlinestatic

Standard object creation callback.

Returns
An empty LTAPIAircraft object.

◆ getAcClass()

std::string LTAPIAircraft::getAcClass ( ) const
inline

a/c class like "L2J"

◆ getAltFt()

double LTAPIAircraft::getAltFt ( ) const
inline

[ft] altitude

◆ getBearing()

float LTAPIAircraft::getBearing ( ) const
inline

[°] to current camera position

◆ getCallSign()

std::string LTAPIAircraft::getCallSign ( ) const
inline

call sign like "DLH56C"

◆ getCatDescr()

std::string LTAPIAircraft::getCatDescr ( ) const
inline

human-readable category description

◆ getCslModel()

std::string LTAPIAircraft::getCslModel ( ) const
inline

name of CSL model used for actual rendering of plane

◆ getDescription()

std::string LTAPIAircraft::getDescription ( ) const

some reasonable descriptive string formed from the above, like an identifier, type, form/to

◆ getDestination()

std::string LTAPIAircraft::getDestination ( ) const
inline

destination airport (IATA or ICAO) like "FRA" or "EDDF"

◆ getDistNm()

float LTAPIAircraft::getDistNm ( ) const
inline

[nm] distance to current camera

◆ getFlaps()

float LTAPIAircraft::getFlaps ( ) const
inline

flap position: 0.0 retracted, 1.0 fully extended

◆ getFlightNumber()

std::string LTAPIAircraft::getFlightNumber ( ) const
inline

flight number like "LH1113"

◆ getGear()

float LTAPIAircraft::getGear ( ) const
inline

gear position: 0.0 retracted, 1.0 fully extended

◆ getHeading()

float LTAPIAircraft::getHeading ( ) const
inline

[°] heading

◆ getHeightFt()

float LTAPIAircraft::getHeightFt ( ) const
inline

[ft] height AGL

◆ getKey()

std::string LTAPIAircraft::getKey ( ) const
inline

Unique key for this aircraft, usually ICAO transponder hex code.

◆ getLat()

double LTAPIAircraft::getLat ( ) const
inline

[°] latitude

◆ getLights()

LTLights LTAPIAircraft::getLights ( ) const
inline

all plane's lights

◆ getLocalCoord()

void LTAPIAircraft::getLocalCoord ( double & x,
double & y,
double & z ) const
inline

lat/lon/alt converted to local coordinates

See also
https://developer.x-plane.com/sdk/XPLMGraphics/#XPLMWorldToLocal
Parameters
[out]xLocal x coordinate
[out]yLocal y coordinate
[out]zLocal z coordinate

◆ getLon()

double LTAPIAircraft::getLon ( ) const
inline

[°] longitude

◆ getMan()

std::string LTAPIAircraft::getMan ( ) const
inline

human-readable manufacturer like "Airbus"

◆ getModel()

std::string LTAPIAircraft::getModel ( ) const
inline

human-readable a/c model like "A321-231"

◆ getModelIcao()

std::string LTAPIAircraft::getModelIcao ( ) const
inline

ICAO aircraft type like "A321".

◆ getMultiIdx()

int LTAPIAircraft::getMultiIdx ( ) const
inline

multiplayer index if plane reported via sim/multiplayer/position dataRefs, 0 if not

◆ getOp()

std::string LTAPIAircraft::getOp ( ) const
inline

human-readable operator like "Lufthansa"

◆ getOpIcao()

std::string LTAPIAircraft::getOpIcao ( ) const
inline

ICAO-code of operator like "DLH".

◆ getOrigin()

std::string LTAPIAircraft::getOrigin ( ) const
inline

origin airport (IATA or ICAO) like "MAD" or "LEMD"

◆ getPhase()

LTFlightPhase LTAPIAircraft::getPhase ( ) const
inline

flight phase

◆ getPhaseStr()

std::string LTAPIAircraft::getPhaseStr ( ) const

flight phase as string

◆ getPitch()

float LTAPIAircraft::getPitch ( ) const
inline

[°] pitch: positive up

◆ getRegistration()

std::string LTAPIAircraft::getRegistration ( ) const
inline

tail number like "D-AISD"

◆ getReversers()

float LTAPIAircraft::getReversers ( ) const
inline

reversers position: 0.0 closed, 1.0 fully opened

◆ getRoll()

float LTAPIAircraft::getRoll ( ) const
inline

[°] roll: positive right

◆ getSpeedKn()

float LTAPIAircraft::getSpeedKn ( ) const
inline

[kt] ground speed

◆ getSquawk()

std::string LTAPIAircraft::getSquawk ( ) const
inline

squawk code (as text) like "1000"

◆ getTerrainFt()

float LTAPIAircraft::getTerrainFt ( ) const
inline

[ft] terrain altitude beneath plane

◆ getTrack()

float LTAPIAircraft::getTrack ( ) const
inline

[°] track over ground

◆ getTrackedBy()

std::string LTAPIAircraft::getTrackedBy ( ) const
inline

name of channel deliverying the underlying tracking data

◆ getVSIft()

float LTAPIAircraft::getVSIft ( ) const
inline

[ft/minute] vertical speed, positive up

◆ getWtc()

std::string LTAPIAircraft::getWtc ( ) const
inline

wake turbulence category like H,M,L/M,L

◆ isOnCamera()

bool LTAPIAircraft::isOnCamera ( ) const
inline

is currently seen on LiveTraffic's internal camera view?

◆ isOnGnd()

bool LTAPIAircraft::isOnGnd ( ) const
inline

Is plane on ground?

◆ isUpdated()

bool LTAPIAircraft::isUpdated ( ) const
inline

Helper in update loop to detected removed aircrafts.

◆ isVisible()

bool LTAPIAircraft::isVisible ( ) const
inline

aircraft visible?

◆ resetUpdated()

void LTAPIAircraft::resetUpdated ( )
inline

Helper in update loop, resets bUpdated flag.

◆ setCameraAc()

void LTAPIAircraft::setCameraAc ( )

Declare the aircraft the one under the camera (e.g. if your plugin is a camera plugin and now views this aircraft)

◆ toggleCamera()

virtual void LTAPIAircraft::toggleCamera ( bool bCameraActive,
SPtrLTAPIAircraft spPrevAc )
inlinevirtual

Called when LiveTraffic toggles its aircraft camera, override in your class to handle event.

Parameters
bCameraActiveTrue if camera is on this aircraft now, false if camera is switched off
spPrevAcMay point to previous aircraft under camera if switching directly from one to this; can be null

◆ updateAircraft() [1/2]

virtual bool LTAPIAircraft::updateAircraft ( const LTAPIBulkData & __bulk,
size_t __inSize )
virtual

Updates the aircraft with fresh numerical values, called from LTAPIConnect::UpdateAcList()

Parameters
__bulkA structure with updated numeric aircraft data
__inSizeNumber of bytes returned by LiveTraffic

◆ updateAircraft() [2/2]

virtual bool LTAPIAircraft::updateAircraft ( const LTAPIBulkInfoTexts & __info,
size_t __inSize )
virtual

Updates the aircraft with fresh textual information, called from LTAPIConnect::UpdateAcList()

Parameters
__infoA structure with updated textual info
__inSizeNumber of bytes returned by LiveTraffic

Member Data Documentation

◆ bulk

LTAPIBulkData LTAPIAircraft::bulk
protected

numerical plane's data

◆ bUpdated

bool LTAPIAircraft::bUpdated = false
protected

update helper, gets reset before updates, set during updates, stays false if not updated

◆ info

LTAPIBulkInfoTexts LTAPIAircraft::info
protected

textual plane's data


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