Retrieve Gateway settings from Module Custom Function

Gurus,

  1. I've used ignition-module-tools to boilerplate my module (this is my 1st ever module in Ignition),
  2. with the help of the Gateway Webpage (Home Connect) Example, I was able to have a settings page for my module.
  3. I've played around scripting-function ( SDK Example ) and was successful to hook my needed function to my designer and through RPC I am able to invoke my gateway function from the designer.
  4. I see that Gateway Context must be injected to retrieve my settings ( please correct me if my understanding is wrong )

APISettingsRecord thatOneRecord = context.getLocalPersistenceInterface().find(APISettingsRecord.META, 0L);

how do I inject Gateway Context or what are the possible path/s I can retrieve my module gateway settings?

Thank you for your help and cooperation as usual

Regards.

Your module is given a gateway context during setup. You need to capture that and provide it to all of the pieces of your module that need it. Using a static field, typically with a static getter method, is common.

2 Likes

Thanks for enlightening here, appreciated.