WPILibC++ 2024.3.2
LiveWindow.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 <functional>
8
9namespace wpi {
10class Sendable;
11} // namespace wpi
12
13namespace frc {
14
15/**
16 * The LiveWindow class is the public interface for putting sensors and
17 * actuators on the LiveWindow.
18 */
19class LiveWindow final {
20 public:
21 /**
22 * Sets function to be called when LiveWindow is enabled.
23 *
24 * @param func function (or nullptr for none)
25 */
26 static void SetEnabledCallback(std::function<void()> func);
27
28 /**
29 * Sets function to be called when LiveWindow is disabled.
30 *
31 * @param func function (or nullptr for none)
32 */
33 static void SetDisabledCallback(std::function<void()> func);
34
35 /**
36 * Enable telemetry for a single component.
37 *
38 * @param component sendable
39 */
40 static void EnableTelemetry(wpi::Sendable* component);
41
42 /**
43 * Disable telemetry for a single component.
44 *
45 * @param component sendable
46 */
47 static void DisableTelemetry(wpi::Sendable* component);
48
49 /**
50 * Disable ALL telemetry.
51 */
52 static void DisableAllTelemetry();
53
54 /**
55 * Enable ALL telemetry.
56 */
57 static void EnableAllTelemetry();
58
59 /**
60 * Returns true if LiveWindow is enabled.
61 *
62 * @return True if LiveWindow is enabled.
63 */
64 static bool IsEnabled();
65
66 /**
67 * Change the enabled status of LiveWindow.
68 *
69 * If it changes to enabled, start livewindow running otherwise stop it
70 */
71 static void SetEnabled(bool enabled);
72
73 /**
74 * Tell all the sensors to update (send) their values.
75 *
76 * Actuators are handled through callbacks on their value changing from the
77 * SmartDashboard widgets.
78 */
79 static void UpdateValues();
80
81 private:
82 LiveWindow() = default;
83
84 /**
85 * Updates the entries, without using a mutex or lock.
86 */
87 static void UpdateValuesUnsafe();
88};
89
90} // namespace frc
The LiveWindow class is the public interface for putting sensors and actuators on the LiveWindow.
Definition: LiveWindow.h:19
static void DisableAllTelemetry()
Disable ALL telemetry.
static void SetEnabled(bool enabled)
Change the enabled status of LiveWindow.
static void EnableTelemetry(wpi::Sendable *component)
Enable telemetry for a single component.
static void UpdateValues()
Tell all the sensors to update (send) their values.
static void SetEnabledCallback(std::function< void()> func)
Sets function to be called when LiveWindow is enabled.
static void DisableTelemetry(wpi::Sendable *component)
Disable telemetry for a single component.
static bool IsEnabled()
Returns true if LiveWindow is enabled.
static void SetDisabledCallback(std::function< void()> func)
Sets function to be called when LiveWindow is disabled.
static void EnableAllTelemetry()
Enable ALL telemetry.
Interface for Sendable objects.
Definition: Sendable.h:16
Definition: AprilTagPoseEstimator.h:15
Definition: ntcore_cpp.h:26