WPILibC++ 2024.1.1-beta-4
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 * Set 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 * Set 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 static bool IsEnabled();
60
61 /**
62 * Change the enabled status of LiveWindow.
63 *
64 * If it changes to enabled, start livewindow running otherwise stop it
65 */
66 static void SetEnabled(bool enabled);
67
68 /**
69 * Tell all the sensors to update (send) their values.
70 *
71 * Actuators are handled through callbacks on their value changing from the
72 * SmartDashboard widgets.
73 */
74 static void UpdateValues();
75
76 private:
77 LiveWindow() = default;
78
79 /**
80 * Updates the entries, without using a mutex or lock.
81 */
82 static void UpdateValuesUnsafe();
83};
84
85} // 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)
Set function to be called when LiveWindow is enabled.
static void DisableTelemetry(wpi::Sendable *component)
Disable telemetry for a single component.
static bool IsEnabled()
static void SetDisabledCallback(std::function< void()> func)
Set 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