Flightplan data with the PDK
Flightplan data with the PDK
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
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
Re: Flightplan data with the PDK
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
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
Re: Flightplan data with the PDK
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
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
Milviz systems dev
Formerly known as Naruto-kun
Re: Flightplan data with the PDK
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
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
Re: Flightplan data with the PDK
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
Milviz systems dev
Formerly known as Naruto-kun
Re: Flightplan data with the PDK
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)
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)
Re: Flightplan data with the PDK
Hi adiemus,
well...I am not super proficient with this stuff, but as I am able to do the following:
in order to set the current waypoint index of the GPS system I would think that you should also be able to use:
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
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)
Code: Select all
(>C:VRSTP_Util:MoaName, string)
But of course...please correct me if I am wrong :).
Greets,
Benny
Re: Flightplan data with the PDK
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 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:in order to set the current waypoint index of the GPS systemCode: Select all
ExecuteCalculatorCode("(>C:fs9gps:FlightPlanWaypointIndex, number)", nullptr, &waypointNo, nullptr)
Re: Flightplan data with the PDK
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.adiemus wrote: ↑Fri Oct 11, 2019 8:09 pmAnd 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 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:in order to set the current waypoint index of the GPS systemCode: Select all
ExecuteCalculatorCode("(>C:fs9gps:FlightPlanWaypointIndex, number)", nullptr, &waypointNo, nullptr)
Greets, Benny
Re: Flightplan data with the PDK
Thanks for confirming. Good to know.