Jump to content
The simFlight Network Forums

PMDG NGX SDK


Recommended Posts

Hello Pete,

I don't know whether you have the PMDG NGX and if so had a chance to look at the SDK that was released over the weekend?

The SDK includes a header file with custom event variables to be accessed by C/C++ software through simconnect-assuming I've understood this correctly!

As I've a limited understanding of LUA and absolutely no knowledge of C/C++, I was wondering if these simconnect events can be accessed by LUA and FSUIPC or will I need to learn C or C++?

regards

Paul

Link to comment
Share on other sites

  • Replies 157
  • Created
  • Last Reply

Top Posters In This Topic

I don't know whether you have the PMDG NGX and if so had a chance to look at the SDK that was released over the weekend?

Sorry, no.

The SDK includes a header file with custom event variables to be accessed by C/C++ software through simconnect-assuming I've understood this correctly!

Are these numbered FS events, or named PMDG events?

If they are custom events then you can list them in an "events" file. Please see the chapter in the FSUIPC4 Advanced User's manual called "Add-on Custom Events". Once they are listed you can assign to them in the normal way.

Regards

Pete

Link to comment
Share on other sites

Thanks for your help Pete,

Are these numbered FS events, or named PMDG events?

I don't have the SDK with me but I think they're both numbered and named

I'll have a look at the advanced manual when I get home tonight, learning C or C++ is a bit daunting!

regards

Paul

Link to comment
Share on other sites

I'll have a look at the advanced manual when I get home tonight, learning C or C++ is a bit daunting!

If they are FS control numbers, like 66191 or whatever, you can probably just send them using the ipc.control function in a small Lua plug-in.

If they are named custom events you only need to list them in an evt file and they will be assignable.

I'll take a look at the SDK when I get time. not today, for sure.

Regards

Pete

Link to comment
Share on other sites

I don't know whether you have the PMDG NGX and if so had a chance to look at the SDK that was released over the weekend?

I've searched all over the PMDG site and can find nothing about the SDK at all. They released the SP1c update for the aircraft package yesterday. I've downloaded that and will install it in the next couple of days or so, but where is this 'SDK'?

Regards

Pete

Link to comment
Share on other sites

I've searched all over the PMDG site and can find nothing about the SDK at all. They released the SP1c update for the aircraft package yesterday. I've downloaded that and will install it in the next couple of days or so, but where is this 'SDK'?

Regards

Pete

Hi Pete.

The SDK files is inside the "PMDG/PMDG 737 NGX" folder under FSX's folder.

Also, there should be a link in in your start menu under "PMDG"...

Regards, Duran.

Link to comment
Share on other sites

The SDK will be installed when you install SP1c. It gets put into a subfolder in the PMDG folder and contains a pdf, a cpp file and a header file.

The SDK files is inside the "PMDG/PMDG 737 NGX" folder under FSX's folder.

Thanks! Yes, found it when I installed SP1c. Wasted some time last night searching for a separate download! ;-)

The Event numbers, 69632-84232, for operating switches and so on, confirm what a lot of folks have found in any case, judging by the Lua and macro contributions already made for NGX users. But there's enough information there to ehnance those quite a bit I think, especially with the info that a lot of the events take numberical parameters, and I see there are events to operate switches via mouse-type operations.

Getting data out, however, is a bit different. it uses the SimConnect "client data" facility. That's easy enough for a programmer, though, and someone could write a program to map the useful parts of that client data to FSUIPC offsets. I cannot build that into FSUIPC myself since there are clauses prohibiting use in payware programs without express permission -- which essentially means licensing. Someone else, however, could make a freeware interface much like Nico Kaan's "LekSeeCon" for the LevelD 767.

It will be interesting to see how things develop now ...

Regards

Pete

Link to comment
Share on other sites

I'm curious about this too. Not a C++ or Simconnect developer though, but I found this way to call c++ / c functions from Lua and was wondering if it would work in FSUIPC.

I think the functions need to be registered though. I'm Probably talking nonsense here, but if it makes some kind of sense, is it possible to register C/C++ functions dynamically upon FSUIPC startup so that we can then call them from Lua scripts?

Link to comment
Share on other sites

Sorry to hop in the thread, and I'm gonna sound a little bit monomaniac, but would there be anyway we could use info from the SDK to try and use with the 747 CDU problem we've been discussing some time ago ? Or at least look for inspiration ?

Yes, I think so -- it lists events for every CDU button. Just program one of your buttons to send the event number as an FS control. Look in the .h file, find the section starting:

// CDU

#define EVT_CDU_L_L1 (THIRD_PARTY_EVENT_ID_MIN + 534)

The value THIRD_PARTY_EVENT_ID_MIN is defined earlier on as 69632, so that one is 70166. You can either send it via a Lua "ipc.control", or possibly just be editing the FSUIPC INI to set number 70166 as the control numer after the C in the button assignments. I'm not sure what the latter method will do to the FSUIPC dropdown display, though. I might try it later.

Regards

Pete

Link to comment
Share on other sites

I'm trying to usderstand Pete's comment about getting data out of the SDK. I use SimConnect code with a C# program but have never used FSUIPC (and am not sure how ti works). How would you interface a separate SimConnect client code with FSUIPC (to map the SimConnect data to FSUIPC offsets)? Are there some "hooks" that I can call from my C# (or C++) code into FSUIPC?

Link to comment
Share on other sites

I'm curious about this too. Not a C++ or Simconnect developer though, but I found this way to call c++ / c functions from Lua and was wondering if it would work in FSUIPC.

I think the functions need to be registered though. I'm Probably talking nonsense here, but if it makes some kind of sense, is it possible to register C/C++ functions dynamically upon FSUIPC startup so that we can then call them from Lua scripts?

No. Not in FSUIPC itself, but you can certainly write a C/C++ DLL which can be called from a Lua program being run in FSUIPC. There are several such DLLs already available, as noted in the FSUIPC Lua documents.You can't call just any old C/C++ functions from Lua, they need to follow certain rules. All of the library functions in the many libraries built into FSUIPC are written in C following these rules, and the libraries are then simply pre-opened for your Lua plug-in so you don't need to use 'require' in their case.

Regards

Pete

Link to comment
Share on other sites

I'm trying to usderstand Pete's comment about getting data out of the SDK. I use SimConnect code with a C# program but have never used FSUIPC (and am not sure how ti works). How would you interface a separate SimConnect client code with FSUIPC (to map the SimConnect data to FSUIPC offsets)? Are there some "hooks" that I can call from my C# (or C++) code into FSUIPC?

No. Such an interface program would use SimConnect to get the data from the NGX, exactly as shown in the example in the SDK, and use the FSUIPC interface, according to the FSUIPC SDK, to write that data to specially assigned offsets. Then other FSUIPC-interfacing programs can read those offsets.

When and if someone wants to start on this, they'd need to write to me for an assignment of offsets in order to ensure those chosen do not clash with anyone else. If not sure I will be willing to assign as much of the restricted offset space as would be needed for a complete one-to-one mapping of the NGX client data -- it looks like it's about 2 kb. It could be compacted quite considerably by using bts for BOOLean flags instead of complete 32 words as defined there. Maybe it could be a little selective too. Probably not all of the listed data is of use.

Regards

Pete

Link to comment
Share on other sites

No. Not in FSUIPC itself, but you can certainly write a C/C++ DLL which can be called from a Lua program being run in FSUIPC. There are several such DLLs already available, as noted in the FSUIPC Lua documents.You can't call just any old C/C++ functions from Lua, they need to follow certain rules. All of the library functions in the many libraries built into FSUIPC are written in C following these rules, and the libraries are then simply pre-opened for your Lua plug-in so you don't need to use 'require' in their case.

Regards

Pete

Ok, those are those the ipc, socket, com, gfd.... libraries, right? would this method avoid the above mentioned offset space restriction?

Thanks Pete

Link to comment
Share on other sites

Ok, those are those the ipc, socket, com, gfd.... libraries, right? would this method avoid the above mentioned offset space restriction?

If you write an external library (DLL) which interfaces to SimConnect to obtain the data or send events, and include in it functions designed to be called by Lua, following the proper rules so that Lua could interface to it, then, yes, you'd be able to write Lua plug-ins which controlled the NGX without needing to use any offsets at all.

The built-in libraries you mention are part of FSUIPC code. An external DLL would be more like those third party ones I list at the end of my FSUIPC Lua Plug-Ins document -- saitek.dll, gd.dll and luacom.dll.

Regards

Pete

Link to comment
Share on other sites

Sorry for all the questions. I'm a software developer, a pilot, a simmer, and am building a sim pit. I understand all the separate pieces--I just don't understand how it all fits together (with SimCommect, FSUIPC, ProSim, etc).

So if you don't add the offset assignments for ALL the PMDG's variables how would someone get to it from FSUIPC? How did they do it before the SDK came out?

Link to comment
Share on other sites

If you write an external library (DLL) which interfaces to SimConnect to obtain the data or send events, and include in it functions designed to be called by Lua, following the proper rules so that Lua could interface to it, then, yes, you'd be able to write Lua plug-ins which controlled the NGX without needing to use any offsets at all.

The built-in libraries you mention are part of FSUIPC code. An external DLL would be more like those third party ones I list at the end of my FSUIPC Lua Plug-Ins document -- saitek.dll, gd.dll and luacom.dll.

Regards

Pete

Thanks again Pete. I found the luacom source code, so I guess I could take that as an example to build a dll for the NGX SDK.

Don't know if I'll be able to do it and when, but sure it will be fun trying

Sorry for all the questions. I'm a software developer, a pilot, a simmer, and am building a sim pit. I understand all the separate pieces--I just don't understand how it all fits together (with SimCommect, FSUIPC, ProSim, etc).

So if you don't add the offset assignments for ALL the PMDG's variables how would someone get to it from FSUIPC? How did they do it before the SDK came out?

I think I can answer the second part Ned.

For inputs, FSUIPC provides with a function to monitor control inputs you can use to determine which controls are called with which parameters so you can later map buttons/keystrokes to those controls.

The news about the SDK is for reading data. Prior to the SDK, only a few Lvars for the MCP were made available to read the MCP displays. Now you can read any switch position, light status... through the PMDG_NGX_Data struct

Link to comment
Share on other sites

So if you don't add the offset assignments for ALL the PMDG's variables how would someone get to it from FSUIPC?

There are lot a lot of things you can do with a Lua plug-in which don't involve offsets. Take a look at some of the User Contributions in that subforum. If there was a DLL which could be called from a Lua plug-in t retrieve data from the NGX, it could be sent to displays or whatever using the exisiting Lua facilities.

Using offsets would be a way for those writing apps to interface to FSUIPC. The Lua plug-in methods are more oriented towards end users who just want a way of getting their hardware operational with the NGX.

How did they do it before the SDK came out?

Do what? Judging by the User Contributions so far, controlling the NGX switches is currently a mix of folks using L:Vars (Local gauge variables), event numbers folks have found for themselves by experiment, and actualy mouse clicking on screen. Not many of the values needed for cockpit displays have been found -- that's where the main use of the SDK will come in.

I am NOT a PMDG NGX user myself. I use Project magenta in my cockpit with a modified default FSX 738.

Pete

Link to comment
Share on other sites

Thanks again Pete. I found the luacom source code, so I guess I could take that as an example to build a dll for the NGX SDK.

Don't know if I'll be able to do it and when, but sure it will be fun trying

Dario,

Unfortunately building a dll is beyond my current capabilities but it's something that I would like to learn. In the meantime I'm willing to assist where I can particularly with testing etc.

regards

Paul

Link to comment
Share on other sites

Hi,

I have made some lua files that interfaces the PMDG NGX's MCP and EFIS. This was done before the SDK came out. The part interfacing the PMDG NGX via Lvars, ipc.control and ipc.read/write commands are controlled by sioc scripts ( I am using Opencockpits hardware). I am now thinking of writing a C++ program, but I need to study the interface simconnect and C++ a little bit more and also other parts.

Why is there any need for FSUIPC4 now that the SDK is available? I had to use FSUIPC before the SDK was available. What I understand is that you need the C++ (dll) to interface PMDG through simconnect and in my case also interface/translate to sioc "language". But, in order to do this, I need to study a little bit more.

I don't have any problem using FSUIPC, but to me using SIOC, C++(dll), SImconnect and FSUIPC incl LUA seems to complicated. There must be an easier way of doing this or?

rgs

Link to comment
Share on other sites

Dario,

Unfortunately building a dll is beyond my current capabilities but it's something that I would like to learn. In the meantime I'm willing to assist where I can particularly with testing etc.

regards

Paul

Thank you Paul. I'll let you all know when/if I have something to test

Hi,

I have made some lua files that interfaces the PMDG NGX's MCP and EFIS. This was done before the SDK came out. The part interfacing the PMDG NGX via Lvars, ipc.control and ipc.read/write commands are controlled by sioc scripts ( I am using Opencockpits hardware). I am now thinking of writing a C++ program, but I need to study the interface simconnect and C++ a little bit more and also other parts.

Why is there any need for FSUIPC4 now that the SDK is available? I had to use FSUIPC before the SDK was available. What I understand is that you need the C++ (dll) to interface PMDG through simconnect and in my case also interface/translate to sioc "language". But, in order to do this, I need to study a little bit more.

I don't have any problem using FSUIPC, but to me using SIOC, C++(dll), SImconnect and FSUIPC incl LUA seems to complicated. There must be an easier way of doing this or?

rgs

Doesn't SIOC interface with FSX via FSUIPC? if it can "talk" to a C++/Simconnect host then you don't need another layer in FSUIPC.

The idea behind accesing the SDK through Lua is to be able to use all the facilities in FSUIPC already available. For VRInsight panels, or just about any switches where you can now read the actual switch position and have it work as an UP-on/DOWN-off switch instead of a simple toggle switch for example

Link to comment
Share on other sites

Why is there any need for FSUIPC4 now that the SDK is available? I had to use FSUIPC before the SDK was available.

Why did you need FSUIPC before, and who says you did? If you are a programmer you could have written whatever you needed to do already, before the SDK came out! All the SDK does for you is give you the specifics of what you found out in any case. There is absolutely nothing in FSUIPC which knows anything about the NGX itself.

Pete

Link to comment
Share on other sites

Yes, I think so -- it lists events for every CDU button. Just program one of your buttons to send the event number as an FS control. Look in the .h file, find the section starting:

// CDU

#define EVT_CDU_L_L1 (THIRD_PARTY_EVENT_ID_MIN + 534)

The value THIRD_PARTY_EVENT_ID_MIN is defined earlier on as 69632, so that one is 70166. You can either send it via a Lua "ipc.control", or possibly just be editing the FSUIPC INI to set number 70166 as the control numer after the C in the button assignments. I'm not sure what the latter method will do to the FSUIPC dropdown display, though. I might try it later.

Regards

Pete

Hi Pete, thanks for the reply. Indeed this works for the 737 NGX (seven THREE seven). I tried using a macro file found here http://forum.simflig...ng-ngx-cdu-lua/ which does the same thing as the ipc.control if I understand well. And indeed it works very well. I can assign any key to any button I want on any device that Fsuipc sees. So the 737NGX is not the problem.

But my question was for the PMDG 747 X (seven FOUR seven) that we have been discussing here : http://forum.simflig...-and-pmdg-747x/ where we had come to the conclusion that no Lvars appeared to be used for the CDU. I tried using the same macro file, but to no avail for the moment. Should I try all the codes from 70166 to 70299 (the NGX CDU keys) hoping that one of the might trigger something ? Or is it totally hopeless because no lua var is used ? Or other codes ?

edit : I tested again with the logging facility that Linda provides and no CDU keypress in the 747 ever triggers a IPC write/FSX control event/Lua event.

Thanks for your most valuable insight anyway Pete !

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.