From f5092b27ba86c36716d00476b8018ee5a81cb27c Mon Sep 17 00:00:00 2001 From: meggert Date: Mon, 13 Feb 2023 17:24:56 +0100 Subject: [PATCH] add SCEX dummy --- dummies/CMakeLists.txt | 1 + dummies/ScexDummy.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ dummies/ScexDummy.h | 34 ++++++++++++++++++++++++++++++++++ dummies/helpers.cpp | 3 +++ 4 files changed, 78 insertions(+) create mode 100644 dummies/ScexDummy.cpp create mode 100644 dummies/ScexDummy.h diff --git a/dummies/CMakeLists.txt b/dummies/CMakeLists.txt index 38527dd6..1e41f7d2 100644 --- a/dummies/CMakeLists.txt +++ b/dummies/CMakeLists.txt @@ -20,6 +20,7 @@ target_sources( GyroL3GD20Dummy.cpp MgmLIS3MDLDummy.cpp PlPcduDummy.cpp + ScexDummy.cpp CoreControllerDummy.cpp helpers.cpp MgmRm3100Dummy.cpp diff --git a/dummies/ScexDummy.cpp b/dummies/ScexDummy.cpp new file mode 100644 index 00000000..303570ff --- /dev/null +++ b/dummies/ScexDummy.cpp @@ -0,0 +1,40 @@ +#include "ScexDummy.h" + +ScexDummy::ScexDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie) + : DeviceHandlerBase(objectId, comif, comCookie) {} + +ScexDummy::~ScexDummy() {} + +void ScexDummy::doStartUp() {} + +void ScexDummy::doShutDown() {} + +ReturnValue_t ScexDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; } + +ReturnValue_t ScexDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) { + return NOTHING_TO_SEND; +} + +ReturnValue_t ScexDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData, + size_t commandDataLen) { + return returnvalue::OK; +} + +ReturnValue_t ScexDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId, + size_t *foundLen) { + return returnvalue::OK; +} + +ReturnValue_t ScexDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { + return returnvalue::OK; +} + +void ScexDummy::fillCommandAndReplyMap() {} + +uint32_t ScexDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; } + +ReturnValue_t ScexDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, + LocalDataPoolManager &poolManager) { + return returnvalue::OK; +} diff --git a/dummies/ScexDummy.h b/dummies/ScexDummy.h new file mode 100644 index 00000000..dc0cc73a --- /dev/null +++ b/dummies/ScexDummy.h @@ -0,0 +1,34 @@ +#ifndef DUMMIES_SCEXDUMMY_H_ +#define DUMMIES_SCEXDUMMY_H_ + +#include + +class ScexDummy : public DeviceHandlerBase { + public: + static const DeviceCommandId_t SIMPLE_COMMAND = 1; + static const DeviceCommandId_t PERIODIC_REPLY = 2; + + static const uint8_t SIMPLE_COMMAND_DATA = 1; + static const uint8_t PERIODIC_REPLY_DATA = 2; + + ScexDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie); + virtual ~ScexDummy(); + + protected: + void doStartUp() override; + void doShutDown() override; + ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override; + ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override; + ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData, + size_t commandDataLen) override; + ReturnValue_t scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId, + size_t *foundLen) override; + ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override; + void fillCommandAndReplyMap() override; + uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override; + ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, + LocalDataPoolManager &poolManager) override; +}; + + +#endif /* DUMMIES_SCEXDUMMY_H_ */ diff --git a/dummies/helpers.cpp b/dummies/helpers.cpp index 2115867f..ee509788 100644 --- a/dummies/helpers.cpp +++ b/dummies/helpers.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -195,5 +196,7 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio } auto* camSwitcher = new CamSwitcher(objects::CAM_SWITCHER, pwrSwitcher, power::NO_SWITCH); camSwitcher->connectModeTreeParent(satsystem::pl::SUBSYSTEM); + auto* scexDummy = new ScexDummy(objects::SCEX, objects::DUMMY_COM_IF, comCookieDummy); + scexDummy->connectModeTreeParent(satsystem::pl::SUBSYSTEM); new PlPcduDummy(objects::PLPCDU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); }