plane icon Welcome to Microsoft Flight Simulator’s SDK Q&A Platform!

You have questions regarding the SDK? DevMode Tools? SimConnect? You would like to submit an idea for future improvements, seek help or exchange knowledge? You’re in the right place.


Please take a moment to read the platform’s guidelines before you get started!


question

jsb avatar image
jsb asked jsb edited

Unable to read ClientData at PANEL_SERVICE_PRE_KILL stage?

I want to notify the third party the plane is unloading. I'm doing so setting the data via SetClientData at the beginning of PANEL_SERVICE_PRE_KILL stage prior to the SimConnect handle is closed.

However, the third party does not "see" the new data (SetClientData returns S_OK) whereas it works during normal operations.

For tests purposes, after the notification, I have written a timed loop in which I call the events polling loop and I only can see SIMCONNECT_RECV_ID_SIMOBJECT_DATA being received. No SIMCONNECT_RECV_ID_CLIENT_DATA.

At which stage should I set the data?

Is it a bug?

simconnectgaugeshelpdevs
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

jsb avatar image
jsb answered

Up this. I really think it's a bug. If not, I'd like to understand the behavior

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

EPellissier avatar image
EPellissier answered

Hi there,

Where is your timed loop running? Is it in some external EXE or another WASM module?

It could help if you could send a minimal repro case (might be easy to base it off the GaugeAircraft sample included in the SDK).

Best regards,

Eric / Asobo

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

jsb avatar image
jsb answered

Hello!

The timed loop is within the same WASM module between the notification and SimConnect_close. Still within PRE_KILL stage. I made it for debug purposes to give some time to the system to “accept” the notification.


I’ll write a piece of code and link it here

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

jsb avatar image
jsb answered jsb edited

Please find attached the file. I've removed and changed a lot of things to make it clearer. I've added some comments.

The data we are interested in are shown with "InterestedIn" word. Once you have loaded the plane, you will be able to see a log in the console with it.

But once you unload the plane...no. Only the two other requests.

screenshot.png

ClientData.zip


screenshot.png (21.4 KiB)
clientdata.zip (3.3 KiB)
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

jsb avatar image
jsb answered

Hello!

Any news regarding this?

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

jsb avatar image
jsb answered

Hello!

Up on this. Did you have time to have a look?

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

EPellissier avatar image
EPellissier answered jsb edited

Hi @jsb,

We have discussed the issue internally and thought we had an idea about what could happen but unfortunately we haven't had time yet to look into this in detail.

I'll see if we can look at the code you provided in the next few days.

Apologies for the delay.

Best regards,

Eric / Asobo

1 comment
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

jsb avatar image jsb commented ·

Thank you!


What's your first thought ? Do you think the error is on my side or yours? Just to know if I have to look deeper in my code.

If you're thinking I'm not using SIMCONNECT_RECV_ID_CLIENT_DATA, I do use it.


Thanks!


0 Likes 0 ·
jsb avatar image
jsb answered

Hello!

Any news on that please? My dev is stuck I really need to know the fix/workaround

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

jsb avatar image
jsb answered jsb edited

Hi!

After reading the latest SDK version release note (with chance), I realized a function existed to get sim events.

I call

SimConnect_SubscribeToSystemEvent 

and subscribe to event

SimStop 

This way, I managed to make everything work.

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.