WPILibC++  unspecified
Solenoid.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 
27 class Solenoid : public SolenoidBase, public LiveWindowSendable {
28  public:
29  explicit Solenoid(int channel);
30  Solenoid(int moduleNumber, int channel);
31  virtual ~Solenoid();
32  virtual void Set(bool on);
33  virtual bool Get() const;
34  bool IsBlackListed() const;
35 
36  void UpdateTable();
37  void StartLiveWindowMode();
38  void StopLiveWindowMode();
39  std::string GetSmartDashboardType() const;
40  void InitTable(std::shared_ptr<nt::NetworkTable> subTable);
41 
42  private:
43  HAL_SolenoidHandle m_solenoidHandle = HAL_kInvalidHandle;
44  int m_channel;
45  nt::NetworkTableEntry m_valueEntry;
46  NT_EntryListener m_valueListener = 0;
47 };
48 
49 } // 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 StartLiveWindowMode()
Start having this sendable object automatically respond to value changes reflect the value on the tab...
Definition: Solenoid.cpp:118
void StopLiveWindowMode()
Stop having this sendable object automatically respond to value changes.
Definition: Solenoid.cpp:130
virtual void Set(bool on)
Set the value of a solenoid.
Definition: Solenoid.cpp:79
virtual bool Get() const
Read the current value of the solenoid.
Definition: Solenoid.cpp:91
void UpdateTable()
Update the table for this sendable object with the latest values.
Definition: Solenoid.cpp:114
Solenoid class for running high voltage Digital Output (PCM).
Definition: Solenoid.h:27
virtual ~Solenoid()
Destructor.
Definition: Solenoid.cpp:69
Solenoid(int channel)
Constructor using the default PCM ID (0).
Definition: Solenoid.cpp:26
void InitTable(std::shared_ptr< nt::NetworkTable > subTable)
Initializes a table for this sendable object.
Definition: Solenoid.cpp:137
bool IsBlackListed() const
Check if solenoid is blacklisted.
Definition: Solenoid.cpp:109
NetworkTables Entry.
Definition: NetworkTableEntry.h:30
std::string GetSmartDashboardType() const
Definition: Solenoid.cpp:135