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

Static Public Member Functions

static LTAPIAircraftCreateNewObject ()
 Standard object creation callback. More...
 

Protected Attributes

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

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_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()

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

Puts together a string if at max 3 compontens:

  1. an identifier (flight number, call sign, key)
  2. a/c type (model ICAO, model human readble)
  3. origin/destination
    Returns
    Description of aircraft useful as label

◆ 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

Returns
Human readable string for current flight phase

◆ 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.

◆ resetUpdated()

void LTAPIAircraft::resetUpdated ( )
inline

Helper in update loop, resets bUpdated flag.

◆ updateAircraft() [1/2]

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

Copies the provided bulk data and sets bUpdated to true if the provided data matches this aircraft.

Note
This function can set this object's key for the first and only time.

◆ updateAircraft() [2/2]

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

Copies the provided info data and sets bUpdated to true if the provided data matches this aircraft.

Note
This function will never overwrite key! A new LTAPIAircraft object will always receive a call to the above version (with LTAPIBulkData) first before receiving a call to this version (with LTAPIBulkInfoTexts).

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 files: