Avionics
Core avionics package for CURE flight computers
Loading...
Searching...
No Matches
SendableSensorData Struct Reference

Declares one telemetry "stream" to include in packets. More...

#include <Telemetry.h>

Collaboration diagram for SendableSensorData:
Collaboration graph

Public Member Functions

 SendableSensorData (SensorDataHandler *sdh, std::uint16_t sendFrequency_hz)
 Create a single SDH stream.
template<std::size_t M>
 SendableSensorData (const std::array< SensorDataHandler *, M > &sdhList, std::uint8_t label, std::uint16_t sendFrequency_hz)
 Create a multi SDH stream from a std::array.
bool shouldBeSent (std::uint32_t now_ms) const
 Return true if enough time has elapsed such that this stream wants to be sent again.
void markWasSent (std::uint32_t now_ms)
 Update internal state after sending.
bool isSingle () const
 Convenience: true if configured as a single SDH stream.
bool isMulti () const
 Convenience: true if configured as a multi SDH stream.

Public Attributes

SensorDataHandlersingleSDH
SensorDataHandler *const * multiSDH
const std::size_t multiSDHLength
std::uint8_t multiSDHDataLabel
std::uint16_t period_ms
std::uint32_t lastSentTimestamp_ms

Detailed Description

Declares one telemetry "stream" to include in packets.

A stream can be either:

  • single SDH: write the SDH name followed by its float value
  • multi SDH group: write a group label followed by N float values

This type does not own any SensorDataHandler objects. Pointers must remain valid while Telemetry uses them.

For multi groups, you can provide either:

  • raw pointer + count (most general)
  • std::array (preferred when size is fixed at compile time)

Definition at line 103 of file Telemetry.h.

Constructor & Destructor Documentation

◆ SendableSensorData() [1/2]

SendableSensorData::SendableSensorData ( SensorDataHandler * sdh,
std::uint16_t sendFrequency_hz )
inline

Create a single SDH stream.

Parameters
sdhSensorDataHandler to send (non-owning).
sendFrequency_hzDesired send rate in Hz.

Definition at line 133 of file Telemetry.h.

◆ SendableSensorData() [2/2]

template<std::size_t M>
SendableSensorData::SendableSensorData ( const std::array< SensorDataHandler *, M > & sdhList,
std::uint8_t label,
std::uint16_t sendFrequency_hz )
inline

Create a multi SDH stream from a std::array.

This is convenient when the group size is fixed at compile time. The std::array passed in must outlive this SendableSensorData object.

Definition at line 148 of file Telemetry.h.

Member Function Documentation

◆ isMulti()

bool SendableSensorData::isMulti ( ) const
inline

Convenience: true if configured as a multi SDH stream.

Definition at line 176 of file Telemetry.h.

◆ isSingle()

bool SendableSensorData::isSingle ( ) const
inline

Convenience: true if configured as a single SDH stream.

Definition at line 173 of file Telemetry.h.

◆ markWasSent()

void SendableSensorData::markWasSent ( std::uint32_t now_ms)
inline

Update internal state after sending.

Definition at line 168 of file Telemetry.h.

◆ shouldBeSent()

bool SendableSensorData::shouldBeSent ( std::uint32_t now_ms) const
inline

Return true if enough time has elapsed such that this stream wants to be sent again.

Definition at line 161 of file Telemetry.h.

Member Data Documentation

◆ lastSentTimestamp_ms

std::uint32_t SendableSensorData::lastSentTimestamp_ms

Last send time in ms (same time base as tick()).

Definition at line 126 of file Telemetry.h.

◆ multiSDH

SensorDataHandler* const* SendableSensorData::multiSDH

Multi-value group. Pointer to an external array of SDHs.

Definition at line 110 of file Telemetry.h.

◆ multiSDHDataLabel

std::uint8_t SendableSensorData::multiSDHDataLabel

Label written once before the multi SDH values.

Definition at line 118 of file Telemetry.h.

◆ multiSDHLength

const std::size_t SendableSensorData::multiSDHLength

Length of multiSDH array.

Definition at line 115 of file Telemetry.h.

◆ period_ms

std::uint16_t SendableSensorData::period_ms

Minimum time between sends for this stream.

Definition at line 123 of file Telemetry.h.

◆ singleSDH

SensorDataHandler* SendableSensorData::singleSDH

Single-value stream. If non-null, this stream will send this SDH.

Definition at line 107 of file Telemetry.h.


The documentation for this struct was generated from the following file: