WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
AlertSim.hpp
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 <string>
10#include <vector>
11
13#include "wpi/hal/Types.h"
14
15namespace wpi::sim {
16
17/**
18 * Class to get info on simulated alerts.
19 */
20class AlertSim final {
21 public:
22 AlertSim() = delete;
23
24 /** Information about an alert. */
25 struct AlertInfo {
26 /** The handle of the alert. */
28
29 /** The group of the alert. */
30 std::string group;
31
32 /** The text of the alert. */
33 std::string text;
34
35 /** The time the alert became active. 0 if not active. */
37
38 /** The level of the alert (HIGH, MEDIUM, or LOW). */
40
41 /**
42 * Returns whether the alert is currently active.
43 *
44 * @return true if the alert is active, false otherwise
45 */
46 bool isActive() const { return activeStartTime != 0; }
47 };
48
49 /**
50 * Gets the number of alerts. Note: this is not guaranteed to be consistent
51 * with the number of alerts returned by GetAll.
52 *
53 * @return the number of alerts
54 */
55 static int32_t GetCount();
56
57 /**
58 * Gets detailed information about each alert.
59 *
60 * @return Alerts
61 */
62 static std::vector<AlertInfo> GetAll();
63
64 /**
65 * Resets all alert simulation data.
66 */
67 static void ResetData();
68};
69
70} // namespace wpi::sim
Level
Represents an alert's level of urgency.
Definition Alert.hpp:41
static std::vector< AlertInfo > GetAll()
Gets detailed information about each alert.
static int32_t GetCount()
Gets the number of alerts.
static void ResetData()
Resets all alert simulation data.
HAL_Handle HAL_AlertHandle
Definition Types.h:19
Definition CTREPCMSim.hpp:13
Information about an alert.
Definition AlertSim.hpp:25
HAL_AlertHandle handle
The handle of the alert.
Definition AlertSim.hpp:27
int64_t activeStartTime
The time the alert became active.
Definition AlertSim.hpp:36
std::string group
The group of the alert.
Definition AlertSim.hpp:30
std::string text
The text of the alert.
Definition AlertSim.hpp:33
bool isActive() const
Returns whether the alert is currently active.
Definition AlertSim.hpp:46
Alert::Level level
The level of the alert (HIGH, MEDIUM, or LOW).
Definition AlertSim.hpp:39