Logic Machine Forum
eibd singleton - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: eibd singleton (/showthread.php?tid=3692)



eibd singleton - buuuudzik - 19.11.2021

Openrb, maybe you can consider creating eibd singleton which allows simple use it in scripts or apps?


e.g.

Code:
if not client then
  client = new EibdClient(listenerId, addressList, tagList, eventListener)
// or maybe something like this
  client = new EibdClient(clientId, eventListener)
end

client.step()


Such solution would simplify for the user this interface and could be more lightweight than creating separate deamons in separate scripts.

I know that preparing reliable solution for this task could be not so easy but you have all tools and this would simplify some examples, add some order and structure and would be easier to use especially for not advanced users.

Maybe you could introduce some new module into UI (like Scenes) for managing clients and their configurations (listened adressList, tagLists etc.) and in the script the user could only pass info which client he want use and pass eventListener to it and use .step() method?


RE: eibd singleton - admin - 19.11.2021

I don't see how can it be more lightweight than using scripts. In most cases there's no big difference from event scripts apart from keeping local variable values between calls. Even with simplified API it will still be too complicated for most users. You can create a user library if you use this construct often.


RE: eibd singleton - buuuudzik - 19.11.2021

It will using script but restarting of script will not restart the eibd deamon and recreate addresses list. And you could easily reuse working eibd deamon in other script.

When I am thinking now that tag list could be enough (it is well known interface but only it is not so much convenient in the UI when you have too much tags or longer names) but such UI tab should have possibility to create eibd deamon, connect it to the selected tag list and stop and start.

If it is about comparison between event-based script and resident+eibd of course keeping local variables is the main reason where it is chosen, choosing it is an optimisation used where there is a problem with performance of event-based (central statuses calculation is a good example for this).