CAPTAIN SIM FORUM
767 Captain II (P3D4) >> 767 Captain II - General  >> SDK
https://www.captainsim.org/forum/csf.pl?num=1587503503

Message started by Skipy on Apr 21st, 2020 at 9:11pm

Title: SDK
Post by Skipy on Apr 21st, 2020 at 9:11pm
Hi,

I was waiting for a long time the 767 :-). Will we have a SDK at release time? The 757 III one was very useful for lua script programming.

Skip.

Title: Re: SDK
Post by Captain Sim on Apr 21st, 2020 at 9:59pm
Thanks!


Skipy wrote on Apr 21st, 2020 at 9:11pm:
Will we have a SDK at release time?

Not at release time, but it's on the list.

Title: Re: SDK
Post by Edo on Apr 21st, 2020 at 11:36pm
Hello, I would be veeeeery much interested in this particular aspect as well. I would like to discuss with you integration possibilities owning a real 767 cockpit. I also can give you feedbacks on your logic, using part of real computers as well, let me know if interested.

THanks and regards


IMG_5248.jpg ( 109 KB | 231 Downloads )

Title: Re: SDK
Post by Captain Sim on Apr 22nd, 2020 at 12:56am

Edo wrote on Apr 21st, 2020 at 11:36pm:
let me know if interested

Many people would be interested to watch such a great piece of hardware integration. Pls keep us posted. I'd even open a dedicated thread for your project.

Title: Re: SDK
Post by Edo on Apr 22nd, 2020 at 12:15pm

Captain Sim wrote on Apr 22nd, 2020 at 12:56am:
Pls keep us posted. I'd even open a dedicated thread for your project.


Sure if you feel like no prob.

I would like to give you my contribute in system logic, being quite well into these specific things in order to have your product to reflect real thing as much as possible.
On the other hand integrating it in a complex environment would require some particular data exchange to be avail thru sdk, so if you feel like to have a talk about this also with the team, I'd me more then happy to do it thru email/whatsapp/skype.

Regards

Title: Re: SDK
Post by cptjaco on Apr 22nd, 2020 at 3:25pm
Ti verrei a trovare per provarlo visto che stiamo a milano....
He registrazione aveva?

Title: Re: SDK
Post by Edo on Apr 22nd, 2020 at 6:37pm
GBZHC. Non si puó provare, c’è ancora molto lavoro da fare.

Title: Re: SDK
Post by Angel of Attack on Apr 23rd, 2020 at 12:23am
I think I'll wait for that, I can't fly without my MCP :-?

Title: Re: SDK
Post by Skipy on Apr 28th, 2020 at 9:38pm

Angel of Attack wrote on Apr 23rd, 2020 at 12:23am:
I think I'll wait for that, I can't fly without my MCP :-?


Is there any chance that the 767 and 767 SDK are similar (button names)?

Title: Re: SDK
Post by Captain Sim on Apr 28th, 2020 at 10:32pm

Skipy wrote on Apr 28th, 2020 at 9:38pm:
Is there any chance that the 767 and 767 SDK are similar (button names)?

Some systems are identical, for the rest you'd try the Manual part 2.
All 757-767 differences are highlighted there.

Title: Gear Lever Off assignment possible?
Post by Dave763 on May 4th, 2020 at 11:41am
Hi everyone,

Does anyone know how to set an assignment (either for a lever or button) for the gear lever off position so that you do not need to use the mouse to drag it to that position?

I have set a throttle quadrant lever as an axis for the gear in FSUIPC but I cannot get it to stop at the 'off' position.

Cheers

Title: Re: SDK
Post by Edo on May 7th, 2020 at 1:45pm

Captain Sim wrote on Apr 22nd, 2020 at 12:56am:

Edo wrote on Apr 21st, 2020 at 11:36pm:
let me know if interested

Many people would be interested to watch such a great piece of hardware integration. Pls keep us posted. I'd even open a dedicated thread for your project.


Sent you a PM. Plz can you check and get back to me?  Thx

Title: Re: SDK
Post by Captain Sim on May 7th, 2020 at 2:35pm

Edo wrote on May 7th, 2020 at 1:45pm:
Sent you a PM. Plz can you check and get back to me?

SDK will be available after the 1.0 release.
If there's not enough information in the SDK, we'd add some more upon request.


Title: Re: SDK
Post by Captain Sim on May 8th, 2020 at 5:21pm
SDK is available

Title: Re: SDK
Post by Kees on May 9th, 2020 at 10:04pm
Thanks for the SDK. Finally I can reprogram my home cockpit from the another company to the CS. And can use it with P3D  :)

Only one question, is there a picture with the MCP's buttons and switches available? It is not currently in the SDK.

Regards,
Kees

Title: Re: SDK
Post by Captain Sim on May 11th, 2020 at 3:40pm

Kees wrote on May 9th, 2020 at 10:04pm:
is there a picture with the MCP's buttons and switches available?

Thanks, updated https://drive.google.com/open?id=1enMcTxYPyCwTxiRmpKTmLZPce7PDShdp

Title: Re: SDK
Post by Kees on May 11th, 2020 at 10:09pm
Great! Thanks

Title: write to LVar of an IND
Post by Kees on May 16th, 2020 at 3:57pm
Why is it not possible to write to the LVAR L:G03_001_IND? The reason I would like this to do is, that I have an own MCP. This is programmed with SIOC from Open Cockpits. When I turn the knob of my speed on my MCP, open cockpits reads (via a LUA script) the value of G03_001_IND, changes it and writes is to a free offset in FSUIPC.
Now I would like to write the value of that offset to G03_001_IND in a LUA script with:
ipc.writeLvar("L:G03_001_IND", value)

But that doesn't anything.

Kind regards,
Kees

Title: Re: write to LVar of an IND
Post by EY on May 16th, 2020 at 9:15pm

Kees wrote on May 16th, 2020 at 3:57pm:
Why is it not possible to write to the LVAR L:G03_001_IND?
Kees


Kees, you can not set G03_001_IND, because the aircraft systems (MCP, electrical) refresh it continuously.
To change the value of this particular indicator of IAS/Mach, you can use the (L:klid) variable with the values:
1703010  //IAS/Mach Knob Increase
-1703010 //IAS/Mach Knob Decrease
1703110  //IAS/Mach Selector Button

Title: Re: SDK
Post by Kees on May 16th, 2020 at 9:30pm
This is indeed the way I have programmed it now. However, this doesn't work as smoothly as the way I expressed in my question. That is why I would still like it if I could write directly to the IND. I think that with me, many who also used the another company first and now switch to Captain Sim, would certainly appreciate this opportunity.

Kees

Title: Re: SDK
Post by Kees on May 16th, 2020 at 9:37pm
In short, what is the difference between turning the knob to change the IND and writing the Lvar of the IND directly to change it.

Title: Re: SDK
Post by Kees on May 17th, 2020 at 7:44pm
I cannot find the lights (LT1 and LT2) of the airplane lightning panel.

These Lvars don't seem to exist:
O20_001_LT1 (+ LT2)
O20_002_LT1 (+ LT2)
O20_003_LT1 (+ LT2)
O20_004_LT1 (+ LT2)

I want to read them so I can light the corresponding lights in my homepit.

Title: Re: SDK
Post by EY on May 18th, 2020 at 2:35pm

Kees wrote on May 17th, 2020 at 7:44pm:
I cannot find the lights (LT1 and LT2) of the airplane lightning panel.

These Lvars don't seem to exist:
O20_001_LT1 (+ LT2)
O20_002_LT1 (+ LT2)
O20_003_LT1 (+ LT2)
O20_004_LT1 (+ LT2)


Use
O20_001_BUT
O20_002_BUT
O20_003_BUT
O20_004_BUT

Title: Re: SDK
Post by EY on May 18th, 2020 at 2:44pm

Kees wrote on May 16th, 2020 at 9:37pm:
In short, what is the difference between turning the knob to change the IND and writing the Lvar of the IND directly to change it.


The status of the indicator depends on several conditions, not only from the knob.
What will happen if the MCP panel loses electrical power? And, after that you will set some value for the indicator.
Right. It will show the value without electricity.

I don't think this is the expected result

Title: Re: SDK
Post by Kees on May 22nd, 2020 at 9:57am

EY wrote on May 18th, 2020 at 2:35pm:
Use
O20_001_BUT
O20_002_BUT
O20_003_BUT
O20_004_BUT


Thanks, this did the trick

Title: Re: SDK
Post by Kees on May 22nd, 2020 at 10:01am

EY wrote on May 18th, 2020 at 2:44pm:
What will happen if the MCP panel loses electrical power? And, after that you will set some value for the indicator.
Right. It will show the value without electricity.


Well, i can program my hompeit to do blank the displays in case that occurs  :).
So writing to the IND's still stays on my wishlist, because turning the knobs in my own made MCP would give a more realistic feeling then the workaround that I have mad now.  ;)

Title: Re: SDK
Post by Kees on Jun 3rd, 2020 at 8:45pm

Kees wrote on May 22nd, 2020 at 10:01am:
EY wrote on May 18th, 2020 at 2:44pm:
What will happen if the MCP panel loses electrical power? And, after that you will set some value for the indicator.
Right. It will show the value without electricity. 

Well, i can program my hompeit to do blank the displays in case that occurs  :-).
So writing to the IND's still stays on my wishlist, because turning the knobs in my own made MCP would give a more realistic feeling then the workaround that I have mad now. 


No reaction? I would like my homepit as realistic as possible. With no possibility, writing to the IND's, the encoders do absolutely not feel as real. There will be not much people who shall write to the IND's, but I am for sure that all former another company pilots who have their own homepit, would greatly appreciate this possibility. This their chance top swicth over to P3d in combination with the CS767 and will not be stuck with the old FSX with the old another company.

I hope you will reconsider this option.

Title: Re: SDK
Post by Captain Sim on Jun 4th, 2020 at 2:55pm

Kees wrote on Jun 3rd, 2020 at 8:45pm:
I hope you will reconsider this option.

Well, you are asking us to re-build the entire 767 code from scratch (which is years of work) just to make it fit better one particular homepit needs.
The answer is no, sorry.

Title: Re: SDK
Post by Kees on Jun 4th, 2020 at 3:18pm
Thanks for your reply. Of course I do not know how the code of the 767 is written. But it looks to me (as a amateur programmer) that you don”t have To rewrite the entirely code just to be able to write to a few var”s.
And it is not just one person with a 767 homepit, but some more. As I already mentioned, much another company simmers with a homepit are now stuck to the FSX and see now the chance to jump over to 64 bits p3d. Good chance that that will be the CS767 because all the other functions needed for a homepit are already in your model. This is the only thing that I really mis.

Kind regards,
Kees

Title: 767 - SDK - Scripting Issues FSX / Mobiflight
Post by flyingjayaraj on Aug 17th, 2020 at 7:43pm
Hello everone, i am stuck at a point where i am unable to program my MCP, due to limited knowledge in coding and deciphering the 757/767 SDK.

CS-767 & 757 - FSX - FSUIPC - Mobiflight

At present, i have used the Lvar for the MCP airspeed written it to a free offset and displaying it on the 7-segment successfully, below is the code that i used.

-----------------------------------------------------
while true do
        n=ipc.readLvar("L:MCP_IAS_Disp")
        ipc.writeUD(0x66C8,n)
        ipc.sleep(100)
        end
------------------------------------------------------------

To increase or decrease the airspeed value - i followed the instructions from the SDK

I created a lua file - CS757SPEEDDEC.LUA

ipc.writeLvar(“L:klid",-1703010)

and another - CS757SPEEDINC.LUA

ipc.writeLvar(“L:klid", 1703010)

These lua files now show up in my FSUIPC list.

Now the next step is to add an entry to auto-run the lua, i have made that entry too.

[Auto]
1=Lua CS757SPEEDINC
2=Lua CS757SPEEDDEC

Now in the macro file, what is the entry that i have to have ?
i tried different entry but none seem to work.

Could anyone please share some script that has worked ? or the steps, assigning the ID to a variable has got me stuck for weeks now, been searching for the forms but unable to find any definite answer.  :'(

Title: Re: SDK
Post by Edo on Dec 7th, 2020 at 2:39pm
Hello, I was tryin to read Lua events for the Eicas and ADI display but looks like no data is available out of those...can you confirm?

Title: SimConnect C++ and CS767 LVARS...
Post by Dave Snyder WI on Mar 19th, 2021 at 3:18am
Does anyone have any experience writing a C++ or C# application that uses SimConnect.  Specifically, I am writing an application that needs to R/W the CS767 LVARS for my home cockpit.  See other post recently here by me - I am subscribing to SIOC events (for my OpenCockpits hardware) and need to sync button presses etc in my hardware to the SIM.  Additionally, I will need to read values from CS767 LVARS to update my various LEDs etc.  Any advice would be greatly appreciated.

Title: Re: SDK
Post by Dave Snyder WI on Mar 19th, 2021 at 8:58pm
I am aware how to create individual LUA scripts for each LVAR that I wish to set, however, since I have a opencockpits program I am writing to get the state of all of my various switches, buttons, etc, I would like to set those LVARS from in that same program as doing all kinds of LUA mini scripts is cumbersome and wouldn't be tied to my actual hardware.
Perhaps the CaptaimSim folk can do a short description of how to access LVARS ???

Title: Re: 767 - SDK - Scripting Issues FSX / Mobiflight
Post by Dave Snyder WI on Mar 19th, 2021 at 10:06pm

flyingjayaraj wrote on Aug 17th, 2020 at 7:43pm:
Hello everone, i am stuck at a point where i am unable to program my MCP, due to limited knowledge in coding and deciphering the 757/767 SDK.

CS-767 & 757 - FSX - FSUIPC - Mobiflight

To increase or decrease the airspeed value - i followed the instructions from the SDK

I created a lua file - CS757SPEEDDEC.LUA

ipc.writeLvar(“L:klid",-1703010)

and another - CS757SPEEDINC.LUA

ipc.writeLvar(“L:klid", 1703010)

These lua files now show up in my FSUIPC list.

Now the next step is to add an entry to auto-run the lua, i have made that entry too.

[Auto]
1=Lua CS757SPEEDINC
2=Lua CS757SPEEDDEC

Now in the macro file, what is the entry that i have to have ?
i tried different entry but none seem to work.

Could anyone please share some script that has worked ? or the steps, assigning the ID to a variable has got me stuck for weeks now, been searching for the forms but unable to find any definite answer.  :'(


I have not yet tried this myself, but it looks like you are missing a trigger to cause these events to happen.  You would need to map a joystick button or keypress to trigger one of these LUA scripts to execute.  I have seen a decent YouTube video to explain this step (https://www.youtube.com/watch?v=mOO32FiMNS0). ; Hopefully that helps.

Title: Re: SDK
Post by Dave Snyder WI on Mar 19th, 2021 at 10:13pm
You could also look at this video as well...
https://youtu.be/_NVpSf4SZJM

He also shows a section in FSUIPC.ini called [LuaFiles] that you may need to add (in addition to your Lua entries in [Auto]) if you are saving FSUIPC macros that call on the scripts.


Title: Re: SDK
Post by Dave Snyder WI on Mar 19th, 2021 at 10:17pm

Captain Sim wrote on Jun 4th, 2020 at 2:55pm:

Kees wrote on Jun 3rd, 2020 at 8:45pm:
I hope you will reconsider this option.

Well, you are asking us to re-build the entire 767 code from scratch (which is years of work) just to make it fit better one particular homepit needs.
The answer is no, sorry.


So, I suspect that the main need isn't to necessarily write those values directly, but instead get a fast performance so that rotary inputs can change values quickly.  I haven't gotten to actually try this out yet (hopefully this weekend), but I wonder if the slow response is because it is calling LUA scripts to access LVARS as opposed to a more performant environment like C++/SimConnect.  Anyway, I do not know how to access LVARS outsite of a Lua script (yet), but hopefully there is a way...

Title: Re: SimConnect C++ and CS767 LVARS...
Post by Dave Snyder WI on Mar 19th, 2021 at 10:33pm

Dave Snyder WI wrote on Mar 19th, 2021 at 3:18am:
Does anyone have any experience writing a C++ or C# application that uses SimConnect.  Specifically, I am writing an application that needs to R/W the CS767 LVARS for my home cockpit.  See other post recently here by me - I am subscribing to SIOC events (for my OpenCockpits hardware) and need to sync button presses etc in my hardware to the SIM.  Additionally, I will need to read values from CS767 LVARS to update my various LEDs etc.  Any advice would be greatly appreciated.


Found a great video on YouTube () that I think gets me very close...

I'll paste in the code that looks to at least get the built-in variables for generic aircraft, just not quite sure how to change the request for LVARS - I wonder if it is simple as putting in the klid number instead of the #define of the variable?

#include <windows.h>
#include <iostream>
#include "SimConnect.h"

int quit = 0;
HANDLE hSimConnect = NULL;

static enum DATA_DEFINE_ID {
     DEFINITION_1,
};

static enum DATA_REQUEST_ID {
     REQUEST_1,
     REQUEST_2,
};

struct SimResponse {
     double altitude;
     int32_t heading;
     int32_t speed;
     int32_t vertical_speed;
};

void CALLBACK MyDispatchProc1(SIMCONNECT_RECV* pData, DWORD cbData, void* pContext) {
     switch (pData->dwID)
     {

     case SIMCONNECT_RECV_ID_SIMOBJECT_DATA:
     {
           SIMCONNECT_RECV_SIMOBJECT_DATA* pObjData = (SIMCONNECT_RECV_SIMOBJECT_DATA*)pData;

           switch (pObjData->dwRequestID)
           {
           case REQUEST_1:

                 SimResponse* pS = (SimResponse*)&pObjData->dwData;

                 std::cout
                       
                       << "\rAltitude: " << pS->altitude
                       << " - Heading: " << pS->heading
                       << " - Speed (knots): " << pS->speed
                       << " - Vertical Speed: " << pS->vertical_speed
                       
                       << std::flush;

                 break;
           }
           break;
     }

     case SIMCONNECT_RECV_ID_QUIT:
     {
           quit = 1;
           break;
     }

     default:
           break;
     }
}

bool initSimEvents() {
     HRESULT hr;

     if (SUCCEEDED(SimConnect_Open(&hSimConnect, "Client Event Demo", NULL, 0, NULL, 0))) {
           std::cout << "\nConnected To Microsoft Flight Simulator 2020!\n";

           // DATA
           hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINITION_1, "Indicated Altitude", "feet");
           hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINITION_1, "HEADING INDICATOR", "degrees", SIMCONNECT_DATATYPE_INT32);
           hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINITION_1, "Airspeed Indicated", "knots", SIMCONNECT_DATATYPE_INT32);
           hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINITION_1, "VERTICAL SPEED", "Feet per second", SIMCONNECT_DATATYPE_INT32);

           // EVERY SECOND REQUEST DATA FOR DEFINITION 1 ON THE CURRENT USER AIRCRAFT (SIMCONNECT_OBJECT_ID_USER)
           hr = SimConnect_RequestDataOnSimObject(hSimConnect, REQUEST_1, DEFINITION_1, SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_PERIOD_SECOND);

           // Process incoming SimConnect Server messages
           while (quit == 0) {
                 // Continuously call SimConnect_CallDispatch until quit - MyDispatchProc1 will handle simulation events
                 SimConnect_CallDispatch(hSimConnect, MyDispatchProc1, NULL);
                 Sleep(1);
           }

           hr = SimConnect_Close(hSimConnect);
           return true;
     }
     else {
           std::cout << "\nFailed to Connect!!!!\n";
           return false;
     }
}

int main() {
     initSimEvents();
     return 0;
}


For example, in the code above, I could try replacing "HEADING INDICATOR" with the numeric klid?

Anyone know?  I'll code this up this weekend and find out...


Title: Re: SDK
Post by Dave Snyder WI on Mar 19th, 2021 at 10:35pm
Oops - forgot to post the YouTube link - https://www.youtube.com/watch?v=M9dWihPtkrQ

The person who did the video wrote the above code.

Title: Re: SDK
Post by Dave Snyder WI on Mar 19th, 2021 at 10:48pm
Ugh - digging further, it seems this might now work for LVARS as those would only be accessible in-proc (and not from separate process of P3D).  Other sites have discussed making a custom C/C++ gauge control and that seems to be able to access LVARS.  Anyway, just putting this info out here for the future when someone will be able to answer...

Title: Re: SDK (LVARS and C/C++)
Post by Dave Snyder WI on Apr 14th, 2021 at 2:00am
BUMP! - Does anyone on the CaptainSim team actually know how to access LVARS via C/C++ or SimConnect???  Seems like someone should know how to interact with these outside the LUA script method...

Title: Re: SDK
Post by Dave Snyder WI on Aug 6th, 2021 at 3:06pm
One more bump...

Anyone out there interested in trying to solve this?  I have a full-size 767 cockpit that I am desperately trying to port over from LD767 and FSX to P3D CS767 and need this functionality.

Summary: Need a C++ way to Read/Write CS767 LVARS.

Specifically, It looks like I need to build a custom gauge DLL (that is in-proc w/ P3D) that can r/w the LVARS in CS767 and then does an IPC (maybe socket) to a module that can talk via SimConnect or FSUIPC and my OpenCockpits Modules.

CAPTAIN SIM FORUM » Powered by YaBB 2.6.0!
YaBB Forum Software © 2000-2024. All Rights Reserved.