WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
Alert.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include <stdint.h>
8
9#include "wpi/hal/Types.h"
10#include "wpi/util/string.h"
11
12/**
13 * @defgroup hal_alert Alert Functions
14 * @ingroup hal_capi
15 * @{
16 */
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22/** Represents an alert's level of urgency. */
24 /**
25 * High priority alert - displayed first with a red "X" symbol. Use this type
26 * for problems which will seriously affect the robot's functionality and thus
27 * require immediate attention.
28 */
31
32 /**
33 * Medium priority alert - displayed second with a yellow "!" symbol. Use this
34 * type for problems which could affect the robot's functionality but do not
35 * necessarily require immediate attention.
36 */
39
40 /**
41 * Low priority alert - displayed last with a green "i" symbol. Use this type
42 * for problems which are unlikely to affect the robot's functionality, or any
43 * other alerts which do not fall under the other categories.
44 */
47};
48
49/**
50 * Creates an alert.
51 *
52 * @param group Group identifier
53 * @param text Text to be displayed when the alert is active
54 * @param level Alert urgency level (HAL_AlertLevel)
55 * @param[out] status Error status variable. 0 on success.
56 * @return the created alert
57 */
59 const struct WPI_String* text, int32_t level,
60 int32_t* status);
61
62/**
63 * Destroys an alert.
64 *
65 * @param alertHandle the alert handle
66 */
68
69/**
70 * Sets whether the alert should be displayed. This method can be
71 * safely be called periodically.
72 *
73 * @param alertHandle the alert handle
74 * @param active true to display the alert, false to hide it
75 * @param[out] status Error status variable. 0 on success.
76 */
78 int32_t* status);
79
80/**
81 * Checks if an alert is active.
82 *
83 * @param alertHandle the alert handle
84 * @param[out] status Error status variable. 0 on success.
85 * @return true if the alert is active
86 */
87HAL_Bool HAL_IsAlertActive(HAL_AlertHandle alertHandle, int32_t* status);
88
89/**
90 * Updates the text of an alert. Use this method to dynamically change the
91 * displayed alert, such as including more details about the detected problem.
92 *
93 * @param alertHandle the alert handle
94 * @param text new text to be displayed when the alert is active
95 * @param[out] status Error status variable. 0 on success.
96 */
98 const struct WPI_String* text, int32_t* status);
99
100/**
101 * Gets the text of an alert.
102 *
103 * @param alertHandle the alert handle
104 * @param text pointer to a WPI_String to be filled with the current text
105 * @param[out] status Error status variable. 0 on success.
106 */
107void HAL_GetAlertText(HAL_AlertHandle alertHandle, struct WPI_String* text,
108 int32_t* status);
109
110#ifdef __cplusplus
111} // extern "C"
112#endif
113/** @} */
HAL_Bool HAL_IsAlertActive(HAL_AlertHandle alertHandle, int32_t *status)
Checks if an alert is active.
void HAL_GetAlertText(HAL_AlertHandle alertHandle, struct WPI_String *text, int32_t *status)
Gets the text of an alert.
void HAL_SetAlertText(HAL_AlertHandle alertHandle, const struct WPI_String *text, int32_t *status)
Updates the text of an alert.
HAL_AlertHandle HAL_CreateAlert(const struct WPI_String *group, const struct WPI_String *text, int32_t level, int32_t *status)
Creates an alert.
void HAL_SetAlertActive(HAL_AlertHandle alertHandle, HAL_Bool active, int32_t *status)
Sets whether the alert should be displayed.
HAL_AlertLevel
Represents an alert's level of urgency.
Definition Alert.h:23
void HAL_DestroyAlert(HAL_AlertHandle alertHandle)
Destroys an alert.
@ HAL_ALERT_INFO
Definition Alert.h:46
@ HAL_ALERT_ERROR
Definition Alert.h:30
@ HAL_ALERT_WARNING
Definition Alert.h:38
@ HAL_ALERT_MEDIUM
Medium priority alert - displayed second with a yellow "!" symbol.
Definition Alert.h:37
@ HAL_ALERT_LOW
Low priority alert - displayed last with a green "i" symbol.
Definition Alert.h:45
@ HAL_ALERT_HIGH
High priority alert - displayed first with a red "X" symbol.
Definition Alert.h:29
int32_t HAL_Bool
Definition Types.h:75
HAL_Handle HAL_AlertHandle
Definition Types.h:19
#define HAL_ENUM(name)
Definition Types.h:90
A const UTF8 string.
Definition string.h:12