Read airport ID failed

SDK supports Prepar3D’s philosophy of an open development architecture and encourages third parties to bring new innovations with improved add-ons and training content.
Locked
ppp333ddd_
Posts: 58
Joined: Fri Aug 18, 2017 1:04 am

Read airport ID failed

Post by ppp333ddd_ »

Hi,

In P3D simconnect SDK, there is a WPF project - Managed Weapon Station Selection.

When reading the name of the aircraft, it uses

this.SimConnect.AddToDataDefinition(DataIdentifier.RecieveSimObjectGeneral,
"title", // Simulation Variable
null, // Units - for strings put 'null'
SIMCONNECT_DATATYPE.STRING256, // Datatype
0.0f,
SimConnect.SIMCONNECT_UNUSED);

Now I want to read the ICAO code of the departure airport in the current schedule, I make it

this.SimConnect.AddToDataDefinition(DataIdentifier.RecieveSimObjectGeneral,
"AI TRAFFIC FROMAIRPORT", // Simulation Variable
null, // Units - for strings put 'null'
SIMCONNECT_DATATYPE.STRING256, // Datatype
0.0f,
SimConnect.SIMCONNECT_UNUSED);

I confirm that I have set the the departure airport in the current schedule, but it shows nothing. Why? Thanks.

Kind regards,

Jeff
User avatar
Rob McCarthy
Lockheed Martin
Posts: 3703
Joined: Wed Aug 24, 2011 1:37 pm

Re: Read airport ID failed

Post by Rob McCarthy »

Jeff,

Which vehicle are you attempting to read this data from. Is this an AI traffic aircraft?

Regards,
Rob McCarthy
Rob McCarthy
Prepar3D® Core Lead
ppp333ddd_
Posts: 58
Joined: Fri Aug 18, 2017 1:04 am

Re: Read airport ID failed

Post by ppp333ddd_ »

Hi Rob,

I was attempting to read the airport information of my own aircraft in the game, not an AI traffic aircraft.

Thanks,

Jeff
obinder
Posts: 145
Joined: Sun Jun 08, 2014 9:43 am

Re: Read airport ID failed

Post by obinder »

Hello Jeff,

not possible. You can only read the ICAO from an AI aircraft that is following a schedule.

Learning Center -> SDK -> References -> Variables -> Simulation variables -> AI TRAFFIC FROMAIRPORT

Note (2) says:
These variables only make sense for aircraft generated by the traffic database, and so have schedules. If an aircraft does not have a schedule, the value returned will be 0 (or false), or an empty string, depending on the units.
Best regards
Oliver Binder
Lorby-SI
Locked