13 #include "CallbackStore.h"
14 #include "mockdata/PCMData.h"
20 explicit PCMSim(
int index) { m_index = index; }
22 std::unique_ptr<CallbackStore> RegisterSolenoidInitializedCallback(
23 int channel, NotifyCallback callback,
bool initialNotify) {
24 auto store = std::make_unique<CallbackStore>(
25 m_index, channel, -1, callback,
26 &HALSIM_CancelPCMSolenoidInitializedCallback);
27 store->SetUid(HALSIM_RegisterPCMSolenoidInitializedCallback(
28 m_index, channel, &CallbackStoreThunk, store.get(), initialNotify));
32 bool GetSolenoidInitialized(
int channel)
const {
33 return HALSIM_GetPCMSolenoidInitialized(m_index, channel);
36 void SetSolenoidInitialized(
int channel,
bool solenoidInitialized) {
37 HALSIM_SetPCMSolenoidInitialized(m_index, channel, solenoidInitialized);
40 std::unique_ptr<CallbackStore> RegisterSolenoidOutputCallback(
41 int channel, NotifyCallback callback,
bool initialNotify) {
42 auto store = std::make_unique<CallbackStore>(
43 m_index, channel, -1, callback,
44 &HALSIM_CancelPCMSolenoidOutputCallback);
45 store->SetUid(HALSIM_RegisterPCMSolenoidOutputCallback(
46 m_index, channel, &CallbackStoreThunk, store.get(), initialNotify));
50 bool GetSolenoidOutput(
int channel)
const {
51 return HALSIM_GetPCMSolenoidOutput(m_index, channel);
54 void SetSolenoidOutput(
int channel,
bool solenoidOutput) {
55 HALSIM_SetPCMSolenoidOutput(m_index, channel, solenoidOutput);
58 std::unique_ptr<CallbackStore> RegisterCompressorInitializedCallback(
59 NotifyCallback callback,
bool initialNotify) {
60 auto store = std::make_unique<CallbackStore>(
61 m_index, -1, callback, &HALSIM_CancelPCMCompressorInitializedCallback);
62 store->SetUid(HALSIM_RegisterPCMCompressorInitializedCallback(
63 m_index, &CallbackStoreThunk, store.get(), initialNotify));
67 bool GetCompressorInitialized()
const {
68 return HALSIM_GetPCMCompressorInitialized(m_index);
71 void SetCompressorInitialized(
bool compressorInitialized) {
72 HALSIM_SetPCMCompressorInitialized(m_index, compressorInitialized);
75 std::unique_ptr<CallbackStore> RegisterCompressorOnCallback(
76 NotifyCallback callback,
bool initialNotify) {
77 auto store = std::make_unique<CallbackStore>(
78 m_index, -1, callback, &HALSIM_CancelPCMCompressorOnCallback);
79 store->SetUid(HALSIM_RegisterPCMCompressorOnCallback(
80 m_index, &CallbackStoreThunk, store.get(), initialNotify));
84 bool GetCompressorOn()
const {
return HALSIM_GetPCMCompressorOn(m_index); }
86 void SetCompressorOn(
bool compressorOn) {
87 HALSIM_SetPCMCompressorOn(m_index, compressorOn);
90 std::unique_ptr<CallbackStore> RegisterClosedLoopEnabledCallback(
91 NotifyCallback callback,
bool initialNotify) {
92 auto store = std::make_unique<CallbackStore>(
93 m_index, -1, callback, &HALSIM_CancelPCMClosedLoopEnabledCallback);
94 store->SetUid(HALSIM_RegisterPCMClosedLoopEnabledCallback(
95 m_index, &CallbackStoreThunk, store.get(), initialNotify));
99 bool GetClosedLoopEnabled()
const {
100 return HALSIM_GetPCMClosedLoopEnabled(m_index);
103 void SetClosedLoopEnabled(
bool closedLoopEnabled) {
104 HALSIM_SetPCMClosedLoopEnabled(m_index, closedLoopEnabled);
107 std::unique_ptr<CallbackStore> RegisterPressureSwitchCallback(
108 NotifyCallback callback,
bool initialNotify) {
109 auto store = std::make_unique<CallbackStore>(
110 m_index, -1, callback, &HALSIM_CancelPCMPressureSwitchCallback);
111 store->SetUid(HALSIM_RegisterPCMPressureSwitchCallback(
112 m_index, &CallbackStoreThunk, store.get(), initialNotify));
116 bool GetPressureSwitch()
const {
117 return HALSIM_GetPCMPressureSwitch(m_index);
120 void SetPressureSwitch(
bool pressureSwitch) {
121 HALSIM_SetPCMPressureSwitch(m_index, pressureSwitch);
124 std::unique_ptr<CallbackStore> RegisterCompressorCurrentCallback(
125 NotifyCallback callback,
bool initialNotify) {
126 auto store = std::make_unique<CallbackStore>(
127 m_index, -1, callback, &HALSIM_CancelPCMCompressorCurrentCallback);
128 store->SetUid(HALSIM_RegisterPCMCompressorCurrentCallback(
129 m_index, &CallbackStoreThunk, store.get(), initialNotify));
133 double GetCompressorCurrent()
const {
134 return HALSIM_GetPCMCompressorCurrent(m_index);
137 void SetCompressorCurrent(
double compressorCurrent) {
138 HALSIM_SetPCMCompressorCurrent(m_index, compressorCurrent);
141 uint8_t GetAllSolenoidOutputs() {
143 HALSIM_GetPCMAllSolenoids(m_index, &ret);
147 void SetAllSolenoidOutputs(uint8_t outputs) {
148 HALSIM_SetPCMAllSolenoids(m_index, outputs);
151 void ResetData() { HALSIM_ResetPCMData(m_index); }