WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
Solenoid.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2008-2017. 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 #include <string>
12 
13 #include "HAL/Types.h"
14 #include "LiveWindow/LiveWindowSendable.h"
15 #include "SolenoidBase.h"
16 #include "tables/ITableListener.h"
17 
18 namespace frc {
19 
26 class Solenoid : public SolenoidBase,
27  public LiveWindowSendable,
28  public ITableListener {
29  public:
30  explicit Solenoid(int channel);
31  Solenoid(int moduleNumber, int channel);
32  virtual ~Solenoid();
33  virtual void Set(bool on);
34  virtual bool Get() const;
35  bool IsBlackListed() const;
36 
37  void ValueChanged(ITable* source, llvm::StringRef key,
38  std::shared_ptr<nt::Value> value, bool isNew);
39  void UpdateTable();
40  void StartLiveWindowMode();
41  void StopLiveWindowMode();
42  std::string GetSmartDashboardType() const;
43  void InitTable(std::shared_ptr<ITable> subTable);
44  std::shared_ptr<ITable> GetTable() const;
45 
46  private:
47  HAL_SolenoidHandle m_solenoidHandle = HAL_kInvalidHandle;
48  int m_channel;
49  std::shared_ptr<ITable> m_table;
50 };
51 
52 } // namespace frc
A table whose values can be read and written to.
Definition: ITable.h:22
Live Window Sendable is a special type of object sendable to the live window.
Definition: LiveWindowSendable.h:17
SolenoidBase class is the common base class for the Solenoid and DoubleSolenoid classes.
Definition: SolenoidBase.h:20
void StartLiveWindowMode()
Start having this sendable object automatically respond to value changes reflect the value on the tab...
Definition: Solenoid.cpp:124
void StopLiveWindowMode()
Stop having this sendable object automatically respond to value changes.
Definition: Solenoid.cpp:131
virtual void Set(bool on)
Set the value of a solenoid.
Definition: Solenoid.cpp:77
virtual bool Get() const
Read the current value of the solenoid.
Definition: Solenoid.cpp:89
void UpdateTable()
Update the table for this sendable object with the latest values.
Definition: Solenoid.cpp:118
Solenoid class for running high voltage Digital Output (PCM).
Definition: Solenoid.h:26
virtual ~Solenoid()
Destructor.
Definition: Solenoid.cpp:67
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:112
Solenoid(int channel)
Constructor using the default PCM ID (0).
Definition: Solenoid.cpp:25
A listener that listens to changes in values in a ITable.
Definition: ITableListener.h:18
bool IsBlackListed() const
Check if solenoid is blacklisted.
Definition: Solenoid.cpp:107
void InitTable(std::shared_ptr< ITable > subTable)
Initializes a table for this sendable object.
Definition: Solenoid.cpp:140
std::string GetSmartDashboardType() const
Definition: Solenoid.cpp:138
std::shared_ptr< ITable > GetTable() const
Definition: Solenoid.cpp:145