2022-06-16 08:26:40 +02:00
|
|
|
#include "RwDummy.h"
|
2022-06-17 08:31:36 +02:00
|
|
|
|
2023-03-24 20:50:33 +01:00
|
|
|
#include <mission/acs/rwHelpers.h>
|
2022-06-16 08:26:40 +02:00
|
|
|
|
|
|
|
RwDummy::RwDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
|
2023-06-21 13:59:15 +02:00
|
|
|
: DeviceHandlerBase(objectId, comif, comCookie),
|
|
|
|
|
|
|
|
statusSet(this),
|
|
|
|
lastResetStatusSet(this),
|
|
|
|
tmDataset(this),
|
|
|
|
rwSpeedActuationSet(*this) {}
|
2022-06-16 08:26:40 +02:00
|
|
|
|
|
|
|
RwDummy::~RwDummy() {}
|
|
|
|
|
2023-06-21 13:59:15 +02:00
|
|
|
void RwDummy::doStartUp() {
|
|
|
|
statusSet.setReportingEnabled(true);
|
|
|
|
setMode(MODE_ON);
|
|
|
|
}
|
2022-06-16 08:26:40 +02:00
|
|
|
|
2023-06-21 13:59:15 +02:00
|
|
|
void RwDummy::doShutDown() {
|
|
|
|
statusSet.setReportingEnabled(false);
|
|
|
|
setMode(MODE_OFF);
|
|
|
|
}
|
2022-06-16 08:26:40 +02:00
|
|
|
|
2022-06-17 08:31:36 +02:00
|
|
|
ReturnValue_t RwDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; }
|
2022-06-16 08:26:40 +02:00
|
|
|
|
|
|
|
ReturnValue_t RwDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
|
|
|
return NOTHING_TO_SEND;
|
|
|
|
}
|
|
|
|
|
|
|
|
ReturnValue_t RwDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
2022-06-17 08:31:36 +02:00
|
|
|
const uint8_t *commandData, size_t commandDataLen) {
|
2022-08-24 17:27:47 +02:00
|
|
|
return returnvalue::OK;
|
2022-06-16 08:26:40 +02:00
|
|
|
}
|
|
|
|
|
2022-06-17 08:31:36 +02:00
|
|
|
ReturnValue_t RwDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
|
|
|
|
size_t *foundLen) {
|
2022-08-24 17:27:47 +02:00
|
|
|
return returnvalue::OK;
|
2022-06-16 08:26:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ReturnValue_t RwDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
2022-08-24 17:27:47 +02:00
|
|
|
return returnvalue::OK;
|
2022-06-16 08:26:40 +02:00
|
|
|
}
|
|
|
|
|
2022-06-17 08:31:36 +02:00
|
|
|
void RwDummy::fillCommandAndReplyMap() {}
|
2022-06-16 08:26:40 +02:00
|
|
|
|
|
|
|
uint32_t RwDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
|
|
|
|
|
2022-06-17 08:31:36 +02:00
|
|
|
ReturnValue_t RwDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
|
|
|
LocalDataPoolManager &poolManager) {
|
2023-04-17 11:35:10 +02:00
|
|
|
localDataPoolMap.emplace(rws::RW_SPEED, &rwSpeed);
|
|
|
|
localDataPoolMap.emplace(rws::RAMP_TIME, &rampTime);
|
|
|
|
|
2023-02-15 17:02:22 +01:00
|
|
|
localDataPoolMap.emplace(rws::TEMPERATURE_C, new PoolEntry<int32_t>({0}));
|
|
|
|
|
|
|
|
localDataPoolMap.emplace(rws::CURR_SPEED, new PoolEntry<int32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::REFERENCE_SPEED, new PoolEntry<int32_t>({0}));
|
2023-02-24 09:11:37 +01:00
|
|
|
localDataPoolMap.emplace(rws::STATE, new PoolEntry<uint8_t>({1}, true));
|
2023-02-15 17:02:22 +01:00
|
|
|
localDataPoolMap.emplace(rws::CLC_MODE, new PoolEntry<uint8_t>({0}));
|
|
|
|
|
|
|
|
localDataPoolMap.emplace(rws::LAST_RESET_STATUS, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::CURRRENT_RESET_STATUS, new PoolEntry<uint8_t>({0}));
|
|
|
|
|
|
|
|
localDataPoolMap.emplace(rws::TM_LAST_RESET_STATUS, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::TM_MCU_TEMPERATURE, new PoolEntry<int32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::PRESSURE_SENSOR_TEMPERATURE, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::PRESSURE, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::TM_RW_STATE, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::TM_CLC_MODE, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::TM_RW_CURR_SPEED, new PoolEntry<int32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::TM_RW_REF_SPEED, new PoolEntry<int32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::INVALID_CRC_PACKETS, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::INVALID_LEN_PACKETS, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::INVALID_CMD_PACKETS, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::EXECUTED_REPLIES, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::COMMAND_REPLIES, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::UART_BYTES_WRITTEN, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::UART_BYTES_READ, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::UART_PARITY_ERRORS, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::UART_NOISE_ERRORS, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::UART_FRAME_ERRORS, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::UART_REG_OVERRUN_ERRORS, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::UART_TOTAL_ERRORS, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::SPI_BYTES_WRITTEN, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::SPI_BYTES_READ, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::SPI_REG_OVERRUN_ERRORS, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(rws::SPI_TOTAL_ERRORS, new PoolEntry<uint32_t>({0}));
|
2023-06-21 13:59:15 +02:00
|
|
|
poolManager.subscribeForDiagPeriodicPacket(
|
|
|
|
subdp::DiagnosticsHkPeriodicParams(statusSet.getSid(), false, 12.0));
|
|
|
|
poolManager.subscribeForRegularPeriodicPacket(
|
|
|
|
subdp::RegularHkPeriodicParams(tmDataset.getSid(), false, 30.0));
|
|
|
|
poolManager.subscribeForRegularPeriodicPacket(
|
|
|
|
subdp::RegularHkPeriodicParams(lastResetStatusSet.getSid(), false, 30.0));
|
2022-08-24 17:27:47 +02:00
|
|
|
return returnvalue::OK;
|
2022-06-16 08:26:40 +02:00
|
|
|
}
|
2023-10-11 09:24:48 +02:00
|
|
|
|
|
|
|
LocalPoolDataSetBase *RwDummy::getDataSetHandle(sid_t sid) {
|
|
|
|
switch (sid.ownerSetId) {
|
|
|
|
case (rws::SetIds::STATUS_SET_ID): {
|
|
|
|
return &statusSet;
|
|
|
|
}
|
|
|
|
case (rws::SetIds::LAST_RESET_ID): {
|
|
|
|
return &lastResetStatusSet;
|
|
|
|
}
|
|
|
|
case (rws::SetIds::SPEED_CMD_SET): {
|
|
|
|
return &rwSpeedActuationSet;
|
|
|
|
}
|
|
|
|
case (rws::SetIds::TM_SET_ID): {
|
|
|
|
return &tmDataset;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|