|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
The stand-in T7 itself, as distinct from a connection to it. More...
#include <T7Stream.hpp>
Public Member Functions | |
| FakeT7Unit (std::string state_path="") | |
| double | reg (const std::string &name, double fallback=0.0) const |
| void | set_reg (const std::string &name, double value) |
| void | power_cycle () |
| Power off and on: no stream, registers back to defaults. | |
| void | load () |
| from state_path; no-op without one or when the file is absent | |
| void | save () const |
Public Attributes | |
| bool | streaming = false |
| uint64_t | stream_id = 0 |
| bumped by every stream start; a handle reads only its own stream | |
| std::vector< std::string > | scan_names |
| the running (or last) stream's scan list | |
| std::vector< std::pair< std::string, double > > | registers |
| last value written per name | |
| uint64_t | starts = 0 |
| uint64_t | stops = 0 |
Private Attributes | |
| std::string | path_ |
The stand-in T7 itself, as distinct from a connection to it.
A real T7 keeps streaming after the process that started the stream dies, and keeps every register it was written; the next process to open it finds both (synnaxlabs/synnax#4142 saw every stream start fail with STREAM_IS_ACTIVE until the leftover stream was stopped). So the stream and the registers live here, not in a FakeT7Device handle: a handle destroyed without a stop — a killed bridge — leaves the unit streaming.
With a state_path the unit is a file, re-read before and written after every operation, so separate t7_bridge processes (--fake-state) see one device: kill -9 the bridge and the next one finds the stream still running. Without one it lives as long as the object.
Definition at line 213 of file T7Stream.hpp.
|
explicit |
Definition at line 231 of file T7Stream.cpp.
| void fsw::t7::FakeT7Unit::load | ( | ) |
from state_path; no-op without one or when the file is absent
Definition at line 260 of file T7Stream.cpp.
References path_, registers, scan_names, starts, stops, stream_id, and streaming.
Referenced by FakeT7Unit(), and engine.layerx.measurements.MeasurementStore::get().
| void fsw::t7::FakeT7Unit::power_cycle | ( | ) |
Power off and on: no stream, registers back to defaults.
Definition at line 251 of file T7Stream.cpp.
References registers, save(), scan_names, and streaming.
| double fsw::t7::FakeT7Unit::reg | ( | const std::string & | name, |
| double | fallback = 0.0 ) const |
Definition at line 235 of file T7Stream.cpp.
| void fsw::t7::FakeT7Unit::save | ( | ) | const |
Definition at line 295 of file T7Stream.cpp.
References path_, r, registers, scan_names, starts, stops, stream_id, and streaming.
Referenced by combined_fsw_gui.ConfigManager::load(), power_cycle(), combined_fsw_gui.ConfigManager::set_actuator_label(), and combined_fsw_gui.ConfigManager::set_sensor_label().
| void fsw::t7::FakeT7Unit::set_reg | ( | const std::string & | name, |
| double | value ) |
Definition at line 242 of file T7Stream.cpp.
|
private |
Definition at line 232 of file T7Stream.hpp.
Referenced by FakeT7Unit(), load(), and save().
| std::vector<std::pair<std::string, double> > fsw::t7::FakeT7Unit::registers |
last value written per name
Definition at line 220 of file T7Stream.hpp.
Referenced by load(), power_cycle(), reg(), save(), and set_reg().
| std::vector<std::string> fsw::t7::FakeT7Unit::scan_names |
the running (or last) stream's scan list
Definition at line 219 of file T7Stream.hpp.
Referenced by load(), power_cycle(), and save().
| uint64_t fsw::t7::FakeT7Unit::starts = 0 |
Definition at line 221 of file T7Stream.hpp.
| uint64_t fsw::t7::FakeT7Unit::stops = 0 |
Definition at line 221 of file T7Stream.hpp.
| uint64_t fsw::t7::FakeT7Unit::stream_id = 0 |
bumped by every stream start; a handle reads only its own stream
Definition at line 218 of file T7Stream.hpp.
| bool fsw::t7::FakeT7Unit::streaming = false |
Definition at line 217 of file T7Stream.hpp.
Referenced by load(), power_cycle(), and save().