WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
Solenoid.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2008-2016. 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 "SolenoidBase.h"
11 #include "LiveWindow/LiveWindowSendable.h"
12 #include "tables/ITableListener.h"
13 
14 #include <memory>
15 
23 class Solenoid : public SolenoidBase,
24  public LiveWindowSendable,
25  public ITableListener {
26  public:
27  explicit Solenoid(uint32_t channel);
28  Solenoid(uint8_t moduleNumber, uint32_t channel);
29  virtual ~Solenoid();
30  virtual void Set(bool on);
31  virtual bool Get() const;
32  bool IsBlackListed() const;
33 
34  void ValueChanged(ITable* source, llvm::StringRef key,
35  std::shared_ptr<nt::Value> value, bool isNew);
36  void UpdateTable();
37  void StartLiveWindowMode();
38  void StopLiveWindowMode();
39  std::string GetSmartDashboardType() const;
40  void InitTable(std::shared_ptr<ITable> subTable);
41  std::shared_ptr<ITable> GetTable() const;
42 
43  private:
44  uint32_t m_channel;
45  std::shared_ptr<ITable> m_table;
46 };
A table whose values can be read and written to.
Definition: ITable.h:43
Live Window Sendable is a special type of object sendable to the live window.
Definition: LiveWindowSendable.h:18
bool IsBlackListed() const
Check if solenoid is blacklisted.
Definition: Solenoid.cpp:97
void InitTable(std::shared_ptr< ITable > subTable)
Initializes a table for this sendable object.
Definition: Solenoid.cpp:130
std::shared_ptr< ITable > GetTable() const
Definition: Solenoid.cpp:135
std::string GetSmartDashboardType() const
Definition: Solenoid.cpp:128
virtual ~Solenoid()
Destructor.
Definition: Solenoid.cpp:59
void StartLiveWindowMode()
Start having this sendable object automatically respond to value changes reflect the value on the tab...
Definition: Solenoid.cpp:114
void StopLiveWindowMode()
Stop having this sendable object automatically respond to value changes.
Definition: Solenoid.cpp:121
void ValueChanged(ITable *source, llvm::StringRef key, std::shared_ptr< nt::Value > value, bool isNew)
Called when a key-value pair is changed in a ITable.
Definition: Solenoid.cpp:102
virtual void Set(bool on)
Set the value of a solenoid.
Definition: Solenoid.cpp:71
A listener that listens to changes in values in a ITable.
Definition: ITableListener.h:18
Solenoid(uint32_t channel)
Constructor using the default PCM ID (0).
Definition: Solenoid.cpp:19
void UpdateTable()
Update the table for this sendable object with the latest values.
Definition: Solenoid.cpp:108
virtual bool Get() const
Read the current value of the solenoid.
Definition: Solenoid.cpp:84
SolenoidBase class is the common base class for the Solenoid and DoubleSolenoid classes.
Definition: SolenoidBase.h:21
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:39
Solenoid class for running high voltage Digital Output (PCM).
Definition: Solenoid.h:23