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 sendFrequencyHz)
 Create a single SDH stream.
template<std::size_t M>
 SendableSensorData (const std::array< SensorDataHandler *, M > &sdhList, std::uint8_t label, std::uint16_t sendFrequencyHz)
 Create a multi SDH stream from a std::array.
bool shouldBeSent (std::uint32_t now) const
 Return true if enough time has elapsed such that this stream wants to be sent again.
void markWasSent (std::uint32_t now)
 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 periodMs
std::uint32_t lastSentTimestamp

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 105 of file Telemetry.h.

Constructor & Destructor Documentation

◆ SendableSensorData() [1/2]

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

Create a single SDH stream.

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

Definition at line 135 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 sendFrequencyHz )
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 150 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 178 of file Telemetry.h.

◆ isSingle()

bool SendableSensorData::isSingle ( ) const
inline

Convenience: true if configured as a single SDH stream.

Definition at line 175 of file Telemetry.h.

◆ markWasSent()

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

Update internal state after sending.

Definition at line 170 of file Telemetry.h.

◆ shouldBeSent()

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

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

Definition at line 163 of file Telemetry.h.

Member Data Documentation

◆ lastSentTimestamp

std::uint32_t SendableSensorData::lastSentTimestamp

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

Definition at line 128 of file Telemetry.h.

◆ multiSDH

SensorDataHandler* const* SendableSensorData::multiSDH

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

Definition at line 112 of file Telemetry.h.

◆ multiSDHDataLabel

std::uint8_t SendableSensorData::multiSDHDataLabel

Label written once before the multi SDH values.

Definition at line 120 of file Telemetry.h.

◆ multiSDHLength

const std::size_t SendableSensorData::multiSDHLength

Length of multiSDH array.

Definition at line 117 of file Telemetry.h.

◆ periodMs

std::uint16_t SendableSensorData::periodMs

Minimum time between sends for this stream.

Definition at line 125 of file Telemetry.h.

◆ singleSDH

SensorDataHandler* SendableSensorData::singleSDH

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

Definition at line 109 of file Telemetry.h.


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