levylabpitt / Instrument-Framework

An object-oriented framework for LabVIEW based on JKI SMOs.
BSD 3-Clause "New" or "Revised" License
4 stars 7 forks source link

Fix blocking calls in Handle Command #84

Closed ciozi137 closed 1 year ago

ciozi137 commented 2 years ago

image

ciozi137 commented 1 year ago

@ciozi137 what is the status of this issue?

ciozi137 commented 1 year ago

Handle Command.vi is still called by Instrument.lvclass:Process.vi. The "SetMagnetField" Sequence is handled by Instrument.Oxford1820.lvclass:Process.vi. I think that the issue described above needs to be better handled by the Instrument Framework

Perhaps Handle Command.vi should simly call "Send Message to Process" to forward the command to the child process. But how to deal with callbacks? As it is Handle command waits until there is a response to give. Not a great architecture.

ciozi137 commented 1 year ago

PPMS uses its process.vi to communicate with the hardware. Messages are sent to it by PPMS:MessagetoProcess.vi; Replies go to Instrument:MessageToProcess.vi [Instrument broadcasts to the public via Instrument:MessageFromProcess.vi].

Oxford 1820 and VRM use their process.vi to handle sequences of commands (Heater, match PS current, wait, etc)

I think the solution should be to move all hardware communication to the child process.vi (like PPMS does); the child process can also be used to handle sequences (like 1820 and VRM) especially if non-blocking calls are avoided (see Wait sequence). Handle Command.vi should do simple message parsing: it can respond with data if it has, or forward messages to the child to execute.

ciozi137 commented 1 year ago
ciozi137 commented 1 year ago
ciozi137 commented 1 year ago
ciozi137 commented 1 year ago

Error handling updated in Instrument.lvclass:process.vi and Instrument.Framework-Template.lvclass:process.vi

ciozi137 commented 1 year ago

CreatePrivateEvents, GetPrivateEvents, DestroyPrivateEvents, SendMessageToProcess created, configured, and called in Instrument.Framework-Template.lvclass:process.vi

ciozi137 commented 1 year ago

Instrument.lvclass:process.vi: "Instrument: Open" and "Instrument: Close" are now disabled by default. If the user needs them (they have not moved their open/close to the child process) they can enable the states. But this is NOT recommended.

ciozi137 commented 1 year ago

Open and Close are states in the Template:process.vi. Handle Command is perfectly capable to forward the command to the child process if the developer would like to go that route.