Brian Silverman | f7f267a | 2017-02-04 16:16:08 -0800 | [diff] [blame^] | 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 "LiveWindow/LiveWindowSendable.h" |
| 14 | #include "simulation/SimContinuousOutput.h" |
| 15 | #include "tables/ITableListener.h" |
| 16 | |
| 17 | namespace frc { |
| 18 | |
| 19 | /** |
| 20 | * Solenoid class for running high voltage Digital Output (PCM). |
| 21 | * |
| 22 | * The Solenoid class is typically used for pneumatics solenoids, but could be |
| 23 | * used for any device within the current spec of the PCM. |
| 24 | */ |
| 25 | class Solenoid : public LiveWindowSendable, public ITableListener { |
| 26 | public: |
| 27 | explicit Solenoid(int channel); |
| 28 | Solenoid(int moduleNumber, int channel); |
| 29 | virtual ~Solenoid(); |
| 30 | virtual void Set(bool on); |
| 31 | virtual bool Get() const; |
| 32 | |
| 33 | void ValueChanged(ITable* source, llvm::StringRef key, |
| 34 | std::shared_ptr<nt::Value> value, bool isNew) override; |
| 35 | void UpdateTable() override; |
| 36 | void StartLiveWindowMode() override; |
| 37 | void StopLiveWindowMode() override; |
| 38 | std::string GetSmartDashboardType() const override; |
| 39 | void InitTable(std::shared_ptr<ITable> subTable) override; |
| 40 | std::shared_ptr<ITable> GetTable() const override; |
| 41 | |
| 42 | private: |
| 43 | SimContinuousOutput* m_impl; |
| 44 | bool m_on; |
| 45 | |
| 46 | std::shared_ptr<ITable> m_table; |
| 47 | }; |
| 48 | |
| 49 | } // namespace frc |