• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

SIMCONNECT_DATA_REQUEST_FLAG_CHANGED does not fire, (sometimes after a while).

Messages
53
Country
unitedkingdom
I first get the list of the AI aircrafts.

Code:
SimConnect_RequestDataOnSimObjectType(
..., REQUEST_1, DEFINITION_1, 
200000, 
SIMCONNECT_SIMOBJECT_TYPE_AIRCRAFT
);

Then in the call back function I add all the object IDs

Code:
...
case SIMCONNECT_RECV_ID_SIMOBJECT_DATA_BYTYPE:
{
  SIMCONNECT_RECV_SIMOBJECT_DATA_BYTYPE *pObjData = (SIMCONNECT_RECV_SIMOBJECT_DATA_BYTYPE*)pData;
  switch(pObjData->dwRequestID)
  {
    case REQUEST_1
    SimConnect_RequestDataOnSimObject
    ( 
    ..., REQUEST_2, DEFINITION_1, 
    ObjectId,
    SIMCONNECT_PERIOD_SECOND,
    SIMCONNECT_DATA_REQUEST_FLAG_CHANGED
    );


And my RECV ID section...

Code:
case SIMCONNECT_RECV_ID_SIMOBJECT_DATA:
{
  SIMCONNECT_RECV_SIMOBJECT_DATA *pObjData = (SIMCONNECT_RECV_SIMOBJECT_DATA*)pData;
  switch(pObjData->dwRequestID)
  {
    case REQUEST_2
    ...

I get no exceptions, and sometimes I get some data, most of the time I get no data.

As a test I am using the AI traffic object sample.
I can see the truck going up and down the runway, but I never get a notification when it happens.

What could be the problems.

Sims
 
Actually I am been silly, (not reading the doc again :p).

I am trying to add requests.
I thought you could have more than one object ID per request.
obviously that's not possible.
Code:
hr = SimConnect_RequestDataOnSimObject(hSimConnect, REQUEST_1, DEFINITION_1, dwID1, SIMCONNECT_PERIOD_SECOND,  SIMCONNECT_DATA_REQUEST_FLAG_CHANGED); 

hr = SimConnect_RequestDataOnSimObject(hSimConnect, REQUEST_1, DEFINITION_1, dwID2, SIMCONNECT_PERIOD_SECOND,  SIMCONNECT_DATA_REQUEST_FLAG_CHANGED);

But that begs the question, if I want to follow AI objects to I need to make a request for each one of them?

In itself it is not a problem, there are ways.
How can I make a request for more than one item at a time?

Sims
 
But that begs the question, if I want to follow AI objects to I need to make a request for each one of them?

Yes, of course. I make the same request for each AI aircraft I am notified of. Your code has to keep the ID and details tabulated, of course.

How can I make a request for more than one item at a time?

Each time you add an item by the AddToDataDefinition call, you are building up what will be sent to you by the one RequestData call (sorry for not using full API names. It gets a bit tiresome -- you know the ones).

If you don't use tagged data you get the same structure back -- your AddToDataDef calls would be exactly in the order of items in your structure. If you asking for a lot of stuff which may not change often, that is very wasteful, however. For instance, asking for the aircraft title and registration and destination, and so on, as well as its position, will mean that all of that is sent every time its position changes.

So, you should either use tagged data (each item is preceded by its tag number so you can process the data item by item), or you should split the frequently changed ones into different data definitions, and hence separate Request calls, from the seldom changed ones.

Regards

Pete
 
AddToDataDef is for individual fields, he's asking about getting the same data back for different AI Objects, and for that you do have to use a unique request ID for each request you send.

The way I handle this is to create an entry in my request enum def like this:

REQUEST_AI_DATA = 0x10000000,

and then use (REQUEST_AI_DATA + dwObjID) as the unique request ID.
 
AddToDataDef is for individual fields, he's asking about getting the same data back for different AI Objects, and for that you do have to use a unique request ID for each request you send.

Yes, of course. When I answered "I make the same request for each AI aircraft ..." I din't mean to imply that the request ID was the same. Sorry if I was misleading.

The way I handle this is to create an entry in my request enum def like this:
REQUEST_AI_DATA = 0x10000000,
and then use (REQUEST_AI_DATA + dwObjID) as the unique request ID.

Yes, I do a similar thing.

Most of my answer was to his second question, about more than one item at a time.

Best Regards

Pete
 
Yes, of course. When I answered "I make the same request for each AI aircraft ..." I din't mean to imply that the request ID was the same. Sorry if I was misleading.



Yes, I do a similar thing.

Most of my answer was to his second question, about more than one item at a time.

Best Regards

Pete

Thanks all or the replies.
Sorry if my questions where a bit misleading

Regards,

sims.
 
I took his more than one item at a time to mean more than one SimObject or ObjID at a time instead of more than one SimVar at a time.

That is indeed what I was trying to say. One objectID at a time.
In any case, all the replies were very useful.

Thanks

Sims
 
Back
Top