BUG SimConnect 64 Bit: SimConnect_RequestClientData

Discuss on the SimConnect SDK can be used by programmers to write add-on components for Prepar3D
Locked
FSTramp
Posts: 78
Joined: Tue Oct 06, 2015 12:12 pm

BUG SimConnect 64 Bit: SimConnect_RequestClientData

Post by FSTramp »

I adapt the FSTramp DLL from 32 to 64 bits.

1. The following problem is new and worked in 32 bit mode with all older simulators. But not in a 64 bit DLL.

SimConnect_RequestClientData (..., SIMCONNECT_CLIENT_DATA_PERIOD_ON_SET, ...) shows no effect. All other time-dependent values of SIMCONNECT_CLIENT_DATA_PERIOD work.

2. Prepar3D 4 Lerning Center
Structures and Enumerations
SIMCONNECT_CLIENT_DATA_PERIOD

The whole description is wrong. It stands for SIMCONNECT_PERIOD, but not for SIMCONNECT_CLIENT_DATA_PERIOD.
Clifton Crane
Lockheed Martin
Posts: 1207
Joined: Tue Sep 25, 2012 2:34 pm

Re: BUG SimConnect 64 Bit

Post by Clifton Crane »

Hello,

Do you receive any exceptions when using the functions? Would you be able to provide a file hosting service link (i.e. Dropbox) to a working sample that demonstrates the issue? This function was tested while in beta and appeared to be working correctly. Also, the Learning Center documentation has been updated.

Thanks.
Clifton Crane
Prepar3D® Software Engineer Sr.
FSTramp
Posts: 78
Joined: Tue Oct 06, 2015 12:12 pm

Re: BUG SimConnect 64 Bit: SimConnect_RequestClientData

Post by FSTramp »

Hello,

Exception does not come.
Since I have a long-time working DLL only recompiled, including the 64 Bit SimConnect.lib, I have also no example to experiment. Here the program text of initialization and setting single values.
If SimConnect_RequestClientData (..., SIMCONNECT_CLIENT_DATA_PERIOD_ON_SET, ...)
is used, I never receive an event SIMCONNECT_RECV_ID_CLIENT_DATA. It works with SIMCONNECT_CLIENT_DATA_PERIOD_SECOND.


ClientDataInit()
{
SimConnect_MapClientDataNameToID(m_hSimConnect, CLIENT_DATA_NAME_FSTRAMP_RO, CLIENT_DATA_ID_RO);

SimConnect_CreateClientData(m_hSimConnect, CLIENT_DATA_ID_RO, sizeof(FSTRAMP_VAR_RO), SIMCONNECT_CREATE_CLIENT_DATA_FLAG_READ_ONLY);

SimConnect_AddToClientDataDefinition(m_hSimConnect, DATA_DEF_CLIENT_RO, SIMCONNECT_CLIENTDATAOFFSET_AUTO, sizeof(FSTrampVarsRO.m_dwFSTrampVersion), 0, FSTRAMP_VERSION);

SimConnect_AddToClientDataDefinition(m_hSimConnect, DATA_DEF_CLIENT_RO, SIMCONNECT_CLIENTDATAOFFSET_AUTO, sizeof(FSTrampVarsRO.m_bFlyHoldingPossible), 0, FSTRAMP_FLY_HOLDING_POSSIBLE);

SimConnect_RequestClientData(m_hSimConnect, CLIENT_DATA_ID_RO, REQUEST_CLIENT_DATA_DEF_RO, DATA_DEF_CLIENT_RO, SIMCONNECT_CLIENT_DATA_PERIOD_ON_SET, SIMCONNECT_DATA_REQUEST_FLAG_CHANGED | SIMCONNECT_DATA_REQUEST_FLAG_TAGGED);

SimConnect_SetClientData(m_hSimConnect, CLIENT_DATA_ID_RO, DATA_DEF_CLIENT_RO, 0, 0, sizeof(FSTrampVarsRO), &FSTrampVarsRO);
}

SetClientData(SIMCONNECT_CLIENT_DATA_ID ClientDataID, DWORD dwOffset, DWORD cbUnitSize, void* pDataSet)
{
SimConnect_AddToClientDataDefinition(m_hSimConnect, DATA_DEF_SETDATA, dwOffset, cbUnitSize);
SimConnect_SetClientData(m_hSimConnect, ClientDataID, DATA_DEF_SETDATA, 0, 0, cbUnitSize, pDataSet);
SimConnect_ClearClientDataDefinition(m_hSimConnect, DATA_DEF_SETDATA);
}
Steveo41
Posts: 19
Joined: Sat Jun 16, 2012 1:05 pm

Re: BUG SimConnect 64 Bit: SimConnect_RequestClientData

Post by Steveo41 »

I have exactly the same problem and reported it LM a few days ago, but they can't seem to recreate the problem. Glad its not just me now seeing this issue.

Best wishes
Steve
Developer of the GoFlight Interface Tool
Adam Breed
Lockheed Martin
Posts: 1382
Joined: Mon Sep 20, 2010 6:17 pm

Re: BUG SimConnect 64 Bit: SimConnect_RequestClientData

Post by Adam Breed »

Hi FSTramp,

Thanks for the report.

We have tested the following cases with a simple structure containing only an integer using the SIMCONNECT_CLIENT_DATA_PERIOD_ON_SET and did not see any issues receiving the SIMCONNECT_RECV_ID_CLIENT_DATA event:

1. 64-bit native application to 64-bit DLL
2. 64-bit managed application to 64-bit DLL
3. 64-bit native application to 64-bit native application
4. 32-bit managed application to 64-bit DLL (your use case, correct?)

Are you able to compile the executable against the v4 SDK in x64 to see if the issue still exists?

Is it possible to provide a sample that we can compile that exhibits the issue? We have been unable to recreate based on our samples. It can be provided to me though Dropbox or any other file share.

Regards,
Adam
Prepar3D® Engineering Project Manager
Steveo41
Posts: 19
Joined: Sat Jun 16, 2012 1:05 pm

Re: BUG SimConnect 64 Bit: SimConnect_RequestClientData

Post by Steveo41 »

Hi Adam,

I have PM'd you a link.

Best wishes
Steve
Developer of the GoFlight Interface Tool
c0nnex
Posts: 7
Joined: Sun Sep 07, 2014 1:48 pm
Location: EDDM
Contact:

Re: BUG SimConnect 64 Bit: SimConnect_RequestClientData

Post by c0nnex »

Hi,

also having exactly the same problem.
64Bit Dll loaded through dll.xml

But Only if I link against the SimConnect.lib
I do not have the problem when I use my own native .NET SimConnect Implementation in a testapp.

Regards,
Ulrich
---
Author of SPAD.neXt - Simulation Advanced Panel Drivers neXt Generation
c0nnex
Posts: 7
Joined: Sun Sep 07, 2014 1:48 pm
Location: EDDM
Contact:

Re: BUG SimConnect 64 Bit: SimConnect_RequestClientData

Post by c0nnex »

c0nnex wrote: Fri Jun 02, 2017 8:59 pm I do not have the problem when I use my own native .NET SimConnect Implementation in a testapp.
Revise that. SIMCONNECT_CLIENT_DATA_PERIOD_ON_SET is not working at all in P3D v4.
---
Author of SPAD.neXt - Simulation Advanced Panel Drivers neXt Generation
roarkr
Posts: 17
Joined: Fri Jan 06, 2012 11:21 pm

Re: BUG SimConnect 64 Bit: SimConnect_RequestClientData

Post by roarkr »

I can also confirm that the SIMCONNECT_CLIENT_DATA_PERIOD_ON_SET is not working as I do not get any client data in my app.

Changing the code in my app to SIMCONNECT_CLIENT_DATA_PERIOD_VISUAL_FRAME my app works OK.


I am not sure what the difference between the two are.

ON_SET and SIMCONNECT_DATA_REQUEST_FLAG_CHANGED will send client data whenever a change occur

VISUAL_FRAME and SIMCONNECT_DATA_REQUEST_FLAG_CHANGED will send client data whenever a change but not between frames.

Can anyone tell me which one is most easy in respect to CPU usage? Will there be any difference at all?
c0nnex
Posts: 7
Joined: Sun Sep 07, 2014 1:48 pm
Location: EDDM
Contact:

Re: BUG SimConnect 64 Bit: SimConnect_RequestClientData

Post by c0nnex »

roarkr wrote: Mon Jun 05, 2017 3:56 pm I am not sure what the difference between the two are.

ON_SET and SIMCONNECT_DATA_REQUEST_FLAG_CHANGED will send client data whenever a change occur

VISUAL_FRAME and SIMCONNECT_DATA_REQUEST_FLAG_CHANGED will send client data whenever a change but not between frames.
Exactly this is the problem.
VISUAL_FRAME will not send updates between frames. If you use the ClientData to send some updates to an external client, it will not get all Datas. It will only get the last one you send in the Callback.

So, at least for me, VISUAL_FRAME is not an option, because i would have to rewrite all my logic.
---
Author of SPAD.neXt - Simulation Advanced Panel Drivers neXt Generation
Steveo41
Posts: 19
Joined: Sat Jun 16, 2012 1:05 pm

Re: BUG SimConnect 64 Bit: SimConnect_RequestClientData

Post by Steveo41 »

Adam has confirmed on the thread I posted in the Beta v4 forum that they are looking into the problem and will get back to us asap.

Best wishes
Steve
Developer of the GoFlight Interface Tool
roarkr
Posts: 17
Joined: Fri Jan 06, 2012 11:21 pm

Re: BUG SimConnect 64 Bit: SimConnect_RequestClientData

Post by roarkr »

Exactly this is the problem.
VISUAL_FRAME will not send updates between frames. If you use the ClientData to send some updates to an external client, it will not get all Datas. It will only get the last one you send in the Callback.

So, at least for me, VISUAL_FRAME is not an option, because i would have to rewrite all my logic.
Still not sure I understand the difference. I thought using PERIOD_VISUAL_FRAME would send all defined Client data after each frame. What do you mean with only the last one in the Callback?
c0nnex
Posts: 7
Joined: Sun Sep 07, 2014 1:48 pm
Location: EDDM
Contact:

Re: BUG SimConnect 64 Bit: SimConnect_RequestClientData

Post by c0nnex »

Well, if you use ClientData to transfer Data from/to an addon to/from an external Program.

ExtPgm -> SetClientData( REQUEST_DATA_UDPATE )
Addon receives the request and then sends a bunch of updates all using the same structure and only one ID.
SetClientData( Datapacket1 )
SetClientData( Datapacket2 )
SetClientData( Datapacket3 )

with ON_SET , the extPgnm will recveive ALL 3 clientdata packets.
with VISUAL_FRAME the extPgm will only receive DataPacket3 , as that was the last one set within the Frame

Due to the nature of my addon, i cannot use one structure to contain all data, as i do not know how much data is needed. And sometimes the data needed to be transferred in total well exceeds 4096 bytes.
So i am using a structure like
{
int packetIdentifier; // ( 0 = Reuqest, 1 = Update , 2 = remove )
char[256] dataName;
double dataValue;
}
to transfer data from/to the extPgm, and each data need to be sent issuing a SetClientData.
---
Author of SPAD.neXt - Simulation Advanced Panel Drivers neXt Generation
c0nnex
Posts: 7
Joined: Sun Sep 07, 2014 1:48 pm
Location: EDDM
Contact:

Re: BUG SimConnect 64 Bit: SimConnect_RequestClientData

Post by c0nnex »

Got word, the bug has been fixed in the current beta.
Any ETA when we can expect this to be available for us mortals?
---
Author of SPAD.neXt - Simulation Advanced Panel Drivers neXt Generation
greggerm
Posts: 36
Joined: Wed Jan 11, 2012 5:57 pm

Re: BUG SimConnect 64 Bit: SimConnect_RequestClientData

Post by greggerm »

Looks like Hotfix 1 just dropped with the needed fix.
Locked