WPILibC++  unspecified
DoubleSolenoid.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2008-2017 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 #include <string>
12 
13 #include <HAL/Types.h>
14 
15 #include "LiveWindow/LiveWindowSendable.h"
16 #include "SolenoidBase.h"
17 #include "networktables/NetworkTableEntry.h"
18 
19 namespace frc {
20 
29  public:
30  enum Value { kOff, kForward, kReverse };
31 
32  explicit DoubleSolenoid(int forwardChannel, int reverseChannel);
33  DoubleSolenoid(int moduleNumber, int forwardChannel, int reverseChannel);
34  virtual ~DoubleSolenoid();
35  virtual void Set(Value value);
36  virtual Value Get() const;
37  bool IsFwdSolenoidBlackListed() const;
38  bool IsRevSolenoidBlackListed() const;
39 
40  void UpdateTable();
41  void StartLiveWindowMode();
42  void StopLiveWindowMode();
43  std::string GetSmartDashboardType() const;
44  void InitTable(std::shared_ptr<nt::NetworkTable> subTable);
45 
46  private:
47  int m_forwardChannel;
48  int m_reverseChannel;
49  int m_forwardMask;
50  int m_reverseMask;
51  HAL_SolenoidHandle m_forwardHandle = HAL_kInvalidHandle;
52  HAL_SolenoidHandle m_reverseHandle = HAL_kInvalidHandle;
53 
54  nt::NetworkTableEntry m_valueEntry;
55  NT_EntryListener m_valueListener = 0;
56 };
57 
58 } // namespace frc
Definition: Timer.cpp:18
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:18
void UpdateTable()
Update the table for this sendable object with the latest values.
Definition: DoubleSolenoid.cpp:184
DoubleSolenoid class for running 2 channels of high voltage Digital Output (PCM). ...
Definition: DoubleSolenoid.h:28
virtual Value Get() const
Read the current value of the solenoid.
Definition: DoubleSolenoid.cpp:143
bool IsRevSolenoidBlackListed() const
Check if the reverse solenoid is blacklisted.
Definition: DoubleSolenoid.cpp:179
void StopLiveWindowMode()
Stop having this sendable object automatically respond to value changes.
Definition: DoubleSolenoid.cpp:217
void InitTable(std::shared_ptr< nt::NetworkTable > subTable)
Initializes a table for this sendable object.
Definition: DoubleSolenoid.cpp:229
DoubleSolenoid(int forwardChannel, int reverseChannel)
Constructor.
Definition: DoubleSolenoid.cpp:29
virtual ~DoubleSolenoid()
Destructor.
Definition: DoubleSolenoid.cpp:99
std::string GetSmartDashboardType() const
Definition: DoubleSolenoid.cpp:225
virtual void Set(Value value)
Set the value of a solenoid.
Definition: DoubleSolenoid.cpp:110
void StartLiveWindowMode()
Start having this sendable object automatically respond to value changes reflect the value on the tab...
Definition: DoubleSolenoid.cpp:200
NetworkTables Entry.
Definition: NetworkTableEntry.h:30
bool IsFwdSolenoidBlackListed() const
Check if the forward solenoid is blacklisted.
Definition: DoubleSolenoid.cpp:166