WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
DoubleSolenoid.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 
28  public LiveWindowSendable,
29  public ITableListener {
30  public:
31  enum Value { kOff, kForward, kReverse };
32 
33  explicit DoubleSolenoid(int forwardChannel, int reverseChannel);
34  DoubleSolenoid(int moduleNumber, int forwardChannel, int reverseChannel);
35  virtual ~DoubleSolenoid();
36  virtual void Set(Value value);
37  virtual Value Get() const;
38  bool IsFwdSolenoidBlackListed() const;
39  bool IsRevSolenoidBlackListed() const;
40 
41  void ValueChanged(ITable* source, llvm::StringRef key,
42  std::shared_ptr<nt::Value> value, bool isNew);
43  void UpdateTable();
44  void StartLiveWindowMode();
45  void StopLiveWindowMode();
46  std::string GetSmartDashboardType() const;
47  void InitTable(std::shared_ptr<ITable> subTable);
48  std::shared_ptr<ITable> GetTable() const;
49 
50  private:
51  int m_forwardChannel;
52  int m_reverseChannel;
53  int m_forwardMask;
54  int m_reverseMask;
55  HAL_SolenoidHandle m_forwardHandle = HAL_kInvalidHandle;
56  HAL_SolenoidHandle m_reverseHandle = HAL_kInvalidHandle;
57 
58  std::shared_ptr<ITable> m_table;
59 };
60 
61 } // 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
std::shared_ptr< ITable > GetTable() const
Definition: DoubleSolenoid.cpp:226
SolenoidBase class is the common base class for the Solenoid and DoubleSolenoid classes.
Definition: SolenoidBase.h:20
void UpdateTable()
Update the table for this sendable object with the latest values.
Definition: DoubleSolenoid.cpp:195
DoubleSolenoid class for running 2 channels of high voltage Digital Output (PCM). ...
Definition: DoubleSolenoid.h:27
virtual Value Get() const
Read the current value of the solenoid.
Definition: DoubleSolenoid.cpp:142
bool IsRevSolenoidBlackListed() const
Check if the reverse solenoid is blacklisted.
Definition: DoubleSolenoid.cpp:178
void StopLiveWindowMode()
Stop having this sendable object automatically respond to value changes.
Definition: DoubleSolenoid.cpp:210
DoubleSolenoid(int forwardChannel, int reverseChannel)
Constructor.
Definition: DoubleSolenoid.cpp:28
A listener that listens to changes in values in a ITable.
Definition: ITableListener.h:18
virtual ~DoubleSolenoid()
Destructor.
Definition: DoubleSolenoid.cpp:98
std::string GetSmartDashboardType() const
Definition: DoubleSolenoid.cpp:217
virtual void Set(Value value)
Set the value of a solenoid.
Definition: DoubleSolenoid.cpp:109
void StartLiveWindowMode()
Start having this sendable object automatically respond to value changes reflect the value on the tab...
Definition: DoubleSolenoid.cpp:203
void InitTable(std::shared_ptr< ITable > subTable)
Initializes a table for this sendable object.
Definition: DoubleSolenoid.cpp:221
bool IsFwdSolenoidBlackListed() const
Check if the forward solenoid is blacklisted.
Definition: DoubleSolenoid.cpp:165