13 #include "CallbackStore.h"
14 #include "mockdata/PDPData.h"
20 explicit PDPSim(
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_CancelPDPInitializedCallback);
26 store->SetUid(HALSIM_RegisterPDPInitializedCallback(
27 m_index, &CallbackStoreThunk, store.get(), initialNotify));
31 bool GetInitialized()
const {
return HALSIM_GetPDPInitialized(m_index); }
33 void SetInitialized(
bool initialized) {
34 HALSIM_SetPDPInitialized(m_index, initialized);
37 std::unique_ptr<CallbackStore> RegisterTemperatureCallback(
38 NotifyCallback callback,
bool initialNotify) {
39 auto store = std::make_unique<CallbackStore>(
40 m_index, -1, callback, &HALSIM_CancelPDPTemperatureCallback);
41 store->SetUid(HALSIM_RegisterPDPTemperatureCallback(
42 m_index, &CallbackStoreThunk, store.get(), initialNotify));
46 double GetTemperature()
const {
return HALSIM_GetPDPTemperature(m_index); }
48 void SetTemperature(
double temperature) {
49 HALSIM_SetPDPTemperature(m_index, temperature);
52 std::unique_ptr<CallbackStore> RegisterVoltageCallback(
53 NotifyCallback callback,
bool initialNotify) {
54 auto store = std::make_unique<CallbackStore>(
55 m_index, -1, callback, &HALSIM_CancelPDPVoltageCallback);
56 store->SetUid(HALSIM_RegisterPDPVoltageCallback(
57 m_index, &CallbackStoreThunk, store.get(), initialNotify));
61 double GetVoltage()
const {
return HALSIM_GetPDPVoltage(m_index); }
63 void SetVoltage(
double voltage) { HALSIM_SetPDPVoltage(m_index, voltage); }
65 std::unique_ptr<CallbackStore> RegisterCurrentCallback(
66 int channel, NotifyCallback callback,
bool initialNotify) {
67 auto store = std::make_unique<CallbackStore>(
68 m_index, channel, -1, callback, &HALSIM_CancelPDPCurrentCallback);
69 store->SetUid(HALSIM_RegisterPDPCurrentCallback(
70 m_index, channel, &CallbackStoreThunk, store.get(), initialNotify));
74 double GetCurrent(
int channel)
const {
75 return HALSIM_GetPDPCurrent(m_index, channel);
78 void SetCurrent(
int channel,
double current) {
79 HALSIM_SetPDPCurrent(m_index, channel, current);
82 void GetAllCurrents(
double* currents) {
83 HALSIM_GetPDPAllCurrents(m_index, currents);
86 void SetAllCurrents(
const double* currents) {
87 HALSIM_SetPDPAllCurrents(m_index, currents);
90 void ResetData() { HALSIM_ResetPDPData(m_index); }