SimConnect_RequestGroundInfo() - no results

Discuss on the SimConnect SDK can be used by programmers to write add-on components for Prepar3D
Mike Schroeter
Lockheed Martin
Posts: 341
Joined: Thu Jan 12, 2012 7:05 pm

Post by Mike Schroeter »

That is correct. Use this for "non-realtime" moves.



Mike
DevSim
Posts: 141
Joined: Thu Jul 07, 2011 12:45 pm

Post by DevSim »

Thank you Mike,



I'll do that. My other question remains. How can I make sure from a SimConnect point of view, that I can let the user fly the plane again? As said, the SimStart Event isn't in synch with what is received altitude wise and also not in synch loading bar wise.



Thanks,

Devsim
Mike Schroeter
Lockheed Martin
Posts: 341
Joined: Thu Jan 12, 2012 7:05 pm

Post by Mike Schroeter »

I believe your high level dispatch callback should only recieve the SIMCONNECT_RECV_ID_EXTERNAL_SIM_SIMULATE data when you should be simulating. I believe this is how the SDK's ExternalSim sample is setup.



Mike
DevSim
Posts: 141
Joined: Thu Jul 07, 2011 12:45 pm

Post by DevSim »

Mike,



I tried to follow the example with the ExternalSim earlier and here's another thread I opened for that a while ago: http://www.prepar3d.com/forum-5/?mingle ... opic&t=601 Unfortunately, the thread stopped there and I couldn't get it to work. I receive other events I'm subscribed to - not the sim_simulate though.



Short: I couldn't get the callback to work inside my own DLL, connecting via SimConnect (connection method is TCP/IP V4).



Regards,

DevSim
Mike Schroeter
Lockheed Martin
Posts: 341
Joined: Thu Jan 12, 2012 7:05 pm

Post by Mike Schroeter »

Ok, I'm a little confused. Your other thread implies your dispatch callback function never gets called, but here you say you are actually receiving at least some events. My suggestion would be to investigate any differences between your implementation and the sample, which appears to handle your scenario appropriately as far as I can tell.



Mike

DevSim
Posts: 141
Joined: Thu Jul 07, 2011 12:45 pm

Post by DevSim »

Sorry, I wasn't 100% accurate in my statement.



What works: SimConnect_CallDispatch() from my own loop

What didn't work: Getting called by after registering the callback routine.



Might it be an issue, that my code runs in its own DLL, implemented in a C++ class within my own namespace? Or is the callback only being called if the DLL is loaded via DLL.XML on the machine running P3D?



Regards

DevSim
Mike Schroeter
Lockheed Martin
Posts: 341
Joined: Thu Jan 12, 2012 7:05 pm

Post by Mike Schroeter »

My assumption is that it shouldn't matter, as long as the function being registered in SimConnect_CallDispatch() is static.



Mike
DevSim
Posts: 141
Joined: Thu Jul 07, 2011 12:45 pm

Post by DevSim »

Here's what I just tried:



- I added the E.S.F.O Aircraft and selected it.

- I disabled the ExternalSimModule parameters in sim.cfg

- I compiled my externally running SimConnect dll with the same GUID as per sim.cfg

- I connected and registered as an external sim (SUCCESS) via TCP/IP v4

- I registered my static callback routine (SUCCESS)

- I didn't get a single call to the callback routine

- I got exceptions for all other SimConnect calls which I left as previously



I think I'm doing something wrong.

DevSim
Posts: 141
Joined: Thu Jul 07, 2011 12:45 pm

Post by DevSim »

Following up on SIMCONNECT_DATATYPE_INITPOSITION: I added this to the example code from ExternalSim.cpp upon receving on the create notification.



1st:

Code:
SimConnect_AddToDataDefinition(g_hSimConnect, INIT_DEF, "Initial Position", "NULL", SIMCONNECT_DATATYPE_INITPOSITION, 0);



2nd:

Code:
SIMCONNECT_DATA_INITPOSITION Init;
Init.Altitude = 5000.0;
Init.Latitude = 47.64210;
Init.Longitude = -122.13010;
Init.Pitch = 0.0;
Init.Bank = 0.0;
Init.Heading = 180.0;
Init.OnGround = 1;
Init.Airspeed = 0;

SimConnect_SetDataOnSimObject(g_hSimConnect, INIT_DEF, SIMCONNECT_OBJECT_ID_USER, 0, 0, sizeof(Init), &Init );



SimConnect_AddToDataDefinition() throws SIMCONNECT_EXCEPTION_NAME_UNRECOGNIZED followod by IMCONNECT_EXCEPTION_BLOCK_TIMEOUT.



What is SIMCONNECT_EXCEPTION_NAME_UNRECOGNIZED complaining about?



Mike Schroeter
Lockheed Martin
Posts: 341
Joined: Thu Jan 12, 2012 7:05 pm

Post by Mike Schroeter »

Not sure. There is nothing that strikes me as being obviously wrong. You didn't say whter the call to SimConnect_SetDataOnSimObject worked or not.



My suggestion would be to compile the ExternalSim project and get it to work there, then compare what you are doing differently.



Mike

DevSim
Posts: 141
Joined: Thu Jul 07, 2011 12:45 pm

Post by DevSim »

Hi Mike,



If the SimConnect_AddToDataDefinition() call throws, the init must throw, and yes, it did too.



I worked from the compiled ExternalSim.cpp, loaded it completely as in the SDK. It worked 100%. Then I removed the dll loading from the sim.cfg and compiled ExternalSim.cpp as an external standalone EXE. Then as described.



Next I'll try to load the new code via the sim.cfg as a DLL....
Locked