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

Persistent alert with debouncing. More...

#include <ctre/phoenix6/Alerts.hpp>

Public Types

enum class  Level { High = 0 , Medium = 1 , Low = 2 }
 Levels of urgency of the alert. More...

Public Member Functions

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

Detailed Description

Persistent 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 Enumeration Documentation

◆ Level

Levels of urgency of the alert.

Enumerator
High 

High priority / Error.

Medium 

Medium priority / Warning.

Low 

Low priority / Info.

Constructor & Destructor Documentation

◆ PhoenixAlert() [1/3]

ctre::phoenix6::PhoenixAlert::PhoenixAlert ( )
default

Creates an invalid alert.

◆ PhoenixAlert() [2/3]

ctre::phoenix6::PhoenixAlert::PhoenixAlert ( char const * group,
char const * id,
Level level,
char const * text = "" )

Creates a new alert.

Parameters
groupGroup identifier
idAlert identifier, unique within the group
levelAlert urgency level
textAlert text to display when the alert is active

◆ PhoenixAlert() [3/3]

ctre::phoenix6::PhoenixAlert::PhoenixAlert ( std::string const & group,
std::string const & id,
Level level,
std::string const & text = "" )
inline

Creates a new alert.

Parameters
groupGroup identifier
idAlert identifier, unique within the group
levelAlert urgency level
textAlert text to display when the alert is active

Member Function Documentation

◆ IsValid()

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

◆ operator bool()

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

◆ SetActive() [1/2]

void ctre::phoenix6::PhoenixAlert::SetActive ( char const * text = nullptr)

Sets the alert state to active and optionally changes the text.

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

Parameters
textNew text to display

◆ SetActive() [2/2]

void ctre::phoenix6::PhoenixAlert::SetActive ( std::optional< std::string > const & text)
inline

Sets the alert state to active and optionally changes the text.

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

Parameters
textNew text to display

◆ SetInactive()

void ctre::phoenix6::PhoenixAlert::SetInactive ( )

Sets the alert state to inactive.

◆ WithDebounce()

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

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

Parameters
debounceDebounce time
Returns
This alert

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