eive-obsw/dummies/Max31865Dummy.cpp
Irini Kosmidou 9a7779cffb
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
struct heaterStates and more
2023-02-22 21:46:56 +01:00

52 lines
2.4 KiB
C++

#include "Max31865Dummy.h"
#include "fsfw/datapool/PoolReadGuard.h"
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) {
using namespace MAX31865;
localDataPoolMap.emplace(static_cast<lp_id_t>(PoolIds::RTD_VALUE), new PoolEntry<float>({0}));
localDataPoolMap.emplace(static_cast<lp_id_t>(PoolIds::TEMPERATURE_C), new PoolEntry<float>({0}));
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}));
return OK;
}
void Max31865Dummy::setTemperature(float temperature, bool valid) {
PoolReadGuard pg(&set);
if (pg.getReadResult() == returnvalue::OK) {
set.temperatureCelcius.value = temperature;
set.setValidity(valid, true);
}
}
LocalPoolDataSetBase *Max31865Dummy::getDataSetHandle(sid_t sid) { return &set; }
Max31865Dummy::Max31865Dummy(object_id_t objectId, CookieIF *cookie)
: DeviceHandlerBase(objectId, objects::DUMMY_COM_IF, cookie),
set(this, EiveMax31855::EXCHANGE_SET_ID) {}