WPILibC++ 2023.4.3
SolenoidSim.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include <memory>
8
11
12namespace frc::sim {
13
15 public:
16 SolenoidSim(std::shared_ptr<PneumaticsBaseSim> moduleSim, int channel);
17 SolenoidSim(int module, PneumaticsModuleType type, int channel);
19
20 bool GetOutput() const;
21 void SetOutput(bool output);
22
23 /**
24 * Register a callback to be run when the output of this solenoid has changed.
25 *
26 * @param callback the callback
27 * @param initialNotify whether to run the callback with the initial state
28 * @return the {@link CallbackStore} object associated with this callback.
29 * Save a reference to this object; it being deconstructed cancels the
30 * callback.
31 */
32 [[nodiscard]] virtual std::unique_ptr<CallbackStore> RegisterOutputCallback(
33 NotifyCallback callback, bool initialNotify);
34
35 std::shared_ptr<PneumaticsBaseSim> GetModuleSim() const;
36
37 private:
38 std::shared_ptr<PneumaticsBaseSim> m_module;
39 int m_channel;
40};
41
42} // namespace frc::sim
Definition: SolenoidSim.h:14
SolenoidSim(int module, PneumaticsModuleType type, int channel)
SolenoidSim(PneumaticsModuleType type, int channel)
bool GetOutput() const
std::shared_ptr< PneumaticsBaseSim > GetModuleSim() const
virtual std::unique_ptr< CallbackStore > RegisterOutputCallback(NotifyCallback callback, bool initialNotify)
Register a callback to be run when the output of this solenoid has changed.
SolenoidSim(std::shared_ptr< PneumaticsBaseSim > moduleSim, int channel)
void SetOutput(bool output)
type
Definition: core.h:575
Definition: AnalogOutputSim.h:15
std::function< void(std::string_view, const HAL_Value *)> NotifyCallback
Definition: CallbackStore.h:14
PneumaticsModuleType
Definition: PneumaticsModuleType.h:8