When using the WASM facility API to request airport data, I am running into issues causing, only part of, the *Leg data (all types of LEG data) to return incorrect numbers. I am not sure if there’s some inherent limitation I am running into, if there’s a bug in the API, or if this is just a documentation issue.
Here’s the data struct I am using to capture the LEG data (basically all the data available). Note the 2 lines marked deliberately do not match the SDK because this is how I can get the “most” correct data.
struct LegRaw {
// Final approach legs, approach legs, missed approach legs
int Type;
char FixICAO[8];
char FixRegion[8];
int FixType;
double FixLat;
double FixLon;
double FixAltitude;
int IsFlyOver;
int DistanceInMinutes;
int IsTrueDegree;
int TurnDirection;
char OriginICAO[8];
char OriginRegion[8];
int OriginType;
double OriginLat;
double OriginLon;
float OriginAltitude; //<--!!! SDK SAYS FLOAT64
float Theta;
float Rho;
float Course;
float RouteDistance;
int ApproachAltDesc;
float Alt1;
float Alt2;
float SpeedLimit;
float VertAngle;
char ArcCenterICAO[8];
char ArcCenterRegion[8];
int ArcCenterType;
double ArcCenterLat;
double ArcCenterLon;
float ArcCenterAltitude; //<--!!! SDK SAYS FLOAT64
int IsIAF;
int IsIF;
int IsFAF;
int IsMAP;
};
I’ve set up the corresponding SimConnect_AddToFacilityDefinition
that corresponds to all the data above. No SimConnect error is reported. When receiving the dispatch message, I am reading the data with const auto leg = *reinterpret_cast<LegRaw*>(&p->Data);
With this struct, I’ve been able to almost all data correctly (e.g. ICAO string all reads correctly, Course, Rho, Theta all reads correctly, etc.), except
FixAltitude
always returns 0. Same forOriginAltitude
andArcCenterAltitude
- The in the 2 lines marked,
OriginAltitude
andArcCenterAltitude
, ifdouble
is used. The data afterward will be wrong.- If
double
is used forOriginAltitude
,Rho
,Theta
,Alt1
, etc. will all be wrong. - If
double
is used forArcCenterAltitude
,IsIAF
,IsIF
, etc. will be wrong.
- If
- I can never get
OriginLat
andOriginLon
to return the right data. They are always something like1.0565893152556172e+270
.