LTAPI
API to access LiveTraffic's aircraft information
Namespaces | Macros | Functions
LTAPI.cpp File Reference

LiveTraffic API. More...

#include <stdio.h>
#include <cstring>
#include <algorithm>
#include <cassert>
#include "LTAPI.h"
#include "XPLMPlugin.h"

Namespaces

 LTAPI
 

Macros

#define LT_PLUGIN_SIGNATURE   "TwinFan.plugin.LiveTraffic"
 LiveTraffic's plugin signature. More...
 
#define ASSIGN_DR_NAME(var, drName, dataRef, type)
 Defines static object to access dataRef and fetches its value into var More...
 
#define RETURN_DR(dataRef, type)
 Defines static object LTDataRef to access dataRef and returns its current value. More...
 
#define ZERO_TERM(str)   str[sizeof(str)-1] = 0
 Set last element of array = 0, meant to ensure zero-termination of C strings. More...
 

Functions

time_t LTAPI::timegm (struct tm *_Tm)
 Inverse for gmtime, i.e. converts struct tm to time_t in ZULU timezone. More...
 
std::string LTAPI::hexStr (uint64_t n, unsigned minChars=6)
 Fairly fast conversion to hex string. More...
 

Detailed Description

LiveTraffic API.

API to access LiveTraffic's aircraft information. Data transfer from LiveTraffic to your plugin is by dataRefs in a fast, efficient way: LiveTraffic copies data of several planes combined into defined structures. LTAPI handles all that in the background and provides you with an array of aircraft information with numerical info like position, heading, speed and textual info like type, registration, call sign, flight number.

See also
https://twinfan.github.io/LTAPI/
Author
Birger Hoppe

Macro Definition Documentation

◆ ASSIGN_DR_NAME

#define ASSIGN_DR_NAME (   var,
  drName,
  dataRef,
  type 
)
Value:
static LTDataRef DR##drName(dataRef); \
var = DR##drName.get##type();

Defines static object to access dataRef and fetches its value into var

Parameters
varVariable receiving current dataRef's value
drNameName to be used for static variable, prepended with "DR"
dataRefName of dataRef as C string
typeType of dataRef like Int, Float, Byte

◆ LT_PLUGIN_SIGNATURE

#define LT_PLUGIN_SIGNATURE   "TwinFan.plugin.LiveTraffic"

LiveTraffic's plugin signature.

◆ RETURN_DR

#define RETURN_DR (   dataRef,
  type 
)
Value:
static LTDataRef DR(dataRef); \
return DR.get##type();

Defines static object LTDataRef to access dataRef and returns its current value.

Parameters
dataRefName of dataRef as C string
typeType of dataRef like Int, Float, Byte

◆ ZERO_TERM

#define ZERO_TERM (   str)    str[sizeof(str)-1] = 0

Set last element of array = 0, meant to ensure zero-termination of C strings.

LTDataRef
Represents a dataRef and covers late binding.
Definition: LTAPI.h:445