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

Classes

struct  SensorDataChunkCollection
 Represents a single data chunk with timestamp and sensor datapoints. More...
struct  SensorConfigData
 High-level representation of a parsed Sensor Config payload. More...

Enumerations

enum class  PacketType : uint8_t {
  BOARD_HEARTBEAT = 1 , SERVER_HEARTBEAT = 2 , SENSOR_DATA = 3 , ACTUATOR_COMMAND = 4 ,
  SENSOR_CONFIG = 5 , ACTUATOR_CONFIG = 6 , ABORT = 7 , ABORT_DONE = 8 ,
  CLEAR_ABORT = 9 , PWM_ACTUATOR_COMMAND = 10 , NO_CONNECTION_ABORT = 11 , SELF_TEST = 12 ,
  ENVIRONMENTAL_DATA = 13 , STACKLIGHT_COMMAND = 14 , LOGS = 15
}
 Defines the type of data contained in a packet. More...
enum class  BoardState : uint8_t {
  SETUP = 1 , ACTIVE = 2 , CONNECTION_LOSS_DETECTED = 3 , NO_CONNECTION_ABORT = 4 ,
  NO_CONN_ABORT_FOLLOWER = 5 , PT_ABORT = 6 , NO_PT_ABORT = 7 , ABORT_FINISHED = 8 ,
  STANDALONE_ABORT = 9 , SELF_TEST = 10
}
 Defines the operational state of a board. More...
enum class  EngineState : uint8_t {
  SAFE = 0 , PRESSURIZING = 1 , LOX_FILL = 2 , FIRING = 3 ,
  POST_FIRE = 4
}
 Defines the overall state of the engine system. More...

Functions

struct __attribute__ ((packed)) PacketHeader
 The standard 6-byte header preceding every packet.
size_t create_board_heartbeat_packet (const BoardHeartbeatPacket &data, uint32_t timestamp_ms, uint8_t *buffer, size_t buffer_size)
 Creates a complete Board Heartbeat packet in the provided buffer.
size_t create_sensor_data_packet (const std::vector< SensorDataChunkCollection > &chunks, const uint8_t num_sensors, uint32_t timestamp_ms, uint8_t *buffer, size_t buffer_size)
 Creates a complete Sensor Data packet in the provided buffer.
size_t create_abort_done_packet (uint32_t timestamp_ms, uint8_t *buffer, size_t buffer_size)
 Creates a simple Abort Done packet.
size_t create_actuator_command_packet (const std::vector< ActuatorCommand > &commands, uint32_t timestamp_ms, uint8_t *buffer, size_t buffer_size)
 Creates a complete Actuator Command packet in the provided buffer.
size_t create_self_test_packet (uint8_t adc_good, const std::vector< SelfTestResult > &results, uint32_t timestamp_ms, uint8_t *buffer, size_t buffer_size)
 Creates a complete Self Test packet in the provided buffer.
size_t create_environmental_data_packet (float temperature_c, uint32_t pressure_pa, float humidity_rh, uint32_t timestamp_ms, uint8_t *buffer, size_t buffer_size)
 Creates a complete Environmental Data packet in the provided buffer.
size_t create_stacklight_command_packet (const StacklightCommandPacket &data, uint32_t timestamp_ms, uint8_t *buffer, size_t buffer_size)
 Creates a complete Stacklight Command packet in the provided buffer.
bool parse_board_heartbeat_packet (const uint8_t *buffer, size_t buffer_size, PacketHeader &header_out, BoardHeartbeatPacket &data_out)
 Parses a Board Heartbeat packet from buffer.
bool parse_server_heartbeat_packet (const uint8_t *buffer, size_t buffer_size, PacketHeader &header_out, ServerHeartbeatPacket &data_out)
 Parses a Server Heartbeat packet from buffer.
bool parse_environmental_data_packet (const uint8_t *buffer, size_t buffer_size, PacketHeader &header_out, EnvironmentalDataPacket &data_out)
 Parses an Environmental Data packet from buffer.
bool parse_stacklight_command_packet (const uint8_t *buffer, size_t buffer_size, PacketHeader &header_out, StacklightCommandPacket &data_out)
 Parses a Stacklight Command packet from buffer.
bool parse_sensor_data_packet (const uint8_t *buffer, size_t buffer_size, PacketHeader &header_out, std::vector< SensorDataChunkCollection > &chunks_out)
 Parses a Sensor Data packet from buffer into chunk collections.
bool parse_abort_done_packet (const uint8_t *buffer, size_t buffer_size, PacketHeader &header_out)
 Parses an Abort Done packet from buffer.
bool parse_actuator_command_packet (const uint8_t *buffer, size_t buffer_size, PacketHeader &header_out, std::vector< ActuatorCommand > &commands_out)
 Parses an Actuator Command packet from buffer.
bool parse_self_test_packet (const uint8_t *buffer, size_t buffer_size, PacketHeader &header_out, uint8_t &adc_good_out, std::vector< SelfTestResult > &results_out)
 Parses a Self Test packet from buffer.
size_t create_pwm_actuator_packet (const std::vector< PWMActuatorCommand > &commands, uint32_t timestamp_ms, uint8_t *buffer, size_t buffer_size)
 Creates a complete PWM Actuator Command packet in the provided buffer.
bool parse_pwm_actuator_packet (const uint8_t *buffer, size_t buffer_size, PacketHeader &header_out, std::vector< PWMActuatorCommand > &commands_out)
 Parses a PWM Actuator Command packet from buffer.
size_t create_sensor_config_packet (const std::vector< uint8_t > &sensor_ids, uint8_t reference_voltage, bool necessary_for_abort, uint32_t controller_ip, uint8_t enable_serial_printing, uint32_t timestamp_ms, uint8_t *buffer, size_t buffer_size)
 Creates a complete Sensor Config packet in the provided buffer.
bool parse_sensor_config_packet (const uint8_t *buffer, size_t buffer_size, PacketHeader &header_out, std::vector< uint8_t > &sensor_ids_out, uint8_t &reference_voltage_out, bool &necessary_for_abort_out, uint32_t &controller_ip_out, uint8_t &enable_serial_printing_out)
 Parses a Sensor Config packet from buffer.
size_t create_actuator_config_packet (uint8_t is_abort_controller, const std::vector< AbortActuatorLocation > &abort_actuators, const std::vector< AbortPTLocation > &abort_pts, uint8_t enable_serial_printing, uint32_t timestamp_ms, uint8_t *buffer, size_t buffer_size)
 Creates a complete Actuator Config packet in the provided buffer.
bool parse_actuator_config_packet (const uint8_t *buffer, size_t buffer_size, PacketHeader &header_out, uint8_t &is_abort_controller_out, std::vector< AbortActuatorLocation > &abort_actuators_out, std::vector< AbortPTLocation > &abort_pts_out, uint8_t &enable_serial_printing_out)
 Parses an Actuator Config packet from buffer.
size_t create_log_packet (uint8_t flags, const uint8_t *text, uint16_t text_len, uint32_t timestamp_ms, uint8_t *buffer, size_t buffer_size)
 Creates a LOGS packet (type 15): buffered board log text for the server.
bool parse_log_packet (const uint8_t *buffer, size_t buffer_size, PacketHeader &header_out, uint8_t &flags_out, const uint8_t *&text_out, uint16_t &text_len_out)
 Parses a LOGS packet (type 15) from buffer.

Enumeration Type Documentation

◆ BoardState

enum class daq::BoardState : uint8_t
strong

Defines the operational state of a board.

Enumerator
SETUP 
ACTIVE 
CONNECTION_LOSS_DETECTED 
NO_CONNECTION_ABORT 
NO_CONN_ABORT_FOLLOWER 
PT_ABORT 
NO_PT_ABORT 
ABORT_FINISHED 
STANDALONE_ABORT 
SELF_TEST 

Definition at line 31 of file DiabloEnums.h.

◆ EngineState

enum class daq::EngineState : uint8_t
strong

Defines the overall state of the engine system.

This is communicated from the server to the boards.

Enumerator
SAFE 
PRESSURIZING 
LOX_FILL 
FIRING 
POST_FIRE 

Definition at line 48 of file DiabloEnums.h.

◆ PacketType

enum class daq::PacketType : uint8_t
strong

Defines the type of data contained in a packet.

Enumerator
BOARD_HEARTBEAT 
SERVER_HEARTBEAT 
SENSOR_DATA 
ACTUATOR_COMMAND 
SENSOR_CONFIG 
ACTUATOR_CONFIG 
ABORT 
ABORT_DONE 
CLEAR_ABORT 
PWM_ACTUATOR_COMMAND 
NO_CONNECTION_ABORT 
SELF_TEST 
ENVIRONMENTAL_DATA 
STACKLIGHT_COMMAND 
LOGS 

Definition at line 10 of file DiabloEnums.h.

Function Documentation

◆ __attribute__()

struct daq::__attribute__ ( (packed) )

The standard 6-byte header preceding every packet.

Body of a stacklight command packet (after PacketHeader).

Body of an Environmental Data packet (after PacketHeader).

Represents a self test result for a single sensor.

Body of a Self Test packet.

Defines the location of a pressure transducer needed for an abort sequence, and its pressure threshold as an ADC code.

Single byte count of abort PT entries; appears after N actuator blocks.

Defines one abort actuator: location (IP), ID, vent state, and abort state.

Fixed-size header of an Actuator Config packet for abort configuration.

Represents a PWM command for a single actuator.

Body of a PWM Actuator Command packet.

Represents a command for a single actuator.

Body of an Actuator Command packet.

Fixed-size header of a Sensor Config packet.

Represents a single sensor reading.

Chunk of a Sensor Data packet.

Body of a Sensor Data packet.

Body of a Server Heartbeat packet.

Body of a Board Heartbeat packet.

Sent from a board to the server.

Sent from the server to all boards.

Contains the fixed-size fields.

Note
The actual packet sent over Ethernet will have this struct followed by a variable number of Chunks and SensorDatapoints.
In the actual packet sent over Ethernet, each chunk will be followed by num_sensors defined in the data packet

Used in the SensorDataPacket.

Full packet layout (after standard PacketHeader):

  • This struct (1 byte): num_sensors (N)
  • N x uint8_t sensor_id
  • uint8_t reference_voltage
  • uint8_t necessary_for_abort (0 or 1)
  • If necessary_for_abort: uint32_t controller_ip (4 bytes)
  • uint8_t enable_serial_printing
Note
The actual packet will have this struct followed by N ActuatorCommands.
The actual packet will have this struct followed by N PWMActuatorCommands.

Full packet layout (after standard PacketHeader):

  • This struct (2 bytes): is_abort_controller, num_abort_actuators (N)
  • N x AbortActuatorLocation (7 bytes each)
  • 1 byte: num_abort_pts (X)
  • X x AbortPTLocation (9 bytes each)
  • 1 byte: enable_serial_printing

7 bytes on wire: 4B IP + 1B actuator_id + 1B vent_state + 1B abort_state.

9 bytes on wire: 4B IP + 1B sensor_id + 4B pressure_threshold_adc.

Note
The actual packet will have this struct followed by N SelfTestResults.

On-wire layout (after PacketHeader): adc_good (1 byte) – 1 if TDAC self-test passed, 0 if failed num_sensors (1 byte) – number of SelfTestResult entries that follow N x SelfTestResult

Temperature in degrees Celsius, absolute pressure in Pa, relative humidity in RH.

Order: red, yellow, green, buzzer. Each byte is 1 = on, 0 = off.

Definition at line 1 of file DiabloPackets.h.

References __attribute__(), and board_id.

Referenced by __attribute__().

◆ create_abort_done_packet()

size_t daq::create_abort_done_packet ( uint32_t timestamp_ms,
uint8_t * buffer,
size_t buffer_size )

Creates a simple Abort Done packet.

This packet is sent from a board to the server to acknowledge that it has successfully completed its abort sequence. It has no data payload.

Parameters
timestamp_msValue for PacketHeader.timestamp.
bufferThe output buffer to write the final packet into.
buffer_sizeThe total size of the output buffer.
Returns
The number of bytes written (always sizeof(PacketHeader)), or 0 on error.

Definition at line 93 of file DiabloPacketUtils.cpp.

References ABORT_DONE.

Referenced by test_abort_done_buffer_too_small(), and test_abort_done_roundtrip().

◆ create_actuator_command_packet()

size_t daq::create_actuator_command_packet ( const std::vector< ActuatorCommand > & commands,
uint32_t timestamp_ms,
uint8_t * buffer,
size_t buffer_size )

Creates a complete Actuator Command packet in the provided buffer.

Packet layout: PacketHeader + ActuatorCommandPacket + N ActuatorCommand.

Parameters
commandsThe list of actuator commands to serialize.
timestamp_msValue for PacketHeader.timestamp.
bufferThe output buffer to write the packet into.
buffer_sizeThe size of the provided buffer.
Returns
The total size of the created packet, or 0 on error.

Definition at line 115 of file DiabloPacketUtils.cpp.

References ACTUATOR_COMMAND, commands, DIABLO_COMMS_VERSION, and ptr.

Referenced by applyAbortToAllActuators(), applyVentToAllActuators(), fsw::control::PressureStateMachine::sendActuatorCommandUDP(), sequencer::ActuatorCommander::sendBatch(), test_actuator_command_empty_list(), and test_actuator_command_roundtrip().

◆ create_actuator_config_packet()

size_t daq::create_actuator_config_packet ( uint8_t is_abort_controller,
const std::vector< AbortActuatorLocation > & abort_actuators,
const std::vector< AbortPTLocation > & abort_pts,
uint8_t enable_serial_printing,
uint32_t timestamp_ms,
uint8_t * buffer,
size_t buffer_size )

Creates a complete Actuator Config packet in the provided buffer.

Packet layout: standard PacketHeader (ACTUATOR_CONFIG, version, timestamp), then config body: is_abort_controller (1B), N (1B), N x AbortActuatorLocation (7B each), then X (1B), X x AbortPTLocation (9B each), then enable_serial_printing (1B).

Parameters
is_abort_controller1 if this board is the abort controller, 0 otherwise.
abort_actuatorsList of abort actuator entries (N entries, 7 bytes each).
abort_ptsList of abort PT entries (X entries, 9 bytes each).
enable_serial_printing1 to enable serial printing, 0 to disable.
timestamp_msValue for PacketHeader.timestamp.
bufferThe output buffer to write the packet into.
buffer_sizeThe size of the provided buffer.
Returns
The total size of the created packet, or 0 on error (e.g. buffer too small).

Definition at line 648 of file DiabloPacketUtils.cpp.

References ACTUATOR_CONFIG, config, DIABLO_COMMS_VERSION, is_abort_controller, MAX_ABORT_ACTUATORS, MAX_ABORT_PTS, and ptr.

Referenced by test_actuator_config_no_pts(), and test_actuator_config_roundtrip().

◆ create_board_heartbeat_packet()

size_t daq::create_board_heartbeat_packet ( const BoardHeartbeatPacket & data,
uint32_t timestamp_ms,
uint8_t * buffer,
size_t buffer_size )

Creates a complete Board Heartbeat packet in the provided buffer.

This is a fixed-size packet sent periodically by a board to the server to indicate it is online and operational.

Parameters
dataThe heartbeat data to encode (firmware SHA-256 hash, board ID, state, etc.).
timestamp_msValue for PacketHeader.timestamp (e.g. Arduino millis() on firmware).
bufferThe output buffer to write the final packet into.
buffer_sizeThe total size of the output buffer, used for safety checks.
Returns
The number of bytes written to the buffer (always sizeof(PacketHeader) + sizeof(BoardHeartbeatPacket)), or 0 on error.

Definition at line 13 of file DiabloPacketUtils.cpp.

References BOARD_HEARTBEAT, and DIABLO_COMMS_VERSION.

Referenced by loop(), sendBoardHeartbeat(), sendBoardHeartbeat(), sendBoardHeartbeat(), SensorHotfire::sendBoardHeartbeat(), sendBoardHeartbeatTo(), sendHeartbeat(), sendHeartbeatPacket(), test_actuator_heartbeat_board_id_preserved(), test_actuator_heartbeat_state_mapping_table(), test_board_heartbeat_buffer_too_small(), test_board_heartbeat_parse_wrong_type(), test_board_heartbeat_roundtrip(), test_log_packet_parse_wrong_type(), and test_sensor_heartbeat_state_mapping_table().

◆ create_environmental_data_packet()

size_t daq::create_environmental_data_packet ( float temperature_c,
uint32_t pressure_pa,
float humidity_rh,
uint32_t timestamp_ms,
uint8_t * buffer,
size_t buffer_size )

Creates a complete Environmental Data packet in the provided buffer.

Packet layout: PacketHeader + EnvironmentalDataPacket (temperature float °C, pressure uint32 Pa, humidity float RH).

Definition at line 201 of file DiabloPacketUtils.cpp.

References DIABLO_COMMS_VERSION, ENVIRONMENTAL_DATA, and ptr.

Referenced by loop().

◆ create_log_packet()

size_t daq::create_log_packet ( uint8_t flags,
const uint8_t * text,
uint16_t text_len,
uint32_t timestamp_ms,
uint8_t * buffer,
size_t buffer_size )

Creates a LOGS packet (type 15): buffered board log text for the server.

Layout: PacketHeader (LOGS) + flags (1B) + text_len (2B, uint16 LE) + text bytes. The board is identified server-side by UDP source IP (static 192.168.2.<board_id>), so no board_id field. text is newline-delimited log lines blobbed together.

Parameters
flagsbit0 = TRUNCATED (some lines dropped on buffer overflow); rest reserved.
textLog text bytes (ASCII, '
'-delimited).
text_lenNumber of text bytes.
timestamp_msValue for PacketHeader.timestamp.
bufferOutput buffer.
buffer_sizeSize of the output buffer.
Returns
Total bytes written (sizeof(PacketHeader) + 3 + text_len), or 0 on error.

Definition at line 780 of file DiabloPacketUtils.cpp.

References DIABLO_COMMS_VERSION, LOGS, and ptr.

Referenced by flushLogs(), SensorHotfire::flushLogs(), test_log_packet_buffer_too_small(), test_log_packet_layout(), test_log_packet_parse_truncated(), and test_log_packet_roundtrip().

◆ create_pwm_actuator_packet()

size_t daq::create_pwm_actuator_packet ( const std::vector< PWMActuatorCommand > & commands,
uint32_t timestamp_ms,
uint8_t * buffer,
size_t buffer_size )

Creates a complete PWM Actuator Command packet in the provided buffer.

Packet layout: PacketHeader + PWMActuatorCommandPacket + N PWMActuatorCommand.

Parameters
commandsThe list of PWM actuator commands to serialize.
timestamp_msValue for PacketHeader.timestamp.
bufferThe output buffer to write the packet into.
buffer_sizeThe size of the provided buffer.
Returns
The total size of the created packet, or 0 on error.

Definition at line 447 of file DiabloPacketUtils.cpp.

References commands, DIABLO_COMMS_VERSION, ptr, and PWM_ACTUATOR_COMMAND.

Referenced by test_pwm_actuator_roundtrip().

◆ create_self_test_packet()

size_t daq::create_self_test_packet ( uint8_t adc_good,
const std::vector< SelfTestResult > & results,
uint32_t timestamp_ms,
uint8_t * buffer,
size_t buffer_size )

Creates a complete Self Test packet in the provided buffer.

Packet layout: PacketHeader + SelfTestPacket (adc_good + num_sensors) + N SelfTestResult.

Parameters
adc_good1 if the TDAC self-test passed (ADC is good), 0 if it failed.
resultsThe list of per-sensor self-test results to serialize.
timestamp_msValue for PacketHeader.timestamp.
bufferThe output buffer to write the packet into.
buffer_sizeThe size of the provided buffer.
Returns
The total size of the created packet, or 0 on error.

Definition at line 157 of file DiabloPacketUtils.cpp.

References DIABLO_COMMS_VERSION, ptr, and SELF_TEST.

Referenced by SensorHotfire::loop(), runSelfTest(), test_self_test_adc_bad(), and test_self_test_roundtrip().

◆ create_sensor_config_packet()

size_t daq::create_sensor_config_packet ( const std::vector< uint8_t > & sensor_ids,
uint8_t reference_voltage,
bool necessary_for_abort,
uint32_t controller_ip,
uint8_t enable_serial_printing,
uint32_t timestamp_ms,
uint8_t * buffer,
size_t buffer_size )

Creates a complete Sensor Config packet in the provided buffer.

Packet layout: PacketHeader + num_sensors (1B) + N sensor_ids (1B each) + reference_voltage (1B) + necessary_for_abort (1B) + [controller_ip (4B) if necessary_for_abort] + enable_serial_printing (1B).

Parameters
sensor_idsList of sensor IDs to include in the config.
reference_voltageADC reference voltage selection.
necessary_for_abortWhether this board's sensors are needed for abort.
controller_ipIP of the abort controller (only written when necessary_for_abort is true).
enable_serial_printing1 to enable serial printing, 0 to disable.
timestamp_msValue for PacketHeader.timestamp.
bufferThe output buffer to write the packet into.
buffer_sizeThe size of the provided buffer.
Returns
The total size of the created packet, or 0 on error.

Definition at line 519 of file DiabloPacketUtils.cpp.

References DIABLO_COMMS_VERSION, ptr, and SENSOR_CONFIG.

Referenced by fsw::config::SensorAssignmentManager::generate_board_config_packet(), test_sensor_config_empty_sensors(), test_sensor_config_roundtrip_with_abort(), test_sensor_config_roundtrip_without_abort(), test_sensor_process_sensor_config_packet(), and test_sensor_process_sensor_config_with_abort().

◆ create_sensor_data_packet()

size_t daq::create_sensor_data_packet ( const std::vector< SensorDataChunkCollection > & chunks,
const uint8_t num_sensors,
uint32_t timestamp_ms,
uint8_t * buffer,
size_t buffer_size )

Creates a complete Sensor Data packet in the provided buffer.

This is a variable-size packet containing readings from one or more sensor data chunks. It consists of a header, a fixed-size body specifying the number of chunks and sensors, followed by the actual sensor data chunks and their datapoints.

Parameters
chunksA vector of SensorDataChunkCollection structs containing the sensor data.
num_sensorsThe number of sensors that are included in the packet
timestamp_msValue for PacketHeader.timestamp.
bufferThe output buffer to write the final packet into.
buffer_sizeThe total size of the output buffer.
Returns
The total number of bytes written to the buffer, or 0 on error.

Definition at line 41 of file DiabloPacketUtils.cpp.

References chunks, DIABLO_COMMS_VERSION, ptr, and SENSOR_DATA.

Referenced by loop(), readCurrentSensePinsAndSend(), readCurrentSensePinsAndSend(), send_chunks_to_impl(), sendDataChunks(), sendPositions(), sendReplyTo(), sendSensorDataPacket(), sendSensorDataPacket(), sendSensorDataPacketTo(), sendSensorPacket(), test_sensor_data_buffer_too_small(), and test_sensor_data_roundtrip().

◆ create_stacklight_command_packet()

size_t daq::create_stacklight_command_packet ( const StacklightCommandPacket & data,
uint32_t timestamp_ms,
uint8_t * buffer,
size_t buffer_size )

Creates a complete Stacklight Command packet in the provided buffer.

Packet layout: PacketHeader + StacklightCommandPacket (red, yellow, green, buzzer; 1 = on).

Definition at line 231 of file DiabloPacketUtils.cpp.

References DIABLO_COMMS_VERSION, ptr, and STACKLIGHT_COMMAND.

Referenced by main().

◆ parse_abort_done_packet()

bool daq::parse_abort_done_packet ( const uint8_t * buffer,
size_t buffer_size,
PacketHeader & header_out )

Parses an Abort Done packet from buffer.

Returns
true on success, false on error.

Definition at line 372 of file DiabloPacketUtils.cpp.

References ABORT_DONE.

Referenced by test_abort_done_roundtrip().

◆ parse_actuator_command_packet()

bool daq::parse_actuator_command_packet ( const uint8_t * buffer,
size_t buffer_size,
PacketHeader & header_out,
std::vector< ActuatorCommand > & commands_out )

Parses an Actuator Command packet from buffer.

Returns
true on success, false on error.

Definition at line 384 of file DiabloPacketUtils.cpp.

References ACTUATOR_COMMAND, and ptr.

Referenced by loop(), main(), processIncomingPacket(), processIncomingPacket(), daqtest::BoardListener::run(), test_actuator_command_roundtrip(), and test_parse_null_buffer().

◆ parse_actuator_config_packet()

bool daq::parse_actuator_config_packet ( const uint8_t * buffer,
size_t buffer_size,
PacketHeader & header_out,
uint8_t & is_abort_controller_out,
std::vector< AbortActuatorLocation > & abort_actuators_out,
std::vector< AbortPTLocation > & abort_pts_out,
uint8_t & enable_serial_printing_out )

Parses an Actuator Config packet from buffer.

Reads standard PacketHeader (must be ACTUATOR_CONFIG), then config body into outputs.

Returns
true on success, false on error (type/size mismatch or buffer too small).

Definition at line 710 of file DiabloPacketUtils.cpp.

References ACTUATOR_CONFIG, config, MAX_ABORT_ACTUATORS, MAX_ABORT_PTS, and ptr.

Referenced by processIncomingPacket(), test_actuator_config_no_pts(), and test_actuator_config_roundtrip().

◆ parse_board_heartbeat_packet()

bool daq::parse_board_heartbeat_packet ( const uint8_t * buffer,
size_t buffer_size,
PacketHeader & header_out,
BoardHeartbeatPacket & data_out )

◆ parse_environmental_data_packet()

bool daq::parse_environmental_data_packet ( const uint8_t * buffer,
size_t buffer_size,
PacketHeader & header_out,
EnvironmentalDataPacket & data_out )

Parses an Environmental Data packet from buffer.

Returns
true on success, false on error (size/type mismatch).

Definition at line 292 of file DiabloPacketUtils.cpp.

References ENVIRONMENTAL_DATA.

Referenced by fsw::streams::SensorFramePipeline::poll().

◆ parse_log_packet()

bool daq::parse_log_packet ( const uint8_t * buffer,
size_t buffer_size,
PacketHeader & header_out,
uint8_t & flags_out,
const uint8_t *& text_out,
uint16_t & text_len_out )

Parses a LOGS packet (type 15) from buffer.

Mirrors the on-wire format produced by create_log_packet: PacketHeader (LOGS) + flags (1B) + text_len (2B, uint16 LE) + text bytes. On success, text_out points into buffer (no copy) and is valid for the lifetime of buffer.

Parameters
flags_outbit0 = TRUNCATED.
text_outSet to point at the first text byte inside buffer.
text_len_outNumber of text bytes.
Returns
true on success, false on error (type/size mismatch or buffer too small).

Definition at line 807 of file DiabloPacketUtils.cpp.

References LOGS, and ptr.

Referenced by main(), test_log_packet_parse_truncated(), test_log_packet_parse_wrong_type(), and test_log_packet_roundtrip().

◆ parse_pwm_actuator_packet()

bool daq::parse_pwm_actuator_packet ( const uint8_t * buffer,
size_t buffer_size,
PacketHeader & header_out,
std::vector< PWMActuatorCommand > & commands_out )

Parses a PWM Actuator Command packet from buffer.

Returns
true on success, false on error.

Definition at line 489 of file DiabloPacketUtils.cpp.

References ptr, and PWM_ACTUATOR_COMMAND.

Referenced by loop(), processIncomingPacket(), and test_pwm_actuator_roundtrip().

◆ parse_self_test_packet()

bool daq::parse_self_test_packet ( const uint8_t * buffer,
size_t buffer_size,
PacketHeader & header_out,
uint8_t & adc_good_out,
std::vector< SelfTestResult > & results_out )

Parses a Self Test packet from buffer.

Parameters
adc_good_outSet to 1 if the TDAC self-test passed, 0 if it failed.
Returns
true on success, false on error.

Definition at line 414 of file DiabloPacketUtils.cpp.

References ptr, and SELF_TEST.

Referenced by fsw::streams::SensorFramePipeline::poll(), test_self_test_adc_bad(), and test_self_test_roundtrip().

◆ parse_sensor_config_packet()

bool daq::parse_sensor_config_packet ( const uint8_t * buffer,
size_t buffer_size,
PacketHeader & header_out,
std::vector< uint8_t > & sensor_ids_out,
uint8_t & reference_voltage_out,
bool & necessary_for_abort_out,
uint32_t & controller_ip_out,
uint8_t & enable_serial_printing_out )

Parses a Sensor Config packet from buffer.

Mirrors the on-wire format produced by create_sensor_config_packet. If necessary_for_abort is false the controller_ip_out is set to 0.

Returns
true on success, false on error (type/size mismatch or buffer too small).

Definition at line 578 of file DiabloPacketUtils.cpp.

References ptr, and SENSOR_CONFIG.

Referenced by SensorHotfire::processIncomingPacket(), SensorSM::processIncomingPacket(), test_sensor_config_empty_sensors(), test_sensor_config_roundtrip_with_abort(), and test_sensor_config_roundtrip_without_abort().

◆ parse_sensor_data_packet()

bool daq::parse_sensor_data_packet ( const uint8_t * buffer,
size_t buffer_size,
PacketHeader & header_out,
std::vector< SensorDataChunkCollection > & chunks_out )

◆ parse_server_heartbeat_packet()

bool daq::parse_server_heartbeat_packet ( const uint8_t * buffer,
size_t buffer_size,
PacketHeader & header_out,
ServerHeartbeatPacket & data_out )

Parses a Server Heartbeat packet from buffer.

Returns
true on success, false on error (size/type mismatch).

Definition at line 273 of file DiabloPacketUtils.cpp.

References SERVER_HEARTBEAT.

Referenced by decodeAndPrintPacket(), loop(), processIncomingPacket(), processIncomingPacket(), processIncomingPacket(), SensorHotfire::processIncomingPacket(), and test_server_heartbeat_roundtrip().

◆ parse_stacklight_command_packet()

bool daq::parse_stacklight_command_packet ( const uint8_t * buffer,
size_t buffer_size,
PacketHeader & header_out,
StacklightCommandPacket & data_out )

Parses a Stacklight Command packet from buffer.

Returns
true on success, false on error (size/type mismatch).

Definition at line 309 of file DiabloPacketUtils.cpp.

References STACKLIGHT_COMMAND.

Referenced by loop().