Jump to content
The simFlight Network Forums

Recommended Posts

Posted

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

Posted

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

  • 2 weeks later...
Posted

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.