STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
fsw::t7::FakeT7Unit Class Reference

The stand-in T7 itself, as distinct from a connection to it. More...

#include <T7Stream.hpp>

Collaboration diagram for fsw::t7::FakeT7Unit:
[legend]

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_

Detailed Description

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.

Constructor & Destructor Documentation

◆ FakeT7Unit()

fsw::t7::FakeT7Unit::FakeT7Unit ( std::string state_path = "")
explicit

Definition at line 231 of file T7Stream.cpp.

References load(), and path_.

Member Function Documentation

◆ load()

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().

◆ power_cycle()

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.

◆ reg()

double fsw::t7::FakeT7Unit::reg ( const std::string & name,
double fallback = 0.0 ) const

Definition at line 235 of file T7Stream.cpp.

References r, and registers.

◆ save()

◆ set_reg()

void fsw::t7::FakeT7Unit::set_reg ( const std::string & name,
double value )

Definition at line 242 of file T7Stream.cpp.

References r, and registers.

Member Data Documentation

◆ path_

std::string fsw::t7::FakeT7Unit::path_
private

Definition at line 232 of file T7Stream.hpp.

Referenced by FakeT7Unit(), load(), and save().

◆ registers

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().

◆ scan_names

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().

◆ starts

uint64_t fsw::t7::FakeT7Unit::starts = 0

Definition at line 221 of file T7Stream.hpp.

Referenced by load(), and save().

◆ stops

uint64_t fsw::t7::FakeT7Unit::stops = 0

Definition at line 221 of file T7Stream.hpp.

Referenced by load(), and save().

◆ stream_id

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.

Referenced by load(), and save().

◆ streaming

bool fsw::t7::FakeT7Unit::streaming = false

Definition at line 217 of file T7Stream.hpp.

Referenced by load(), power_cycle(), and save().


The documentation for this class was generated from the following files: