My goal is to have a system where I can have 4 devices, lets say a PC with multiple displays, and 3 tablets where I can differentiate between them so that if one of the devices wants to control the system, the other 3 should be in “View Mode”.
So when one of the devices that wants to request control, a popup would appear to the one in control, and either accept or decline the request.
The goal is to use one project and one page view for all of the devices.
I tried a hardcoded way by duplicating the page views for each device, and got it to work by using custom props and scripting,
but if the project were to expand, the time and effort to change a single thing would mean that I need to change it for every single device.
What is the best course of action in this situation?
Create a document tag to contain a session ID and a expiration timestamp.
A session would take control by writing its own session ID and some near-future timestamp, but allowed only when now() is after the current expires TS.
Each session would maintain an "InControl" boolean session property that simply checks for the matching ID in the document tag, and that now() is still less than the expire TS.
Don't bother having prompts to take control. Just have a short expiration.
What pturmel said, but if operatorA is in control and operatorB wants to take over control then a popup is probably still wise to implement to notify them of wanting control. So do what he said but then also build a messagehandler that pushes the ask popup to the session ID that is currently in control and then they can do the accept or deny. You'll also need to include a default timeout incase someone has control on their iPad but they leave unattended.
That being said, is it actually necessary to lock others out of controlling the system at the same time? We have many facilities with multiple control stations or even iPads that operators use and generally speaking they don't have any issues using them simultaneously. If there's ever any maintenance work that dictates something needs to stay shutdown then there should be physical controls in place rather than just software procedures.