Jump to content
The simFlight Network Forums

Dynamic and duplicate Offsets


Recommended Posts

Hi

When I have to create offsets dynamically (from user input) and I have multiple offset with the same address and size, will this result in duplicate calls to FSUIPC and should I manage the offsets in a cache?

Thanks
jaxx

Link to post
Share on other sites

Hi Jaxx,

Each offset is treated as unique by the DLL, even if 2 or more have the same address and size. This means the Process() call will add all the duplicates to the request file that is sent to FSUIPC. (assuming they are in the same group). FSUIPC will then fill in the same data for all the duplicate offsets.

The time taken to fill in data for most offsets is negligible compared to the overall communication process. So having a few duplicate offsets isn't doing much harm.

Quote

should I manage the offsets in a cache?

If this is only to prevent a few duplicate offsets then it's probably not worth it.

It would only be a concern if you're getting like 50 duplicates of the same offset, or if your requesting many offsets (>200) and they are all duplicated.

If it's just 2 or 3 duplicates of a couple of offsets then the extra time taken up by the duplicates will be barely measurable.

Paul

Link to post
Share on other sites
  • 2 weeks later...

Thanks,

I tried it without a cache, but due to the SDK of the hardware I'm using that was not really feasible. Basically every item that is currently shown on the display is represented by an object that is only created while it's visible and then destroyed again, due to this lifecycle it would create thousands or more offsets if I would create them when needed. Also the Offsets are dynamic and can change on the fly if the user changes the settings.

So now I'm using a cache where other instances can subscribe/unsubscribe to when they want to listen on an offset and this also takes care of the polling, only having offsets connected that have a listener and notifying its subscribers only if one of the offsets they want to listen to has changed.

That is for monitoring offset, for offsets that I need to read or write directly on a user interaction I'm now just using a dedicated group that I use for a single read or write Process and then delete again.

jaxx

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.