Author Topic: Reading variables from my C++ program. How ?  (Read 5214 times)

TheFlyingCoder

  • Newbie
  • *
  • Posts: 7
Reading variables from my C++ program. How ?
« on: September 30, 2020, 07:41:23 am »
Hi devs! I am currently developing my own ACARS for my virtual airline, basically i am trying to read the variables when i use GSX like getting to know if Catering is called, catering is done, how many passengers are on board total.  I am using C++ to program my software. Thus, i am wondering how do i read those variables and where do i start ? Hope to get some help here. Much appreciated !

 

virtuali

  • Administrator
  • Hero Member
  • *****
  • Posts: 50691
    • VIRTUALI Sagl
Re: Reading variables from my C++ program. How ?
« Reply #1 on: September 30, 2020, 10:47:33 am »
The manual has some examples in C++ how to read these variables. They work through the Panel interface ( in P3D4+ the same functions are in the PDK ), but in both cases, access to these functions call works only through an in-process executable, like a .DLL module or an airplane Gauge.

If you are doing an external .EXE, you cannot access those functions directly, so you need either:

- Do a separate .DLL module only to access L: variables from the sim, and have this communicate with the external app using some of the Windows functions, like Sockets, Named Pipes or IPC

- Use FSUIPC and interface with it, to get the L: variables and send them back to your application.

TheFlyingCoder

  • Newbie
  • *
  • Posts: 7
Re: Reading variables from my C++ program. How ?
« Reply #2 on: September 30, 2020, 12:43:06 pm »
Hi, thank you for the reply. Making your own DLL and having to connect them is kinda tedious process. However, since there can be availability to run using FSUIPC, i will try using that approach. In that case, how is it like to call variable using FSUIPC ?

virtuali

  • Administrator
  • Hero Member
  • *****
  • Posts: 50691
    • VIRTUALI Sagl

TheFlyingCoder

  • Newbie
  • *
  • Posts: 7
Re: Reading variables from my C++ program. How ?
« Reply #4 on: October 01, 2020, 05:02:32 am »
Hi, i managed to make it work using FSUIPC. One quesiton, is there any way for me to set or preset passengers using my program rather than having to use your GSX input ?

TheFlyingCoder

  • Newbie
  • *
  • Posts: 7
Re: Reading variables from my C++ program. How ?
« Reply #5 on: October 01, 2020, 05:57:44 am »
And one more thing, is it possible and how do i check if the user has GSX installed ?

virtuali

  • Administrator
  • Hero Member
  • *****
  • Posts: 50691
    • VIRTUALI Sagl
Re: Reading variables from my C++ program. How ?
« Reply #6 on: October 01, 2020, 01:43:06 pm »
is there any way for me to set or preset passengers using my program rather than having to use your GSX input ?

Please clarify, you mean changing the number of passengers ?

TheFlyingCoder

  • Newbie
  • *
  • Posts: 7
Re: Reading variables from my C++ program. How ?
« Reply #7 on: October 01, 2020, 02:18:39 pm »
Hi yes, changing the num of passenger via my software instead of your GSX the input prompt when pilot press boarding option. So now, i would like to know if its possible to set via my program.

virtuali

  • Administrator
  • Hero Member
  • *****
  • Posts: 50691
    • VIRTUALI Sagl
Re: Reading variables from my C++ program. How ?
« Reply #8 on: October 05, 2020, 11:14:32 pm »
GSX manual, Page 66:

Quote
Interfacing with the Passengers simulation

L:FSDT_GSX_NUMPASSENGERS

This variable can be set from a gauge code, and GSX will use it in place of its own calculation, to set the correct number of passengers to match the airplane.