|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Sensor Assignment Manager. More...
#include <SensorAssignment.hpp>
Public Member Functions | |
| SensorAssignmentManager () | |
| ~SensorAssignmentManager ()=default | |
| bool | load_sensor_definitions (const std::string &config_path) |
| Load sensor definitions from config. | |
| void | set_static_board_ip (uint8_t board_id, const std::string &ip) |
| Set a static IP for a board from loaded configuration. | |
| std::string | assign_board_ip (uint8_t board_id, const std::string &mac_address, SystemState system_state, const std::string &source_ip="") |
| Assign IP address to board (called by FSW) If a static IP was set for this board_id, it will be used regardless of MAC/source_ip. | |
| bool | assign_sensors_to_board (uint8_t board_id, const std::vector< std::string > &sensor_ids, uint8_t start_channel=0) |
| Assign sensors to board (called by FSW). | |
| std::vector< uint8_t > | generate_board_config_packet (uint8_t board_id) const |
| Get board configuration for sending to board. | |
| std::optional< SensorAssignment > | get_sensor_assignment (const std::string &sensor_id) const |
| Get sensor assignment for a sensor ID. | |
| std::vector< SensorAssignment > | get_board_sensors (uint8_t board_id) const |
| Get all sensors for a board. | |
| std::vector< SensorAssignment > | get_system_sensors (SystemState state) const |
| Get all sensors for a system state. | |
| std::optional< BoardConfiguration > | get_board_config (uint8_t board_id) const |
| Get board configuration. | |
| bool | update_board_config_from_packet (uint8_t board_id, const uint8_t *data, size_t size) |
| Update board configuration from received packet. | |
| bool | load_assignments_from_config (const std::string &config_path) |
| Load assignments from config file. | |
| const std::map< std::string, PressureSensorSpec > & | get_pressure_sensor_specs () const |
| Get all pressure sensor specs. | |
| void | register_config_update_callback (std::function< void(uint8_t, const BoardConfiguration &)> callback) |
| Register callback for board configuration updates. | |
Private Member Functions | |
| std::string | calculate_ip_from_mac (const std::string &mac_address, SystemState state) const |
| SensorType | sensor_type_from_string (const std::string &type_str) const |
| std::string | sensor_type_to_string (SensorType type) const |
Private Attributes | |
| std::map< std::string, PressureSensorSpec > | pressure_sensor_specs_ |
| std::map< uint8_t, BoardConfiguration > | board_configs_ |
| std::map< uint8_t, std::string > | static_board_ips_ |
| std::map< std::string, SensorAssignment > | sensor_assignments_ |
| std::string | gse_base_ip_ |
| std::string | flight_base_ip_ |
| uint8_t | gse_ip_range_start_ |
| uint8_t | gse_ip_range_end_ |
| uint8_t | flight_ip_range_start_ |
| uint8_t | flight_ip_range_end_ |
| std::vector< std::function< void(uint8_t, const BoardConfiguration &)> > | config_callbacks_ |
Sensor Assignment Manager.
Manages sensor-to-board assignments, IP assignment from FSW, and configuration distribution to boards.
Definition at line 85 of file SensorAssignment.hpp.
| fsw::config::SensorAssignmentManager::SensorAssignmentManager | ( | ) |
Definition at line 16 of file SensorAssignment.cpp.
References flight_base_ip_, flight_ip_range_end_, flight_ip_range_start_, gse_base_ip_, gse_ip_range_end_, and gse_ip_range_start_.
|
default |
| std::string fsw::config::SensorAssignmentManager::assign_board_ip | ( | uint8_t | board_id, |
| const std::string & | mac_address, | ||
| SystemState | system_state, | ||
| const std::string & | source_ip = "" ) |
Assign IP address to board (called by FSW) If a static IP was set for this board_id, it will be used regardless of MAC/source_ip.
| board_id | Board identifier |
| mac_address | Board MAC address |
| system_state | GSE or FLIGHT |
| source_ip | IP address from which the heartbeat was received |
Definition at line 135 of file SensorAssignment.cpp.
References board_configs_, board_id, calculate_ip_from_mac(), fsw::config::GSE, sensor_assignments_, and static_board_ips_.
| bool fsw::config::SensorAssignmentManager::assign_sensors_to_board | ( | uint8_t | board_id, |
| const std::vector< std::string > & | sensor_ids, | ||
| uint8_t | start_channel = 0 ) |
Assign sensors to board (called by FSW).
| board_id | Board identifier |
| sensor_ids | List of sensor IDs to assign |
| start_channel | Starting channel ID on board |
Definition at line 208 of file SensorAssignment.cpp.
References board_configs_, board_id, fsw::config::SensorAssignment::board_id, fsw::config::BoardConfiguration::board_ip, fsw::config::SensorAssignment::board_ip, fsw::config::BoardConfiguration::board_port, fsw::config::SensorAssignment::board_port, fsw::config::SensorAssignment::channel_id, fsw::config::SensorAssignment::is_active, pressure_sensor_specs_, fsw::config::BoardConfiguration::primary_sensor_type, fsw::config::PT, sensor_assignments_, fsw::config::SensorAssignment::sensor_id, fsw::config::SensorAssignment::sensor_type, fsw::config::BoardConfiguration::sensors, and fsw::config::SensorAssignment::system_state.
|
private |
Definition at line 359 of file SensorAssignment.cpp.
References flight_base_ip_, flight_ip_range_end_, flight_ip_range_start_, fsw::config::GSE, gse_base_ip_, gse_ip_range_end_, gse_ip_range_start_, and state.
Referenced by assign_board_ip().
| std::vector< uint8_t > fsw::config::SensorAssignmentManager::generate_board_config_packet | ( | uint8_t | board_id | ) | const |
Get board configuration for sending to board.
| board_id | Board identifier |
Definition at line 261 of file SensorAssignment.cpp.
References board_configs_, board_id, daq::create_sensor_config_packet(), and MAX_PACKET_SIZE.
| std::optional< BoardConfiguration > fsw::config::SensorAssignmentManager::get_board_config | ( | uint8_t | board_id | ) | const |
Get board configuration.
Definition at line 332 of file SensorAssignment.cpp.
References board_configs_, and board_id.
| std::vector< SensorAssignment > fsw::config::SensorAssignmentManager::get_board_sensors | ( | uint8_t | board_id | ) | const |
Get all sensors for a board.
Definition at line 314 of file SensorAssignment.cpp.
References board_configs_, and board_id.
|
inline |
Get all pressure sensor specs.
Definition at line 164 of file SensorAssignment.hpp.
References pressure_sensor_specs_.
| std::optional< SensorAssignment > fsw::config::SensorAssignmentManager::get_sensor_assignment | ( | const std::string & | sensor_id | ) | const |
Get sensor assignment for a sensor ID.
Definition at line 305 of file SensorAssignment.cpp.
References sensor_assignments_.
| std::vector< SensorAssignment > fsw::config::SensorAssignmentManager::get_system_sensors | ( | SystemState | state | ) | const |
Get all sensors for a system state.
Definition at line 322 of file SensorAssignment.cpp.
References sensor_assignments_, and state.
| bool fsw::config::SensorAssignmentManager::load_assignments_from_config | ( | const std::string & | config_path | ) |
Load assignments from config file.
| bool fsw::config::SensorAssignmentManager::load_sensor_definitions | ( | const std::string & | config_path | ) |
Load sensor definitions from config.
Definition at line 25 of file SensorAssignment.cpp.
References fsw::config::FLIGHT, fsw::config::GSE, and pressure_sensor_specs_.
| void fsw::config::SensorAssignmentManager::register_config_update_callback | ( | std::function< void(uint8_t, const BoardConfiguration &)> | callback | ) |
Register callback for board configuration updates.
Definition at line 420 of file SensorAssignment.cpp.
References config_callbacks_.
|
private |
Definition at line 389 of file SensorAssignment.cpp.
References fsw::config::ACTUATOR, fsw::config::LC, fsw::config::PT, fsw::config::RTD, and fsw::config::TC.
|
private |
Definition at line 403 of file SensorAssignment.cpp.
References fsw::config::ACTUATOR, fsw::config::LC, fsw::config::PT, fsw::config::RTD, and fsw::config::TC.
| void fsw::config::SensorAssignmentManager::set_static_board_ip | ( | uint8_t | board_id, |
| const std::string & | ip ) |
Set a static IP for a board from loaded configuration.
| board_id | Board identifier |
| ip | The IP address configured for this board |
Definition at line 114 of file SensorAssignment.cpp.
References board_configs_, board_id, sensor_assignments_, and static_board_ips_.
| bool fsw::config::SensorAssignmentManager::update_board_config_from_packet | ( | uint8_t | board_id, |
| const uint8_t * | data, | ||
| size_t | size ) |
Update board configuration from received packet.
Definition at line 341 of file SensorAssignment.cpp.
References board_configs_, board_id, and config_callbacks_.
|
private |
Definition at line 179 of file SensorAssignment.hpp.
Referenced by assign_board_ip(), assign_sensors_to_board(), generate_board_config_packet(), get_board_config(), get_board_sensors(), set_static_board_ip(), and update_board_config_from_packet().
|
private |
Definition at line 196 of file SensorAssignment.hpp.
Referenced by register_config_update_callback(), and update_board_config_from_packet().
|
private |
Definition at line 189 of file SensorAssignment.hpp.
Referenced by calculate_ip_from_mac(), and SensorAssignmentManager().
|
private |
Definition at line 193 of file SensorAssignment.hpp.
Referenced by calculate_ip_from_mac(), and SensorAssignmentManager().
|
private |
Definition at line 192 of file SensorAssignment.hpp.
Referenced by calculate_ip_from_mac(), and SensorAssignmentManager().
|
private |
Definition at line 188 of file SensorAssignment.hpp.
Referenced by calculate_ip_from_mac(), and SensorAssignmentManager().
|
private |
Definition at line 191 of file SensorAssignment.hpp.
Referenced by calculate_ip_from_mac(), and SensorAssignmentManager().
|
private |
Definition at line 190 of file SensorAssignment.hpp.
Referenced by calculate_ip_from_mac(), and SensorAssignmentManager().
|
private |
Definition at line 176 of file SensorAssignment.hpp.
Referenced by assign_sensors_to_board(), get_pressure_sensor_specs(), and load_sensor_definitions().
|
private |
Definition at line 185 of file SensorAssignment.hpp.
Referenced by assign_board_ip(), assign_sensors_to_board(), get_sensor_assignment(), get_system_sensors(), and set_static_board_ip().
|
private |
Definition at line 182 of file SensorAssignment.hpp.
Referenced by assign_board_ip(), and set_static_board_ip().