eive-obsw/dummies/Max31865Dummy.cpp

53 lines
2.4 KiB
C++
Raw Permalink Normal View History

2022-11-25 10:13:24 +01:00
#include "Max31865Dummy.h"
#include "fsfw/datapool/PoolReadGuard.h"
2022-11-25 10:13:24 +01:00
using namespace returnvalue;
Max31865Dummy::Max31865Dummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
: DeviceHandlerBase(objectId, comif, comCookie), set(this, EiveMax31855::EXCHANGE_SET_ID) {}
void Max31865Dummy::doStartUp() { setMode(MODE_ON); }
void Max31865Dummy::doShutDown() { setMode(_MODE_POWER_DOWN); }
ReturnValue_t Max31865Dummy::buildNormalDeviceCommand(DeviceCommandId_t *id) {
return NOTHING_TO_SEND;
}
ReturnValue_t Max31865Dummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) { return OK; }
ReturnValue_t Max31865Dummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData,
size_t commandDataLen) {
return 0;
}
ReturnValue_t Max31865Dummy::scanForReply(const uint8_t *start, size_t len,
DeviceCommandId_t *foundId, size_t *foundLen) {
return 0;
}
ReturnValue_t Max31865Dummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
return 0;
}
void Max31865Dummy::fillCommandAndReplyMap() {}
uint32_t Max31865Dummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 0; }
ReturnValue_t Max31865Dummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
2022-11-25 10:19:45 +01:00
using namespace MAX31865;
localDataPoolMap.emplace(static_cast<lp_id_t>(PoolIds::RTD_VALUE), new PoolEntry<float>({0}));
2023-03-15 15:00:06 +01:00
localDataPoolMap.emplace(static_cast<lp_id_t>(PoolIds::TEMPERATURE_C),
new PoolEntry<float>({10.0}, true));
2022-11-25 10:19:45 +01:00
localDataPoolMap.emplace(static_cast<lp_id_t>(PoolIds::LAST_FAULT_BYTE),
new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(static_cast<lp_id_t>(PoolIds::FAULT_BYTE), new PoolEntry<uint8_t>({0}));
2022-11-25 10:37:10 +01:00
return OK;
2022-11-25 10:13:24 +01:00
}
2023-01-17 16:16:59 +01:00
void Max31865Dummy::setTemperature(float temperature, bool valid) {
PoolReadGuard pg(&set);
2023-02-22 21:46:56 +01:00
if (pg.getReadResult() == returnvalue::OK) {
set.temperatureCelcius.value = temperature;
set.setValidity(valid, true);
}
2023-01-17 16:16:59 +01:00
}
2022-11-25 10:19:45 +01:00
LocalPoolDataSetBase *Max31865Dummy::getDataSetHandle(sid_t sid) { return &set; }
2022-11-25 10:27:47 +01:00
Max31865Dummy::Max31865Dummy(object_id_t objectId, CookieIF *cookie)
: DeviceHandlerBase(objectId, objects::DUMMY_COM_IF, cookie),
set(this, EiveMax31855::EXCHANGE_SET_ID) {}