LTAPI
API to access LiveTraffic's aircraft information
LTAPI.cpp File Reference

LiveTraffic API. More...

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

Macros

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

Variables

constexpr const char * SDR_CAMERA_TCAS_IDX = "sim/multiplayer/camera/tcas_idx"
 shared dataRef for accessing current aircraft under camera
 
constexpr const char * SDR_CAMERA_MODES_ID = "sim/multiplayer/camera/modeS_id"
 shared dataRef for accessing current aircraft under camera
 

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();
Represents a dataRef and covers late binding.
Definition LTAPI.h:462

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)
Value:
str[sizeof(str)-1] = 0

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

Variable Documentation

◆ SDR_CAMERA_MODES_ID

const char* SDR_CAMERA_MODES_ID = "sim/multiplayer/camera/modeS_id"
constexpr

shared dataRef for accessing current aircraft under camera

◆ SDR_CAMERA_TCAS_IDX

const char* SDR_CAMERA_TCAS_IDX = "sim/multiplayer/camera/tcas_idx"
constexpr

shared dataRef for accessing current aircraft under camera