|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
What a running script is allowed to do to the world. More...
#include <ScriptRunner.hpp>
Public Attributes | |
| std::function< void(const std::string &role, int pos)> | set_valve |
| Command one valve by canonical config name. | |
| std::function< void(State target)> | transition |
| Leave the state. | |
| std::function< bool(const std::string &role, double &psi)> | read_pressure |
| Read a calibrated pressure by canonical role name. | |
| std::string | state_name |
| Where the script's log lines are attributed. | |
What a running script is allowed to do to the world.
Everything the interpreter can reach is a callback supplied by its owner, so the language has no way to touch anything that was not handed to it — and so the whole runner is testable against recording stubs, with no sockets and no boards.
Definition at line 22 of file ScriptRunner.hpp.
| std::function<bool(const std::string& role, double& psi)> sequencer::ScriptEnv::read_pressure |
Read a calibrated pressure by canonical role name.
Returns false when the value must not be acted on — no reading yet, too old, or flagged uncalibrated. The script then FAILS rather than proceeding on a stand-in number: an uncalibrated PT publishes a smooth, plausible 0.0 PSI, and a "cycle until 90% of COPV" loop reading zero computes a target of zero and does nothing at all, successfully.
Definition at line 45 of file ScriptRunner.hpp.
Referenced by sequencer::SequencerService::makeScriptEnv().
| std::function<void(const std::string& role, int pos)> sequencer::ScriptEnv::set_valve |
Command one valve by canonical config name.
Expected to set the script position AND send immediately, exactly as debug manual control does.
Definition at line 25 of file ScriptRunner.hpp.
Referenced by sequencer::SequencerService::makeScriptEnv().
| std::string sequencer::ScriptEnv::state_name |
Where the script's log lines are attributed.
Definition at line 48 of file ScriptRunner.hpp.
Referenced by sequencer::SequencerService::makeScriptEnv(), and sequencer::ScriptRunner::run().
Leave the state.
TERMINAL: the runner unwinds its whole stack after calling this and the thread exits.
The owner must post this rather than perform it inline — the worker that handles the transition joins this thread, so doing the transition synchronously from here is a guaranteed deadlock (the same one documented for the fire timer's expiry callback).
Definition at line 35 of file ScriptRunner.hpp.
Referenced by sequencer::SequencerService::makeScriptEnv(), and sequencer::ScriptRunner::run().