13 #include "CallbackStore.h"
14 #include "mockdata/AnalogInData.h"
20 explicit AnalogInSim(
int index) { m_index = index; }
22 std::unique_ptr<CallbackStore> RegisterInitializedCallback(
23 NotifyCallback callback,
bool initialNotify) {
24 auto store = std::make_unique<CallbackStore>(
25 m_index, -1, callback, &HALSIM_CancelAnalogInInitializedCallback);
26 store->SetUid(HALSIM_RegisterAnalogInInitializedCallback(
27 m_index, &CallbackStoreThunk, store.get(), initialNotify));
31 bool GetInitialized()
const {
return HALSIM_GetAnalogInInitialized(m_index); }
33 void SetInitialized(
bool initialized) {
34 HALSIM_SetAnalogInInitialized(m_index, initialized);
37 std::unique_ptr<CallbackStore> RegisterAverageBitsCallback(
38 NotifyCallback callback,
bool initialNotify) {
39 auto store = std::make_unique<CallbackStore>(
40 m_index, -1, callback, &HALSIM_CancelAnalogInAverageBitsCallback);
41 store->SetUid(HALSIM_RegisterAnalogInAverageBitsCallback(
42 m_index, &CallbackStoreThunk, store.get(), initialNotify));
46 int GetAverageBits()
const {
return HALSIM_GetAnalogInAverageBits(m_index); }
48 void SetAverageBits(
int averageBits) {
49 HALSIM_SetAnalogInAverageBits(m_index, averageBits);
52 std::unique_ptr<CallbackStore> RegisterOversampleBitsCallback(
53 NotifyCallback callback,
bool initialNotify) {
54 auto store = std::make_unique<CallbackStore>(
55 m_index, -1, callback, &HALSIM_CancelAnalogInOversampleBitsCallback);
56 store->SetUid(HALSIM_RegisterAnalogInOversampleBitsCallback(
57 m_index, &CallbackStoreThunk, store.get(), initialNotify));
61 int GetOversampleBits()
const {
62 return HALSIM_GetAnalogInOversampleBits(m_index);
65 void SetOversampleBits(
int oversampleBits) {
66 HALSIM_SetAnalogInOversampleBits(m_index, oversampleBits);
69 std::unique_ptr<CallbackStore> RegisterVoltageCallback(
70 NotifyCallback callback,
bool initialNotify) {
71 auto store = std::make_unique<CallbackStore>(
72 m_index, -1, callback, &HALSIM_CancelAnalogInVoltageCallback);
73 store->SetUid(HALSIM_RegisterAnalogInVoltageCallback(
74 m_index, &CallbackStoreThunk, store.get(), initialNotify));
78 double GetVoltage()
const {
return HALSIM_GetAnalogInVoltage(m_index); }
80 void SetVoltage(
double voltage) {
81 HALSIM_SetAnalogInVoltage(m_index, voltage);
84 std::unique_ptr<CallbackStore> RegisterAccumulatorInitializedCallback(
85 NotifyCallback callback,
bool initialNotify) {
86 auto store = std::make_unique<CallbackStore>(
87 m_index, -1, callback,
88 &HALSIM_CancelAnalogInAccumulatorInitializedCallback);
89 store->SetUid(HALSIM_RegisterAnalogInAccumulatorInitializedCallback(
90 m_index, &CallbackStoreThunk, store.get(), initialNotify));
94 bool GetAccumulatorInitialized()
const {
95 return HALSIM_GetAnalogInAccumulatorInitialized(m_index);
98 void SetAccumulatorInitialized(
bool accumulatorInitialized) {
99 HALSIM_SetAnalogInAccumulatorInitialized(m_index, accumulatorInitialized);
102 std::unique_ptr<CallbackStore> RegisterAccumulatorValueCallback(
103 NotifyCallback callback,
bool initialNotify) {
104 auto store = std::make_unique<CallbackStore>(
105 m_index, -1, callback, &HALSIM_CancelAnalogInAccumulatorValueCallback);
106 store->SetUid(HALSIM_RegisterAnalogInAccumulatorValueCallback(
107 m_index, &CallbackStoreThunk, store.get(), initialNotify));
111 int64_t GetAccumulatorValue()
const {
112 return HALSIM_GetAnalogInAccumulatorValue(m_index);
115 void SetAccumulatorValue(int64_t accumulatorValue) {
116 HALSIM_SetAnalogInAccumulatorValue(m_index, accumulatorValue);
119 std::unique_ptr<CallbackStore> RegisterAccumulatorCountCallback(
120 NotifyCallback callback,
bool initialNotify) {
121 auto store = std::make_unique<CallbackStore>(
122 m_index, -1, callback, &HALSIM_CancelAnalogInAccumulatorCountCallback);
123 store->SetUid(HALSIM_RegisterAnalogInAccumulatorCountCallback(
124 m_index, &CallbackStoreThunk, store.get(), initialNotify));
128 int64_t GetAccumulatorCount()
const {
129 return HALSIM_GetAnalogInAccumulatorCount(m_index);
132 void SetAccumulatorCount(int64_t accumulatorCount) {
133 HALSIM_SetAnalogInAccumulatorCount(m_index, accumulatorCount);
136 std::unique_ptr<CallbackStore> RegisterAccumulatorCenterCallback(
137 NotifyCallback callback,
bool initialNotify) {
138 auto store = std::make_unique<CallbackStore>(
139 m_index, -1, callback, &HALSIM_CancelAnalogInAccumulatorCenterCallback);
140 store->SetUid(HALSIM_RegisterAnalogInAccumulatorCenterCallback(
141 m_index, &CallbackStoreThunk, store.get(), initialNotify));
145 int GetAccumulatorCenter()
const {
146 return HALSIM_GetAnalogInAccumulatorCenter(m_index);
149 void SetAccumulatorCenter(
int accumulatorCenter) {
150 HALSIM_SetAnalogInAccumulatorCenter(m_index, accumulatorCenter);
153 std::unique_ptr<CallbackStore> RegisterAccumulatorDeadbandCallback(
154 NotifyCallback callback,
bool initialNotify) {
155 auto store = std::make_unique<CallbackStore>(
156 m_index, -1, callback,
157 &HALSIM_CancelAnalogInAccumulatorDeadbandCallback);
158 store->SetUid(HALSIM_RegisterAnalogInAccumulatorDeadbandCallback(
159 m_index, &CallbackStoreThunk, store.get(), initialNotify));
163 int GetAccumulatorDeadband()
const {
164 return HALSIM_GetAnalogInAccumulatorDeadband(m_index);
167 void SetAccumulatorDeadband(
int accumulatorDeadband) {
168 HALSIM_SetAnalogInAccumulatorDeadband(m_index, accumulatorDeadband);
171 void ResetData() { HALSIM_ResetAnalogInData(m_index); }