WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
DoubleSolenoid.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 
24  public LiveWindowSendable,
25  public ITableListener {
26  public:
27  enum Value { kOff, kForward, kReverse };
28 
29  explicit DoubleSolenoid(uint32_t forwardChannel, uint32_t reverseChannel);
30  DoubleSolenoid(uint8_t moduleNumber, uint32_t forwardChannel,
31  uint32_t reverseChannel);
32  virtual ~DoubleSolenoid();
33  virtual void Set(Value value);
34  virtual Value Get() const;
35  bool IsFwdSolenoidBlackListed() const;
36  bool IsRevSolenoidBlackListed() const;
37 
38  void ValueChanged(ITable* source, llvm::StringRef key,
39  std::shared_ptr<nt::Value> value, bool isNew);
40  void UpdateTable();
41  void StartLiveWindowMode();
42  void StopLiveWindowMode();
43  std::string GetSmartDashboardType() const;
44  void InitTable(std::shared_ptr<ITable> subTable);
45  std::shared_ptr<ITable> GetTable() const;
46 
47  private:
48  uint32_t m_forwardChannel;
49  uint32_t m_reverseChannel;
50  uint8_t m_forwardMask;
51  uint8_t m_reverseMask;
52 
53  std::shared_ptr<ITable> m_table;
54 };
virtual Value Get() const
Read the current value of the solenoid.
Definition: DoubleSolenoid.cpp:122
A table whose values can be read and written to.
Definition: ITable.h:43
void InitTable(std::shared_ptr< ITable > subTable)
Initializes a table for this sendable object.
Definition: DoubleSolenoid.cpp:193
Live Window Sendable is a special type of object sendable to the live window.
Definition: LiveWindowSendable.h:18
void StartLiveWindowMode()
Start having this sendable object automatically respond to value changes reflect the value on the tab...
Definition: DoubleSolenoid.cpp:175
DoubleSolenoid class for running 2 channels of high voltage Digital Output (PCM). ...
Definition: DoubleSolenoid.h:23
virtual void Set(Value value)
Set the value of a solenoid.
Definition: DoubleSolenoid.cpp:98
DoubleSolenoid(uint32_t forwardChannel, uint32_t reverseChannel)
Constructor.
Definition: DoubleSolenoid.cpp:20
virtual ~DoubleSolenoid()
Destructor.
Definition: DoubleSolenoid.cpp:85
std::string GetSmartDashboardType() const
Definition: DoubleSolenoid.cpp:189
bool IsFwdSolenoidBlackListed() const
Check if the forward solenoid is blacklisted.
Definition: DoubleSolenoid.cpp:138
A listener that listens to changes in values in a ITable.
Definition: ITableListener.h:18
std::shared_ptr< ITable > GetTable() const
Definition: DoubleSolenoid.cpp:198
void UpdateTable()
Update the table for this sendable object with the latest values.
Definition: DoubleSolenoid.cpp:167
SolenoidBase class is the common base class for the Solenoid and DoubleSolenoid classes.
Definition: SolenoidBase.h:21
void StopLiveWindowMode()
Stop having this sendable object automatically respond to value changes.
Definition: DoubleSolenoid.cpp:182
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:39
bool IsRevSolenoidBlackListed() const
Check if the reverse solenoid is blacklisted.
Definition: DoubleSolenoid.cpp:150