WPILibC++ 2027.0.0-alpha-5
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 */
30
31 /**
32 * Medium priority alert - displayed second with a yellow "!" symbol. Use this
33 * type for problems which could affect the robot's functionality but do not
34 * necessarily require immediate attention.
35 */
37
38 /**
39 * Low priority alert - displayed last with a green "i" symbol. Use this type
40 * for problems which are unlikely to affect the robot's functionality, or any
41 * other alerts which do not fall under the other categories.
42 */
44};
45
46/**
47 * Creates an alert.
48 *
49 * @param group Group identifier
50 * @param text Text to be displayed when the alert is active
51 * @param level Alert urgency level (HAL_AlertLevel)
52 * @param[out] status Error status variable. 0 on success.
53 * @return the created alert
54 */
56 const struct WPI_String* text, int32_t level,
57 int32_t* status);
58
59/**
60 * Destroys an alert.
61 *
62 * @param alertHandle the alert handle
63 */
65
66/**
67 * Sets whether the alert should be displayed. This method can be
68 * safely be called periodically.
69 *
70 * @param alertHandle the alert handle
71 * @param active true to display the alert, false to hide it
72 * @param[out] status Error status variable. 0 on success.
73 */
75 int32_t* status);
76
77/**
78 * Checks if an alert is active.
79 *
80 * @param alertHandle the alert handle
81 * @param[out] status Error status variable. 0 on success.
82 * @return true if the alert is active
83 */
84HAL_Bool HAL_IsAlertActive(HAL_AlertHandle alertHandle, int32_t* status);
85
86/**
87 * Updates the text of an alert. Use this method to dynamically change the
88 * displayed alert, such as including more details about the detected problem.
89 *
90 * @param alertHandle the alert handle
91 * @param text new text to be displayed when the alert is active
92 * @param[out] status Error status variable. 0 on success.
93 */
95 const struct WPI_String* text, int32_t* status);
96
97/**
98 * Gets the text of an alert.
99 *
100 * @param alertHandle the alert handle
101 * @param text pointer to a WPI_String to be filled with the current text
102 * @param[out] status Error status variable. 0 on success.
103 */
104void HAL_GetAlertText(HAL_AlertHandle alertHandle, struct WPI_String* text,
105 int32_t* status);
106
107#ifdef __cplusplus
108} // extern "C"
109#endif
110/** @} */
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_MEDIUM
Medium priority alert - displayed second with a yellow "!" symbol.
Definition Alert.h:36
@ HAL_ALERT_LOW
Low priority alert - displayed last with a green "i" symbol.
Definition Alert.h:43
@ HAL_ALERT_HIGH
High priority alert - displayed first with a red "X" symbol.
Definition Alert.h:29
int32_t HAL_Bool
Definition Types.h:65
HAL_Handle HAL_AlertHandle
Definition Types.h:19
#define HAL_ENUM(name)
Definition Types.h:82
A const UTF8 string.
Definition string.h:40