eive-obsw/dummies/Tmp1075Dummy.cpp

65 lines
2.1 KiB
C++
Raw Permalink Normal View History

2022-11-25 10:13:24 +01:00
#include "Tmp1075Dummy.h"
#include <fsfw/datapool/PoolReadGuard.h>
2023-03-26 16:42:00 +02:00
#include <mission/tcs/Tmp1075Definitions.h>
2022-11-25 10:19:45 +01:00
2022-11-25 10:13:24 +01:00
using namespace returnvalue;
Tmp1075Dummy::Tmp1075Dummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
2022-11-25 10:19:45 +01:00
: DeviceHandlerBase(objectId, comif, comCookie), set(this) {}
2023-03-13 18:29:22 +01:00
2023-06-18 13:38:00 +02:00
void Tmp1075Dummy::doStartUp() { setMode(MODE_ON); }
void Tmp1075Dummy::doShutDown() {
PoolReadGuard pg(&set);
set.setValidity(false, true);
setMode(MODE_OFF);
}
2023-03-13 18:29:22 +01:00
2022-11-25 10:13:24 +01:00
ReturnValue_t Tmp1075Dummy::buildNormalDeviceCommand(DeviceCommandId_t *id) {
return NOTHING_TO_SEND;
}
2023-06-18 13:38:00 +02:00
ReturnValue_t Tmp1075Dummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
return NOTHING_TO_SEND;
}
2022-11-25 10:13:24 +01:00
ReturnValue_t Tmp1075Dummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData,
size_t commandDataLen) {
2023-06-18 13:38:00 +02:00
return NOTHING_TO_SEND;
2022-11-25 10:13:24 +01:00
}
2023-06-18 13:38:00 +02:00
2022-11-25 10:13:24 +01:00
ReturnValue_t Tmp1075Dummy::scanForReply(const uint8_t *start, size_t len,
DeviceCommandId_t *foundId, size_t *foundLen) {
return 0;
}
2023-06-18 13:38:00 +02:00
2022-11-25 10:13:24 +01:00
ReturnValue_t Tmp1075Dummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
return 0;
}
2023-06-18 13:38:00 +02:00
void Tmp1075Dummy::setTemperature(float temperature, bool valid) {
PoolReadGuard pg(&set);
set.temperatureCelcius.value = temperature;
set.setValidity(valid, true);
}
2023-06-18 13:38:00 +02:00
2022-11-25 10:13:24 +01:00
void Tmp1075Dummy::fillCommandAndReplyMap() {}
2023-06-18 13:38:00 +02:00
2022-11-25 10:19:45 +01:00
uint32_t Tmp1075Dummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 1000; }
2023-06-18 13:38:00 +02:00
2022-11-25 10:13:24 +01:00
ReturnValue_t Tmp1075Dummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
2023-03-15 15:00:06 +01:00
localDataPoolMap.emplace(TMP1075::TEMPERATURE_C_TMP1075, new PoolEntry<float>({10.0}, true));
2022-11-25 10:19:45 +01:00
return OK;
2022-11-25 10:13:24 +01:00
}
2023-06-18 13:38:00 +02:00
ReturnValue_t Tmp1075Dummy::setHealth(HealthState health) {
if (health == FAULTY or health == PERMANENT_FAULTY) {
setMode(_MODE_SHUT_DOWN);
}
return DeviceHandlerBase::setHealth(health);
}
2022-11-25 10:19:45 +01:00
LocalPoolDataSetBase *Tmp1075Dummy::getDataSetHandle(sid_t sid) { return &set; }