CTRE Phoenix 6 C++ 26.70.0-alpha-2
Loading...
Searching...
No Matches
ctre::phoenix6::PhoenixMultiAlert Class Referencefinal

Persistent multi-level alert with debouncing. More...

#include <ctre/phoenix6/Alerts.hpp>

Public Types

using Level = PhoenixAlert::Level

Public Member Functions

 PhoenixMultiAlert ()=default
 Creates an invalid multi-level alert.
 PhoenixMultiAlert (char const *group, char const *id, uint32_t levelFlags, char const *text="")
 Creates a new multi-level alert.
 PhoenixMultiAlert (std::string const &group, std::string const &id, uint32_t levelFlags, std::string const &text="")
 Creates a new multi-level alert.
bool IsValid () const
 operator bool () const
PhoenixMultiAlertWithDebounce (wpi::units::second_t debounce)
 Sets the time debounce of this alert, default 1 second.
void SetActive (Level level, char const *text=nullptr)
 Sets the alert state to active at the given level and optionally changes the text.
void SetActive (Level level, std::optional< std::string > const &text)
 Sets the alert state to active at the given level and optionally changes the text.
void SetInactive ()
 Sets the alert state to inactive.

Static Public Attributes

static constexpr uint32_t LevelFlag_High = 1 << (int)Level::High
 Include High priority / Error.
static constexpr uint32_t LevelFlag_Medium = 1 << (int)Level::Medium
 Include Medium priority / Warning.
static constexpr uint32_t LevelFlag_Low = 1 << (int)Level::Low
 Include Low priority / Info.

Detailed Description

Persistent multi-level alert with debouncing.

On a FIRST robot controller, this shows up as a persistent alert in the Driver Station and compatible NetworkTables dashboards. Otherwise, this is a no-op.

Member Typedef Documentation

◆ Level

Constructor & Destructor Documentation

◆ PhoenixMultiAlert() [1/3]

ctre::phoenix6::PhoenixMultiAlert::PhoenixMultiAlert ( )
default

Creates an invalid multi-level alert.

◆ PhoenixMultiAlert() [2/3]

ctre::phoenix6::PhoenixMultiAlert::PhoenixMultiAlert ( char const * group,
char const * id,
uint32_t levelFlags,
char const * text = "" )

Creates a new multi-level alert.

Parameters
groupGroup identifier
idAlert identifier, unique within the group
levelFlagsAlert urgency levels to include
textAlert text to display when the alert is active

◆ PhoenixMultiAlert() [3/3]

ctre::phoenix6::PhoenixMultiAlert::PhoenixMultiAlert ( std::string const & group,
std::string const & id,
uint32_t levelFlags,
std::string const & text = "" )
inline

Creates a new multi-level alert.

Parameters
groupGroup identifier
idAlert identifier, unique within the group
levelFlagsAlert urgency levels to include
textAlert text to display when the alert is active

Member Function Documentation

◆ IsValid()

bool ctre::phoenix6::PhoenixMultiAlert::IsValid ( ) const
inline
Returns
Whether this alert is valid

◆ operator bool()

ctre::phoenix6::PhoenixMultiAlert::operator bool ( ) const
inlineexplicit
Returns
Whether this alert is valid

◆ SetActive() [1/2]

void ctre::phoenix6::PhoenixMultiAlert::SetActive ( Level level,
char const * text = nullptr )

Sets the alert state to active at the given level and optionally changes the text.

This should be called periodically, even if the active state does not change.

Parameters
levelNew alert urgency level
textNew text to display

◆ SetActive() [2/2]

void ctre::phoenix6::PhoenixMultiAlert::SetActive ( Level level,
std::optional< std::string > const & text )
inline

Sets the alert state to active at the given level and optionally changes the text.

This should be called periodically, even if the active state does not change.

Parameters
levelNew alert urgency level
textNew text to display

◆ SetInactive()

void ctre::phoenix6::PhoenixMultiAlert::SetInactive ( )

Sets the alert state to inactive.

◆ WithDebounce()

PhoenixMultiAlert & ctre::phoenix6::PhoenixMultiAlert::WithDebounce ( wpi::units::second_t debounce)

Sets the time debounce of this alert, default 1 second.

Parameters
debounceDebounce time
Returns
This alert

Member Data Documentation

◆ LevelFlag_High

uint32_t ctre::phoenix6::PhoenixMultiAlert::LevelFlag_High = 1 << (int)Level::High
staticconstexpr

Include High priority / Error.

◆ LevelFlag_Low

uint32_t ctre::phoenix6::PhoenixMultiAlert::LevelFlag_Low = 1 << (int)Level::Low
staticconstexpr

Include Low priority / Info.

◆ LevelFlag_Medium

uint32_t ctre::phoenix6::PhoenixMultiAlert::LevelFlag_Medium = 1 << (int)Level::Medium
staticconstexpr

Include Medium priority / Warning.


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