|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
A connection to a stand-in T7, for tests and for running the bridge with no hardware (t7_bridge --fake). More...
#include <T7Stream.hpp>
Classes | |
| struct | Options |
Public Member Functions | |
| FakeT7Device () | |
| FakeT7Device (Options o) | |
| void | open (const std::string &ip) override |
| int64_t | serial_number () override |
| void | write_names (const std::vector< std::string > &names, const std::vector< double > &values) override |
| std::vector< double > | read_names (const std::vector< std::string > &names) override |
| Command-response reads; only valid while no stream is running. | |
| double | stream_start (const std::vector< std::string > &scan_names, int scans_per_read, double scan_rate_hz) override |
| Starts the stream; returns the scan rate the device will actually run at. | |
| Backlog | stream_read (std::vector< double > &data) override |
| Fills data with scans_per_read scans, channels interleaved. | |
| void | stream_stop () override |
| void | close () override |
| FakeT7Unit & | unit () |
| double | volts (int ain, double t) const |
| Volts on ain at t: Options::signal, else the default described above. | |
| Public Member Functions inherited from fsw::t7::T7Device | |
| virtual | ~T7Device ()=default |
Public Attributes | |
| std::string | opened_ip |
| std::vector< std::pair< std::string, double > > | writes |
| std::vector< std::string > | scan_names |
| std::vector< std::string > | reads |
| every name read_names() was asked for | |
| bool | streaming = false |
| this handle's own stream is running | |
| bool | closed = false |
| int | stop_calls = 0 |
Private Member Functions | |
| bool | owns_stream () const |
Private Attributes | |
| Options | opt_ |
| int | scans_per_read_ = 0 |
| double | rate_ = 0.0 |
| uint64_t | scan_ = 0 |
| int | reads_ = 0 |
| uint64_t | my_stream_ = 0 |
| unit stream_id this handle started; 0 = none | |
A connection to a stand-in T7, for tests and for running the bridge with no hardware (t7_bridge --fake).
By default each AIN reads a slow sine offset by its AIN number, so the GUI shows distinct lines; Options::signal replaces that. AIN14 (the internal temperature sensor) reads 25 C and TEMPERATURE_DEVICE_K agrees with it. Every call is recorded so a test can check what the session asked of the device. Device state (stream, registers) is the shared FakeT7Unit's.
Modelled on LJM and the T7 firmware: a stream start, a configuration write or a command-response read while the unit streams fails with STREAM_IS_ACTIVE (2605); a stop with no stream answers STREAM_NOT_RUNNING (1303); writing STREAM_ENABLE = 0 stops the stream from any handle; reading a stream another handle stopped times out (1306).
Definition at line 249 of file T7Stream.hpp.
|
inline |
Definition at line 270 of file T7Stream.hpp.
References FakeT7Device().
Referenced by FakeT7Device().
|
explicit |
Definition at line 318 of file T7Stream.cpp.
|
overridevirtual |
Implements fsw::t7::T7Device.
Definition at line 455 of file T7Stream.cpp.
References closed, my_stream_, and streaming.
Referenced by engine.layerx.pool.WorkerPool::__exit__().
|
overridevirtual |
Implements fsw::t7::T7Device.
Definition at line 323 of file T7Stream.cpp.
|
inlineprivate |
Definition at line 308 of file T7Stream.hpp.
References my_stream_, and opt_.
Referenced by stream_read(), stream_stop(), and write_names().
|
overridevirtual |
Command-response reads; only valid while no stream is running.
Implements fsw::t7::T7Device.
Definition at line 360 of file T7Stream.cpp.
References fsw::t7::ljm_code::kStreamIsActive, opt_, reads, and volts().
|
overridevirtual |
|
overridevirtual |
Fills data with scans_per_read scans, channels interleaved.
Blocks until they arrive.
Implements fsw::t7::T7Device.
Definition at line 407 of file T7Stream.cpp.
References fsw::t7::kDummyValue, fsw::t7::ljm_code::kStreamNotInitialized, fsw::t7::ljm_code::kSynchronizationTimeout, my_stream_, opt_, owns_stream(), rate_, reads_, scan_, scan_names, scans_per_read_, streaming, and volts().
|
overridevirtual |
Starts the stream; returns the scan rate the device will actually run at.
Implements fsw::t7::T7Device.
Definition at line 386 of file T7Stream.cpp.
References fsw::t7::ljm_code::kStreamIsActive, my_stream_, opt_, rate_, scan_, scan_names, scans_per_read_, and streaming.
|
overridevirtual |
Implements fsw::t7::T7Device.
Definition at line 436 of file T7Stream.cpp.
References fsw::t7::ljm_code::kStreamNotInitialized, fsw::t7::ljm_code::kStreamNotRunning, my_stream_, opt_, owns_stream(), stop_calls, and streaming.
|
inline |
Definition at line 294 of file T7Stream.hpp.
References opt_.
| double fsw::t7::FakeT7Device::volts | ( | int | ain, |
| double | t ) const |
Volts on ain at t: Options::signal, else the default described above.
Definition at line 378 of file T7Stream.cpp.
References fsw::t7::kAin14NominalOffsetK, fsw::t7::kAin14SlopeKPerV, fsw::t7::kCjcAin, and opt_.
Referenced by read_names(), and stream_read().
|
overridevirtual |
Implements fsw::t7::T7Device.
Definition at line 333 of file T7Stream.cpp.
References fsw::t7::ljm_code::kStreamIsActive, opt_, owns_stream(), streaming, and writes.
| bool fsw::t7::FakeT7Device::closed = false |
Definition at line 291 of file T7Stream.hpp.
|
private |
unit stream_id this handle started; 0 = none
Definition at line 307 of file T7Stream.hpp.
Referenced by close(), owns_stream(), stream_read(), stream_start(), and stream_stop().
| std::string fsw::t7::FakeT7Device::opened_ip |
Definition at line 286 of file T7Stream.hpp.
|
private |
Definition at line 302 of file T7Stream.hpp.
Referenced by FakeT7Device(), open(), owns_stream(), read_names(), serial_number(), stream_read(), stream_start(), stream_stop(), unit(), volts(), and write_names().
|
private |
Definition at line 304 of file T7Stream.hpp.
Referenced by stream_read(), and stream_start().
| std::vector<std::string> fsw::t7::FakeT7Device::reads |
every name read_names() was asked for
Definition at line 289 of file T7Stream.hpp.
Referenced by main(), and read_names().
|
private |
Definition at line 306 of file T7Stream.hpp.
Referenced by stream_read().
|
private |
Definition at line 305 of file T7Stream.hpp.
Referenced by stream_read(), and stream_start().
| std::vector<std::string> fsw::t7::FakeT7Device::scan_names |
Definition at line 288 of file T7Stream.hpp.
Referenced by stream_read(), and stream_start().
|
private |
Definition at line 303 of file T7Stream.hpp.
Referenced by stream_read(), and stream_start().
| int fsw::t7::FakeT7Device::stop_calls = 0 |
Definition at line 292 of file T7Stream.hpp.
Referenced by main(), and stream_stop().
| bool fsw::t7::FakeT7Device::streaming = false |
this handle's own stream is running
Definition at line 290 of file T7Stream.hpp.
Referenced by close(), main(), stream_read(), stream_start(), stream_stop(), and write_names().
| std::vector<std::pair<std::string, double> > fsw::t7::FakeT7Device::writes |
Definition at line 287 of file T7Stream.hpp.
Referenced by main(), and write_names().