WPILibC++ 2025.0.0-alpha-1-9-ga2beb75
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 virtual ~SolenoidSim() = default;
20
21 bool GetOutput() const;
22 void SetOutput(bool output);
23
24 /**
25 * Register a callback to be run when the output of this solenoid has changed.
26 *
27 * @param callback the callback
28 * @param initialNotify whether to run the callback with the initial state
29 * @return the {@link CallbackStore} object associated with this callback.
30 * Save a reference to this object; it being deconstructed cancels the
31 * callback.
32 */
33 [[nodiscard]]
34 virtual std::unique_ptr<CallbackStore> RegisterOutputCallback(
35 NotifyCallback callback, bool initialNotify);
36
37 std::shared_ptr<PneumaticsBaseSim> GetModuleSim() const;
38
39 private:
40 std::shared_ptr<PneumaticsBaseSim> m_module;
41 int m_channel;
42};
43
44} // namespace frc::sim
Definition: SolenoidSim.h:14
SolenoidSim(int module, PneumaticsModuleType type, int channel)
virtual ~SolenoidSim()=default
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:573
Definition: ADXL345Sim.h:14
std::function< void(std::string_view, const HAL_Value *)> NotifyCallback
Definition: CallbackStore.h:14
PneumaticsModuleType
Pneumatics module type.
Definition: PneumaticsModuleType.h:11