|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
FSW Configuration Manager. More...
#include <FSWConfigManager.hpp>
Public Member Functions | |
| FSWConfigManager () | |
| ~FSWConfigManager ()=default | |
| bool | initialize (const std::string &bind_address, uint16_t bind_port) |
| Initialize FSW config manager. | |
| std::string | process_board_heartbeat (const daq::PacketHeader &header, const daq::BoardHeartbeatPacket &body, const std::string &source_ip, const std::string &mac_address) |
| Process board heartbeat and assign IP if needed. | |
| bool | assign_sensors (uint8_t board_id, const std::vector< std::string > &sensor_ids, uint8_t start_channel=0) |
| Assign sensors to a board. | |
| bool | send_config_to_board (uint8_t board_id) |
| Send configuration packet to board. | |
| void | send_configs_to_all_boards () |
| Send configuration to all configured boards. | |
| config::SensorAssignmentManager & | get_assignment_manager () |
| Get sensor assignment manager. | |
| void | set_system_state (config::SystemState state) |
| Set system state (GSE or FLIGHT). | |
| void | set_board_static_ip (uint8_t board_id, const std::string &ip) |
| Configure static board IP address loaded from config.toml. | |
| config::SystemState | get_system_state () const |
| Get current system state. | |
Private Member Functions | |
| config::SystemState | infer_system_state (uint8_t board_id, const std::string &source_ip) const |
Private Attributes | |
| std::string | bind_address_ |
| Local address board config packets are sent from — the same NIC this manager listens on. | |
| config::SensorAssignmentManager | assignment_manager_ |
| std::unique_ptr< daq_comms::transport::UDPSocket > | config_socket_ |
| config::SystemState | current_state_ |
| std::map< uint8_t, bool > | boards_configured_ |
FSW Configuration Manager.
Manages IP assignment and sensor configuration distribution to boards. This runs on the FSW side and assigns configurations to boards.
Definition at line 27 of file FSWConfigManager.hpp.
| fsw::fsw::FSWConfigManager::FSWConfigManager | ( | ) |
Definition at line 14 of file FSWConfigManager.cpp.
References current_state_, and FSWConfigManager().
Referenced by FSWConfigManager().
|
default |
References initialize().
| bool fsw::fsw::FSWConfigManager::assign_sensors | ( | uint8_t | board_id, |
| const std::vector< std::string > & | sensor_ids, | ||
| uint8_t | start_channel = 0 ) |
Assign sensors to a board.
| board_id | Board ID |
| sensor_ids | List of sensor IDs to assign |
| start_channel | Starting channel on board |
Definition at line 110 of file FSWConfigManager.cpp.
References assign_sensors(), assignment_manager_, board_id, send_config_to_board(), and success.
Referenced by assign_sensors().
|
inline |
Get sensor assignment manager.
Definition at line 82 of file FSWConfigManager.hpp.
References assignment_manager_.
|
inline |
Get current system state.
Definition at line 99 of file FSWConfigManager.hpp.
References current_state_.
|
private |
Definition at line 195 of file FSWConfigManager.cpp.
References board_id, current_state_, fsw::config::FLIGHT, fsw::config::GSE, and infer_system_state().
Referenced by infer_system_state(), and process_board_heartbeat().
| bool fsw::fsw::FSWConfigManager::initialize | ( | const std::string & | bind_address, |
| uint16_t | bind_port ) |
Initialize FSW config manager.
| bind_address | Address to bind UDP socket for sending configs |
| bind_port | Port for sending configs |
Definition at line 17 of file FSWConfigManager.cpp.
References assignment_manager_, bind_address_, config_socket_, current_state_, fsw::config::GSE, and initialize().
Referenced by initialize(), and ~FSWConfigManager().
| std::string fsw::fsw::FSWConfigManager::process_board_heartbeat | ( | const daq::PacketHeader & | header, |
| const daq::BoardHeartbeatPacket & | body, | ||
| const std::string & | source_ip, | ||
| const std::string & | mac_address ) |
Process board heartbeat and assign IP if needed.
| heartbeat | Parsed heartbeat packet |
| source_ip | Source IP address |
| mac_address | Board MAC address |
Definition at line 37 of file FSWConfigManager.cpp.
References assignment_manager_, board_id, fsw::config::FLIGHT, infer_system_state(), and process_board_heartbeat().
Referenced by process_board_heartbeat().
| bool fsw::fsw::FSWConfigManager::send_config_to_board | ( | uint8_t | board_id | ) |
Send configuration packet to board.
| board_id | Board ID |
Definition at line 122 of file FSWConfigManager.cpp.
References assignment_manager_, bind_address_, board_id, boards_configured_, daq_comms::transport::UDPSocket::send(), and send_config_to_board().
Referenced by assign_sensors(), send_config_to_board(), and send_configs_to_all_boards().
| void fsw::fsw::FSWConfigManager::send_configs_to_all_boards | ( | ) |
Send configuration to all configured boards.
Definition at line 172 of file FSWConfigManager.cpp.
References assignment_manager_, board_id, send_config_to_board(), and send_configs_to_all_boards().
Referenced by send_configs_to_all_boards().
| void fsw::fsw::FSWConfigManager::set_board_static_ip | ( | uint8_t | board_id, |
| const std::string & | ip ) |
Configure static board IP address loaded from config.toml.
Definition at line 189 of file FSWConfigManager.cpp.
References assignment_manager_, board_id, and set_board_static_ip().
Referenced by set_board_static_ip().
| void fsw::fsw::FSWConfigManager::set_system_state | ( | config::SystemState | state | ) |
Set system state (GSE or FLIGHT).
Definition at line 183 of file FSWConfigManager.cpp.
References current_state_, fsw::config::GSE, set_system_state(), and state.
Referenced by set_system_state().
|
private |
Definition at line 104 of file FSWConfigManager.hpp.
Referenced by assign_sensors(), get_assignment_manager(), initialize(), process_board_heartbeat(), send_config_to_board(), send_configs_to_all_boards(), and set_board_static_ip().
|
private |
Local address board config packets are sent from — the same NIC this manager listens on.
Empty/"0.0.0.0" leaves the egress interface to the kernel.
Definition at line 42 of file FSWConfigManager.hpp.
Referenced by initialize(), and send_config_to_board().
|
private |
Definition at line 109 of file FSWConfigManager.hpp.
Referenced by send_config_to_board().
|
private |
Definition at line 105 of file FSWConfigManager.hpp.
Referenced by initialize().
|
private |
Definition at line 106 of file FSWConfigManager.hpp.
Referenced by FSWConfigManager(), get_system_state(), infer_system_state(), initialize(), and set_system_state().