XPMP2
X-Plane multiplayer library 2 - using instancing
Classes | Typedefs | Enumerations | Functions | Variables
XPMP2 Namespace Reference

Classes

struct  CSLModelInfo_t
 Collates some information on the CSL model. More...
 
class  Aircraft
 Actual representation of all aircraft in XPMP2. More...
 
class  XPMP2Error
 XPMP2 Exception class, e.g. thrown if there are no CSL models or duplicate modeS_ids when creating an Aircraft. More...
 
struct  RemoteDataRefPackTy
 Definition for how to map dataRef values to (u)int8, ie. to an integer range of 8 bits. More...
 
struct  RemoteMsgBaseTy
 Message header, identical for all message types. More...
 
struct  RemoteMsgBeaconTy
 "Beacon of Interest", ie. some message on the multicast just to wake up sender More...
 
struct  RemoteMsgSettingsTy
 Settings message, identifying a sending plugin, regularly providing its settings. More...
 
struct  RemoteAcDetailTy
 A/C details, packed into an array message. More...
 
struct  RemoteMsgAcDetailTy
 A/C detail message, has an inherited header plus an array of XPMP2::RemoteAcDetailTy elements. More...
 
struct  RemoteAcPosUpdateTy
 A/C Position updates based on global coordinates. More...
 
struct  RemoteMsgAcPosUpdateTy
 A/C detail message, has an inherited header plus an array of XPMP2::RemoteAcDetailTy elements. More...
 
struct  RemoteAcAnimTy
 A/C animation dataRef changes. More...
 
struct  RemoteMsgAcAnimTy
 A/C animation dataRef message, has an inherited header plus an array of variable sized XPMP2::RemoteAcAnimTy elements. More...
 
struct  RemoteAcRemoveTy
 A/C Removal only includes the plane id, structure required for msgSize() function. More...
 
struct  RemoteMsgAcRemoveTy
 A/C removal message, an array of plane ids. More...
 
struct  RemoteCBFctTy
 Function prototypes for callback functions to handle the received messages. More...
 
struct  multiDataRefsTy
 Keeps the dataRef handles for one of the up to 19 legacy AI/Multiplayer slots ("sim/multiplayer/position") More...
 
struct  infoDataRefsTy
 Keeps the dataRef handles for one of the up to 63 shared data slots ("sim/multiplayer/position/plane#...") More...
 
union  TcasLightsTy
 A structure simplifying communicaton with sim/cockpit2/tcas/targets/position/lights. More...
 
class  LegacyAircraft
 This class helps creating aircraft via the legacy global functions. It provides standard implementations of the abstract callbacks. More...
 
class  CSLObj
 One .obj file of a CSL model (of which it can have multiple) More...
 
class  CSLModel
 Represents a CSL model as it is saved on disk. More...
 
struct  LocalIntfAddrTy
 Stores information about local interface addresses. More...
 
struct  SockAddrTy
 Helper definition for all these IPv4/6 differences. More...
 
class  NetRuntimeError
 Exception raised by XPMP2::SocketNetworking objects. More...
 
class  SocketNetworking
 Base class for any socket-based networking. More...
 
class  UDPReceiver
 Receives UDP messages. More...
 
class  UDPMulticast
 UDP Multicast, always binding to INADDR_ANY. More...
 
class  TCPConnection
 Listens to TCP connections and opens a session socket upon connect. More...
 
struct  InetAddrTy
 Numerical IP address, used for both ipv4 and ipv6, for ease of handling. More...
 
struct  Doc8643
 Represents a line in the Doc8643.txt file, of which we use only classification and WTC. More...
 
struct  Obj8DataRefs
 A pair of strings, first one to search for, second one to replace it with. More...
 
struct  RemoteAcDetailTy_v0
 Version 0 A/C details, packed into an array message. More...
 
struct  RemoteMsgAcDetailTy_v0
 Version 0 A/C detail message, has an inherited header plus an array of XPMP2::RemoteAcDetailTy elements. More...
 
struct  RmtAcCacheTy
 Holds a copy of some aircraft data as was sent out last. More...
 
class  RmtDataBaseTy
 Base structure for passing information from XP's main thread to the multicast thread. More...
 
class  RmtDataEnqeueTy
 Passing information about any data type (like a/c full detail message); the data is contained as copy. More...
 
class  RmtDataAcAnimTy
 Animation dataRef requires a special queue data type as each msg element is already of variable length. More...
 
class  RmtMsgBufTy
 Helper class to manage the temporary buffers in which the network message are put together. More...
 
struct  SoundDefTy
 Definition of how sound is handled based on dataRef values (type) More...
 
class  FmodError
 Exception class to pass on error information. More...
 
class  SoundFile
 Represents a sound file. More...
 
class  SoundWAV
 Represents a WAV file, read into memory, played by XP's Sound API. More...
 
class  SoundChannel
 A sound object being played, called channel. More...
 
class  SoundSystem
 Base class for sound systems, practically empty. More...
 
class  SoundSystemXP
 Encapsulates the XP12 Sound System. More...
 
class  SoundFMOD
 Represents a sound file to be passed on to FMOD to be played. More...
 
class  SoundSystemFMOD
 Encapsulates direct access to the FMOD Sound System. More...
 
struct  XPMPPlaneNotifierTy
 Stores the function and refcon pointer for plane creation/destrcution notifications. More...
 
struct  GlobVars
 All global config settings and variables are kept in one structure for convenient access and central definition. More...
 
union  SockAddrTy.__unnamed4__
 
union  InetAddrTy.__unnamed6__
 
union  RmtDataAcAnimTy.__unnamed8__
 

Typedefs

typedef std::map< float, XPMPPlaneIDmapAcByDistTy
 Map of Aircrafts, sorted by (priority-biased) distance. More...
 
typedef std::map< std::string, Aircraft::wakeTymapWakeTy
 
typedef std::map< XPMPPlaneID, Aircraft * > mapAcTy
 Map of all aircraft, key is tthe plane id. More...
 
typedef std::map< std::string, int > mapStrIntTy
 a map of a text and a counter More...
 
typedef std::map< std::string, std::string > mapCSLPackageTy
 Map of CSLPackages: Maps an id to the base path (path ends on forward slash) More...
 
typedef std::list< CSLObjlistCSLObjTy
 List of objects. More...
 
typedef std::pair< std::string, std::string > pairOfStrTy
 
typedef std::map< std::string, CSLModelmapCSLModelTy
 Map of CSLModels (owning the object), ordered by related group / type. More...
 
typedef std::multimap< unsigned long, std::pair< CSLModel *, const CSLModel::MatchCritTy * > > mmapCSLModelPTy
 Multimap of references to CSLModels and match criteria for matching purposes. More...
 
typedef std::map< std::string, XPLMMapLayerID > mapMapLayerIDTy
 A map holding our layer identifier, indexed by the map's name. More...
 
typedef std::set< LocalIntfAddrTySetLocalIntfAddrTy
 Set of local IP interface addresses. More...
 
typedef std::map< std::string, int > mapRelatedTy
 Map of group membership: ICAO a/c type maps to line in related.txt. More...
 
typedef std::map< std::string, Doc8643mapDoc8643Ty
 Map of Doc8643 information, key is the (icao) type code. More...
 
typedef std::list< Obj8DataRefslistObj8DataRefsTy
 a list of Obj8DataRefs definitions More...
 
typedef std::map< XPMPPlaneID, RmtAcCacheTymapRmtAcCacheTy
 Defines a map with the plane id as key and the aboce cache structure as payload. More...
 
typedef std::unique_ptr< RmtDataBaseTyptrRmtDataBaseTy
 Smart pointer to XPMP2::RmtDataBaseTy by which we manage objects of this and derived types. More...
 
typedef std::queue< ptrRmtDataBaseTy, std::list< ptrRmtDataBaseTy > > queueRmtDataTy
 A queue managing the information objects, used to transfer data between main thread and network thread. More...
 
typedef RmtDataEnqeueTy< RemoteAcDetailTy, RMT_MSG_AC_DETAILEDRmtDataAcDetailTy
 A/C Detail queue type. More...
 
typedef RmtDataEnqeueTy< RemoteAcPosUpdateTy, RMT_MSG_AC_POS_UPDATERmtDataAcPosUpdateTy
 A/C Position Update queue type. More...
 
typedef RmtDataEnqeueTy< RemoteAcRemoveTy, RMT_MSG_AC_REMOVERmtDataAcRemoveTy
 A/C Removal queue type. More...
 
typedef std::unique_ptr< RmtDataAcAnimTyptrRmtDataAcAnimTy
 Smart pointer to XPMP2::RmtDataAcAnimTy. More...
 
typedef XPLM_API FMOD_CHANNEL *() f_XPLMPlayPCMOnBus(void *audioBuffer, uint32_t bufferSize, FMOD_SOUND_FORMAT soundFormat, int freqHz, int numChannels, int loop, XPLMAudioBus audioType, XPLMPCMComplete_f inCallback, void *inRefcon)
 
typedef XPLM_API FMOD_RESULT() f_XPLMStopAudio(FMOD_CHANNEL *fmod_channel)
 
typedef XPLM_API FMOD_RESULT() f_XPLMSetAudioPosition(FMOD_CHANNEL *fmod_channel, FMOD_VECTOR *position, FMOD_VECTOR *velocity)
 
typedef XPLM_API FMOD_RESULT() f_XPLMSetAudioFadeDistance(FMOD_CHANNEL *fmod_channel, float min_fade_distance, float max_fade_distance)
 
typedef XPLM_API FMOD_RESULT() f_XPLMSetAudioVolume(FMOD_CHANNEL *fmod_channel, float source_volume)
 
typedef XPLM_API FMOD_RESULT() f_XPLMSetAudioCone(FMOD_CHANNEL *fmod_channel, float inside_angle, float outside_angle, float outside_volume, FMOD_VECTOR *orientation)
 
typedef std::unique_ptr< SoundFileSoundFilePtr
 Smart pointer to a SoundFile object. More...
 
typedef std::map< std::string, SoundFilePtrmapSoundPtrTy
 Map of all sounds, indexed by a sound name (type) More...
 
typedef std::list< XPMPPlaneNotifierTylistXPMPPlaneNotifierTy
 

Enumerations

enum  DR_VALS : std::uint8_t {
  V_CONTROLS_GEAR_RATIO = 0 , V_CONTROLS_NWS_RATIO , V_CONTROLS_FLAP_RATIO , V_CONTROLS_SPOILER_RATIO ,
  V_CONTROLS_SPEED_BRAKE_RATIO , V_CONTROLS_SLAT_RATIO , V_CONTROLS_WING_SWEEP_RATIO , V_CONTROLS_THRUST_RATIO ,
  V_CONTROLS_YOKE_PITCH_RATIO , V_CONTROLS_YOKE_HEADING_RATIO , V_CONTROLS_YOKE_ROLL_RATIO , V_CONTROLS_THRUST_REVERS ,
  V_CONTROLS_TAXI_LITES_ON , V_CONTROLS_LANDING_LITES_ON , V_CONTROLS_BEACON_LITES_ON , V_CONTROLS_STROBE_LITES_ON ,
  V_CONTROLS_NAV_LITES_ON , V_GEAR_NOSE_GEAR_DEFLECTION_MTR , V_GEAR_TIRE_VERTICAL_DEFLECTION_MTR , V_GEAR_TIRE_ROTATION_ANGLE_DEG ,
  V_GEAR_TIRE_ROTATION_SPEED_RPM , V_GEAR_TIRE_ROTATION_SPEED_RAD_SEC , V_ENGINES_ENGINE_ROTATION_ANGLE_DEG , V_ENGINES_ENGINE_ROTATION_SPEED_RPM ,
  V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC , V_ENGINES_PROP_ROTATION_ANGLE_DEG , V_ENGINES_PROP_ROTATION_SPEED_RPM , V_ENGINES_PROP_ROTATION_SPEED_RAD_SEC ,
  V_ENGINES_THRUST_REVERSER_DEPLOY_RATIO , V_ENGINES_ENGINE_ROTATION_ANGLE_DEG1 , V_ENGINES_ENGINE_ROTATION_ANGLE_DEG2 , V_ENGINES_ENGINE_ROTATION_ANGLE_DEG3 ,
  V_ENGINES_ENGINE_ROTATION_ANGLE_DEG4 , V_ENGINES_ENGINE_ROTATION_SPEED_RPM1 , V_ENGINES_ENGINE_ROTATION_SPEED_RPM2 , V_ENGINES_ENGINE_ROTATION_SPEED_RPM3 ,
  V_ENGINES_ENGINE_ROTATION_SPEED_RPM4 , V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC1 , V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC2 , V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC3 ,
  V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC4 , V_MISC_TOUCH_DOWN , V_COUNT
}
 The dataRefs provided by XPMP2 to the CSL models. More...
 
enum  RemoteMsgTy : std::uint8_t {
  RMT_MSG_INTEREST_BEACON = 0 , RMT_MSG_SEND , RMT_MSG_SETTINGS , RMT_MSG_AC_DETAILED ,
  RMT_MSG_AC_POS_UPDATE , RMT_MSG_AC_ANIM , RMT_MSG_AC_REMOVE
}
 Message type. More...
 
enum  RemoteStatusTy : unsigned {
  REMOTE_OFF = 0 , REMOTE_SEND_WAITING , REMOTE_SENDING , REMOTE_RECV_WAITING ,
  REMOTE_RECEIVING
}
 State of remote communcations. More...
 
enum  ObjLoadStateTy {
  OLS_INVALID = -1 , OLS_UNAVAIL = 0 , OLS_COPYING , OLS_LOADING ,
  OLS_AVAILABLE
}
 State of the X-Plane object: Is it being loaded or available? More...
 
enum  RelTxtTy : size_t { REL_TXT_DESIGNATOR = 0 , REL_TXT_OP , REL_TXT_NUM }
 
enum  logLevelTy {
  logDEBUG = 0 , logINFO , logWARN , logERR ,
  logFATAL , logMSG
}
 Logging level. More...
 
enum  ThreeWaySwitchTy : int { SWITCH_CFG_OFF = -1 , SWITCH_CFG_AUTO = 0 , SWITCH_CFG_ON = 1 }
 3-way switch type More...
 

Functions

AircraftAcFindByID (XPMPPlaneID _id)
 Find aircraft by its plane ID, can return nullptr. More...
 
bool AcSetDefaultWakeData (const std::string &_wtc, const Aircraft::wakeTy &_wake)
 (Re)Define default wake turbulence values per WTC More...
 
std::uint16_t PJWHash16 (const char *s)
 Produces a reproducible(!) hash value for strings. More...
 
CSLModelCSLModelByPkgShortId (std::uint16_t _pkgHash, const std::string &_shortId)
 Find a model by package name hash and short id. More...
 
template<class T >
constexpr const T & clamp (const T &v, const T &lo, const T &hi)
 Clamps v between lo and hi: lo if v < lo, hi if hi < v, otherwise v More...
 
RemoteStatusTy RemoteGetStatus ()
 Returns the current Remote status. More...
 
void RemoteRecvStart (const RemoteCBFctTy &_rmtCBFcts)
 Starts the listener, will call provided callback functions with received messages. More...
 
void RemoteRecvStop ()
 Stops the receiver. More...
 
void TwoDDrawLabels ()
 Write the labels of all aircraft. More...
 
int CPLabelDrawing (XPLMDrawingPhase, int, void *)
 Drawing callback, called by X-Plane in every drawing cycle. More...
 
void TwoDActivate ()
 Activate actual label drawing, esp. set up drawing callback. More...
 
void TwoDDeactivate ()
 Deactivate actual label drawing, esp. stop drawing callback. More...
 
void TwoDInit ()
 Initialize the module. More...
 
void TwoDCleanup ()
 Grace cleanup. More...
 
void AIMultiClearAIDataRefs (multiDataRefsTy &drM, bool bDeactivateToZero)
 Resets all actual values of the AI/multiplayer dataRefs of one plane to something initial. More...
 
void AIMultiClearInfoDataRefs (infoDataRefsTy &drI)
 Clears the shared info dataRefs. More...
 
bool GoTCASOverride ()
 Are we going to new (TCAS override) or the old way? More...
 
bool GoTCASWake ()
 Can we use the XP12 wake support system? More...
 
size_t AIUpdateMultiplayerDataRefs ()
 The old way: Update Multiplayer dataRefs directly. More...
 
size_t AIUpdateTCASTargets ()
 The modern way: Use TCAS override and update TCAS targets. More...
 
void AIAssignSlots (size_t fromSlot, size_t toSlot)
 Assigns slots, ie. planes to places in gSlots. More...
 
void AIMultiUpdate ()
 Updates all TCAS target dataRefs, both standard X-Plane, as well as additional shared dataRefs for text publishing. More...
 
int AIMultiControlPlaneCount (XPLMDrawingPhase, int inIsBefore, void *)
 Callback to toggle aircraft count ("TCAS hack") More...
 
void AIMultiClearTcasDataRefs ()
 Clears the key (mode_s) of the TCAS target dataRefs. More...
 
void AIMultiInitAllDataRefs (bool bDeactivateToZero)
 Reset all (controlled) multiplayer dataRef values of all planes. More...
 
void AIMultiInformDREs ()
 Inform DRE and DRT of our shared dataRefs. More...
 
void AIMultiInit ()
 Initialize the module. More...
 
void AIMultiCleanup ()
 Grace cleanup. More...
 
float obj_get_float (void *)
 
int obj_get_float_array (void *, float *, int, int inCount)
 See obj_get_float() More...
 
void AcInit ()
 Initialize the module. More...
 
void AcCleanup ()
 Grace cleanup, esp. remove all aircraft. More...
 
bool ContrailInit ()
 Initialize the Contrail module and load the Contrail object. More...
 
void ContrailCleanup ()
 Graceful shutdown. More...
 
std::string CSLModelGetKeyStr (int _related, const std::string &_type, const std::string &_id)
 compiles the string used as key in the CSL model map More...
 
std::string CSLModelsConvPackagePath (const std::string &pkgPath, int lnNr, bool bPkgOptional=false)
 Turn a relative package path into a full path. More...
 
void CSLModelsAdd (CSLModel &_csl)
 Adds a readily defined CSL model to all the necessary maps. More...
 
const char * CSLModelsReadPkgId (const std::string &path)
 Scans an xsb_aircraft.txt file for EXPORT_NAME entries to fill the list of packages. More...
 
const char * CSLModelsFindPkgs (const std::string &_path, std::vector< std::string > &paths, int _maxDepth=5)
 Recursively scans folders to find xsb_aircraft.txt files of CSL packages. More...
 
void AcTxtLine_DEPENDENCY (std::vector< std::string > &tokens, int lnNr)
 Process an DEPENDENCY line of an xsb_aircraft.txt file. More...
 
void AcTxtLine_OBJ8_AIRCRAFT (CSLModel &csl, const std::string &ln, const std::string &xsbAircraftPath, const std::string &exportName, int lnNr)
 Process an OBJ8_AIRCRAFT line of an xsb_aircraft.txt file. More...
 
void AcTxtLine_OBJECT_AIRCRAFT (CSLModel &csl, const std::string &, int)
 Process an OBJECT or AIRCRAFT line of an xsb_aircraft.txt file (which are no longer supported) More...
 
void AcTxtLine_OBJ8 (CSLModel &csl, std::vector< std::string > &tokens, int lnNr)
 
void AcTxtLine_VERT_OFFSET (CSLModel &csl, std::vector< std::string > &tokens, int lnNr)
 Process an VERT_OFFSET line of an xsb_aircraft.txt file. More...
 
void AcTxtLine_OFFSET (CSLModel &csl, std::vector< std::string > &tokens, int lnNr)
 
void AcTxtLine_MATCHES (CSLModel &csl, std::vector< std::string > &tokens, int lnNr)
 Process an ICAO, AIRLINE, LIVERY, or MATCHES line of an xsb_aircraft.txt file. More...
 
int StrCntString (const mapStrIntTy &m, std::string &s)
 Compiles a string from a map of string->int like "(A320 x 5, A388 x 12)". More...
 
const char * CSLModelsProcessAcFile (const std::string &path)
 Process one xsb_aircraft.txt file for importing OBJ8 models. More...
 
void CSLModelsInit ()
 Initialization. More...
 
void CSLModelsCleanup ()
 Grace cleanup. More...
 
const char * CSLModelsLoad (const std::string &_path, int _maxDepth=5)
 Read the CSL Models found in the given path and below. More...
 
CSLModelCSLModelById (const std::string &_cslId, mapCSLModelTy::iterator *_pOutIter=nullptr)
 Find a model by unique id. More...
 
CSLModelCSLModelByKey (const std::string &_cslKey, mapCSLModelTy::iterator *_pOutIter=nullptr)
 Find a model by (even more) unique key. More...
 
template<class IteratorT >
IteratorT iterRnd (IteratorT lower, IteratorT upper)
 Returns any random value in the range [cslLower; cslUpper), or upper if there is no value in that range. More...
 
bool CSLFindMatch (const std::string &_type, const std::string &_airline, const std::string &_livery, bool bIgnoreNoMatch, int &quality, CSLModel *&pModel)
 Tries finding a match using both aircraft and Doc8643 attributes. More...
 
int CSLModelMatching (const std::string &_type, const std::string &_airline, const std::string &_livery, CSLModel *&pModel)
 Find a matching model. More...
 
bool IsInRect (float x, float y, const float bounds_ltrb[4])
 Tests if x/y lies within the rect, given as a float[4] array. More...
 
void MapPrepareCacheCB (XPLMMapLayerID, const float *inTotalMapBoundsLeftTopRightBottom, XPLMMapProjectionID projection, void *)
 Prepare map drawing information. More...
 
void MapIconDrawingCB (XPLMMapLayerID inLayer, const float *inMapBoundsLeftTopRightBottom, float, float mapUnitsPerUserInterfaceUnit, XPLMMapStyle, XPLMMapProjectionID projection, void *refcon)
 Actually draw the icons into the map. More...
 
void MapLabelDrawingCB (XPLMMapLayerID inLayer, const float *inMapBoundsLeftTopRightBottom, float, float mapUnitsPerUserInterfaceUnit, XPLMMapStyle, XPLMMapProjectionID projection, void *refcon)
 Actually draw the labels into th emap. More...
 
void MapDeleteCB (XPLMMapLayerID inLayer, void *)
 Called when a map is about to be deleted. More...
 
void MapLayerCreate (const char *mapIdentifier)
 Create our map layer for the given map. More...
 
void MapCreateAll ()
 Loop all existing maps and create our map layer for them. More...
 
void MapDestroyAll ()
 Remove all our map layers. More...
 
void MapCreateCB (const char *mapIdentifier, void *)
 Callback called when a map is created. We then need to add our layer to it. More...
 
void MapInit ()
 Initialize the module. More...
 
void MapCleanup ()
 Grace cleanup. More...
 
std::string _NetwGetIntfName (uint32_t idx, uint8_t family)
 Get an interface's name. More...
 
LocalIntfAddrTy _NetwFindLocalIntf (const std::string &intf, uint8_t family)
 Find a matching local interface based on name and family. More...
 
void _NetwGetLocalAddresses (bool bForceRefresh=false)
 Fetch all local addresses and cache locally. More...
 
uint32_t _GetIntfNext (const uint32_t prevIdx, SetLocalIntfAddrTy::const_iterator &i, uint8_t family, uint32_t fMust, uint32_t fSkip)
 Internal: Returns the next interface index of a broadcast interface for the given protocol family. More...
 
uint32_t GetIntfFirst (SetLocalIntfAddrTy::const_iterator &i, uint8_t family, uint32_t fMust, uint32_t fSkip=0)
 Returns the first interface index of a broadcast interface for the given protocol family. More...
 
uint32_t GetIntfNext (SetLocalIntfAddrTy::const_iterator &i, uint8_t family, uint32_t fMust, uint32_t fSkip=0)
 Returns the next interface index of a broadcast interface for the given protocol family. More...
 
std::vector< std::string > NetwGetInterfaces (uint8_t family, uint32_t fMust=0, uint32_t fSkip=0)
 Return list of known local interfaces. More...
 
std::string NetwGetInterfaceNames (uint8_t family, uint32_t fMust=0, uint32_t fSkip=0)
 Return comma-separated string will all known local interfaces, calls NetwGetInterfaces() More...
 
bool NetwIsLocalAddr (const InetAddrTy &addr)
 Is given address a local one? More...
 
bool NetwIsLocalAddr (const SockAddrTy &sa)
 Is given address a local one? More...
 
bool NetwIsLocalAddr (const sockaddr *pSa)
 Is given address a local one? More...
 
const char * RelatedLoad (RelTxtTy relType, const std::string &_path)
 Read the related.txt file, full path passed in. More...
 
const char * RelatedLoad (const std::string _paths[], size_t _num)
 Load all related files. More...
 
int RelatedGet (RelTxtTy relType, const std::string &_key)
 Find the related group for a given key, 0 if none. More...
 
const char * Doc8643Load (const std::string &_path)
 Load the content of the provided Doc8643.txt file. More...
 
const Doc8643Doc8643Get (const std::string &_type)
 Return a reference to the matching Doc8643 object. More...
 
bool Doc8643IsTypeValid (const std::string &_type)
 Is the given aircraft type a valid ICAO type as per Doc8643? More...
 
const char * Obj8DataRefsLoad (const std::string &_path)
 Load the content of the provided Obj8DataRefs.txt file. More...
 
std::unique_lock< std::mutex > glockRmtData (gmutexRmtData)
 The lock that we keep during handling of the flight loop. More...
 
bool RmtSendContinue ()
 Conditions for continued send operation. More...
 
void RmtSendProcessQueue ()
 Process the data passed down to us in the queue. More...
 
void RmtSendSettings ()
 Send our settings. More...
 
void RmtSendLoop ()
 Sending function, ie. we are actively sending data out. More...
 
void RmtSendMain ()
 Thread main function for the sender. More...
 
void RmtSendBeacon ()
 Sends an Interest Beacon. More...
 
bool RmtRecvContinue ()
 Conditions for continued receive operation. More...
 
void RmtRecvMain ()
 Thread main function for the receiver. More...
 
void RmtStartMCThread (bool bSender)
 Start the background thread to listen to multicast, to see if anybody is interested in our data. More...
 
void RmtStopAll ()
 Stop all threads and communication with the network. More...
 
void RemoteInit ()
 Initialize the module. More...
 
void RemoteCleanup ()
 Grace cleanup, stops all threads. More...
 
void RemoteSenderUpdateStatus ()
 Compares current vs. expected status and takes appropriate action. More...
 
void RemoteAcEnqueueStarts (float now)
 
void RemoteAcEnqueue (const Aircraft &ac)
 Regularly called from the flight loop callback to send a/c date onto the network. More...
 
void RemoteAcEnqueueDone ()
 Informs us that all a/c have been processed: All pending messages to be sent now. More...
 
void RemoteAcRemove (const Aircraft &ac)
 Informs us about an aircraft deletion. More...
 
void RemoteAcClearAll ()
 Informs us that there are no more aircraft, clear our caches! More...
 
FMOD_VECTOR FmodHeadPitch2Vec (const float head, const float pitch)
 Convert heading/pitch to normalized x/y/z vector. More...
 
bool XPSoundIsAvail ()
 Are XP12 sound functions available? More...
 
bool XPSoundLoadFctPtr ()
 Tries to find all the new XP12 sound functions, available as of XP12.04. More...
 
int SoundLoadXPSounds ()
 Load fixed set of X-Plane-internal sounds. More...
 
const char * SoundEventTxt (Aircraft::SoundEventsTy e)
 Return a text for the values of Aircraft::SoundEventsTy. More...
 
void FmodHeadPitchRoll2Normal (const float head, const float pitch, const float roll, FMOD_VECTOR &vecDir, FMOD_VECTOR &vecNorm)
 Convert heading/pitch to normal x/y/z vector. More...
 
void FmodNormalizeHeadingPitch (float &head, float &pitch)
 Normalize Pitch/Heading. More...
 
void SoundInit ()
 Initialize the sound module and load the sounds. More...
 
void SoundUpdatesBegin ()
 Prepare for this frame's updates, which are about to start. More...
 
void SoundUpdatesDone ()
 Tell FMOD that all updates are done. More...
 
void SoundCleanup ()
 Graceful shoutdown. More...
 
ThreeWaySwitchTy Read3WaySwitch (std::string &sVal, const std::string &sKey, const std::string &cfgFileName, ThreeWaySwitchTy defVal)
 Convert strings on, auto, off to enums of type ThreeWaySwitchTy More...
 
int PrefsFuncIntDefault (const char *, const char *, int _default)
 Default config function just always returns the provided default value. More...
 
bool ExistsFile (const std::string &filename)
 Does a file path exist? More...
 
bool IsDir (const std::string &path)
 Is path a directory? More...
 
bool CreateDir (const std::string &path)
 Create directory if it does not exist. More...
 
bool CopyFileIfNewer (const std::string &source, const std::string &destDir)
 Copy file if source is newer or destination missing. More...
 
std::list< std::string > GetDirContents (const std::string &path)
 List of files in a directory (wrapper around XPLMGetDirectoryContents) More...
 
std::istream & safeGetline (std::istream &is, std::string &t)
 Read a line from a text file, no matter if ending on CRLF or LF. More...
 
const std::string & GetXPSystemPath ()
 Returns XP's system directory, including a trailing slash. More...
 
std::string StripXPSysDir (const std::string &path)
 If a path starts with X-Plane's system directory it is stripped. More...
 
void RemoveExtension (std::string &path)
 Removes everything after the last dot, the dot including. More...
 
std::string & str_tolower (std::string &s)
 change a std::string to uppercase More...
 
std::vector< std::string > str_tokenize (const std::string s, const std::string tokens, bool bSkipEmpty=true)
 separates string into tokens More...
 
float headDiff (float head1, float head2)
 (Shortest) difference between 2 angles: How much to turn to go from h1 to h2? More...
 
std::valarray< float > HeadPitch2Vec (const float head, const float pitch)
 Convert heading/pitch to normalized x/y/z vector. More...
 
std::valarray< float > HeadPitchRoll2Normal (const float head, const float pitch, const float roll)
 Convert heading/pitch/roll to unit and normal vector, ie. returns 6 values, first 3 like HeadPitch2Vec, second three the normal vector (pointing "up") More...
 
float GetMiscNetwTime ()
 Get synched network time from X-Plane (sim/network/misc/network_time_sec) as used in Log.txt. More...
 
std::string GetMiscNetwTimeStr (float _time=NAN)
 Return the network time as a string like used in the XP's Log.txt. More...
 
const char * GetGraphicsDriverTxt ()
 Text string for current graphics driver in use. More...
 
bool IsPaused ()
 X-Plane in a Pause state? More...
 
bool IsViewExternal ()
 Is current X-Plane view an external view (outside a cockpit)? More...
 
bool CheckEverySoOften (float &_lastCheck, float _interval, float _now)
 Convenience function to check on something at most every x seconds. More...
 
const char * LogGetString (const char *szFile, int ln, const char *szFunc, logLevelTy lvl, const char *szMsg, va_list args)
 Returns ptr to static buffer filled with formatted log string. More...
 
void LogMsg (const char *szFile, int ln, const char *szFunc, logLevelTy lvl, const char *szMsg,...) XPMP2_FMTARGS(5)
 Log Text to log file. More...
 
std::string & rtrim (std::string &s, const char *t=WHITESPACE)
 trimming of string (from right) More...
 
std::string & ltrim (std::string &s, const char *t=WHITESPACE)
 trimming of string (from left) More...
 
std::string & trim (std::string &s, const char *t=WHITESPACE)
 trimming of string (from both ends) More...
 
std::string leftOf (const std::string &s, const std::string &terminators)
 Returns everything left of any of terminators. More...
 
bool fequal (float a, float b)
 Are these two float near-equal? (to avoid trying something like a == b) More...
 
template<class T >
rad2deg (const T _rad)
 Convert radians to degrees, normalized to [0..360) More...
 
template<class T >
deg2rad (const T _deg)
 Convert degree to radians. More...
 
template<class T >
sqr (const T a)
 Square. More...
 
template<class T >
dist (const T x1, const T y1, const T z1, const T x2, const T y2, const T z2)
 Pythagorean distance between two points in a 3-D world. More...
 
float atan2deg (float x, float y)
 atan2 converted to degrees: the angle between (0|0) and the given point More...
 
float angleLocCoord (float x1, float z1, float x2, float z2)
 Angle of line from point (x1|z1) to point (x2|z2) More...
 
template<class numT >
numT headNormalize (numT _head)
 Normalize a heading value to [0..360), works for both float and double values. More...
 
bool CheckEverySoOften (float &_lastCheck, float _interval)
 Convenience function to check on something at most every x seconds. More...
 
std::string TOPOSIX (const std::string &p)
 On Lin/Win there is no need for a conversion, but we do treat p now as std::string More...
 
std::string FROMPOSIX (const std::string &p)
 On Lin/Win there is no need for a conversion, but we do treat p now as std::string More...
 
void XPMPSendNotification (const Aircraft &plane, XPMPPlaneNotification _notification)
 Send a notification to all observers. More...
 
const char * XPMPValidateResourceFiles (const char *resourceDir)
 Validate all required files are available in the resource directory. More...
 

Variables

constexpr float RPM_to_RADs = 0.10471975511966f
 Defined by XPMP2 internally. More...
 
constexpr double M_per_FT = 0.3048
 Convert feet to meters, e.g. for altitude calculations. More...
 
constexpr int M_per_NM = 1852
 Convert nautical miles to meters. More...
 
constexpr double KT_per_M_per_S = 1.94384
 Convert m/s to knots. More...
 
constexpr float G_EARTH = 9.80665f
 standard gravitational acceleration [m/s²] More...
 
constexpr const char * REMOTE_SIGNATURE = "TwinFan.plugin.XPMP2.Remote"
 The signature of the XPMP2 Remote Client. More...
 
const std::array< RemoteDataRefPackTy, V_COUNTREMOTE_DR_DEF
 An array holding all dataRef packing definitions. More...
 
struct XPMP2::RemoteMsgBaseTy PACKED
 
constexpr std::uint8_t RMT_VER_BEACON = 0
 Interest Beacon message version number. More...
 
constexpr int REMOTE_SEND_SETTINGS_INTVL = 20
 How often to send settings? [s]. More...
 
constexpr std::uint8_t RMT_VER_SETTINGS = 0
 Setttings message version number. More...
 
constexpr std::uint8_t RMT_VER_AC_DETAIL = 3
 A/C detail message version number. More...
 
constexpr std::uint8_t RMT_VER_AC_DETAIL_2 = 2
 
constexpr std::uint8_t RMT_VER_AC_DETAIL_1 = 1
 
constexpr std::uint8_t RMT_VER_AC_DETAIL_0 = 0
 
constexpr std::uint8_t RMT_VER_AC_POS_UPDATE = 0
 A/C Position update message version number. More...
 
constexpr double REMOTE_DEGREE_RES = 0.00000001
 What is the maximum difference a RemoteAcPosUpdateTy can hold? More...
 
constexpr double REMOTE_MAX_DIFF_DEGREE = REMOTE_DEGREE_RES * INT16_MAX
 maximum degree difference that can be represented in a pos update msg More...
 
constexpr double REMOTE_ALT_FT_RES = 0.01
 resolution of altitude[ft] updates More...
 
constexpr double REMOTE_MAX_DIFF_ALT_FT = REMOTE_ALT_FT_RES * INT16_MAX
 maximum altitude[ft] difference that can be represented in a pos update msg More...
 
constexpr float REMOTE_TIME_RES = 0.0001f
 resolution of time difference More...
 
constexpr float REMOTE_MAX_DIFF_TIME = REMOTE_TIME_RES * UINT16_MAX
 maximum time difference thatn can be represented in a pos update msg More...
 
constexpr std::uint8_t RMT_VER_AC_ANIM = 0
 A/C Position update message version number. More...
 
constexpr std::uint8_t RMT_VER_AC_REMOVE = 0
 A/C removal message version number. More...
 
constexpr float FAR_AWAY_VAL_GL = 9999999.9f
 Don't dare using NAN...but with this coordinate for x/y/z a plane should be far out and virtually invisible. More...
 
constexpr float AISLOT_CHANGE_PERIOD = 15.0f
 How often do we reassign AI slots? [seconds]. More...
 
constexpr int AI_PRIO_MULTIPLIER = 10 * M_per_NM
 How much distance does each AIPrio add? More...
 
float F_NULL [10] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}
 A constant array of zero values supporting quick array initialization. More...
 
constexpr int XPLM_PHASE_AIRPLANES = 25
 The drawing phase "xplm_Phase_Airplanes" is deprecated in XP11.50 upwards, but we need it in earlier versions to fake TCAS. More...
 
const char * DATA_REF_EDITORS []
 
std::vector< std::string > vecDREdataRefStr
 list of dataRef strings to be send to the editors More...
 
constexpr size_t SDR_CSLMODEL_TXT_SIZE = 40
 Number of characters to be allowed for CSL model text. More...
 
XPLMFlightLoopID gFlightLoopID = nullptr
 The id of our flight loop callback. More...
 
std::vector< std::unique_ptr< std::string > > drStrings
 
std::vector< XPLMDataRef > ahDataRefs
 Registered dataRefs. More...
 
XPLMObjectRef ghContrailObj = nullptr
 The one global Contrail object. More...
 
XPLMDataRef ghDrContrailLifeTime = nullptr
 The handle for the registered Contrail LifeTime dataRef. More...
 
XPLMFlightLoopID gGarbageCollectionID = nullptr
 The ids of our garbage collection flight loop callback. More...
 
constexpr float GARBAGE_COLLECTION_PERIOD = 60.0f
 How often to call the garbage collection [s]. More...
 
constexpr float GARBAGE_COLLECTION_TIMEOUT = 180.0f
 Unload an unused object after how many seconds? More...
 
constexpr int MAP_ICON_WIDTH = 3
 Dimenson of MapIcon.png. More...
 
constexpr int MAP_ICON_HEIGHT = 3
 Dimenson of MapIcon.png. More...
 
constexpr int MAP_MIN_ICON_SIZE = 40
 Minimum icon size in map in UI units. More...
 
constexpr float MAP_AC_SIZE = 30.0f
 Assumed size of an aircraft in m. More...
 
std::array< const char *, 2 > ALL_MAPS
 The list of known maps, which are hard-coded by X-Plane's SDK. More...
 
constexpr int SERR_LEN = 100
 Maximum length of OS error message. More...
 
SetLocalIntfAddrTy gAddrLocal
 Set of local IP interface addresses. More...
 
std::recursive_mutex mtxAddrLocal
 Mutex to safeguard access to gAddrLocal More...
 
std::recursive_mutex mtxSocketClose
 Mutex to ensure closing is done in one thread only to avoid race conditions on deleting the buffer. More...
 
constexpr int ERR_CFG_FILE_MAXWARN = 5
 Maximum number of warnings during file read before bailing. More...
 
const Doc8643 DOC8643_EMPTY
 
constexpr int REMOTE_RECV_BEACON_INTVL = 15
 How often to send an Interest Beacon? [s]. More...
 
constexpr float REMOTE_SEND_AC_DETAILS_INTVL = 10.f
 How often to send full a/c details? [s]. More...
 
mapRmtAcCacheTy gmapRmtAcCache
 Cache for last data sent out to the network. More...
 
unsigned gFullUpdDue = 0
 What's the full update group that has its turn now? More...
 
unsigned gFullUpdLastDone = 0
 the last actually processed full update group More...
 
unsigned gNxtFullUpdGrpToAssign = 0
 What's the next group number to assign to the next a/c? (Assigned will be the value incremented by 1) More...
 
float gNow = 0.0f
 Current network timestamp. More...
 
float gNxtTxfTime = 0.0f
 When to actually process position updates next? More...
 
queueRmtDataTy gqueueRmtData
 the queue for passing data from main to network thread More...
 
std::condition_variable gcvRmtData
 notifies the network thread of available data to be processed More...
 
std::mutex gmutexRmtData
 
constexpr int MC_MAX_ERR =5
 after this many errors we no longer try listening More...
 
std::thread gThrMC
 remote listening/sending thread More...
 
UDPMulticastgpMc = nullptr
 multicast socket for listening/sending (destructor uses locks, which don't work during module shutdown, so can't create a global object due to its exit-time destructor) More...
 
volatile bool gbStopMCThread = false
 Shall the network thread stop? More...
 
bool gbRemoteGaveUp = false
 No longer try remote functionality, have seen to many errors. More...
 
float gSendSettingsLast = 0.0f
 Timestamp when we sent our settings the last time. More...
 
RmtMsgBufTy< RemoteAcDetailTy, RMT_MSG_AC_DETAILED, RMT_VER_AC_DETAILgMsgAcDetail
 A/C Detail message. More...
 
RmtMsgBufTy< RemoteAcPosUpdateTy, RMT_MSG_AC_POS_UPDATE, RMT_VER_AC_POS_UPDATEgMsgAcPosUpdate
 A/C Position Update message. More...
 
RmtMsgBufTy< RemoteAcAnimTy, RMT_MSG_AC_ANIM, RMT_VER_AC_ANIMgMsgAcAnim
 A/C Animation dataRefs message. More...
 
RmtMsgBufTy< RemoteAcRemoveTy, RMT_MSG_AC_REMOVE, RMT_VER_AC_REMOVEgMsgAcRemove
 A/C Removal message. More...
 
RemoteCBFctTy gRmtCBFcts
 The callback function pointers the remote client plugin provided. More...
 
SoundSystemgpSndSys = nullptr
 The sound system in use. More...
 
FMOD_RESULT gFmodRes = FMOD_OK
 last FMOD result code, needed by the following macro, better don't rely on anywhere else More...
 
constexpr float FMOD_3D_MAX_DIST = 10000.0f
 Value used for 3D max distance, which doesn't have much of a function for the inverse roll-off model used here. More...
 
constexpr int EXP_COMP_SKIP_CYCLES = 10
 In how many cycles to skip expensive computations? More...
 
f_XPLMPlayPCMOnBusgpXPLMPlayPCMOnBus = nullptr
 
f_XPLMStopAudiogpXPLMStopAudio = nullptr
 
f_XPLMSetAudioPositiongpXPLMSetAudioPosition = nullptr
 
f_XPLMSetAudioFadeDistancegpXPLMSetAudioFadeDistance = nullptr
 
f_XPLMSetAudioVolumegpXPLMSetAudioVolume = nullptr
 
f_XPLMSetAudioConegpXPLMSetAudioCone = nullptr
 
constexpr int FMOD_NUM_VIRT_CHANNELS = 1000
 Number of virtual channels during initialization. More...
 
constexpr float FMOD_LOW_PASS_GAIN = 0.2f
 Gain used when activating Low Pass filter. More...
 
GlobVars glob
 The one and only global variable structure. More...
 
const char * LOG_LEVEL []
 
constexpr const char * RSRC_RELATED = "related.txt"
 
constexpr const char * RSRC_REL_OP = "relOp.txt"
 
constexpr const char * RSRC_DOC8643 = "Doc8643.txt"
 
constexpr const char * RSRC_MAP_ICONS = "MapIcons.png"
 
constexpr const char * RSRC_OBJ8DATAREFS = "Obj8DataRefs.txt"
 
constexpr double PI = 3.1415926535897932384626433832795028841971693993751
 Pi. More...
 
constexpr float EPSILON_F = 0.00001f
 Epsilon, a small number. More...
 

Class Documentation

◆ XPMP2::TcasLightsTy

union XPMP2::TcasLightsTy

A structure simplifying communicaton with sim/cockpit2/tcas/targets/position/lights.

Class Members
struct BitsTy b
int i the full integer value

◆ XPMP2::SockAddrTy.__unnamed4__

union XPMP2::SockAddrTy.__unnamed4__
Class Members
sockaddr sa
sockaddr_in sa_in
sockaddr_in6 sa_in6

◆ XPMP2::InetAddrTy.__unnamed6__

union XPMP2::InetAddrTy.__unnamed6__
Class Members
uint32_t addr[4]
struct in6_addr in6_addr
struct in_addr in_addr

◆ XPMP2::RmtDataAcAnimTy.__unnamed8__

union XPMP2::RmtDataAcAnimTy.__unnamed8__
Class Members
char bufSize[RemoteAcAnimTy::msgSize(V_COUNT)] a declaration that only makes sure that enough memory is reserved so that XPMP2::RmtDataAcAnimTy::data::v can fill up to max
RemoteAcAnimTy data The animation dataRef values element.

Typedef Documentation

◆ f_XPLMPlayPCMOnBus

typedef XPLM_API FMOD_CHANNEL*() XPMP2::f_XPLMPlayPCMOnBus(void *audioBuffer, uint32_t bufferSize, FMOD_SOUND_FORMAT soundFormat, int freqHz, int numChannels, int loop, XPLMAudioBus audioType, XPLMPCMComplete_f inCallback, void *inRefcon)

◆ f_XPLMSetAudioCone

typedef XPLM_API FMOD_RESULT() XPMP2::f_XPLMSetAudioCone(FMOD_CHANNEL *fmod_channel, float inside_angle, float outside_angle, float outside_volume, FMOD_VECTOR *orientation)

◆ f_XPLMSetAudioFadeDistance

typedef XPLM_API FMOD_RESULT() XPMP2::f_XPLMSetAudioFadeDistance(FMOD_CHANNEL *fmod_channel, float min_fade_distance, float max_fade_distance)

◆ f_XPLMSetAudioPosition

typedef XPLM_API FMOD_RESULT() XPMP2::f_XPLMSetAudioPosition(FMOD_CHANNEL *fmod_channel, FMOD_VECTOR *position, FMOD_VECTOR *velocity)

◆ f_XPLMSetAudioVolume

typedef XPLM_API FMOD_RESULT() XPMP2::f_XPLMSetAudioVolume(FMOD_CHANNEL *fmod_channel, float source_volume)

◆ f_XPLMStopAudio

typedef XPLM_API FMOD_RESULT() XPMP2::f_XPLMStopAudio(FMOD_CHANNEL *fmod_channel)

◆ listCSLObjTy

typedef std::list<CSLObj> XPMP2::listCSLObjTy

List of objects.

◆ listObj8DataRefsTy

a list of Obj8DataRefs definitions

◆ listXPMPPlaneNotifierTy

◆ mapAcByDistTy

typedef std::map<float,XPMPPlaneID> XPMP2::mapAcByDistTy

Map of Aircrafts, sorted by (priority-biased) distance.

◆ mapAcTy

typedef std::map<XPMPPlaneID,Aircraft*> XPMP2::mapAcTy

Map of all aircraft, key is tthe plane id.

Note
Map stores pointers and does not own the objects. Plugin (the one using this library) is expected to own and destroy the object

◆ mapCSLModelTy

typedef std::map<std::string,CSLModel> XPMP2::mapCSLModelTy

Map of CSLModels (owning the object), ordered by related group / type.

◆ mapCSLPackageTy

typedef std::map<std::string,std::string> XPMP2::mapCSLPackageTy

Map of CSLPackages: Maps an id to the base path (path ends on forward slash)

◆ mapDoc8643Ty

typedef std::map<std::string, Doc8643> XPMP2::mapDoc8643Ty

Map of Doc8643 information, key is the (icao) type code.

◆ mapMapLayerIDTy

typedef std::map<std::string, XPLMMapLayerID> XPMP2::mapMapLayerIDTy

A map holding our layer identifier, indexed by the map's name.

◆ mapRelatedTy

typedef std::map<std::string, int> XPMP2::mapRelatedTy

Map of group membership: ICAO a/c type maps to line in related.txt.

◆ mapRmtAcCacheTy

Defines a map with the plane id as key and the aboce cache structure as payload.

◆ mapSoundPtrTy

typedef std::map<std::string,SoundFilePtr> XPMP2::mapSoundPtrTy

Map of all sounds, indexed by a sound name (type)

◆ mapStrIntTy

typedef std::map<std::string, int> XPMP2::mapStrIntTy

a map of a text and a counter

◆ mapWakeTy

typedef std::map<std::string, Aircraft::wakeTy> XPMP2::mapWakeTy

◆ mmapCSLModelPTy

typedef std::multimap<unsigned long,std::pair<CSLModel*,const CSLModel::MatchCritTy*> > XPMP2::mmapCSLModelPTy

Multimap of references to CSLModels and match criteria for matching purposes.

◆ pairOfStrTy

typedef std::pair<std::string,std::string> XPMP2::pairOfStrTy

◆ ptrRmtDataAcAnimTy

typedef std::unique_ptr<RmtDataAcAnimTy> XPMP2::ptrRmtDataAcAnimTy

Smart pointer to XPMP2::RmtDataAcAnimTy.

◆ ptrRmtDataBaseTy

typedef std::unique_ptr<RmtDataBaseTy> XPMP2::ptrRmtDataBaseTy

Smart pointer to XPMP2::RmtDataBaseTy by which we manage objects of this and derived types.

◆ queueRmtDataTy

typedef std::queue<ptrRmtDataBaseTy,std::list<ptrRmtDataBaseTy> > XPMP2::queueRmtDataTy

A queue managing the information objects, used to transfer data between main thread and network thread.

◆ RmtDataAcDetailTy

A/C Detail queue type.

◆ RmtDataAcPosUpdateTy

A/C Position Update queue type.

◆ RmtDataAcRemoveTy

A/C Removal queue type.

◆ SetLocalIntfAddrTy

Set of local IP interface addresses.

◆ SoundFilePtr

typedef std::unique_ptr<SoundFile> XPMP2::SoundFilePtr

Smart pointer to a SoundFile object.

Enumeration Type Documentation

◆ DR_VALS

enum XPMP2::DR_VALS : std::uint8_t

The dataRefs provided by XPMP2 to the CSL models.

Enumerator
V_CONTROLS_GEAR_RATIO 

libxplanemp/controls/gear_ratio and
sim/cockpit2/tcas/targets/position/gear_deploy

V_CONTROLS_NWS_RATIO 

libxplanemp/controls/nws_ratio, the nose wheel angle, actually in degrees

V_CONTROLS_FLAP_RATIO 

libxplanemp/controls/flap_ratio and
sim/cockpit2/tcas/targets/position/flap_ratio and ...flap_ratio2

V_CONTROLS_SPOILER_RATIO 

libxplanemp/controls/spoiler_ratio

V_CONTROLS_SPEED_BRAKE_RATIO 

libxplanemp/controls/speed_brake_ratio and
sim/cockpit2/tcas/targets/position/speedbrake_ratio

V_CONTROLS_SLAT_RATIO 

libxplanemp/controls/slat_ratio and
sim/cockpit2/tcas/targets/position/slat_ratio

V_CONTROLS_WING_SWEEP_RATIO 

libxplanemp/controls/wing_sweep_ratio and
sim/cockpit2/tcas/targets/position/wing_sweep

V_CONTROLS_THRUST_RATIO 

libxplanemp/controls/thrust_ratio and
sim/cockpit2/tcas/targets/position/throttle

V_CONTROLS_YOKE_PITCH_RATIO 

libxplanemp/controls/yoke_pitch_ratio and
sim/cockpit2/tcas/targets/position/yolk_pitch

V_CONTROLS_YOKE_HEADING_RATIO 

libxplanemp/controls/yoke_heading_ratio and
sim/cockpit2/tcas/targets/position/yolk_yaw

V_CONTROLS_YOKE_ROLL_RATIO 

libxplanemp/controls/yoke_roll_ratio and
sim/cockpit2/tcas/targets/position/yolk_roll

V_CONTROLS_THRUST_REVERS 

libxplanemp/controls/thrust_revers

V_CONTROLS_TAXI_LITES_ON 

libxplanemp/controls/taxi_lites_on and
sim/cockpit2/tcas/targets/position/lights

V_CONTROLS_LANDING_LITES_ON 

libxplanemp/controls/landing_lites_on and
sim/cockpit2/tcas/targets/position/lights

V_CONTROLS_BEACON_LITES_ON 

libxplanemp/controls/beacon_lites_on and
sim/cockpit2/tcas/targets/position/lights

V_CONTROLS_STROBE_LITES_ON 

libxplanemp/controls/strobe_lites_on and
sim/cockpit2/tcas/targets/position/lights

V_CONTROLS_NAV_LITES_ON 

libxplanemp/controls/nav_lites_on and
sim/cockpit2/tcas/targets/position/lights

V_GEAR_NOSE_GEAR_DEFLECTION_MTR 

libxplanemp/gear/nose_gear_deflection_mtr

V_GEAR_TIRE_VERTICAL_DEFLECTION_MTR 

libxplanemp/gear/tire_vertical_deflection_mtr

V_GEAR_TIRE_ROTATION_ANGLE_DEG 

libxplanemp/gear/tire_rotation_angle_deg

V_GEAR_TIRE_ROTATION_SPEED_RPM 

libxplanemp/gear/tire_rotation_speed_rpm

V_GEAR_TIRE_ROTATION_SPEED_RAD_SEC 

libxplanemp/gear/tire_rotation_speed_rad_sec

V_ENGINES_ENGINE_ROTATION_ANGLE_DEG 

libxplanemp/engines/engine_rotation_angle_deg

V_ENGINES_ENGINE_ROTATION_SPEED_RPM 

libxplanemp/engines/engine_rotation_speed_rpm

V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC 

libxplanemp/engines/engine_rotation_speed_rad_sec

V_ENGINES_PROP_ROTATION_ANGLE_DEG 

libxplanemp/engines/prop_rotation_angle_deg

V_ENGINES_PROP_ROTATION_SPEED_RPM 

libxplanemp/engines/prop_rotation_speed_rpm

V_ENGINES_PROP_ROTATION_SPEED_RAD_SEC 

libxplanemp/engines/prop_rotation_speed_rad_sec

V_ENGINES_THRUST_REVERSER_DEPLOY_RATIO 

libxplanemp/engines/thrust_reverser_deploy_ratio

V_ENGINES_ENGINE_ROTATION_ANGLE_DEG1 

libxplanemp/engines/engine_rotation_angle_deg1

V_ENGINES_ENGINE_ROTATION_ANGLE_DEG2 

libxplanemp/engines/engine_rotation_angle_deg2

V_ENGINES_ENGINE_ROTATION_ANGLE_DEG3 

libxplanemp/engines/engine_rotation_angle_deg3

V_ENGINES_ENGINE_ROTATION_ANGLE_DEG4 

libxplanemp/engines/engine_rotation_angle_deg4

V_ENGINES_ENGINE_ROTATION_SPEED_RPM1 

libxplanemp/engines/engine_rotation_speed_rpm1

V_ENGINES_ENGINE_ROTATION_SPEED_RPM2 

libxplanemp/engines/engine_rotation_speed_rpm2

V_ENGINES_ENGINE_ROTATION_SPEED_RPM3 

libxplanemp/engines/engine_rotation_speed_rpm3

V_ENGINES_ENGINE_ROTATION_SPEED_RPM4 

libxplanemp/engines/engine_rotation_speed_rpm4

V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC1 

libxplanemp/engines/engine_rotation_speed_rad_sec1

V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC2 

libxplanemp/engines/engine_rotation_speed_rad_sec2

V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC3 

libxplanemp/engines/engine_rotation_speed_rad_sec3

V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC4 

libxplanemp/engines/engine_rotation_speed_rad_sec4

V_MISC_TOUCH_DOWN 

libxplanemp/misc/touch_down

V_COUNT 

always last, number of dataRefs XPMP2 pre-defines

◆ logLevelTy

Logging level.

Enumerator
logDEBUG 

Debug, highest level of detail.

logINFO 

regular info messages

logWARN 

warnings, i.e. unexpected, but uncritical events, maybe leading to unwanted display, but still: display of aircraft

logERR 

errors mean, aircraft can potentially not be displayed

logFATAL 

fatal is shortly before a crash

logMSG 

will always be output, no matter what has been configured, cannot be suppressed

◆ ObjLoadStateTy

State of the X-Plane object: Is it being loaded or available?

Enumerator
OLS_INVALID 

loading once failed -> invalid!

OLS_UNAVAIL 

Not yet tried loading the CSL object.

OLS_COPYING 

creating a new .obj file copy, replacing dataRefs and textures

OLS_LOADING 

async load underway

OLS_AVAILABLE 

X-Plane object available in xpObj

◆ RelTxtTy

enum XPMP2::RelTxtTy : size_t
Enumerator
REL_TXT_DESIGNATOR 

related file for plane type (designator), related.txt

REL_TXT_OP 

related file for operators, relOp.txt

REL_TXT_NUM 

always last: number of "related" files

◆ RemoteMsgTy

enum XPMP2::RemoteMsgTy : std::uint8_t

Message type.

Enumerator
RMT_MSG_INTEREST_BEACON 

beacon sent by a remote client to signal interest in data

RMT_MSG_SEND 

internal indicator telling to send out all pending messages

RMT_MSG_SETTINGS 

a sender's id and its settings

RMT_MSG_AC_DETAILED 

aircraft full details, needed to create new a/c objects and to re-synch all remote data

RMT_MSG_AC_POS_UPDATE 

aircraft differences only

RMT_MSG_AC_ANIM 

aircraft animation values (dataRef values) only

RMT_MSG_AC_REMOVE 

aircraft is removed

◆ RemoteStatusTy

enum XPMP2::RemoteStatusTy : unsigned

State of remote communcations.

Enumerator
REMOTE_OFF 

no remote connectivtiy, not listening, not sending

REMOTE_SEND_WAITING 

listening for a request to send data, but not actively sending data

REMOTE_SENDING 

actively sending aircraft data out to the network

REMOTE_RECV_WAITING 

waiting to receive data, periodically sending a token of interest

REMOTE_RECEIVING 

actively receiving data

◆ ThreeWaySwitchTy

3-way switch type

Enumerator
SWITCH_CFG_OFF 

config: force off

SWITCH_CFG_AUTO 

config: automatic or default

SWITCH_CFG_ON 

config: force on

Function Documentation

◆ _GetIntfNext()

uint32_t XPMP2::_GetIntfNext ( const uint32_t  prevIdx,
SetLocalIntfAddrTy::const_iterator &  i,
uint8_t  family,
uint32_t  fMust,
uint32_t  fSkip 
)

Internal: Returns the next interface index of a broadcast interface for the given protocol family.

◆ _NetwFindLocalIntf()

LocalIntfAddrTy XPMP2::_NetwFindLocalIntf ( const std::string &  intf,
uint8_t  family 
)

Find a matching local interface based on name and family.

◆ _NetwGetIntfName()

std::string XPMP2::_NetwGetIntfName ( uint32_t  idx,
uint8_t  family 
)

Get an interface's name.

◆ _NetwGetLocalAddresses()

void XPMP2::_NetwGetLocalAddresses ( bool  bForceRefresh = false)

Fetch all local addresses and cache locally.

◆ AcCleanup()

void XPMP2::AcCleanup ( )

Grace cleanup, esp. remove all aircraft.

◆ AcFindByID()

Aircraft * XPMP2::AcFindByID ( XPMPPlaneID  _id)

Find aircraft by its plane ID, can return nullptr.

◆ AcInit()

void XPMP2::AcInit ( )

Initialize the module.

◆ AcSetDefaultWakeData()

bool XPMP2::AcSetDefaultWakeData ( const std::string &  _wtc,
const Aircraft::wakeTy _wake 
)

(Re)Define default wake turbulence values per WTC

◆ AcTxtLine_DEPENDENCY()

void XPMP2::AcTxtLine_DEPENDENCY ( std::vector< std::string > &  tokens,
int  lnNr 
)

Process an DEPENDENCY line of an xsb_aircraft.txt file.

◆ AcTxtLine_MATCHES()

void XPMP2::AcTxtLine_MATCHES ( CSLModel csl,
std::vector< std::string > &  tokens,
int  lnNr 
)

Process an ICAO, AIRLINE, LIVERY, or MATCHES line of an xsb_aircraft.txt file.

◆ AcTxtLine_OBJ8()

void XPMP2::AcTxtLine_OBJ8 ( CSLModel csl,
std::vector< std::string > &  tokens,
int  lnNr 
)

Process an OBJ8 line of an xsb_aircraft.txt file We don't care what type of object it is (ignoring the 1st parameter)

◆ AcTxtLine_OBJ8_AIRCRAFT()

void XPMP2::AcTxtLine_OBJ8_AIRCRAFT ( CSLModel csl,
const std::string &  ln,
const std::string &  xsbAircraftPath,
const std::string &  exportName,
int  lnNr 
)

Process an OBJ8_AIRCRAFT line of an xsb_aircraft.txt file.

◆ AcTxtLine_OBJECT_AIRCRAFT()

void XPMP2::AcTxtLine_OBJECT_AIRCRAFT ( CSLModel csl,
const std::string &  ,
int   
)

Process an OBJECT or AIRCRAFT line of an xsb_aircraft.txt file (which are no longer supported)

◆ AcTxtLine_OFFSET()

void XPMP2::AcTxtLine_OFFSET ( CSLModel csl,
std::vector< std::string > &  tokens,
int  lnNr 
)

Process an OFFSET line of a PilotEdge xsb_aircraft.txt file, actually its 3rd parameter only (we still don't know what the first 2 are)

See also
http://forums.pilotedge.net/viewtopic.php?f=12&t=7236#p47925

◆ AcTxtLine_VERT_OFFSET()

void XPMP2::AcTxtLine_VERT_OFFSET ( CSLModel csl,
std::vector< std::string > &  tokens,
int  lnNr 
)

Process an VERT_OFFSET line of an xsb_aircraft.txt file.

◆ AIAssignSlots()

void XPMP2::AIAssignSlots ( size_t  fromSlot,
size_t  toSlot 
)

Assigns slots, ie. planes to places in gSlots.

Called in several passes as to make sure that the lowest n slots are occupied by the closest n planes.

◆ AIMultiCleanup()

void XPMP2::AIMultiCleanup ( )

Grace cleanup.

Make sure we aren't in control, then Unshare the shared dataRefs

◆ AIMultiClearAIDataRefs()

void XPMP2::AIMultiClearAIDataRefs ( multiDataRefsTy drM,
bool  bDeactivateToZero 
)

Resets all actual values of the AI/multiplayer dataRefs of one plane to something initial.

Note
There as pending bug, filed as XPD-13332, which affects this function with XP12. X-Plane 12 can freeze since b5 when clearing Multiplayer positions to zero.
See also
https://forums.x-plane.org/index.php?/forums/topic/276319-xp12-on-mac-since-b5-freeze-upon-tcas-activation/
also https://forums.x-plane.org/index.php?/forums/topic/296584-livetraffic-freezes-xp-1208beta1-on-taking-over-tcas/ reporting the same issue for Linux, so we switch initializing off completely.

◆ AIMultiClearInfoDataRefs()

void XPMP2::AIMultiClearInfoDataRefs ( infoDataRefsTy drI)

Clears the shared info dataRefs.

◆ AIMultiClearTcasDataRefs()

void XPMP2::AIMultiClearTcasDataRefs ( )

Clears the key (mode_s) of the TCAS target dataRefs.

◆ AIMultiControlPlaneCount()

int XPMP2::AIMultiControlPlaneCount ( XPLMDrawingPhase  ,
int  inIsBefore,
void *   
)

Callback to toggle aircraft count ("TCAS hack")

We use AI Aircraft to simulate TCAS blibs, but we don't want these AI Aircraft to actually draw. So during aircraft drawing phase we tell X-Plane there are no AI planes, afterwards we put the correct number back

Note
Only used if TCAS fallback via classic multiplayer dataRefs is active

◆ AIMultiInformDREs()

void XPMP2::AIMultiInformDREs ( )

Inform DRE and DRT of our shared dataRefs.

◆ AIMultiInit()

void XPMP2::AIMultiInit ( )

Initialize the module.

Fetches all dataRef handles for all dataRefs of all up to 19 AI/multiplayer slots

◆ AIMultiInitAllDataRefs()

void XPMP2::AIMultiInitAllDataRefs ( bool  bDeactivateToZero)

Reset all (controlled) multiplayer dataRef values of all planes.

◆ AIMultiUpdate()

void XPMP2::AIMultiUpdate ( )

Updates all TCAS target dataRefs, both standard X-Plane, as well as additional shared dataRefs for text publishing.

◆ AIUpdateMultiplayerDataRefs()

size_t XPMP2::AIUpdateMultiplayerDataRefs ( )

The old way: Update Multiplayer dataRefs directly.

Returns
Number of TCAS targets produced

◆ AIUpdateTCASTargets()

size_t XPMP2::AIUpdateTCASTargets ( )

The modern way: Use TCAS override and update TCAS targets.

Returns
Number of TCAS targets produced (incl. user's plane)

◆ angleLocCoord()

float XPMP2::angleLocCoord ( float  x1,
float  z1,
float  x2,
float  z2 
)
inline

Angle of line from point (x1|z1) to point (x2|z2)

Note
Points are given in XP's local coordinates with x -> east and z -> south(!), but as in atan2 angles grow counter-clockwise, but we expect clockwise, these 2 effects (z south, counter-clockwise angles) neutralize.
atan2 returns 0° when pointing along the x axis, ie. east, when we would expect a result of 90°. Hence, we need to add 90°=PI/2 to the result.

◆ atan2deg()

float XPMP2::atan2deg ( float  x,
float  y 
)
inline

atan2 converted to degrees: the angle between (0|0) and the given point

◆ CheckEverySoOften() [1/2]

bool XPMP2::CheckEverySoOften ( float &  _lastCheck,
float  _interval 
)
inline

Convenience function to check on something at most every x seconds.

Parameters
_lastCheckProvide a float which holds the time of last check (init with 0.0f)
_interval[seconds] How often to perform the check?
Returns
true if more than _interval time has passed since _lastCheck

◆ CheckEverySoOften() [2/2]

bool XPMP2::CheckEverySoOften ( float &  _lastCheck,
float  _interval,
float  _now 
)

Convenience function to check on something at most every x seconds.

Parameters
_lastCheckProvide a float which holds the time of last check (init with 0.0f)
_interval[seconds] How often to perform the check?
_nowCurrent time, possibly from a call to GetTotalRunningTime()
Returns
true if more than _interval time has passed since _lastCheck

◆ clamp()

template<class T >
constexpr const T& XPMP2::clamp ( const T &  v,
const T &  lo,
const T &  hi 
)
constexpr

Clamps v between lo and hi: lo if v < lo, hi if hi < v, otherwise v

See also
C++17, https://en.cppreference.com/w/cpp/algorithm/clamp
Note
Reimplemented here because Docker clang environment doesn't include it

◆ ContrailCleanup()

void XPMP2::ContrailCleanup ( )

Graceful shutdown.

◆ ContrailInit()

bool XPMP2::ContrailInit ( )

Initialize the Contrail module and load the Contrail object.

Has a quick exit if already initialized or has already failed to initialize

Returns
Successfully initialized?

◆ CopyFileIfNewer()

bool XPMP2::CopyFileIfNewer ( const std::string &  source,
const std::string &  destDir 
)

Copy file if source is newer or destination missing.

Returns
Does the destination file (now) exist?

◆ CPLabelDrawing()

int XPMP2::CPLabelDrawing ( XPLMDrawingPhase  ,
int  ,
void *   
)

Drawing callback, called by X-Plane in every drawing cycle.

◆ CreateDir()

bool XPMP2::CreateDir ( const std::string &  path)

Create directory if it does not exist.

Returns
Does directory (now) exist?

◆ CSLFindMatch()

bool XPMP2::CSLFindMatch ( const std::string &  _type,
const std::string &  _airline,
const std::string &  _livery,
bool  bIgnoreNoMatch,
int &  quality,
CSLModel *&  pModel 
)

Tries finding a match using both aircraft and Doc8643 attributes.

Each attribute is represented by a bit in a bit mask. Lower priority attributes are represented by low value bits, and vice versa high prio match criteria by high value bits. The bit is 0 if the attribute matches and 1 if not. The resulting numeric value of the bitmask is considered the match quality: The lower the number the better the quality.

◆ CSLModelById()

CSLModel * XPMP2::CSLModelById ( const std::string &  _cslId,
mapCSLModelTy::iterator *  _pOutIter = nullptr 
)

Find a model by unique id.

Parameters
_cslIdThe model's unique id to search for (package name/short id)
[out]_pOutIterOptional pointer to an iterator variable, receiving the iterator position of the found model

◆ CSLModelByKey()

CSLModel * XPMP2::CSLModelByKey ( const std::string &  _cslKey,
mapCSLModelTy::iterator *  _pOutIter = nullptr 
)

Find a model by (even more) unique key.

Parameters
_cslKeyThe model's unique key into the map
[out]_pOutIterOptional pointer to an iterator variable, receiving the iterator position of the found model

◆ CSLModelByPkgShortId()

CSLModel * XPMP2::CSLModelByPkgShortId ( std::uint16_t  _pkgHash,
const std::string &  _shortId 
)

Find a model by package name hash and short id.

This approach is used by the remote client to safe network bandwith. If an exact match with pkgHash and shortID is not found, then a model matching the short id alone is returned if available.

Note
This is directly used by XPMP2-Remote client with a potentially limited short id string

◆ CSLModelGetKeyStr()

std::string XPMP2::CSLModelGetKeyStr ( int  _related,
const std::string &  _type,
const std::string &  _id 
)

compiles the string used as key in the CSL model map

◆ CSLModelMatching()

int XPMP2::CSLModelMatching ( const std::string &  _type,
const std::string &  _airline,
const std::string &  _livery,
CSLModel *&  pModel 
)

Find a matching model.

Matching happens usually in just one pass by calling CSLFindMatch().
The only exception is if the passed-in aircraft type is not an official ICAO type (which is what doc8643-matching bases on). In that case, the first pass is done without doc8643-matching. If that pass found no actual match, then there is a second pass based on the default ICAO type.

Parameters
_typeICAO aircraft type like "A319"
_airlineICAO airline code like "DLH"
_liveryAny specific livery code, in LiveTraffic e.g. the tail number
[out]pModelReceives the pointer to the matching CSL model, or NULL if nothing found
Returns
The number of passes needed to find a match, the lower the better the quality, negative is error.

◆ CSLModelsAdd()

void XPMP2::CSLModelsAdd ( CSLModel _csl)

Adds a readily defined CSL model to all the necessary maps.

◆ CSLModelsCleanup()

void XPMP2::CSLModelsCleanup ( )

Grace cleanup.

◆ CSLModelsConvPackagePath()

std::string XPMP2::CSLModelsConvPackagePath ( const std::string &  pkgPath,
int  lnNr,
bool  bPkgOptional = false 
)

Turn a relative package path into a full path.

Turns a relative package path in xsb_aircraft.txt (like "__Bluebell_Airbus:A306/A306_AAW.obj") into a full path pointing to a concrete file and verifies the file's existence.

Returns
Empty if any validation fails, otherwise a full path to an existing .obj file

◆ CSLModelsFindPkgs()

const char* XPMP2::CSLModelsFindPkgs ( const std::string &  _path,
std::vector< std::string > &  paths,
int  _maxDepth = 5 
)

Recursively scans folders to find xsb_aircraft.txt files of CSL packages.

Parameters
_pathThe path to start the search in
[out]pathsList of paths in which an xsb_aircraft.txt file has actually been found
_maxDepthHow deep into the folder hierarchy shall we search? (defaults to 5)

◆ CSLModelsInit()

void XPMP2::CSLModelsInit ( )

Initialization.

◆ CSLModelsLoad()

const char * XPMP2::CSLModelsLoad ( const std::string &  _path,
int  _maxDepth = 5 
)

Read the CSL Models found in the given path and below.

Parameters
_pathPath to a folder, which will be searched hierarchically for xsb_aircraft.txt files
_maxDepthSearch shall go how many folders deep at max?
Returns
An empty string on success, otherwise a human-readable error message

◆ CSLModelsProcessAcFile()

const char* XPMP2::CSLModelsProcessAcFile ( const std::string &  path)

Process one xsb_aircraft.txt file for importing OBJ8 models.

◆ CSLModelsReadPkgId()

const char* XPMP2::CSLModelsReadPkgId ( const std::string &  path)

Scans an xsb_aircraft.txt file for EXPORT_NAME entries to fill the list of packages.

◆ deg2rad()

template<class T >
T XPMP2::deg2rad ( const T  _deg)
inline

Convert degree to radians.

◆ dist()

template<class T >
T XPMP2::dist ( const T  x1,
const T  y1,
const T  z1,
const T  x2,
const T  y2,
const T  z2 
)
inline

Pythagorean distance between two points in a 3-D world.

◆ Doc8643Get()

const Doc8643 & XPMP2::Doc8643Get ( const std::string &  _type)

Return a reference to the matching Doc8643 object.

Returns
If no match can be found a reference to a standard empty object is returned.

◆ Doc8643IsTypeValid()

bool XPMP2::Doc8643IsTypeValid ( const std::string &  _type)

Is the given aircraft type a valid ICAO type as per Doc8643?

◆ Doc8643Load()

const char * XPMP2::Doc8643Load ( const std::string &  _path)

Load the content of the provided Doc8643.txt file.

◆ ExistsFile()

bool XPMP2::ExistsFile ( const std::string &  filename)

Does a file path exist?

See also
https://stackoverflow.com/a/51301928

◆ fequal()

bool XPMP2::fequal ( float  a,
float  b 
)
inline

Are these two float near-equal? (to avoid trying something like a == b)

◆ FmodHeadPitch2Vec()

FMOD_VECTOR XPMP2::FmodHeadPitch2Vec ( const float  head,
const float  pitch 
)

Convert heading/pitch to normalized x/y/z vector.

Note
Given all the trigonometric functions this is probably expensive, so use with care and avoid in flight loop callback when unnecessary.

◆ FmodHeadPitchRoll2Normal()

void XPMP2::FmodHeadPitchRoll2Normal ( const float  head,
const float  pitch,
const float  roll,
FMOD_VECTOR &  vecDir,
FMOD_VECTOR &  vecNorm 
)

Convert heading/pitch to normal x/y/z vector.

Note
Given all the trigonometric functions this is probably expensive, so use with care and avoid in flight loop callback when unnecessary.

◆ FmodNormalizeHeadingPitch()

void XPMP2::FmodNormalizeHeadingPitch ( float &  head,
float &  pitch 
)

Normalize Pitch/Heading.

Heading: [0; 360), Pitch: [-90; 90]

◆ FROMPOSIX()

std::string XPMP2::FROMPOSIX ( const std::string &  p)
inline

On Lin/Win there is no need for a conversion, but we do treat p now as std::string

◆ GetDirContents()

std::list< std::string > XPMP2::GetDirContents ( const std::string &  path)

List of files in a directory (wrapper around XPLMGetDirectoryContents)

◆ GetGraphicsDriverTxt()

const char * XPMP2::GetGraphicsDriverTxt ( )

Text string for current graphics driver in use.

◆ GetIntfFirst()

uint32_t XPMP2::GetIntfFirst ( SetLocalIntfAddrTy::const_iterator &  i,
uint8_t  family,
uint32_t  fMust,
uint32_t  fSkip = 0 
)

Returns the first interface index of a broadcast interface for the given protocol family.

◆ GetIntfNext()

uint32_t XPMP2::GetIntfNext ( SetLocalIntfAddrTy::const_iterator &  i,
uint8_t  family,
uint32_t  fMust,
uint32_t  fSkip = 0 
)

Returns the next interface index of a broadcast interface for the given protocol family.

◆ GetMiscNetwTime()

float XPMP2::GetMiscNetwTime ( )

Get synched network time from X-Plane (sim/network/misc/network_time_sec) as used in Log.txt.

◆ GetMiscNetwTimeStr()

std::string XPMP2::GetMiscNetwTimeStr ( float  _time = NAN)

Return the network time as a string like used in the XP's Log.txt.

Parameters
_timeIf given convert that time, otherwise convert XPMP2::GetMiscNetwTime()

◆ GetXPSystemPath()

const std::string & XPMP2::GetXPSystemPath ( )

Returns XP's system directory, including a trailing slash.

◆ glockRmtData()

std::unique_lock<std::mutex> XPMP2::glockRmtData ( gmutexRmtData  )

The lock that we keep during handling of the flight loop.

◆ GoTCASOverride()

bool XPMP2::GoTCASOverride ( )
inline

Are we going to new (TCAS override) or the old way?

◆ GoTCASWake()

bool XPMP2::GoTCASWake ( )
inline

Can we use the XP12 wake support system?

◆ headDiff()

float XPMP2::headDiff ( float  head1,
float  head2 
)

(Shortest) difference between 2 angles: How much to turn to go from h1 to h2?

◆ headNormalize()

template<class numT >
numT XPMP2::headNormalize ( numT  _head)

Normalize a heading value to [0..360), works for both float and double values.

◆ HeadPitch2Vec()

std::valarray< float > XPMP2::HeadPitch2Vec ( const float  head,
const float  pitch 
)

Convert heading/pitch to normalized x/y/z vector.

Note
Given all the trigonometric functions this is probably expensive, so use with care and avoid in flight loop callback when unnecessary.
Returns
a valarray with 3 values, x, y, and z

◆ HeadPitchRoll2Normal()

std::valarray< float > XPMP2::HeadPitchRoll2Normal ( const float  head,
const float  pitch,
const float  roll 
)

Convert heading/pitch/roll to unit and normal vector, ie. returns 6 values, first 3 like HeadPitch2Vec, second three the normal vector (pointing "up")

See also
https://math.stackexchange.com/a/1637853, however with different order of values (x = 2nd row, y = 3rd row, z = 1st row of vectors) as X-Plane is using a different coordinate system

◆ IsDir()

bool XPMP2::IsDir ( const std::string &  path)

Is path a directory?

◆ IsInRect()

bool XPMP2::IsInRect ( float  x,
float  y,
const float  bounds_ltrb[4] 
)

Tests if x/y lies within the rect, given as a float[4] array.

◆ IsPaused()

bool XPMP2::IsPaused ( )

X-Plane in a Pause state?

◆ IsViewExternal()

bool XPMP2::IsViewExternal ( )

Is current X-Plane view an external view (outside a cockpit)?

◆ iterRnd()

template<class IteratorT >
IteratorT XPMP2::iterRnd ( IteratorT  lower,
IteratorT  upper 
)

Returns any random value in the range [cslLower; cslUpper), or upper if there is no value in that range.

◆ leftOf()

std::string XPMP2::leftOf ( const std::string &  s,
const std::string &  terminators 
)
inline

Returns everything left of any of terminators.

◆ LogGetString()

const char * XPMP2::LogGetString ( const char *  szPath,
int  ln,
const char *  szFunc,
logLevelTy  lvl,
const char *  szMsg,
va_list  args 
)

Returns ptr to static buffer filled with formatted log string.

◆ LogMsg()

void XPMP2::LogMsg ( const char *  szPath,
int  ln,
const char *  szFunc,
logLevelTy  lvl,
const char *  szMsg,
  ... 
)

Log Text to log file.

◆ ltrim()

std::string& XPMP2::ltrim ( std::string &  s,
const char *  t = WHITESPACE 
)
inline

◆ MapCleanup()

void XPMP2::MapCleanup ( )

Grace cleanup.

◆ MapCreateAll()

void XPMP2::MapCreateAll ( )

Loop all existing maps and create our map layer for them.

◆ MapCreateCB()

void XPMP2::MapCreateCB ( const char *  mapIdentifier,
void *   
)

Callback called when a map is created. We then need to add our layer to it.

◆ MapDeleteCB()

void XPMP2::MapDeleteCB ( XPLMMapLayerID  inLayer,
void *   
)

Called when a map is about to be deleted.

◆ MapDestroyAll()

void XPMP2::MapDestroyAll ( )

Remove all our map layers.

◆ MapIconDrawingCB()

void XPMP2::MapIconDrawingCB ( XPLMMapLayerID  inLayer,
const float *  inMapBoundsLeftTopRightBottom,
float  ,
float  mapUnitsPerUserInterfaceUnit,
XPLMMapStyle  ,
XPLMMapProjectionID  projection,
void *  refcon 
)

Actually draw the icons into the map.

This call computes the labels location on the map and puts this info into the aircraft object. MapLabelDrawingCB() reuses the cached location info.

◆ MapInit()

void XPMP2::MapInit ( )

Initialize the module.

◆ MapLabelDrawingCB()

void XPMP2::MapLabelDrawingCB ( XPLMMapLayerID  inLayer,
const float *  inMapBoundsLeftTopRightBottom,
float  ,
float  mapUnitsPerUserInterfaceUnit,
XPLMMapStyle  ,
XPLMMapProjectionID  projection,
void *  refcon 
)

Actually draw the labels into th emap.

◆ MapLayerCreate()

void XPMP2::MapLayerCreate ( const char *  mapIdentifier)

Create our map layer for the given map.

◆ MapPrepareCacheCB()

void XPMP2::MapPrepareCacheCB ( XPLMMapLayerID  ,
const float *  inTotalMapBoundsLeftTopRightBottom,
XPLMMapProjectionID  projection,
void *   
)

Prepare map drawing information.

It seems that XPLMMapScaleMeter only works from here, otherwise could crash the sim. (Reported as bug to Laminar)

◆ NetwGetInterfaceNames()

std::string XPMP2::NetwGetInterfaceNames ( uint8_t  family,
uint32_t  fMust,
uint32_t  fSkip 
)

Return comma-separated string will all known local interfaces, calls NetwGetInterfaces()

◆ NetwGetInterfaces()

std::vector< std::string > XPMP2::NetwGetInterfaces ( uint8_t  family,
uint32_t  fMust = 0,
uint32_t  fSkip = 0 
)

Return list of known local interfaces.

Parameters
familyAF_INET or AF_INET6
fMustReturn only interfaces having these interface flags like IFF_MULTICAST, IFF_BROADCAST
fSkipSkipt interfaces having these interface flags like IFF_LOOPBACK
Returns
A vector of strings of interface names

◆ NetwIsLocalAddr() [1/3]

bool XPMP2::NetwIsLocalAddr ( const InetAddrTy addr)

Is given address a local one?

◆ NetwIsLocalAddr() [2/3]

bool XPMP2::NetwIsLocalAddr ( const sockaddr *  pSa)
inline

Is given address a local one?

◆ NetwIsLocalAddr() [3/3]

bool XPMP2::NetwIsLocalAddr ( const SockAddrTy sa)
inline

Is given address a local one?

◆ Obj8DataRefsLoad()

const char * XPMP2::Obj8DataRefsLoad ( const std::string &  _path)

Load the content of the provided Obj8DataRefs.txt file.

◆ obj_get_float()

float XPMP2::obj_get_float ( void *  )

We need to provide these functions for purely formal reasons. They are not actually ever called as we provide the current dataRef values via XPLMInstanceSetPosition. So we don't bother providing any implementation

◆ obj_get_float_array()

int XPMP2::obj_get_float_array ( void *  ,
float *  ,
int  ,
int  inCount 
)

◆ PJWHash16()

std::uint16_t XPMP2::PJWHash16 ( const char *  s)

Produces a reproducible(!) hash value for strings.

Result is the same if the same string is provided, across platform and across executions, unlike what std::hash requires.
It is implemented as a 16-bit version of the PJW hash:

See also
https://en.wikipedia.org/wiki/PJW_hash_function

◆ PrefsFuncIntDefault()

int XPMP2::PrefsFuncIntDefault ( const char *  ,
const char *  ,
int  _default 
)

Default config function just always returns the provided default value.

◆ rad2deg()

template<class T >
T XPMP2::rad2deg ( const T  _rad)
inline

Convert radians to degrees, normalized to [0..360)

◆ Read3WaySwitch()

ThreeWaySwitchTy XPMP2::Read3WaySwitch ( std::string &  sVal,
const std::string &  sKey,
const std::string &  cfgFileName,
ThreeWaySwitchTy  defVal 
)

Convert strings on, auto, off to enums of type ThreeWaySwitchTy

◆ RelatedGet()

int XPMP2::RelatedGet ( RelTxtTy  relType,
const std::string &  _acType 
)

Find the related group for a given key, 0 if none.

◆ RelatedLoad() [1/2]

const char * XPMP2::RelatedLoad ( const std::string  _paths[],
size_t  _num 
)

Load all related files.

Note
Non-existing files are skipped with warning in log, but don't return an error

◆ RelatedLoad() [2/2]

const char * XPMP2::RelatedLoad ( RelTxtTy  relType,
const std::string &  _path 
)

Read the related.txt file, full path passed in.

Returns
Empty string on success, otherwise error message

◆ RemoteAcClearAll()

void XPMP2::RemoteAcClearAll ( )

Informs us that there are no more aircraft, clear our caches!

◆ RemoteAcEnqueue()

void XPMP2::RemoteAcEnqueue ( const Aircraft ac)

Regularly called from the flight loop callback to send a/c date onto the network.

Will collect data into network messages but only send out when full

◆ RemoteAcEnqueueDone()

void XPMP2::RemoteAcEnqueueDone ( )

Informs us that all a/c have been processed: All pending messages to be sent now.

◆ RemoteAcEnqueueStarts()

void XPMP2::RemoteAcEnqueueStarts ( float  now)

Informs us that updating a/c will start now, do some prep work

Note
Internally acquires a lock, XPMP2::RemoteAcEnqueueDone() must be called to release that lock

◆ RemoteAcRemove()

void XPMP2::RemoteAcRemove ( const Aircraft ac)

Informs us about an aircraft deletion.

◆ RemoteCleanup()

void XPMP2::RemoteCleanup ( )

Grace cleanup, stops all threads.

◆ RemoteGetStatus()

RemoteStatusTy XPMP2::RemoteGetStatus ( )

Returns the current Remote status.

◆ RemoteInit()

void XPMP2::RemoteInit ( )

Initialize the module.

◆ RemoteRecvStart()

void XPMP2::RemoteRecvStart ( const RemoteCBFctTy _rmtCBFcts)

Starts the listener, will call provided callback functions with received messages.

◆ RemoteRecvStop()

void XPMP2::RemoteRecvStop ( )

Stops the receiver.

◆ RemoteSenderUpdateStatus()

void XPMP2::RemoteSenderUpdateStatus ( )

Compares current vs. expected status and takes appropriate action.

◆ RemoveExtension()

void XPMP2::RemoveExtension ( std::string &  path)

Removes everything after the last dot, the dot including.

◆ RmtRecvContinue()

bool XPMP2::RmtRecvContinue ( )
inline

Conditions for continued receive operation.

◆ RmtRecvMain()

void XPMP2::RmtRecvMain ( )

Thread main function for the receiver.

< error counter for network thread

◆ RmtSendBeacon()

void XPMP2::RmtSendBeacon ( )

Sends an Interest Beacon.

◆ RmtSendContinue()

bool XPMP2::RmtSendContinue ( )
inline

Conditions for continued send operation.

◆ RmtSendLoop()

void XPMP2::RmtSendLoop ( )

Sending function, ie. we are actively sending data out.

◆ RmtSendMain()

void XPMP2::RmtSendMain ( )

Thread main function for the sender.

< error counter for network thread

◆ RmtSendProcessQueue()

void XPMP2::RmtSendProcessQueue ( )

Process the data passed down to us in the queue.

◆ RmtSendSettings()

void XPMP2::RmtSendSettings ( )

Send our settings.

◆ RmtStartMCThread()

void XPMP2::RmtStartMCThread ( bool  bSender)

Start the background thread to listen to multicast, to see if anybody is interested in our data.

◆ RmtStopAll()

void XPMP2::RmtStopAll ( )

Stop all threads and communication with the network.

◆ rtrim()

std::string& XPMP2::rtrim ( std::string &  s,
const char *  t = WHITESPACE 
)
inline

◆ safeGetline()

std::istream & XPMP2::safeGetline ( std::istream &  is,
std::string &  t 
)

Read a line from a text file, no matter if ending on CRLF or LF.

Read a text line, handling both Windows (CRLF) and Unix (LF) ending Code makes use of the fact that in both cases LF is the terminal character. So we read from file until LF (without widening!). In case of CRLF files there then is a trailing CR, which we just remove.

◆ SoundCleanup()

void XPMP2::SoundCleanup ( )

Graceful shoutdown.

◆ SoundEventTxt()

const char* XPMP2::SoundEventTxt ( Aircraft::SoundEventsTy  e)

Return a text for the values of Aircraft::SoundEventsTy.

◆ SoundInit()

void XPMP2::SoundInit ( )

Initialize the sound module and load the sounds.

◆ SoundLoadXPSounds()

int XPMP2::SoundLoadXPSounds ( )

Load fixed set of X-Plane-internal sounds.

Returns
Number of loaded sounds

◆ SoundUpdatesBegin()

void XPMP2::SoundUpdatesBegin ( )

Prepare for this frame's updates, which are about to start.

◆ SoundUpdatesDone()

void XPMP2::SoundUpdatesDone ( )

Tell FMOD that all updates are done.

◆ sqr()

template<class T >
T XPMP2::sqr ( const T  a)
inline

Square.

◆ str_tokenize()

std::vector< std::string > XPMP2::str_tokenize ( const std::string  s,
const std::string  tokens,
bool  bSkipEmpty 
)

separates string into tokens

◆ str_tolower()

std::string & XPMP2::str_tolower ( std::string &  s)

change a std::string to uppercase

◆ StrCntString()

int XPMP2::StrCntString ( const mapStrIntTy m,
std::string &  s 
)

Compiles a string from a map of string->int like "(A320 x 5, A388 x 12)".

Returns
Total count (17 in the example above)

◆ StripXPSysDir()

std::string XPMP2::StripXPSysDir ( const std::string &  path)

If a path starts with X-Plane's system directory it is stripped.

◆ TOPOSIX()

std::string XPMP2::TOPOSIX ( const std::string &  p)
inline

On Lin/Win there is no need for a conversion, but we do treat p now as std::string

◆ trim()

std::string& XPMP2::trim ( std::string &  s,
const char *  t = WHITESPACE 
)
inline

◆ TwoDActivate()

void XPMP2::TwoDActivate ( )

Activate actual label drawing, esp. set up drawing callback.

◆ TwoDCleanup()

void XPMP2::TwoDCleanup ( )

Grace cleanup.

◆ TwoDDeactivate()

void XPMP2::TwoDDeactivate ( )

Deactivate actual label drawing, esp. stop drawing callback.

◆ TwoDDrawLabels()

void XPMP2::TwoDDrawLabels ( )

Write the labels of all aircraft.

See also
This code bases on the last part of XPMPDefaultPlaneRenderer of the original libxplanemp
Author
Ben Supnik, Chris Serio, Chris Collins, Birger Hoppe

◆ TwoDInit()

void XPMP2::TwoDInit ( )

Initialize the module.

◆ XPMPSendNotification()

void XPMP2::XPMPSendNotification ( const Aircraft plane,
XPMPPlaneNotification  _notification 
)

Send a notification to all observers.

◆ XPMPValidateResourceFiles()

const char* XPMP2::XPMPValidateResourceFiles ( const char *  resourceDir)

Validate all required files are available in the resource directory.

◆ XPSoundIsAvail()

bool XPMP2::XPSoundIsAvail ( )
inline

Are XP12 sound functions available?

◆ XPSoundLoadFctPtr()

bool XPMP2::XPSoundLoadFctPtr ( )

Tries to find all the new XP12 sound functions, available as of XP12.04.

Variable Documentation

◆ ahDataRefs

std::vector<XPLMDataRef> XPMP2::ahDataRefs

Registered dataRefs.

◆ AI_PRIO_MULTIPLIER

constexpr int XPMP2::AI_PRIO_MULTIPLIER = 10 * M_per_NM
constexpr

How much distance does each AIPrio add?

◆ AISLOT_CHANGE_PERIOD

constexpr float XPMP2::AISLOT_CHANGE_PERIOD = 15.0f
constexpr

How often do we reassign AI slots? [seconds].

◆ ALL_MAPS

std::array<const char*, 2> XPMP2::ALL_MAPS
Initial value:
= {
XPLM_MAP_USER_INTERFACE,
XPLM_MAP_IOS,
}

The list of known maps, which are hard-coded by X-Plane's SDK.

◆ DATA_REF_EDITORS

const char* XPMP2::DATA_REF_EDITORS[]
Initial value:
= {
"xplanesdk.examples.DataRefEditor",
"com.leecbaker.datareftool"
}

◆ DOC8643_EMPTY

const Doc8643 XPMP2::DOC8643_EMPTY

◆ drStrings

std::vector<std::unique_ptr<std::string> > XPMP2::drStrings

Here we store the dataRef strings as smart pointers, so that the pointed-to location will not change but we can easily manage them

◆ EPSILON_F

constexpr float XPMP2::EPSILON_F = 0.00001f
constexpr

Epsilon, a small number.

◆ ERR_CFG_FILE_MAXWARN

constexpr int XPMP2::ERR_CFG_FILE_MAXWARN = 5
constexpr

Maximum number of warnings during file read before bailing.

◆ EXP_COMP_SKIP_CYCLES

constexpr int XPMP2::EXP_COMP_SKIP_CYCLES = 10
constexpr

In how many cycles to skip expensive computations?

◆ F_NULL

float XPMP2::F_NULL[10] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}

A constant array of zero values supporting quick array initialization.

◆ FAR_AWAY_VAL_GL

constexpr float XPMP2::FAR_AWAY_VAL_GL = 9999999.9f
constexpr

Don't dare using NAN...but with this coordinate for x/y/z a plane should be far out and virtually invisible.

◆ FMOD_3D_MAX_DIST

constexpr float XPMP2::FMOD_3D_MAX_DIST = 10000.0f
constexpr

Value used for 3D max distance, which doesn't have much of a function for the inverse roll-off model used here.

◆ FMOD_LOW_PASS_GAIN

constexpr float XPMP2::FMOD_LOW_PASS_GAIN = 0.2f
constexpr

Gain used when activating Low Pass filter.

◆ FMOD_NUM_VIRT_CHANNELS

constexpr int XPMP2::FMOD_NUM_VIRT_CHANNELS = 1000
constexpr

Number of virtual channels during initialization.

◆ G_EARTH

constexpr float XPMP2::G_EARTH = 9.80665f
constexpr

standard gravitational acceleration [m/s²]

See also
https://en.wikipedia.org/wiki/Gravity_of_Earth

◆ gAddrLocal

SetLocalIntfAddrTy XPMP2::gAddrLocal

Set of local IP interface addresses.

◆ GARBAGE_COLLECTION_PERIOD

constexpr float XPMP2::GARBAGE_COLLECTION_PERIOD = 60.0f
constexpr

How often to call the garbage collection [s].

◆ GARBAGE_COLLECTION_TIMEOUT

constexpr float XPMP2::GARBAGE_COLLECTION_TIMEOUT = 180.0f
constexpr

Unload an unused object after how many seconds?

◆ gbRemoteGaveUp

bool XPMP2::gbRemoteGaveUp = false

No longer try remote functionality, have seen to many errors.

◆ gbStopMCThread

volatile bool XPMP2::gbStopMCThread = false

Shall the network thread stop?

◆ gcvRmtData

std::condition_variable XPMP2::gcvRmtData

notifies the network thread of available data to be processed

◆ gFlightLoopID

XPLMFlightLoopID XPMP2::gFlightLoopID = nullptr

The id of our flight loop callback.

◆ gFmodRes

FMOD_RESULT XPMP2::gFmodRes = FMOD_OK

last FMOD result code, needed by the following macro, better don't rely on anywhere else

◆ gFullUpdDue

unsigned XPMP2::gFullUpdDue = 0

What's the full update group that has its turn now?

◆ gFullUpdLastDone

unsigned XPMP2::gFullUpdLastDone = 0

the last actually processed full update group

◆ gGarbageCollectionID

XPLMFlightLoopID XPMP2::gGarbageCollectionID = nullptr

The ids of our garbage collection flight loop callback.

◆ ghContrailObj

XPLMObjectRef XPMP2::ghContrailObj = nullptr

The one global Contrail object.

◆ ghDrContrailLifeTime

XPLMDataRef XPMP2::ghDrContrailLifeTime = nullptr

The handle for the registered Contrail LifeTime dataRef.

◆ glob

GlobVars XPMP2::glob

The one and only global variable structure.

◆ gmapRmtAcCache

mapRmtAcCacheTy XPMP2::gmapRmtAcCache

Cache for last data sent out to the network.

◆ gMsgAcAnim

A/C Animation dataRefs message.

◆ gMsgAcDetail

A/C Detail message.

◆ gMsgAcPosUpdate

A/C Position Update message.

◆ gMsgAcRemove

A/C Removal message.

◆ gmutexRmtData

std::mutex XPMP2::gmutexRmtData

protects modifying access to the queue and the condition variable

◆ gNow

float XPMP2::gNow = 0.0f

Current network timestamp.

◆ gNxtFullUpdGrpToAssign

unsigned XPMP2::gNxtFullUpdGrpToAssign = 0

What's the next group number to assign to the next a/c? (Assigned will be the value incremented by 1)

◆ gNxtTxfTime

float XPMP2::gNxtTxfTime = 0.0f

When to actually process position updates next?

◆ gpMc

UDPMulticast* XPMP2::gpMc = nullptr

multicast socket for listening/sending (destructor uses locks, which don't work during module shutdown, so can't create a global object due to its exit-time destructor)

◆ gpSndSys

SoundSystem * XPMP2::gpSndSys = nullptr

The sound system in use.

◆ gpXPLMPlayPCMOnBus

f_XPLMPlayPCMOnBus* XPMP2::gpXPLMPlayPCMOnBus = nullptr

◆ gpXPLMSetAudioCone

f_XPLMSetAudioCone* XPMP2::gpXPLMSetAudioCone = nullptr

◆ gpXPLMSetAudioFadeDistance

f_XPLMSetAudioFadeDistance* XPMP2::gpXPLMSetAudioFadeDistance = nullptr

◆ gpXPLMSetAudioPosition

f_XPLMSetAudioPosition* XPMP2::gpXPLMSetAudioPosition = nullptr

◆ gpXPLMSetAudioVolume

f_XPLMSetAudioVolume* XPMP2::gpXPLMSetAudioVolume = nullptr

◆ gpXPLMStopAudio

f_XPLMStopAudio* XPMP2::gpXPLMStopAudio = nullptr

◆ gqueueRmtData

queueRmtDataTy XPMP2::gqueueRmtData

the queue for passing data from main to network thread

◆ gRmtCBFcts

RemoteCBFctTy XPMP2::gRmtCBFcts

The callback function pointers the remote client plugin provided.

◆ gSendSettingsLast

float XPMP2::gSendSettingsLast = 0.0f

Timestamp when we sent our settings the last time.

◆ gThrMC

std::thread XPMP2::gThrMC

remote listening/sending thread

◆ KT_per_M_per_S

constexpr double XPMP2::KT_per_M_per_S = 1.94384
constexpr

Convert m/s to knots.

◆ LOG_LEVEL

const char* XPMP2::LOG_LEVEL[]
Initial value:
= {
"DEBUG", "INFO ", "WARN ", "ERROR", "FATAL", "MSG "
}

◆ M_per_FT

constexpr double XPMP2::M_per_FT = 0.3048
constexpr

Convert feet to meters, e.g. for altitude calculations.

◆ M_per_NM

constexpr int XPMP2::M_per_NM = 1852
constexpr

Convert nautical miles to meters.

◆ MAP_AC_SIZE

constexpr float XPMP2::MAP_AC_SIZE = 30.0f
constexpr

Assumed size of an aircraft in m.

◆ MAP_ICON_HEIGHT

constexpr int XPMP2::MAP_ICON_HEIGHT = 3
constexpr

Dimenson of MapIcon.png.

◆ MAP_ICON_WIDTH

constexpr int XPMP2::MAP_ICON_WIDTH = 3
constexpr

Dimenson of MapIcon.png.

◆ MAP_MIN_ICON_SIZE

constexpr int XPMP2::MAP_MIN_ICON_SIZE = 40
constexpr

Minimum icon size in map in UI units.

◆ MC_MAX_ERR

constexpr int XPMP2::MC_MAX_ERR =5
constexpr

after this many errors we no longer try listening

◆ mtxAddrLocal

std::recursive_mutex XPMP2::mtxAddrLocal

Mutex to safeguard access to gAddrLocal

◆ mtxSocketClose

std::recursive_mutex XPMP2::mtxSocketClose

Mutex to ensure closing is done in one thread only to avoid race conditions on deleting the buffer.

◆ PACKED

◆ PI

constexpr double XPMP2::PI = 3.1415926535897932384626433832795028841971693993751
constexpr

Pi.

◆ REMOTE_ALT_FT_RES

constexpr double XPMP2::REMOTE_ALT_FT_RES = 0.01
constexpr

resolution of altitude[ft] updates

◆ REMOTE_DEGREE_RES

constexpr double XPMP2::REMOTE_DEGREE_RES = 0.00000001
constexpr

What is the maximum difference a RemoteAcPosUpdateTy can hold?

resolution of degree updates

◆ REMOTE_DR_DEF

const std::array< RemoteDataRefPackTy, V_COUNT > XPMP2::REMOTE_DR_DEF

An array holding all dataRef packing definitions.

Defines per dataRef the value range we support transferring to the remote client.

◆ REMOTE_MAX_DIFF_ALT_FT

constexpr double XPMP2::REMOTE_MAX_DIFF_ALT_FT = REMOTE_ALT_FT_RES * INT16_MAX
constexpr

maximum altitude[ft] difference that can be represented in a pos update msg

◆ REMOTE_MAX_DIFF_DEGREE

constexpr double XPMP2::REMOTE_MAX_DIFF_DEGREE = REMOTE_DEGREE_RES * INT16_MAX
constexpr

maximum degree difference that can be represented in a pos update msg

◆ REMOTE_MAX_DIFF_TIME

constexpr float XPMP2::REMOTE_MAX_DIFF_TIME = REMOTE_TIME_RES * UINT16_MAX
constexpr

maximum time difference thatn can be represented in a pos update msg

◆ REMOTE_RECV_BEACON_INTVL

constexpr int XPMP2::REMOTE_RECV_BEACON_INTVL = 15
constexpr

How often to send an Interest Beacon? [s].

◆ REMOTE_SEND_AC_DETAILS_INTVL

constexpr float XPMP2::REMOTE_SEND_AC_DETAILS_INTVL = 10.f
constexpr

How often to send full a/c details? [s].

◆ REMOTE_SEND_SETTINGS_INTVL

constexpr int XPMP2::REMOTE_SEND_SETTINGS_INTVL = 20
constexpr

How often to send settings? [s].

◆ REMOTE_SIGNATURE

constexpr const char* XPMP2::REMOTE_SIGNATURE = "TwinFan.plugin.XPMP2.Remote"
constexpr

The signature of the XPMP2 Remote Client.

◆ REMOTE_TIME_RES

constexpr float XPMP2::REMOTE_TIME_RES = 0.0001f
constexpr

resolution of time difference

◆ RMT_VER_AC_ANIM

constexpr std::uint8_t XPMP2::RMT_VER_AC_ANIM = 0
constexpr

A/C Position update message version number.

◆ RMT_VER_AC_DETAIL

constexpr std::uint8_t XPMP2::RMT_VER_AC_DETAIL = 3
constexpr

A/C detail message version number.

◆ RMT_VER_AC_DETAIL_0

constexpr std::uint8_t XPMP2::RMT_VER_AC_DETAIL_0 = 0
constexpr

◆ RMT_VER_AC_DETAIL_1

constexpr std::uint8_t XPMP2::RMT_VER_AC_DETAIL_1 = 1
constexpr

◆ RMT_VER_AC_DETAIL_2

constexpr std::uint8_t XPMP2::RMT_VER_AC_DETAIL_2 = 2
constexpr

◆ RMT_VER_AC_POS_UPDATE

constexpr std::uint8_t XPMP2::RMT_VER_AC_POS_UPDATE = 0
constexpr

A/C Position update message version number.

◆ RMT_VER_AC_REMOVE

constexpr std::uint8_t XPMP2::RMT_VER_AC_REMOVE = 0
constexpr

A/C removal message version number.

◆ RMT_VER_BEACON

constexpr std::uint8_t XPMP2::RMT_VER_BEACON = 0
constexpr

Interest Beacon message version number.

◆ RMT_VER_SETTINGS

constexpr std::uint8_t XPMP2::RMT_VER_SETTINGS = 0
constexpr

Setttings message version number.

◆ RPM_to_RADs

constexpr float XPMP2::RPM_to_RADs = 0.10471975511966f
constexpr

Defined by XPMP2 internally.

Convert revolutions-per-minute (RPM) to radians per second (rad/s) by multiplying with PI/30

◆ RSRC_DOC8643

constexpr const char* XPMP2::RSRC_DOC8643 = "Doc8643.txt"
constexpr

◆ RSRC_MAP_ICONS

constexpr const char* XPMP2::RSRC_MAP_ICONS = "MapIcons.png"
constexpr

◆ RSRC_OBJ8DATAREFS

constexpr const char* XPMP2::RSRC_OBJ8DATAREFS = "Obj8DataRefs.txt"
constexpr

◆ RSRC_REL_OP

constexpr const char* XPMP2::RSRC_REL_OP = "relOp.txt"
constexpr

◆ RSRC_RELATED

constexpr const char* XPMP2::RSRC_RELATED = "related.txt"
constexpr

◆ SDR_CSLMODEL_TXT_SIZE

constexpr size_t XPMP2::SDR_CSLMODEL_TXT_SIZE = 40
constexpr

Number of characters to be allowed for CSL model text.

◆ SERR_LEN

constexpr size_t XPMP2::SERR_LEN = 100
constexpr

Maximum length of OS error message.

◆ vecDREdataRefStr

std::vector<std::string> XPMP2::vecDREdataRefStr

list of dataRef strings to be send to the editors

◆ XPLM_PHASE_AIRPLANES

constexpr int XPMP2::XPLM_PHASE_AIRPLANES = 25
constexpr

The drawing phase "xplm_Phase_Airplanes" is deprecated in XP11.50 upwards, but we need it in earlier versions to fake TCAS.