STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
fsw::elodin Namespace Reference

Namespaces

namespace  anonymous_namespace{DatabaseConfig.cpp}

Classes

struct  BoardChannels
 Per-board channel info for board-namespaced entity registration. More...
class  DatabaseConfig
 Register sensor table schemas with Elodin database. More...
class  ElodinClient
 Standalone Elodin database client. More...
struct  PacketHeader
class  SubscriptionTracker

Enumerations

enum class  PacketType : uint8_t { MSG = 0 , TABLE = 1 , TIME_SERIES = 2 }

Functions

std::vector< std::pair< uint8_t, uint8_t > > raw_sensor_tables (const std::vector< BoardChannels > &pt_boards, const std::vector< BoardChannels > &act_boards, const std::vector< BoardChannels > &tc_boards, const std::vector< BoardChannels > &rtd_boards, const std::vector< BoardChannels > &lc_boards, const std::vector< BoardChannels > &enc_boards)
 Elodin table ids (hi, lo) for the RAW sensor VTables the given boards publish.
std::vector< std::pair< uint8_t, uint8_t > > calibrated_sensor_tables (const std::vector< BoardChannels > &pt_boards, const std::vector< BoardChannels > &tc_boards, const std::vector< BoardChannels > &rtd_boards, const std::vector< BoardChannels > &lc_boards, const std::vector< BoardChannels > &enc_boards, const std::vector< BoardChannels > &act_boards)
 Elodin table ids for the CALIBRATED VTables, matching register_calibrated_tables() (same encoding as above with a +0x10 channel offset, and ACT at 0x31 rather than 0x30).
std::vector< std::pair< uint8_t, uint8_t > > ball_valve_raw_tables (const std::vector< BoardChannels > &bv_boards)
std::vector< std::pair< uint8_t, uint8_t > > ball_valve_calibrated_tables (const std::vector< BoardChannels > &bv_boards)
std::vector< std::pair< uint8_t, uint8_t > > ball_valve_cmd_tables (const std::vector< BoardChannels > &bv_boards)
std::array< uint8_t, 2 > message_id_to_packet_id (uint16_t message_id)
uint32_t fnv1a_hash_32 (std::string_view str)
uint64_t fnv1a_hash_64 (std::string_view str)
uint16_t fnv1a_hash_16_xor (std::string_view str)
std::array< uint8_t, 2 > msg_id (std::string_view str)
uint64_t component_id (std::string_view str)
bool is_error_response (const uint8_t *pkt, size_t len)
 ErrorResponse: header len(4) | ty(1) | msg id [0xE0, 0x1D] | request id(1).
template<typename T>
static bool send_msg (ElodinClient &client, T msg)
static bool register_raw_sensor_vtable (ElodinClient &client, uint8_t type_hi, uint8_t channel_id, uint64_t entity_id, const std::string &entity_name, const std::string &adc_field_name)
static bool register_calibrated_vtable (ElodinClient &client, uint8_t type_hi, uint8_t pkt_lo, uint64_t entity_id, const std::string &entity_name, const std::string &cal_field_name, const std::string &raw_field_name)
static bool register_actuator_state_vtable (ElodinClient &client, uint8_t type_hi, uint8_t channel_id, uint64_t entity_id, const std::string &entity_name)
static bool register_self_test_vtable (ElodinClient &client, uint8_t board_id, uint8_t sensor_id)
static bool register_sequencer_vtable (ElodinClient &client)
static bool register_calibration_command_vtable (ElodinClient &client)

Variables

constexpr uint8_t kBallValveRawHi = 0x33
 Ball valve boards (BALL_VALVE) have their own type_hi bytes, so a valve never shares a key with an ACTUATOR board on the same board_id % 10 slot (board 71 and actuator board 11 are both slot 1): 0x33 raw position counts BV<n>.CH<m> raw_adc_counts 0x34 calibrated position BV<n>_Cal.CH<m> position_pct, raw_adc, cal_status 0x35 commanded state BV_CMD.B<n>.CH<m> actuator_state (0 closed, 1 open) Low bytes follow the other boards: raw/cmd (n-1)*0x20 + m, calibrated (n-1)*0x20 + 0x10 + m.
constexpr uint8_t kBallValveCalHi = 0x34
constexpr uint8_t kBallValveCmdHi = 0x35
constexpr std::pair< uint8_t, uint8_t > kTableSequencerState {0x50, 0x00}
 Non-sensor tables, named rather than spelled as literals at each use site.
constexpr std::pair< uint8_t, uint8_t > kTableControllerState {0x43, 0x00}
constexpr std::pair< uint8_t, uint8_t > kTableCalibrationCommand {0x46, 0x00}
static constexpr uint8_t SELF_TEST_HIGH_BASE = 0x60
static constexpr uint8_t SELF_TEST_MAX_SENSOR = 15

Enumeration Type Documentation

◆ PacketType

enum class fsw::elodin::PacketType : uint8_t
strong
Enumerator
MSG 
TABLE 
TIME_SERIES 

Definition at line 14 of file ElodinProtocol.hpp.

Function Documentation

◆ ball_valve_calibrated_tables()

std::vector< std::pair< uint8_t, uint8_t > > fsw::elodin::ball_valve_calibrated_tables ( const std::vector< BoardChannels > & bv_boards)

Definition at line 606 of file DatabaseConfig.cpp.

References kBallValveCalHi.

Referenced by main().

◆ ball_valve_cmd_tables()

std::vector< std::pair< uint8_t, uint8_t > > fsw::elodin::ball_valve_cmd_tables ( const std::vector< BoardChannels > & bv_boards)

Definition at line 613 of file DatabaseConfig.cpp.

References kBallValveCmdHi.

Referenced by main().

◆ ball_valve_raw_tables()

std::vector< std::pair< uint8_t, uint8_t > > fsw::elodin::ball_valve_raw_tables ( const std::vector< BoardChannels > & bv_boards)

Definition at line 599 of file DatabaseConfig.cpp.

References kBallValveRawHi.

Referenced by main(), and main().

◆ calibrated_sensor_tables()

std::vector< std::pair< uint8_t, uint8_t > > fsw::elodin::calibrated_sensor_tables ( const std::vector< BoardChannels > & pt_boards,
const std::vector< BoardChannels > & tc_boards,
const std::vector< BoardChannels > & rtd_boards,
const std::vector< BoardChannels > & lc_boards,
const std::vector< BoardChannels > & enc_boards,
const std::vector< BoardChannels > & act_boards )

Elodin table ids for the CALIBRATED VTables, matching register_calibrated_tables() (same encoding as above with a +0x10 channel offset, and ACT at 0x31 rather than 0x30).

Definition at line 188 of file DatabaseConfig.cpp.

Referenced by main().

◆ component_id()

uint64_t fsw::elodin::component_id ( std::string_view str)
inline

Definition at line 61 of file ElodinProtocol.hpp.

References fnv1a_hash_64().

◆ fnv1a_hash_16_xor()

uint16_t fsw::elodin::fnv1a_hash_16_xor ( std::string_view str)
inline

Definition at line 49 of file ElodinProtocol.hpp.

References fnv1a_hash_32().

Referenced by msg_id().

◆ fnv1a_hash_32()

uint32_t fsw::elodin::fnv1a_hash_32 ( std::string_view str)
inline

Definition at line 25 of file ElodinProtocol.hpp.

Referenced by fnv1a_hash_16_xor().

◆ fnv1a_hash_64()

uint64_t fsw::elodin::fnv1a_hash_64 ( std::string_view str)
inline

Definition at line 37 of file ElodinProtocol.hpp.

Referenced by component_id().

◆ is_error_response()

bool fsw::elodin::is_error_response ( const uint8_t * pkt,
size_t len )
inline

ErrorResponse: header len(4) | ty(1) | msg id [0xE0, 0x1D] | request id(1).

Definition at line 32 of file SubscriptionTracker.hpp.

Referenced by main(), and test_error_response_is_recognised().

◆ message_id_to_packet_id()

std::array< uint8_t, 2 > fsw::elodin::message_id_to_packet_id ( uint16_t message_id)
inline

Definition at line 205 of file ElodinClient.hpp.

Referenced by fsw::elodin::ElodinClient::serialize_msg().

◆ msg_id()

std::array< uint8_t, 2 > fsw::elodin::msg_id ( std::string_view str)
inline

Definition at line 56 of file ElodinProtocol.hpp.

References fnv1a_hash_16_xor().

Referenced by fsw::elodin::ElodinClient::publish().

◆ raw_sensor_tables()

std::vector< std::pair< uint8_t, uint8_t > > fsw::elodin::raw_sensor_tables ( const std::vector< BoardChannels > & pt_boards,
const std::vector< BoardChannels > & act_boards,
const std::vector< BoardChannels > & tc_boards,
const std::vector< BoardChannels > & rtd_boards,
const std::vector< BoardChannels > & lc_boards,
const std::vector< BoardChannels > & enc_boards )

Elodin table ids (hi, lo) for the RAW sensor VTables the given boards publish.

The (type_hi, (board_number-1)*0x20 + channel) encoding is defined by DatabaseConfig::register_tables(), so it lives here beside it rather than being re-derived by every subscriber. Built from the boards actually in config — the version this replaced guessed boards 1-8 x channels 1-10 and subscribed to 480 tables whether they existed or not.

Definition at line 174 of file DatabaseConfig.cpp.

Referenced by main(), and main().

◆ register_actuator_state_vtable()

bool fsw::elodin::register_actuator_state_vtable ( ElodinClient & client,
uint8_t type_hi,
uint8_t channel_id,
uint64_t entity_id,
const std::string & entity_name )
static

◆ register_calibrated_vtable()

bool fsw::elodin::register_calibrated_vtable ( ElodinClient & client,
uint8_t type_hi,
uint8_t pkt_lo,
uint64_t entity_id,
const std::string & entity_name,
const std::string & cal_field_name,
const std::string & raw_field_name )
static

◆ register_calibration_command_vtable()

bool fsw::elodin::register_calibration_command_vtable ( ElodinClient & client)
static

Definition at line 571 of file DatabaseConfig.cpp.

References send_msg().

Referenced by fsw::elodin::DatabaseConfig::register_non_sensor_tables().

◆ register_raw_sensor_vtable()

bool fsw::elodin::register_raw_sensor_vtable ( ElodinClient & client,
uint8_t type_hi,
uint8_t channel_id,
uint64_t entity_id,
const std::string & entity_name,
const std::string & adc_field_name )
static

◆ register_self_test_vtable()

bool fsw::elodin::register_self_test_vtable ( ElodinClient & client,
uint8_t board_id,
uint8_t sensor_id )
static

◆ register_sequencer_vtable()

bool fsw::elodin::register_sequencer_vtable ( ElodinClient & client)
static

Definition at line 536 of file DatabaseConfig.cpp.

References send_msg().

Referenced by fsw::elodin::DatabaseConfig::register_non_sensor_tables().

◆ send_msg()

Variable Documentation

◆ kBallValveCalHi

uint8_t fsw::elodin::kBallValveCalHi = 0x34
constexpr

◆ kBallValveCmdHi

uint8_t fsw::elodin::kBallValveCmdHi = 0x35
constexpr

◆ kBallValveRawHi

uint8_t fsw::elodin::kBallValveRawHi = 0x33
constexpr

Ball valve boards (BALL_VALVE) have their own type_hi bytes, so a valve never shares a key with an ACTUATOR board on the same board_id % 10 slot (board 71 and actuator board 11 are both slot 1): 0x33 raw position counts BV<n>.CH<m> raw_adc_counts 0x34 calibrated position BV<n>_Cal.CH<m> position_pct, raw_adc, cal_status 0x35 commanded state BV_CMD.B<n>.CH<m> actuator_state (0 closed, 1 open) Low bytes follow the other boards: raw/cmd (n-1)*0x20 + m, calibrated (n-1)*0x20 + 0x10 + m.

Definition at line 57 of file DatabaseConfig.hpp.

Referenced by ball_valve_raw_tables(), main(), and fsw::elodin::DatabaseConfig::register_ball_valve_tables().

◆ kTableCalibrationCommand

std::pair<uint8_t, uint8_t> fsw::elodin::kTableCalibrationCommand {0x46, 0x00}
constexpr

Definition at line 71 of file DatabaseConfig.hpp.

Referenced by main().

◆ kTableControllerState

std::pair<uint8_t, uint8_t> fsw::elodin::kTableControllerState {0x43, 0x00}
constexpr

Definition at line 70 of file DatabaseConfig.hpp.

◆ kTableSequencerState

std::pair<uint8_t, uint8_t> fsw::elodin::kTableSequencerState {0x50, 0x00}
constexpr

Non-sensor tables, named rather than spelled as literals at each use site.

Definition at line 69 of file DatabaseConfig.hpp.

Referenced by anonymous_namespace{heartbeat_service_main.cpp}::elodinThread(), and anonymous_namespace{stacklight_service_main.cpp}::elodinThread().

◆ SELF_TEST_HIGH_BASE

uint8_t fsw::elodin::SELF_TEST_HIGH_BASE = 0x60
staticconstexpr

Definition at line 494 of file DatabaseConfig.cpp.

Referenced by register_self_test_vtable().

◆ SELF_TEST_MAX_SENSOR

uint8_t fsw::elodin::SELF_TEST_MAX_SENSOR = 15
staticconstexpr