Flightplan data with the PDK

Post Reply
BenBaron
Posts: 80
Joined: Fri Jan 16, 2015 7:51 am

Flightplan data with the PDK

Post by BenBaron »

Hi guys,

does anyone know a viable way to retrieve loaded flightplan data (esp. departure and destination ICAOs) via the PDK as well as getting notified if a new flightplan is loaded? Is this even possible, yet?

Thanks for your help.

Benny
BenBaron
Posts: 80
Joined: Fri Jan 16, 2015 7:51 am

Re: Flightplan data with the PDK

Post by BenBaron »

Just as a follow-up:

I know I can use ExecuteCalculatorCode() from the IPanelSystemV400 to retrieve flighplan data from the gps system, but this seems a little cumbersome to me...but if need be, I will go down this route, for now. Just looking for some confirmation that there actually is no other way.

All the best,

Benny
JB3DG
Posts: 507
Joined: Mon Jan 09, 2012 6:44 pm

Re: Flightplan data with the PDK

Post by JB3DG »

You can use the IGaugeCCallback system.

Best description on how to use C: vars is found here:

https://forums.vrsimulations.com/support/index.php/TacPack_SDK#CVars_via_C.2B.2B
Jonathan Bleeker
Milviz systems dev

Formerly known as Naruto-kun
BenBaron
Posts: 80
Joined: Fri Jan 16, 2015 7:51 am

Re: Flightplan data with the PDK

Post by BenBaron »

Thanks Jonathan for the hint.

I looked at the link you provided and compared it to the PDK documentation of the Panel System Service...while I could recreate the TacPack approach with it, I don't see the advantage coding-wise over just using ExecuteCalculatorCode() from within my module. They are writing: "You can't use execute_calculator_code() to make it easier..." so obviously for them this was out of the option, but in the end, if you can use ExecuteCalculatorCode() it still looks "cleaner" to me...but of course I don't know if the performance might be more affected.

Greets, Benny
JB3DG
Posts: 507
Joined: Mon Jan 09, 2012 6:44 pm

Re: Flightplan data with the PDK

Post by JB3DG »

It actually is quite clean if you make a wrapper class for it and use enums and arrays for the string names and IDs and create some read and write functions.
Jonathan Bleeker
Milviz systems dev

Formerly known as Naruto-kun
adiemus
Posts: 120
Joined: Fri Mar 16, 2012 4:19 am
Contact:

Re: Flightplan data with the PDK

Post by adiemus »

As the author of both the TacPack and linked doc, at least at the time I wrote it (back before Prepar3D even existed) it wasn't possible to access C: vars inside the version of execute_calculator_code() exposed by the Panels interface.

Now, I've not ever tried ExecuteCalculatorCode() from IPanelSystemV400, and maybe it no longer has that limitation. Otherwise, you'll find that it's not performance issues you'll encounter, but rather a complete lack of functionality. Hence the need to use IGaugeCCallback.

(But if it does work and you can indeed read/write C: vars with ExecuteCalculatorCode() from IPanelSystemV400, do please update this thread to confirm it. Though I agree with you that it'd still be cumbersome. The IGaugeCCallback method requires a lot of scaffolding, but once done, I find it much more natural to actually use, at least in a C/C++ project)
BenBaron
Posts: 80
Joined: Fri Jan 16, 2015 7:51 am

Re: Flightplan data with the PDK

Post by BenBaron »

Hi adiemus,

well...I am not super proficient with this stuff, but as I am able to do the following:

Code: Select all

ExecuteCalculatorCode("(>C:fs9gps:FlightPlanWaypointIndex, number)", nullptr, &waypointNo, nullptr)
in order to set the current waypoint index of the GPS system I would think that you should also be able to use:

Code: Select all

(>C:VRSTP_Util:MoaName, string)
with the ExecuteCalculatorCode function of PDK's PanelSystem to write to the "MoaName" variable.

But of course...please correct me if I am wrong :).

Greets,

Benny
adiemus
Posts: 120
Joined: Fri Mar 16, 2012 4:19 am
Contact:

Re: Flightplan data with the PDK

Post by adiemus »

BenBaron wrote: Fri Oct 11, 2019 5:55 pm Hi adiemus,

well...I am not super proficient with this stuff, but as I am able to do the following:

Code: Select all

ExecuteCalculatorCode("(>C:fs9gps:FlightPlanWaypointIndex, number)", nullptr, &waypointNo, nullptr)
in order to set the current waypoint index of the GPS system
And it actually changes the waypoint index? In my (long-ago, pre-P3D) testing, it "worked" in that it didn't throw an error, but it also didn't actually do anything. No state was changed. The CVar value remained unchanged. Are you saying that it now actually works and can actually change the state of CVars?
BenBaron
Posts: 80
Joined: Fri Jan 16, 2015 7:51 am

Re: Flightplan data with the PDK

Post by BenBaron »

adiemus wrote: Fri Oct 11, 2019 8:09 pm
BenBaron wrote: Fri Oct 11, 2019 5:55 pm Hi adiemus,

well...I am not super proficient with this stuff, but as I am able to do the following:

Code: Select all

ExecuteCalculatorCode("(>C:fs9gps:FlightPlanWaypointIndex, number)", nullptr, &waypointNo, nullptr)
in order to set the current waypoint index of the GPS system
And it actually changes the waypoint index? In my (long-ago, pre-P3D) testing, it "worked" in that it didn't throw an error, but it also didn't actually do anything. No state was changed. The CVar value remained unchanged. Are you saying that it now actually works and can actually change the state of CVars?
Yes..I am using the code snippet to set the waypoint index to the last waypoint to thereafter get the Destination ICAO. Works like a charm, indeed.

Greets, Benny
adiemus
Posts: 120
Joined: Fri Mar 16, 2012 4:19 am
Contact:

Re: Flightplan data with the PDK

Post by adiemus »

Thanks for confirming. Good to know.
Post Reply