WPILibC++  2019.2.1-1-g453a904
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
LiveWindow.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2012-2018 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include <memory>
11 
12 #include <wpi/Twine.h>
13 #include <wpi/deprecated.h>
14 
15 #include "frc/smartdashboard/Sendable.h"
16 
17 namespace frc {
18 
23 class LiveWindow {
24  public:
25  LiveWindow(const LiveWindow&) = delete;
26  LiveWindow& operator=(const LiveWindow&) = delete;
27 
34  static LiveWindow* GetInstance();
35 
36  WPI_DEPRECATED("no longer required")
37  void Run();
38 
46  WPI_DEPRECATED("use Sendable::SetName() instead")
47  void AddSensor(const wpi::Twine& subsystem, const wpi::Twine& name,
48  Sendable* component);
49 
57  WPI_DEPRECATED("use Sendable::SetName() instead")
58  void AddSensor(const wpi::Twine& subsystem, const wpi::Twine& name,
59  Sendable& component);
60 
68  WPI_DEPRECATED("use Sendable::SetName() instead")
69  void AddSensor(const wpi::Twine& subsystem, const wpi::Twine& name,
70  std::shared_ptr<Sendable> component);
71 
80  WPI_DEPRECATED("use Sendable::SetName() instead")
81  void AddActuator(const wpi::Twine& subsystem, const wpi::Twine& name,
82  Sendable* component);
83 
92  WPI_DEPRECATED("use Sendable::SetName() instead")
93  void AddActuator(const wpi::Twine& subsystem, const wpi::Twine& name,
94  Sendable& component);
95 
104  WPI_DEPRECATED("use Sendable::SetName() instead")
105  void AddActuator(const wpi::Twine& subsystem, const wpi::Twine& name,
106  std::shared_ptr<Sendable> component);
107 
113  WPI_DEPRECATED("use SensorUtil::SetName() instead")
114  void AddSensor(const wpi::Twine& type, int channel, Sendable* component);
115 
121  WPI_DEPRECATED("use SensorUtil::SetName() instead")
122  void AddActuator(const wpi::Twine& type, int channel, Sendable* component);
123 
129  WPI_DEPRECATED("use SensorUtil::SetName() instead")
130  void AddActuator(const wpi::Twine& type, int module, int channel,
131  Sendable* component);
132 
138  void Add(std::shared_ptr<Sendable> component);
139 
145  void Add(Sendable* component);
146 
153  void AddChild(Sendable* parent, std::shared_ptr<Sendable> component);
154 
161  void AddChild(Sendable* parent, void* component);
162 
168  void Remove(Sendable* component);
169 
175  void EnableTelemetry(Sendable* component);
176 
182  void DisableTelemetry(Sendable* component);
183 
187  void DisableAllTelemetry();
188 
189  bool IsEnabled() const;
190 
196  void SetEnabled(bool enabled);
197 
204  void UpdateValues();
205 
206  private:
207  LiveWindow();
208 
209  struct Impl;
210  std::unique_ptr<Impl> m_impl;
211 
215  void UpdateValuesUnsafe();
216 };
217 
218 } // namespace frc
void AddChild(Sendable *parent, std::shared_ptr< Sendable > component)
Add a child component to a component.
WPILib FRC namespace.
Definition: SPIAccelerometerSim.h:18
void AddSensor(const wpi::Twine &subsystem, const wpi::Twine &name, Sendable *component)
Add a Sensor associated with the subsystem and call it by the given name.
void DisableTelemetry(Sendable *component)
Disable telemetry for a single component.
The LiveWindow class is the public interface for putting sensors and actuators on the LiveWindow...
Definition: LiveWindow.h:23
void DisableAllTelemetry()
Disable ALL telemetry.
void AddActuator(const wpi::Twine &subsystem, const wpi::Twine &name, Sendable *component)
Add an Actuator associated with the subsystem and call it by the given name.
static LiveWindow * GetInstance()
Get an instance of the LiveWindow main class.
void SetEnabled(bool enabled)
Change the enabled status of LiveWindow.
void Remove(Sendable *component)
Remove the component from the LiveWindow.
void UpdateValues()
Tell all the sensors to update (send) their values.
Definition: Sendable.h:18
void EnableTelemetry(Sendable *component)
Enable telemetry for a single component.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:79
void Add(std::shared_ptr< Sendable > component)
Add a component to the LiveWindow.