XPMP2
X-Plane multiplayer library 2 - using instancing
XPMPRemote.h
Go to the documentation of this file.
1
28
29#ifndef _XPMPRemote_h_
30#define _XPMPRemote_h_
31
32#include <cassert>
33#include <cstdint>
34#include <cstring>
35#include <cmath>
36#include <array>
37#include <algorithm>
38
39namespace XPMP2 {
40
42constexpr const char* REMOTE_SIGNATURE = "TwinFan.plugin.XPMP2.Remote";
43
44//
45// MARK: Global Helpers
46//
47
53std::uint16_t PJWHash16 (const char *s);
54
59CSLModel* CSLModelByPkgShortId (std::uint16_t _pkgHash,
60 const std::string& _shortId);
61
65template<class T>
66constexpr const T& clamp( const T& v, const T& lo, const T& hi )
67{
68 assert( !(hi < lo) );
69 return (v < lo) ? lo : (hi < v) ? hi : v;
70}
71
72//
73// MARK: Network Data Definitions
74//
75
86
89 float minV = 0.0f;
90 float range = 0.0f;
91
93 RemoteDataRefPackTy (float _min, float _max) : minV(_min), range(_max - _min) { assert(range != 0.0f); }
94
96 std::uint8_t pack (float f) const { return std::uint8_t(clamp<float>(f-minV,0.0f,range) * UINT8_MAX / range); }
98 float unpack (std::uint8_t i) const { return minV + range*float(i)/255.0f; }
99};
100
102extern const std::array<RemoteDataRefPackTy,V_COUNT> REMOTE_DR_DEF;
103
104//
105// MARK: Message Header (Base)
106//
107
108// To ensure best network capacity usage as well as identical alignment across platform we enforce tightly packed structures.
109// The approach is very different between Visual C++ and clang / gcc, though:
110#ifdef _MSC_VER // Visual C++
111#pragma pack(push,1) // set packing once (ie. not per struct)
112#define PACKED
113#elif defined(__clang__) || defined(__GNUC__) // Clang (Mac XCode etc) or GNU (Linux)
114#define PACKED __attribute__ ((__packed__))
115#else
116#error Unhandled Compiler!
117#endif
118
122 std::uint8_t msgVer : 4;
123 bool bLocalSender : 1;
124 std::uint8_t filler1 : 7;
125 std::uint16_t pluginId = 0;
126 std::uint32_t filler2 = 0;
128 RemoteMsgBaseTy (RemoteMsgTy _ty, std::uint8_t _ver);
130
131//
132// MARK: Beacon of Interest
133//
134
136constexpr std::uint8_t RMT_VER_BEACON = 0;
139 // don't need additional data fields
142} PACKED;
143
144//
145// MARK: Settings
146//
147
149constexpr int REMOTE_SEND_SETTINGS_INTVL = 20;
150
152constexpr std::uint8_t RMT_VER_SETTINGS = 0;
155 char name[16];
157 char defaultIcao[4];
158 char carIcaoType[4];
159 std::uint8_t logLvl :3;
160 bool bLogMdlMatch :1;
164 bool bMapEnabled :1;
165 bool bMapLabels :1;
167 std::uint16_t filler;
168
171
172} PACKED;
173
174//
175// MARK: A/C Details
176//
177
179constexpr std::uint8_t RMT_VER_AC_DETAIL = 3;
180constexpr std::uint8_t RMT_VER_AC_DETAIL_2 = 2;
181constexpr std::uint8_t RMT_VER_AC_DETAIL_1 = 1;
182constexpr std::uint8_t RMT_VER_AC_DETAIL_0 = 0;
185 std::uint32_t modeS_id;
186 char icaoType[4];
187 char icaoOp[4];
188 char sShortId[20];
189 std::uint16_t pkgHash;
190 char label[23];
191 std::uint8_t labelCol[3];
192 float alt_ft;
193 // ^ the above has 64 bytes, so that these doubles start on an 8-byte bounday:
194 double lat;
195 double lon;
196 std::int16_t pitch;
197 std::uint16_t heading;
198 std::int16_t roll;
199
200 std::int16_t aiPrio;
201 std::uint16_t dTime;
202 bool bValid : 1;
203 bool bVisible : 1;
204 bool bRender : 1;
205 bool bDrawLabel : 1;
206 bool bOnGrnd : 1;
207 std::uint8_t contrailNum : 3;
208
209 // selectively taken from XPMPInfoTexts_t and packed:
210 char tailNum[10];
211 char manufacturer[40];
212 char model[40];
213 char airline[40];
214 char flightNum [10];
215 char aptFrom [5];
216 char aptTo [5];
217
218 std::uint8_t contrailDist_m;
219 std::uint8_t contrailLifeTime;
220 std::uint8_t filler[3];
221
223 std::uint8_t v[XPMP2::V_COUNT]; // 42
224
228 RemoteAcDetailTy (const Aircraft& _ac, double _lat, double _lon, float _alt_ft, std::uint16_t _dTime);
230 void CopyFrom (const Aircraft& _ac, double _lat, double _lon, float _alt_ft, std::uint16_t _dTime);
231
232 void SetLabelCol (const float _col[4]);
233 void GetLabelCol (float _col[4]) const;
234
235 void SetPitch (float _p) { pitch = std::int16_t(_p*100.0f); }
236 float GetPitch () const { return float(pitch) / 100.0f; }
237
240 void SetHeading (float _h);
241 float GetHeading () const { return float(heading) / 100.0f; }
242
243 void SetRoll (float _r) { roll = std::int16_t(std::lround(_r*100.0f)); }
244 float GetRoll () const { return float(roll) / 100.0f; }
245
246 static constexpr size_t msgSize () { return sizeof(RemoteAcDetailTy); }
247} PACKED;
248
252
256 static constexpr size_t NumElem (size_t _msgLen) { return (_msgLen - sizeof(RemoteMsgBaseTy)) / sizeof(RemoteAcDetailTy); }
257} PACKED;
258
259//
260// MARK: A/C Position Update
261//
262
264constexpr std::uint8_t RMT_VER_AC_POS_UPDATE = 0;
265
267constexpr double REMOTE_DEGREE_RES = 0.00000001;
268constexpr double REMOTE_MAX_DIFF_DEGREE = REMOTE_DEGREE_RES * INT16_MAX;
269constexpr double REMOTE_ALT_FT_RES = 0.01;
270constexpr double REMOTE_MAX_DIFF_ALT_FT = REMOTE_ALT_FT_RES * INT16_MAX;
271constexpr float REMOTE_TIME_RES = 0.0001f;
272constexpr float REMOTE_MAX_DIFF_TIME = REMOTE_TIME_RES * UINT16_MAX;
273
279 std::uint32_t modeS_id;
280 std::int16_t dLat;
281 std::int16_t dLon;
282 std::int16_t dAlt_ft;
283 std::uint16_t dTime;
284 std::int16_t pitch;
285 std::uint16_t heading;
286 std::int16_t roll;
287 std::uint16_t filler1;
288
290 RemoteAcPosUpdateTy () { std::memset(this,0,sizeof(*this)); }
293 std::int16_t _dLat, std::int16_t _dLon,
294 std::int16_t _dAlt_ft, std::uint16_t _dTime,
295 float _pitch, float _heading, float _roll);
296
297 void SetPitch (float _p) { pitch = std::int16_t(_p*100.0f); }
298 float GetPitch () const { return float(pitch) / 100.0f; }
299
302 void SetHeading (float _h);
303 float GetHeading () const { return float(heading) / 100.0f; }
304
305 void SetRoll (float _r) { roll = std::int16_t(std::lround(_r*100.0f)); }
306 float GetRoll () const { return float(roll) / 100.0f; }
307
308 static constexpr size_t msgSize () { return sizeof(RemoteAcPosUpdateTy); }
309} PACKED;
310
314
318 static constexpr size_t NumElem (size_t _msgLen) { return (_msgLen - sizeof(RemoteMsgBaseTy)) / sizeof(RemoteAcPosUpdateTy); }
319} PACKED;
320
321//
322// MARK: A/C animation dataRefs
323//
324
326constexpr std::uint8_t RMT_VER_AC_ANIM = 0;
327
334 std::uint32_t modeS_id = 0;
335 std::uint8_t numVals = 0;
336 std::uint8_t filler = 0;
337
341 std::uint8_t v;
342 } v[1];
343
345 RemoteAcAnimTy (XPMPPlaneID _id) : modeS_id(_id) { v[0].idx = DR_VALS(0); v[0].v = 0; }
346
348 static constexpr size_t msgSize (std::uint8_t num)
349 { return sizeof(RemoteAcAnimTy) + (num-1) * sizeof(DataRefValTy); }
351 size_t msgSize() const { return msgSize(numVals); }
352} PACKED;
353
357
360
362 const RemoteAcAnimTy* next (size_t _msgLen, const RemoteAcAnimTy* pCurr = nullptr) const;
363} PACKED;
364
365
366//
367// MARK: A/C Removal
368//
369
370
372constexpr std::uint8_t RMT_VER_AC_REMOVE = 0;
373
376 std::uint32_t modeS_id;
377
380
381 static constexpr size_t msgSize () { return sizeof(RemoteAcRemoveTy); }
382} PACKED;
383
387
391 static constexpr size_t NumElem (size_t _msgLen) { return (_msgLen - sizeof(RemoteMsgBaseTy)) / sizeof(arr[0]); }
392} PACKED;
393
394#ifdef _MSC_VER // Visual C++
395#pragma pack(pop) // reseting packing
396#endif
397
398// A few static validations just to make sure that no compiler fiddles with my network message layout.
399static_assert(sizeof(RemoteMsgBaseTy) == 8, "RemoteMsgBaseTy doesn't have expected size");
400static_assert(sizeof(RemoteMsgSettingsTy) == 40, "RemoteMsgSettingsTy doesn't have expected size");
401static_assert(sizeof(RemoteAcDetailTy) == 246+42, "RemoteAcDetailTy doesn't have expected size");
402static_assert(sizeof(RemoteMsgAcDetailTy) == 254+42, "RemoteMsgAcDetailTy doesn't have expected size");
403static_assert(sizeof(RemoteAcPosUpdateTy) == 20, "RemoteAcPosUpdateTy doesn't have expected size");
404static_assert(sizeof(RemoteMsgAcPosUpdateTy)== 28, "RemoteMsgAcPosUpdateTy doesn't have expected size");
405static_assert(sizeof(RemoteAcAnimTy) == 8, "RemoteAcAnimTy doesn't have expected size");
406static_assert(RemoteAcAnimTy::msgSize(V_COUNT) == 90, "RemoteAcAnimTy for V_COUNT dataRefs doesn't have expected size");
407static_assert(sizeof(RemoteMsgAcAnimTy) == 16, "RemoteMsgAcAnimTy doesn't have expected size");
408static_assert(sizeof(RemoteMsgAcRemoveTy) == 12, "RemoteMsgAcRemoveTy doesn't have expected size");
409
410//
411// MARK: Miscellaneous
412//
413
417 void (*pfBeforeFirstAc)() = nullptr;
419 void (*pfAfterLastAc)() = nullptr;
421 void (*pfMsgSettings) (const std::uint32_t from[4],
422 const std::string& sFrom,
423 const RemoteMsgSettingsTy&) = nullptr;
425 void (*pfMsgACDetails) (const std::uint32_t from[4], size_t msgLen,
426 const RemoteMsgAcDetailTy&) = nullptr;
428 void (*pfMsgACPosUpdate) (const std::uint32_t from[4], size_t msgLen,
429 const RemoteMsgAcPosUpdateTy&) = nullptr;
431 void (*pfMsgACAnim) (const std::uint32_t from[4], size_t msgLen,
432 const RemoteMsgAcAnimTy&) = nullptr;
434 void (*pfMsgACRemove) (const std::uint32_t from[4], size_t msgLen,
435 const RemoteMsgAcRemoveTy&) = nullptr;
436};
437
446
449
451void RemoteRecvStart (const RemoteCBFctTy& _rmtCBFcts);
452
454void RemoteRecvStop ();
455
456}
457
458
459#endif
unsigned XPMPPlaneID
Unique ID for an aircraft created by a plugin.
Definition XPMPMultiplayer.h:259
Actual representation of all aircraft in XPMP2.
Definition XPMPAircraft.h:178
Represents a CSL model as it is saved on disk.
Definition CSLModels.h:113
Definition XPMPAircraft.h:70
constexpr std::uint8_t RMT_VER_BEACON
Interest Beacon message version number.
Definition XPMPRemote.h:136
constexpr std::uint8_t RMT_VER_AC_DETAIL_0
Definition XPMPRemote.h:182
void(* pfMsgSettings)(const std::uint32_t from[4], const std::string &sFrom, const RemoteMsgSettingsTy &)
Callback for processing Settings messages.
Definition XPMPRemote.h:421
constexpr std::uint8_t RMT_VER_SETTINGS
Setttings message version number.
Definition XPMPRemote.h:152
void(* pfAfterLastAc)()
Called in flight loop after processing last aircraft.
Definition XPMPRemote.h:419
constexpr std::uint8_t RMT_VER_AC_ANIM
A/C Position update message version number.
Definition XPMPRemote.h:326
constexpr std::uint8_t RMT_VER_AC_REMOVE
A/C removal message version number.
Definition XPMPRemote.h:372
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
Definition XPMPRemote.h:66
void(* pfMsgACRemove)(const std::uint32_t from[4], size_t msgLen, const RemoteMsgAcRemoveTy &)
Callback for processing A/C Removal messages.
Definition XPMPRemote.h:434
RemoteStatusTy RemoteGetStatus()
Returns the current Remote status.
Definition Remote.cpp:1145
void RemoteRecvStop()
Stops the receiver.
Definition Remote.cpp:1410
RemoteMsgTy
Message type.
Definition XPMPRemote.h:77
@ RMT_MSG_AC_REMOVE
aircraft is removed
Definition XPMPRemote.h:84
@ RMT_MSG_AC_ANIM
aircraft animation values (dataRef values) only
Definition XPMPRemote.h:83
@ RMT_MSG_INTEREST_BEACON
beacon sent by a remote client to signal interest in data
Definition XPMPRemote.h:78
@ RMT_MSG_SEND
internal indicator telling to send out all pending messages
Definition XPMPRemote.h:79
@ RMT_MSG_AC_DETAILED
aircraft full details, needed to create new a/c objects and to re-synch all remote data
Definition XPMPRemote.h:81
@ RMT_MSG_SETTINGS
a sender's id and its settings
Definition XPMPRemote.h:80
@ RMT_MSG_AC_POS_UPDATE
aircraft differences only
Definition XPMPRemote.h:82
void(* pfMsgACAnim)(const std::uint32_t from[4], size_t msgLen, const RemoteMsgAcAnimTy &)
Callback for processing A/C Animation dataRef messages.
Definition XPMPRemote.h:431
constexpr float REMOTE_MAX_DIFF_TIME
maximum time difference thatn can be represented in a pos update msg
Definition XPMPRemote.h:272
constexpr std::uint8_t RMT_VER_AC_DETAIL_1
Definition XPMPRemote.h:181
CSLModel * CSLModelByPkgShortId(std::uint16_t _pkgHash, const std::string &_shortId)
Find a model by package name hash and short id.
Definition CSLModels.cpp:1157
RemoteStatusTy
State of remote communcations.
Definition XPMPRemote.h:439
@ REMOTE_RECV_WAITING
waiting to receive data, periodically sending a token of interest
Definition XPMPRemote.h:443
@ REMOTE_OFF
no remote connectivtiy, not listening, not sending
Definition XPMPRemote.h:440
@ REMOTE_SEND_WAITING
listening for a request to send data, but not actively sending data
Definition XPMPRemote.h:441
@ REMOTE_SENDING
actively sending aircraft data out to the network
Definition XPMPRemote.h:442
@ REMOTE_RECEIVING
actively receiving data
Definition XPMPRemote.h:444
constexpr double REMOTE_DEGREE_RES
What is the maximum difference a RemoteAcPosUpdateTy can hold?
Definition XPMPRemote.h:267
constexpr std::uint8_t RMT_VER_AC_DETAIL
A/C detail message version number.
Definition XPMPRemote.h:179
constexpr float REMOTE_TIME_RES
resolution of time difference
Definition XPMPRemote.h:271
constexpr double REMOTE_MAX_DIFF_ALT_FT
maximum altitude[ft] difference that can be represented in a pos update msg
Definition XPMPRemote.h:270
void(* pfBeforeFirstAc)()
Called in flight loop before processing first aircraft.
Definition XPMPRemote.h:417
void(* pfMsgACDetails)(const std::uint32_t from[4], size_t msgLen, const RemoteMsgAcDetailTy &)
Callback for processing A/C Details messages.
Definition XPMPRemote.h:425
constexpr int REMOTE_SEND_SETTINGS_INTVL
How often to send settings? [s].
Definition XPMPRemote.h:149
std::uint16_t PJWHash16(const char *s)
Produces a reproducible(!) hash value for strings.
Definition Utilities.cpp:634
void(* pfMsgACPosUpdate)(const std::uint32_t from[4], size_t msgLen, const RemoteMsgAcPosUpdateTy &)
Callback for processing A/C Details messages.
Definition XPMPRemote.h:428
constexpr std::uint8_t RMT_VER_AC_DETAIL_2
Definition XPMPRemote.h:180
struct XPMP2::RemoteMsgBaseTy PACKED
DR_VALS
The dataRefs provided by XPMP2 to the CSL models.
Definition XPMPAircraft.h:87
@ V_COUNT
always last, number of dataRefs XPMP2 pre-defines
Definition XPMPAircraft.h:137
constexpr double REMOTE_ALT_FT_RES
resolution of altitude[ft] updates
Definition XPMPRemote.h:269
const std::array< RemoteDataRefPackTy, V_COUNT > REMOTE_DR_DEF
An array holding all dataRef packing definitions.
Definition Remote.cpp:36
constexpr const char * REMOTE_SIGNATURE
The signature of the XPMP2 Remote Client.
Definition XPMPRemote.h:42
constexpr double REMOTE_MAX_DIFF_DEGREE
maximum degree difference that can be represented in a pos update msg
Definition XPMPRemote.h:268
constexpr std::uint8_t RMT_VER_AC_POS_UPDATE
A/C Position update message version number.
Definition XPMPRemote.h:264
void RemoteRecvStart(const RemoteCBFctTy &_rmtCBFcts)
Starts the listener, will call provided callback functions with received messages.
Definition Remote.cpp:1403
Function prototypes for callback functions to handle the received messages.
Definition XPMPRemote.h:415
A/C animation dataRef changes.
Definition XPMPRemote.h:333
DR_VALS idx
index into XPMP2::Aircraft::v
Definition XPMPRemote.h:340
std::uint8_t v
dataRef animation value
Definition XPMPRemote.h:341
std::uint8_t filler
not yet used
Definition XPMPRemote.h:336
static constexpr size_t msgSize(std::uint8_t num)
message size assuming num array elements
Definition XPMPRemote.h:348
size_t msgSize() const
current message size
Definition XPMPRemote.h:351
RemoteAcAnimTy(XPMPPlaneID _id)
Constructor.
Definition XPMPRemote.h:345
struct XPMP2::RemoteAcAnimTy::DataRefValTy v[1]
array of dataRef animation types and value
std::uint8_t numVals
number of dataRef values in the following array
Definition XPMPRemote.h:335
std::uint32_t modeS_id
plane's unique id at the sender side (might differ remotely in case of duplicates)
Definition XPMPRemote.h:334
dataRef animation types and value
Definition XPMPRemote.h:339
A/C details, packed into an array message.
Definition XPMPRemote.h:184
double lat
latitude
Definition XPMPRemote.h:194
double lon
longitude
Definition XPMPRemote.h:195
void CopyFrom(const Aircraft &_ac, double _lat, double _lon, float _alt_ft, std::uint16_t _dTime)
Copies values from passed-in XPMP2::Aircraft object.
Definition Remote.cpp:192
bool bVisible
Shall this plane be drawn at the moment?
Definition XPMPRemote.h:203
char flightNum[10]
flight number
Definition XPMPRemote.h:214
std::int16_t roll
[0.01°] roll/100
Definition XPMPRemote.h:198
char icaoOp[4]
icao airline code
Definition XPMPRemote.h:187
char icaoType[4]
icao a/c type
Definition XPMPRemote.h:186
std::uint16_t heading
[0.01°] heading/100
Definition XPMPRemote.h:197
std::uint8_t filler[3]
yet unused
Definition XPMPRemote.h:220
char manufacturer[40]
a/c manufacturer, human readable
Definition XPMPRemote.h:211
std::uint32_t modeS_id
plane's unique id at the sender side (might differ remotely in case of duplicates)
Definition XPMPRemote.h:185
void SetPitch(float _p)
sets pitch from float
Definition XPMPRemote.h:235
float alt_ft
[ft] current altitude
Definition XPMPRemote.h:192
bool bOnGrnd
Is the aircraft on the ground?
Definition XPMPRemote.h:206
float GetRoll() const
returns float pitch
Definition XPMPRemote.h:244
void SetRoll(float _r)
sets pitch from float
Definition XPMPRemote.h:243
std::uint16_t pkgHash
hash value of package name
Definition XPMPRemote.h:189
char label[23]
label
Definition XPMPRemote.h:190
std::uint8_t labelCol[3]
label color (RGB)
Definition XPMPRemote.h:191
char airline[40]
airline, human readable
Definition XPMPRemote.h:213
float GetHeading() const
returns float heading
Definition XPMPRemote.h:241
char model[40]
a/c model, human readable
Definition XPMPRemote.h:212
char tailNum[10]
registration, tail number
Definition XPMPRemote.h:210
char aptFrom[5]
Origin airport (ICAO)
Definition XPMPRemote.h:215
bool bRender
Shall the CSL model be drawn in 3D world?
Definition XPMPRemote.h:204
static constexpr size_t msgSize()
message size
Definition XPMPRemote.h:246
std::uint8_t v[XPMP2::V_COUNT]
Definition XPMPRemote.h:223
char sShortId[20]
CSL model's short id.
Definition XPMPRemote.h:188
void SetLabelCol(const float _col[4])
set the label color from a float array (4th number, alpha, is always considered 1....
Definition Remote.cpp:243
void GetLabelCol(float _col[4]) const
writes color out into a float array
Definition Remote.cpp:251
bool bValid
is this object valid? (Will be reset in case of exceptions)
Definition XPMPRemote.h:202
void SetHeading(float _h)
Sets heading from float.
Definition Remote.cpp:260
bool bDrawLabel
Draw the label of the aircraft? (new with v2)
Definition XPMPRemote.h:205
std::uint8_t contrailDist_m
distance between several contrails and to the aircraft's centerline, in meter
Definition XPMPRemote.h:218
RemoteAcDetailTy()
Default Constructor sets all to zero.
Definition Remote.cpp:170
std::int16_t aiPrio
priority for display in limited TCAS target slots, -1 indicates "no TCAS display"
Definition XPMPRemote.h:200
std::uint8_t contrailLifeTime
this aircraft's contrail's life time
Definition XPMPRemote.h:219
char aptTo[5]
Destination airport (ICAO)
Definition XPMPRemote.h:216
std::int16_t pitch
[0.01°] pitch/100
Definition XPMPRemote.h:196
std::uint16_t dTime
[0.0001s] time difference to previous position in 1/10000s
Definition XPMPRemote.h:201
float GetPitch() const
returns float pitch
Definition XPMPRemote.h:236
std::uint8_t contrailNum
number of contrails requested
Definition XPMPRemote.h:207
A/C Position updates based on global coordinates.
Definition XPMPRemote.h:278
std::uint16_t dTime
[0.0001s] time difference to previous position in 1/10000s
Definition XPMPRemote.h:283
float GetPitch() const
returns float pitch
Definition XPMPRemote.h:298
std::int16_t roll
[0.01 degree] roll/100
Definition XPMPRemote.h:286
float GetHeading() const
returns float heading
Definition XPMPRemote.h:303
std::int16_t dAlt_ft
[0.01 ft] altitude difference
Definition XPMPRemote.h:282
std::uint16_t filler1
not yet used (for 4-byte alignment)
Definition XPMPRemote.h:287
std::uint16_t heading
[0.01 degree] heading/100
Definition XPMPRemote.h:285
std::uint32_t modeS_id
plane's unique id at the sender side (might differ remotely in case of duplicates)
Definition XPMPRemote.h:279
void SetPitch(float _p)
sets pitch from float
Definition XPMPRemote.h:297
std::int16_t pitch
[0.01 degree] pitch/100
Definition XPMPRemote.h:284
std::int16_t dLon
[0.0000001 degrees] longitude position difference
Definition XPMPRemote.h:281
RemoteAcPosUpdateTy()
Default Constructor sets all 0.
Definition XPMPRemote.h:290
void SetRoll(float _r)
sets pitch from float
Definition XPMPRemote.h:305
static constexpr size_t msgSize()
message size
Definition XPMPRemote.h:308
std::int16_t dLat
[0.0000001 degrees] latitude position difference
Definition XPMPRemote.h:280
void SetHeading(float _h)
Sets heading from float.
Definition Remote.cpp:386
float GetRoll() const
returns float pitch
Definition XPMPRemote.h:306
A/C Removal only includes the plane id, structure required for msgSize() function.
Definition XPMPRemote.h:375
std::uint32_t modeS_id
plane's unique id at the sender side (might differ remotely in case of duplicates)
Definition XPMPRemote.h:376
static constexpr size_t msgSize()
message size
Definition XPMPRemote.h:381
RemoteAcRemoveTy(XPMPPlaneID _id=0)
Constructor sets plane id.
Definition XPMPRemote.h:379
Definition for how to map dataRef values to (u)int8, ie. to an integer range of 8 bits.
Definition XPMPRemote.h:88
float unpack(std::uint8_t i) const
unpack an integer value to float
Definition XPMPRemote.h:98
RemoteDataRefPackTy(float _min, float _max)
Constructor sets minimum value and range.
Definition XPMPRemote.h:93
float minV
minimum transferred value
Definition XPMPRemote.h:89
std::uint8_t pack(float f) const
pack afloat value to integer
Definition XPMPRemote.h:96
float range
range of transferred value = maxV - minV
Definition XPMPRemote.h:90
A/C animation dataRef message, has an inherited header plus an array of variable sized XPMP2::RemoteA...
Definition XPMPRemote.h:355
RemoteAcAnimTy animData
message data starts here but extend beyond this point!
Definition XPMPRemote.h:356
const RemoteAcAnimTy * next(size_t _msgLen, const RemoteAcAnimTy *pCurr=nullptr) const
Returns a pointer to the first/next animation data element in the message.
Definition Remote.cpp:505
RemoteMsgAcAnimTy()
Constructor sets expected message type and version.
Definition XPMPRemote.h:359
A/C detail message, has an inherited header plus an array of XPMP2::RemoteAcDetailTy elements.
Definition XPMPRemote.h:250
static constexpr size_t NumElem(size_t _msgLen)
Convert msg len to number of arr elements.
Definition XPMPRemote.h:256
RemoteMsgAcDetailTy()
Constructor sets expected message type and version.
Definition XPMPRemote.h:254
RemoteAcDetailTy arr[1]
basis for the array of actual details
Definition XPMPRemote.h:251
A/C detail message, has an inherited header plus an array of XPMP2::RemoteAcDetailTy elements.
Definition XPMPRemote.h:312
static constexpr size_t NumElem(size_t _msgLen)
Convert msg len to number of arr elements.
Definition XPMPRemote.h:318
RemoteMsgAcPosUpdateTy()
Constructor sets expected message type and version.
Definition XPMPRemote.h:316
RemoteAcPosUpdateTy arr[1]
basis for the array of actual position updates
Definition XPMPRemote.h:313
A/C removal message, an array of plane ids.
Definition XPMPRemote.h:385
RemoteAcRemoveTy arr[1]
plane's unique id at the sender side (might differ remotely in case of duplicates)
Definition XPMPRemote.h:386
RemoteMsgAcRemoveTy()
Constructor sets expected message type and version.
Definition XPMPRemote.h:389
static constexpr size_t NumElem(size_t _msgLen)
Convert msg len to number of arr elements.
Definition XPMPRemote.h:391
Message header, identical for all message types.
Definition XPMPRemote.h:120
std::uint8_t filler1
yet unsed
Definition XPMPRemote.h:124
std::uint32_t filler2
Definition XPMPRemote.h:126
RemoteMsgTy msgTy
message type
Definition XPMPRemote.h:121
std::uint16_t pluginId
lower 16 bit of the sending plugin's id
Definition XPMPRemote.h:125
std::uint8_t msgVer
message version
Definition XPMPRemote.h:122
bool bLocalSender
is the sender "local", ie. on same machine?
Definition XPMPRemote.h:123
RemoteMsgBaseTy(RemoteMsgTy _ty, std::uint8_t _ver)
Constructor just sets the values.
Definition Remote.cpp:145
"Beacon of Interest", ie. some message on the multicast just to wake up sender
Definition XPMPRemote.h:138
RemoteMsgBeaconTy()
Constructor sets appropriate message type.
Definition Remote.cpp:153
Settings message, identifying a sending plugin, regularly providing its settings.
Definition XPMPRemote.h:154
char name[16]
plugin's name, not necessarily zero-terminated if using full 12 chars
Definition XPMPRemote.h:155
char defaultIcao[4]
Default ICAO aircraft type designator if no match can be found.
Definition XPMPRemote.h:157
bool bMapEnabled
Do we feed X-Plane's maps with our aircraft positions?
Definition XPMPRemote.h:164
std::uint8_t logLvl
logging level
Definition XPMPRemote.h:159
RemoteMsgSettingsTy()
Constructor sets most values to zero.
Definition Remote.cpp:159
bool bHaveTCASControl
Do we have AI/TCAS control?
Definition XPMPRemote.h:166
bool bLabelCutOffAtVisibility
Cut off labels at XP's reported visibility mit?
Definition XPMPRemote.h:163
bool bObjReplTextures
Replace textures in .obj files on load if needed?
Definition XPMPRemote.h:162
char carIcaoType[4]
Ground vehicle type identifier.
Definition XPMPRemote.h:158
bool bLogMdlMatch
Debug model matching?
Definition XPMPRemote.h:160
bool bObjReplDataRefs
Replace dataRefs in .obj files on load?
Definition XPMPRemote.h:161
std::uint16_t filler
yet unused, fills size up for a multiple of 8
Definition XPMPRemote.h:167
float maxLabelDist
Maximum distance for drawing labels? [m].
Definition XPMPRemote.h:156
bool bMapLabels
Do we show labels with the aircraft icons?
Definition XPMPRemote.h:165