• Content count

  • Joined

  • Last visited

Community Reputation

0 Neutral

Flight Sim Profile

  • Commercial Member
  • Online Flight Organization Membership
  • Virtual Airlines

Profile Information

  • Gender
  1. Since there wasn't any real clear example of how to interact between the GNS 530 using C# through SimConnect, I wrote a minimalist example that hopefully will allow others to avoid some of that initial grief and hair pulling. The concept will be the same for the 430 if you use that unit instead. While I don't have the G1000 unit, I'm guessing that it works in a similar manner through the configuration of a .INI file. You can use this example as the stepping stone to connecting up your hardware to the GNS. I wrote this to connect to P3D using the SimConnect 3.2 version of the DLL. If you want to target FSX or a different version of P3D, you'll need to swap out the DLL in the references part of the project to something else and also swap out the 'using LockheedMartin.Prepar3D.SimConnect;' statement to the FSX one in the cSimConnect.cs file to the appropriate DLL namespace. VS2015 C# 4.5 Framework project is here: A copy of the GNS.ini file that is configured to work with the program is included in the zip fle. You will need to swap out your installed one for mine before launching P3D. You can find your installed one in the folder: "C:\Program Files (x86)\Mindstar\Flight Simulator Addons\GNS.ini" I hope you find this useful. Geodirk Note: the GPS image in the program is just static..
  2. geodirk

    Using Simconnect Example

    Ed, you are SO right. My bad. I can't tell you how many times I've read that section of the SDK and yet missed that little gem. Thanks for the help and have a great day. - Dirk
  3. geodirk

    Using Simconnect Example

    Hi Ed, Pardon my frustration, but from my first post above I made it amply clear that I know and have read the SDK. I know how this function works. I've used it over and over and over again in my code. But you have yet to give me a simple one line snippet of how to actually use what is written in your guide to call the function using your hex numbers. SimConnect_MapClientEventToSimEvent doesn't take a hex number it takes a constant char event name. From the SDK this is the syntax for the call: HRESULT SimConnect_MapClientEventToSimEvent( HANDLE hSimConnect, SIMCONNECT_CLIENT_EVENT_ID EventID, const char* EventName ); All I'm looking for is the one line of code to merge what your guide says and this function. Can I pass in the 0x11000 as a char and have it work?? - Dirk
  4. geodirk

    Using Simconnect Example

    Hi Ed, Yes, I've designed an Arduino controller that manages all the button, switches, knob events for various instruments around the cockpit panel. I'm planning on laying out a circuit board for your GNS unit that also contains all the necessary knobs and buttons for a Garmin. I'll hook this up to my existing C# driver code that communicates with P3D using simconnect. So, for example, I have a knob that controls the airspeed indicator instrument. Some code snippets for controlling that device are: public void OpenConection(IntPtr handle) { do { try { // open connection to FS _FSData = new SimConnect("Managed Data Request", handle, WM_USER_SIMCONNECT, null, 0); // Simevents _FSData.MapClientEventToSimEvent(EVENT_ID.AIRSPEED_DEC, "TRUE_AIRSPEED_CAL_DEC"); _FSData.MapClientEventToSimEvent(EVENT_ID.AIRSPEED_INC, "TRUE_AIRSPEED_CAL_INC"); // handler for events notification _FSData.OnRecvEvent += new SimConnect.RecvEventEventHandler(ReceiveEvent); } catch (Exception ex) { Console.WriteLine("cSimconnect.OpenConnection(): " + ex.Message); Thread.Sleep(1000); } } while (!_bHasFSConnection); return; } //Set Airspeed Calibration Knob public void SetAirspeedCalibration(bool bInc) { if (bInc) { _FSData.TransmitClientEvent(1, EVENT_ID.AIRSPEED_INC, 0, GROUP_ID.GROUP0, SIMCONNECT_EVENT_FLAG.DEFAULT); _FSData.TransmitClientEvent(1, EVENT_ID.AIRSPEED_INC, 0, GROUP_ID.GROUP0, SIMCONNECT_EVENT_FLAG.DEFAULT); //run twice to speed it up } else { _FSData.TransmitClientEvent(1, EVENT_ID.AIRSPEED_DEC, 0, GROUP_ID.GROUP0, SIMCONNECT_EVENT_FLAG.DEFAULT); _FSData.TransmitClientEvent(1, EVENT_ID.AIRSPEED_DEC, 0, GROUP_ID.GROUP0, SIMCONNECT_EVENT_FLAG.DEFAULT); //run twice to speed it up } } In both of these code snippets, to receive an event or transmit an event to the sim, they are using the predefined enums of EVENT_ID.AIRSPEED_INC and EVENT_ID.AIRSPEED_DEC But your guide says to map to events that are hex numbers (e.g., GPS1_COM_FREQ_TOGGLE=0x11000). I guess when I'm looking at the SDK, I'm not following how one would do that? I'm not seeing any spot where you can trigger an event using a hex number. So, how does one implement what you are suggesting in your guide? - Dirk
  5. geodirk

    Using Simconnect Example

    Hi Ed, Well your guide to your software says: I'm looking to implement what you have written. But I can't find any sort of documentation in the P3D SDK that shows how to do what you are suggesting. Lots of examples of how to use all the simconnect predefined enums, but nothing that would let me use the hex numbers to trigger the event. So I'm looking for a small code snippet from you that demonstrates using simconnect to trigger an event that will pass over to the GNS. That make sense? - Dirk
  6. Hi Ed, I'm looking for a code snippet (preferably C# but I can manage [pun intended] to read other languages) that shows how to use a couple of simconnect functions when I have defined a hex event code in the .ini file. I've scoured Google yesterday looking for an example of how to use a hex number versus the usual predefined enums (e.g., KEY_GPS_POWER_BUTTON) but couldn't find anything. For example, if I have defined this in the following in the .ini file: GPS1_COM_FREQ_TOGGLE=0x11000 how would I setup and call the simconnect functions of: TransmitClientEvent() MapClientEventToSimEvent() Thanks for the help, Dirk