WPILibC++  unspecified
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 <llvm/Twine.h>
13 #include <support/deprecated.h>
14 
15 #include "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 
28  static LiveWindow* GetInstance();
29 
30  WPI_DEPRECATED("no longer required")
31  void Run() { UpdateValues(); }
32 
33  WPI_DEPRECATED("use Sendable::SetName() instead")
34  void AddSensor(const llvm::Twine& subsystem, const llvm::Twine& name,
35  Sendable* component);
36  WPI_DEPRECATED("use Sendable::SetName() instead")
37  void AddSensor(const llvm::Twine& subsystem, const llvm::Twine& name,
38  Sendable& component);
39  WPI_DEPRECATED("use Sendable::SetName() instead")
40  void AddSensor(const llvm::Twine& subsystem, const llvm::Twine& name,
41  std::shared_ptr<Sendable> component);
42  WPI_DEPRECATED("use Sendable::SetName() instead")
43  void AddActuator(const llvm::Twine& subsystem, const llvm::Twine& name,
44  Sendable* component);
45  WPI_DEPRECATED("use Sendable::SetName() instead")
46  void AddActuator(const llvm::Twine& subsystem, const llvm::Twine& name,
47  Sendable& component);
48  WPI_DEPRECATED("use Sendable::SetName() instead")
49  void AddActuator(const llvm::Twine& subsystem, const llvm::Twine& name,
50  std::shared_ptr<Sendable> component);
51 
52  WPI_DEPRECATED("use SensorBase::SetName() instead")
53  void AddSensor(const llvm::Twine& type, int channel, Sendable* component);
54  WPI_DEPRECATED("use SensorBase::SetName() instead")
55  void AddActuator(const llvm::Twine& type, int channel, Sendable* component);
56  WPI_DEPRECATED("use SensorBase::SetName() instead")
57  void AddActuator(const llvm::Twine& type, int module, int channel,
58  Sendable* component);
59 
60  void Add(std::shared_ptr<Sendable> component);
61  void Add(Sendable* component);
62  void AddChild(Sendable* parent, std::shared_ptr<Sendable> component);
63  void AddChild(Sendable* parent, void* component);
64  void Remove(Sendable* component);
65 
66  void EnableTelemetry(Sendable* component);
67  void DisableTelemetry(Sendable* component);
68  void DisableAllTelemetry();
69 
70  bool IsEnabled() const;
71  void SetEnabled(bool enabled);
72 
73  void UpdateValues();
74 
75  private:
76  LiveWindow();
77 
78  struct Impl;
79  std::unique_ptr<Impl> m_impl;
80 };
81 
82 } // namespace frc
Definition: RobotController.cpp:14
void AddChild(Sendable *parent, std::shared_ptr< Sendable > component)
Add a child component to a component.
Definition: LiveWindow.cpp:247
The LiveWindow class is the public interface for putting sensors and actuators on the LiveWindow...
Definition: LiveWindow.h:23
void SetEnabled(bool enabled)
Change the enabled status of LiveWindow.
Definition: LiveWindow.cpp:86
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:79
void DisableTelemetry(Sendable *component)
Disable telemetry for a single component.
Definition: LiveWindow.cpp:292
void AddSensor(const llvm::Twine &subsystem, const llvm::Twine &name, Sendable *component)
Use a raw pointer to the LiveWindow.
Definition: LiveWindow.cpp:139
void AddActuator(const llvm::Twine &subsystem, const llvm::Twine &name, Sendable *component)
Use a raw pointer to the LiveWindow.
Definition: LiveWindow.cpp:181
void UpdateValues()
Tell all the sensors to update (send) their values.
Definition: LiveWindow.cpp:313
void DisableAllTelemetry()
Disable ALL telemetry.
Definition: LiveWindow.cpp:301
void Remove(Sendable *component)
Remove the component from the LiveWindow.
Definition: LiveWindow.cpp:269
void EnableTelemetry(Sendable *component)
Enable telemetry for a single component.
Definition: LiveWindow.cpp:279
Definition: LiveWindow.cpp:27
static LiveWindow * GetInstance()
Get an instance of the LiveWindow main class.
Definition: LiveWindow.cpp:64
Definition: Sendable.h:18
void Add(std::shared_ptr< Sendable > component)
Add a component to the LiveWindow.
Definition: LiveWindow.cpp:226