A2A C172 L:Vars with SimConnect C# Application

Post any technical issues here. This forum gets priority from our staff.
new reply
dagoston93
Airman Basic
Posts: 6
Joined: 04 Jan 2017, 13:01

A2A C172 L:Vars with SimConnect C# Application

Post by dagoston93 »

Hi,
I am Agoston, and new here.
First of all I would like to say congratulations to this C172 add-on. It is amazing.
That's the reason why I chose to use your add-on to build my own cockpit.
I am not intending to use hardware from shop, except for the yoke and the pedals, so I am gonna build and design everything on my own.
The concept is that all switches and stuff will be connected to a microcontroller, and that communicates to the PC on serial port.
I just finished the prototype of the light panel. Now I am working on the software.
I am using a C# windows form application.
I can already read the states of switches from the microcontroller, and I can send events to SimConnect so that the switches move in FSX whenever i move the real ones.
Now I am trying to syncronize the switches of fsx and my cockpit on startup.
That's where the problem is.
I am using this line of code to access the state of the master battery switch:

Code: Select all

simconnect.AddToDataDefinition(Cockpit.DEFINITIONS.SyncDataStruct, "ELECTRICAL MASTER BATTERY",
                    "bool", SIMCONNECT_DATATYPE.INT32, 0.0f, SimConnect.SIMCONNECT_UNUSED);
When I am running the default C172, everything works fine. But when I am running A2A C172, I always get back true.
I found the PDF with the A2A local variables, and I suppose, I should access somehow this variable: Battery1Switch.
But I could not find out how. If I simply replave ELECTRICAL MASTER BATTERY with Battery1Switch, I don't get the correct result...
How can I get the correct value?
I tried many google searches but none of the results gave me the answer...

Thank's in advance!

Agoston

User avatar
Nick - A2A
A2A Captain
Posts: 13803
Joined: 06 Jun 2014, 13:06
Location: UK

Re: A2A C172 L:Vars with SimConnect C# Application

Post by Nick - A2A »

Hi Agoston - welcome to the forums.

Afraid I don't have any expertise with programming C/C++ gauges, but is the following link any use? http://www.fsdeveloper.com/forum/thread ... ll.435743/

In referring to the L:Var within your code, I guess you'd always need to include the "L:" part, e.g. "L:Battery1Switch".

Sorry I can't be more help. :|
Nick

maddz
Senior Airman
Posts: 202
Joined: 30 Aug 2010, 09:47

Re: A2A C172 L:Vars with SimConnect C# Application

Post by maddz »

If you haven't tryed it already google linda fsx. Makes setting up a controller and buttons easy. Also has a "tracer" to help u find Lvars. Read the manual on how to do this.

dagoston93
Airman Basic
Posts: 6
Joined: 04 Jan 2017, 13:01

Re: A2A C172 L:Vars with SimConnect C# Application

Post by dagoston93 »

Thanks for the answers,

Nick M, unfortunately that link doesn't help me too much...
That looks to be a C gauge, which I don't work, and the functions used there are not available for me.ű
I am using the SimConnect managed IDE.
I realised now, that when I am trying to get the LVar, with L: or without, I get an exception 7, which is :
SIMCONNECT_EXCEPTION_NAME_UNRECOGNIZED
So simconnect doesn't know, what the hell I am trying to get...

maddz, I haven't heard abaout linda fsx, yet, thank you for the suggestion.
I will google it right now, and let you know if that could solve my problem.

Thanks a lot.

dagoston93
Airman Basic
Posts: 6
Joined: 04 Jan 2017, 13:01

Re: A2A C172 L:Vars with SimConnect C# Application

Post by dagoston93 »

Hi again,

Linda fsx also doesn't help me...
But I found a topic on a forum, which says that I cannot directly reach a local variable from the SimConnect ide...
So It seems that I need to create a C gauge which actually can read a local variable, then I need to work out an interprocess communication method to pass the required value to my driver software...
Thanks Microsoft..

If you have a better idea or some knowledge that could help me, please share :)

Thanks a lot,
Have a nice evening,
Agoston

new reply

Return to “C172 Trainer Tech Support”

Who is online

Users browsing this forum: No registered users and 18 guests