Skip to content

[MCCS-1794] defer connecting

Drew Devereux requested to merge mccs-1794-defer-connect into main

Currently, the ska-low-mccs-pasd PasdBusDevice Modbus driver establishes a connection to the hardware as soon as it is initialised, and that connection is never closed.

Initially, the connection to the hardware is not used for anything. No communication occurs until we put the device online, at which point the device starts polling the hardware. Similarly, when we take the PasdBusDevice offline, we stop polling the hardware, but the connection to the hardware is not closed.

This is problematic because if we want to use some other client to monitor and control the PaSD hardware (for example, the Curtin scripts) we expect that we can simply take the MCCS devices offline, and this will clear the way for something else to take over. But in fact, taking the MCCS devices offline does not close the connection to the hardware, and the hardware only permits one connection at a time. Hence, we have to completely tear MCCS down if we want to use some other client to monitor and control the PaSD hardware.

This MR modifies the PasdBusDevice Modbus driver so that it does not establish a connection until put online, and closes that connection when taken offline.

It also modifies the JSON driver and corresponding simulator service to use long-lived connections, like the Modbus driver does. This was not necessary to deliver the story, but having a simulator with long-lived connections will be needed later, when we move the unit testing over to use the Modbus driver.

Edited by Drew Devereux

Merge request reports