From b53bfb9a6fb3dbee1884ae4086ce8fd6281dc2b9 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Thu, 16 Jun 2022 08:26:40 +0200 Subject: [PATCH] dummy devices --- .../fsfwconfig/pollingsequence/CMakeLists.txt | 1 + .../fsfwconfig/pollingsequence/DummyPst.cpp | 133 ++++++++++++++++++ .../fsfwconfig/pollingsequence/DummyPst.h | 14 ++ dummies/AcuDummy.cpp | 45 ++++++ dummies/AcuDummy.h | 33 +++++ dummies/BpxDummy.cpp | 58 ++++++++ dummies/BpxDummy.h | 48 +++++++ dummies/CMakeLists.txt | 19 +++ dummies/ComCookieDummy.cpp | 5 + dummies/ComCookieDummy.h | 12 ++ dummies/ComIFDummy.cpp | 21 +++ dummies/ComIFDummy.h | 27 ++++ dummies/CoreControllerDummy.cpp | 58 ++++++++ dummies/CoreControllerDummy.h | 21 +++ dummies/GyroAdisDummy.cpp | 42 ++++++ dummies/GyroAdisDummy.h | 33 +++++ dummies/GyroL3GD20Dummy.cpp | 45 ++++++ dummies/GyroL3GD20Dummy.h | 33 +++++ dummies/ImtqDummy.cpp | 45 ++++++ dummies/ImtqDummy.h | 33 +++++ dummies/MgmLIS3MDLDummy.cpp | 42 ++++++ dummies/MgmLIS3MDLDummy.h | 33 +++++ dummies/P60DockDummy.cpp | 43 ++++++ dummies/P60DockDummy.h | 33 +++++ dummies/PduDummy.cpp | 42 ++++++ dummies/PduDummy.h | 33 +++++ dummies/PlPcduDummy.cpp | 45 ++++++ dummies/PlPcduDummy.h | 34 +++++ dummies/RwDummy.cpp | 78 ++++++++++ dummies/RwDummy.h | 33 +++++ dummies/StarTrackerDummy.cpp | 45 ++++++ dummies/StarTrackerDummy.h | 33 +++++ dummies/SusDummy.cpp | 82 +++++++++++ dummies/SusDummy.h | 27 ++++ dummies/SyrlinksDummy.cpp | 46 ++++++ dummies/SyrlinksDummy.h | 33 +++++ dummies/TemperatureSensorsDummy.cpp | 98 +++++++++++++ dummies/TemperatureSensorsDummy.h | 29 ++++ fsfw | 2 +- mission/devices/ComIFMock.cpp | 46 ++++++ mission/devices/ComIFMock.h | 37 +++++ mission/devices/CookieIFMock.cpp | 5 + mission/devices/CookieIFMock.h | 12 ++ 43 files changed, 1636 insertions(+), 1 deletion(-) create mode 100644 bsp_hosted/fsfwconfig/pollingsequence/CMakeLists.txt create mode 100644 bsp_hosted/fsfwconfig/pollingsequence/DummyPst.cpp create mode 100644 bsp_hosted/fsfwconfig/pollingsequence/DummyPst.h create mode 100644 dummies/AcuDummy.cpp create mode 100644 dummies/AcuDummy.h create mode 100644 dummies/BpxDummy.cpp create mode 100644 dummies/BpxDummy.h create mode 100644 dummies/CMakeLists.txt create mode 100644 dummies/ComCookieDummy.cpp create mode 100644 dummies/ComCookieDummy.h create mode 100644 dummies/ComIFDummy.cpp create mode 100644 dummies/ComIFDummy.h create mode 100644 dummies/CoreControllerDummy.cpp create mode 100644 dummies/CoreControllerDummy.h create mode 100644 dummies/GyroAdisDummy.cpp create mode 100644 dummies/GyroAdisDummy.h create mode 100644 dummies/GyroL3GD20Dummy.cpp create mode 100644 dummies/GyroL3GD20Dummy.h create mode 100644 dummies/ImtqDummy.cpp create mode 100644 dummies/ImtqDummy.h create mode 100644 dummies/MgmLIS3MDLDummy.cpp create mode 100644 dummies/MgmLIS3MDLDummy.h create mode 100644 dummies/P60DockDummy.cpp create mode 100644 dummies/P60DockDummy.h create mode 100644 dummies/PduDummy.cpp create mode 100644 dummies/PduDummy.h create mode 100644 dummies/PlPcduDummy.cpp create mode 100644 dummies/PlPcduDummy.h create mode 100644 dummies/RwDummy.cpp create mode 100644 dummies/RwDummy.h create mode 100644 dummies/StarTrackerDummy.cpp create mode 100644 dummies/StarTrackerDummy.h create mode 100644 dummies/SusDummy.cpp create mode 100644 dummies/SusDummy.h create mode 100644 dummies/SyrlinksDummy.cpp create mode 100644 dummies/SyrlinksDummy.h create mode 100644 dummies/TemperatureSensorsDummy.cpp create mode 100644 dummies/TemperatureSensorsDummy.h create mode 100644 mission/devices/ComIFMock.cpp create mode 100644 mission/devices/ComIFMock.h create mode 100644 mission/devices/CookieIFMock.cpp create mode 100644 mission/devices/CookieIFMock.h diff --git a/bsp_hosted/fsfwconfig/pollingsequence/CMakeLists.txt b/bsp_hosted/fsfwconfig/pollingsequence/CMakeLists.txt new file mode 100644 index 00000000..8dd44c1c --- /dev/null +++ b/bsp_hosted/fsfwconfig/pollingsequence/CMakeLists.txt @@ -0,0 +1 @@ +target_sources(${OBSW_NAME} PRIVATE DummyPst.cpp) \ No newline at end of file diff --git a/bsp_hosted/fsfwconfig/pollingsequence/DummyPst.cpp b/bsp_hosted/fsfwconfig/pollingsequence/DummyPst.cpp new file mode 100644 index 00000000..354d4dc8 --- /dev/null +++ b/bsp_hosted/fsfwconfig/pollingsequence/DummyPst.cpp @@ -0,0 +1,133 @@ +#include "DummyPst.h" + +#include +#include +#include +#include + +ReturnValue_t dummy_pst::pst(FixedTimeslotTaskIF *thisSequence) { + uint32_t length = thisSequence->getPeriodMs(); + + thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0, DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::RW1, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::RW1, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::RW1, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::RW1, length * 0, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::RW1, length * 0, DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::RW2, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::RW2, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::RW2, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::RW2, length * 0, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::RW2, length * 0, DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::RW3, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::RW3, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::RW3, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::RW3, length * 0, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::RW3, length * 0, DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::RW4, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::RW4, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::RW4, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::RW4, length * 0, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::RW4, length * 0, DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::STAR_TRACKER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::STAR_TRACKER, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::STAR_TRACKER, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::STAR_TRACKER, length * 0, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::STAR_TRACKER, length * 0, DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0, DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::ACU_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::ACU_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::ACU_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::ACU_HANDLER, length * 0, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::ACU_HANDLER, length * 0, DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::PDU1_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::PDU1_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::PDU1_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::PDU1_HANDLER, length * 0, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::PDU1_HANDLER, length * 0, DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::PDU2_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::PDU2_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::PDU2_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::PDU2_HANDLER, length * 0, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::PDU2_HANDLER, length * 0, DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::P60DOCK_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::P60DOCK_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::P60DOCK_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::P60DOCK_HANDLER, length * 0, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::P60DOCK_HANDLER, length * 0, DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::GET_READ); + + if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) { + return HasReturnvaluesIF::RETURN_OK; + } else { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "pst::pollingSequenceInitDefault: Sequence invalid!" << std::endl; +#endif + return HasReturnvaluesIF::RETURN_FAILED; + } +} diff --git a/bsp_hosted/fsfwconfig/pollingsequence/DummyPst.h b/bsp_hosted/fsfwconfig/pollingsequence/DummyPst.h new file mode 100644 index 00000000..711e39ba --- /dev/null +++ b/bsp_hosted/fsfwconfig/pollingsequence/DummyPst.h @@ -0,0 +1,14 @@ +#ifndef POLLINGSEQUENCEFACTORY_H_ +#define POLLINGSEQUENCEFACTORY_H_ + +#include + +class FixedTimeslotTaskIF; + +namespace dummy_pst { + +ReturnValue_t pst(FixedTimeslotTaskIF *thisSequence); + +} + +#endif /* POLLINGSEQUENCEINIT_H_ */ diff --git a/dummies/AcuDummy.cpp b/dummies/AcuDummy.cpp new file mode 100644 index 00000000..e882139e --- /dev/null +++ b/dummies/AcuDummy.cpp @@ -0,0 +1,45 @@ +#include "AcuDummy.h" +#include + +AcuDummy::AcuDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie) + : DeviceHandlerBase(objectId, comif, comCookie) {} + +AcuDummy::~AcuDummy() {} + +void AcuDummy::doStartUp() {} + +void AcuDummy::doShutDown() {} + +ReturnValue_t AcuDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { + return NOTHING_TO_SEND; +} + +ReturnValue_t AcuDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) { + return NOTHING_TO_SEND; +} + +ReturnValue_t AcuDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData, + size_t commandDataLen) { + return RETURN_OK; +} + +ReturnValue_t AcuDummy::scanForReply(const uint8_t *start, size_t len, + DeviceCommandId_t *foundId, size_t *foundLen) { + return RETURN_OK; +} + +ReturnValue_t AcuDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { + return RETURN_OK; +} + +void AcuDummy::fillCommandAndReplyMap() { +} + +uint32_t AcuDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; } + +ReturnValue_t AcuDummy::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, + LocalDataPoolManager& poolManager) { + localDataPoolMap.emplace(P60System::pool::ACU_TEMPERATURES, new PoolEntry(3)); + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/dummies/AcuDummy.h b/dummies/AcuDummy.h new file mode 100644 index 00000000..d5527222 --- /dev/null +++ b/dummies/AcuDummy.h @@ -0,0 +1,33 @@ +#ifndef DUMMIES_ACUDUMMY_H_ +#define DUMMIES_ACUDUMMY_H_ + +#include + +class AcuDummy : 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; + + AcuDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie); + virtual ~AcuDummy(); + + 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_ACUDUMMY_H_ */ diff --git a/dummies/BpxDummy.cpp b/dummies/BpxDummy.cpp new file mode 100644 index 00000000..6647f5cd --- /dev/null +++ b/dummies/BpxDummy.cpp @@ -0,0 +1,58 @@ +#include "BpxDummy.h" +#include + +BpxDummy::BpxDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie) + : DeviceHandlerBase(objectId, comif, comCookie) {} + +BpxDummy::~BpxDummy() {} + +void BpxDummy::doStartUp() {} + +void BpxDummy::doShutDown() {} + +ReturnValue_t BpxDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { + return NOTHING_TO_SEND; +} + +ReturnValue_t BpxDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) { + return NOTHING_TO_SEND; +} + +ReturnValue_t BpxDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData, + size_t commandDataLen) { + return RETURN_OK; +} + +ReturnValue_t BpxDummy::scanForReply(const uint8_t *start, size_t len, + DeviceCommandId_t *foundId, size_t *foundLen) { + return RETURN_OK; +} + +ReturnValue_t BpxDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { + return RETURN_OK; +} + +void BpxDummy::fillCommandAndReplyMap() { +} + +uint32_t BpxDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; } + +ReturnValue_t BpxDummy::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, + LocalDataPoolManager& poolManager) { + localDataPoolMap.emplace(BpxBattery::BATT_TEMP_1, &battTemp1); + localDataPoolMap.emplace(BpxBattery::BATT_TEMP_2, &battTemp2); + localDataPoolMap.emplace(BpxBattery::BATT_TEMP_3, &battTemp3); + localDataPoolMap.emplace(BpxBattery::BATT_TEMP_4, &battTemp4); + localDataPoolMap.emplace(BpxBattery::CHARGE_CURRENT, &chargeCurrent); + localDataPoolMap.emplace(BpxBattery::DISCHARGE_CURRENT, &dischargeCurrent); + localDataPoolMap.emplace(BpxBattery::HEATER_CURRENT, &heaterCurrent); + localDataPoolMap.emplace(BpxBattery::BATT_VOLTAGE, &battVolt); + localDataPoolMap.emplace(BpxBattery::REBOOT_COUNTER, &rebootCounter); + localDataPoolMap.emplace(BpxBattery::BOOTCAUSE, &bootCause); + + localDataPoolMap.emplace(BpxBattery::BATTERY_HEATER_MODE, &battheatMode); + localDataPoolMap.emplace(BpxBattery::BATTHEAT_LOW_LIMIT, &battheatLow); + localDataPoolMap.emplace(BpxBattery::BATTHEAT_HIGH_LIMIT, &battheatHigh); + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/dummies/BpxDummy.h b/dummies/BpxDummy.h new file mode 100644 index 00000000..1332f36b --- /dev/null +++ b/dummies/BpxDummy.h @@ -0,0 +1,48 @@ +#ifndef DUMMIES_BPXDUMMY_H_ +#define DUMMIES_BPXDUMMY_H_ + +#include + +class BpxDummy : 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; + + BpxDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie); + virtual ~BpxDummy(); + + 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; + + private: + PoolEntry chargeCurrent = PoolEntry({0}); + PoolEntry dischargeCurrent = PoolEntry({0}); + PoolEntry heaterCurrent = PoolEntry({0}); + PoolEntry battVolt = PoolEntry({0}); + PoolEntry battTemp1 = PoolEntry({0}); + PoolEntry battTemp2 = PoolEntry({0}); + PoolEntry battTemp3 = PoolEntry({0}); + PoolEntry battTemp4 = PoolEntry({0}); + PoolEntry rebootCounter = PoolEntry({0}); + PoolEntry bootCause = PoolEntry({0}); + PoolEntry battheatMode = PoolEntry({0}); + PoolEntry battheatLow = PoolEntry({0}); + PoolEntry battheatHigh = PoolEntry({0}); +}; + +#endif /* DUMMIES_BPXDUMMY_H_ */ diff --git a/dummies/CMakeLists.txt b/dummies/CMakeLists.txt new file mode 100644 index 00000000..930d6e89 --- /dev/null +++ b/dummies/CMakeLists.txt @@ -0,0 +1,19 @@ +target_sources(${LIB_DUMMIES} PUBLIC +TemperatureSensorsDummy.cpp +SusDummy.cpp +BpxDummy.cpp +ComIFDummy.cpp +ComCookieDummy.cpp +RwDummy.cpp +StarTrackerDummy.cpp +SyrlinksDummy.cpp +ImtqDummy.cpp +AcuDummy.cpp +PduDummy.cpp +P60DockDummy.cpp +GyroAdisDummy.cpp +GyroL3GD20Dummy.cpp +MgmLIS3MDLDummy.cpp +PlPcduDummy.cpp +CoreControllerDummy.cpp +) diff --git a/dummies/ComCookieDummy.cpp b/dummies/ComCookieDummy.cpp new file mode 100644 index 00000000..2e2edf99 --- /dev/null +++ b/dummies/ComCookieDummy.cpp @@ -0,0 +1,5 @@ +#include "ComCookieDummy.h" + +ComCookieDummy::ComCookieDummy() {} + +ComCookieDummy::~ComCookieDummy() {} diff --git a/dummies/ComCookieDummy.h b/dummies/ComCookieDummy.h new file mode 100644 index 00000000..e4e2086e --- /dev/null +++ b/dummies/ComCookieDummy.h @@ -0,0 +1,12 @@ +#ifndef TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COMCOOKIEDUMMY_H_ +#define TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COMCOOKIEDUMMY_H_ + +#include "fsfw/devicehandlers/CookieIF.h" + +class ComCookieDummy : public CookieIF { + public: + ComCookieDummy(); + virtual ~ComCookieDummy(); +}; + +#endif /* TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COMCOOKIEDUMMY_H_ */ diff --git a/dummies/ComIFDummy.cpp b/dummies/ComIFDummy.cpp new file mode 100644 index 00000000..e1552fca --- /dev/null +++ b/dummies/ComIFDummy.cpp @@ -0,0 +1,21 @@ +#include "ComIFDummy.h" + +ComIFDummy::ComIFDummy(object_id_t objectId) : SystemObject(objectId) {} + +ComIFDummy::~ComIFDummy() {} + +ReturnValue_t ComIFDummy::initializeInterface(CookieIF *cookie) { return RETURN_OK; } + +ReturnValue_t ComIFDummy::sendMessage(CookieIF *cookie, const uint8_t *sendData, size_t sendLen) { + return RETURN_OK; +} + +ReturnValue_t ComIFDummy::getSendSuccess(CookieIF *cookie) { return RETURN_OK; } + +ReturnValue_t ComIFDummy::requestReceiveMessage(CookieIF *cookie, size_t requestLen) { + return RETURN_OK; +} + +ReturnValue_t ComIFDummy::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) { + return RETURN_OK; +} diff --git a/dummies/ComIFDummy.h b/dummies/ComIFDummy.h new file mode 100644 index 00000000..72089f3a --- /dev/null +++ b/dummies/ComIFDummy.h @@ -0,0 +1,27 @@ +#ifndef DUMMIES_COMIFDUMMY_H_ +#define DUMMIES_COMIFDUMMY_H_ + +#include +#include + +/** + * @brief The ComIFMock supports the simulation of various device communication error cases + * like incomplete or wrong replies and can be used to test the + * DeviceHandlerBase. + */ +class ComIFDummy : public DeviceCommunicationIF, public SystemObject { + public: + + ComIFDummy(object_id_t objectId); + virtual ~ComIFDummy(); + + virtual ReturnValue_t initializeInterface(CookieIF *cookie) override; + virtual ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t *sendData, + size_t sendLen) override; + virtual ReturnValue_t getSendSuccess(CookieIF *cookie) override; + virtual ReturnValue_t requestReceiveMessage(CookieIF *cookie, size_t requestLen) override; + virtual ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer, + size_t *size) override; +}; + +#endif /* DUMMIES_COMIFDUMMY_H_ */ diff --git a/dummies/CoreControllerDummy.cpp b/dummies/CoreControllerDummy.cpp new file mode 100644 index 00000000..f9462e93 --- /dev/null +++ b/dummies/CoreControllerDummy.cpp @@ -0,0 +1,58 @@ +#include "CoreControllerDummy.h" + +#include +#include + +#include +#include + +CoreControllerDummy::CoreControllerDummy(object_id_t objectId) + : ExtendedControllerBase(objectId, objects::NO_OBJECT) { +} + +ReturnValue_t CoreControllerDummy::initialize() { + static bool done = false; + if (not done) { + done = true; + ReturnValue_t result = ExtendedControllerBase::initialize(); + if (result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + } + + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t CoreControllerDummy::handleCommandMessage(CommandMessage* message) { + return RETURN_FAILED; +} + +void CoreControllerDummy::performControlOperation() { + return; +} + +ReturnValue_t CoreControllerDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, + LocalDataPoolManager &poolManager) { + localDataPoolMap.emplace(core::TEMPERATURE, new PoolEntry({0})); + localDataPoolMap.emplace(core::PS_VOLTAGE, new PoolEntry({0})); + localDataPoolMap.emplace(core::PL_VOLTAGE, new PoolEntry({0})); + return HasReturnvaluesIF::RETURN_OK; +} + +LocalPoolDataSetBase* CoreControllerDummy::getDataSetHandle(sid_t sid) { + switch (sid.ownerSetId) { + default: + return nullptr; + } +} + +ReturnValue_t CoreControllerDummy::checkModeCommand(Mode_t mode, Submode_t submode, + uint32_t* msToReachTheMode) { + if (submode != SUBMODE_NONE) { + return INVALID_SUBMODE; + } + if ((mode != MODE_OFF) && (mode != MODE_ON) && (mode != MODE_NORMAL)) { + return INVALID_MODE; + } + return RETURN_OK; +} diff --git a/dummies/CoreControllerDummy.h b/dummies/CoreControllerDummy.h new file mode 100644 index 00000000..1b4eeaf8 --- /dev/null +++ b/dummies/CoreControllerDummy.h @@ -0,0 +1,21 @@ +#pragma once + +#include +#include + +class CoreControllerDummy : public ExtendedControllerBase { + public: + CoreControllerDummy(object_id_t objectId); + + ReturnValue_t initialize() override; + + protected: + virtual ReturnValue_t handleCommandMessage(CommandMessage* message) override; + virtual void performControlOperation() override; + virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, + LocalDataPoolManager& poolManager) override; + virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override; + + virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, + uint32_t* msToReachTheMode) override; +}; diff --git a/dummies/GyroAdisDummy.cpp b/dummies/GyroAdisDummy.cpp new file mode 100644 index 00000000..43136bf2 --- /dev/null +++ b/dummies/GyroAdisDummy.cpp @@ -0,0 +1,42 @@ +#include "GyroAdisDummy.h" + +#include "mission/devices/devicedefinitions/GyroADIS1650XDefinitions.h" + +GyroAdisDummy::GyroAdisDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie) + : DeviceHandlerBase(objectId, comif, comCookie) {} + +GyroAdisDummy::~GyroAdisDummy() {} + +void GyroAdisDummy::doStartUp() {} + +void GyroAdisDummy::doShutDown() {} + +ReturnValue_t GyroAdisDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; } + +ReturnValue_t GyroAdisDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) { + return NOTHING_TO_SEND; +} + +ReturnValue_t GyroAdisDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData, size_t commandDataLen) { + return RETURN_OK; +} + +ReturnValue_t GyroAdisDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId, + size_t *foundLen) { + return RETURN_OK; +} + +ReturnValue_t GyroAdisDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { + return RETURN_OK; +} + +void GyroAdisDummy::fillCommandAndReplyMap() {} + +uint32_t GyroAdisDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; } + +ReturnValue_t GyroAdisDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, + LocalDataPoolManager &poolManager) { + localDataPoolMap.emplace(ADIS1650X::TEMPERATURE, new PoolEntry({0.0})); + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/dummies/GyroAdisDummy.h b/dummies/GyroAdisDummy.h new file mode 100644 index 00000000..89f7c06e --- /dev/null +++ b/dummies/GyroAdisDummy.h @@ -0,0 +1,33 @@ +#ifndef DUMMIES_GYROADISDUMMY_H_ +#define DUMMIES_GYROADISDUMMY_H_ + +#include + +class GyroAdisDummy : 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; + + GyroAdisDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie); + virtual ~GyroAdisDummy(); + + 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_GYROADISDUMMY_H_ */ diff --git a/dummies/GyroL3GD20Dummy.cpp b/dummies/GyroL3GD20Dummy.cpp new file mode 100644 index 00000000..af36ac74 --- /dev/null +++ b/dummies/GyroL3GD20Dummy.cpp @@ -0,0 +1,45 @@ +#include "GyroL3GD20Dummy.h" + +#include "fsfw_hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h" + +GyroL3GD20Dummy::GyroL3GD20Dummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie) + : DeviceHandlerBase(objectId, comif, comCookie) {} + +GyroL3GD20Dummy::~GyroL3GD20Dummy() {} + +void GyroL3GD20Dummy::doStartUp() {} + +void GyroL3GD20Dummy::doShutDown() {} + +ReturnValue_t GyroL3GD20Dummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; } + +ReturnValue_t GyroL3GD20Dummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) { + return NOTHING_TO_SEND; +} + +ReturnValue_t GyroL3GD20Dummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData, size_t commandDataLen) { + return RETURN_OK; +} + +ReturnValue_t GyroL3GD20Dummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId, + size_t *foundLen) { + return RETURN_OK; +} + +ReturnValue_t GyroL3GD20Dummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { + return RETURN_OK; +} + +void GyroL3GD20Dummy::fillCommandAndReplyMap() {} + +uint32_t GyroL3GD20Dummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; } + +ReturnValue_t GyroL3GD20Dummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, + LocalDataPoolManager &poolManager) { + localDataPoolMap.emplace(L3GD20H::ANG_VELOC_X, new PoolEntry({0.0})); + localDataPoolMap.emplace(L3GD20H::ANG_VELOC_Y, new PoolEntry({0.0})); + localDataPoolMap.emplace(L3GD20H::ANG_VELOC_Z, new PoolEntry({0.0})); + localDataPoolMap.emplace(L3GD20H::TEMPERATURE, new PoolEntry({0.0})); + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/dummies/GyroL3GD20Dummy.h b/dummies/GyroL3GD20Dummy.h new file mode 100644 index 00000000..7af69f50 --- /dev/null +++ b/dummies/GyroL3GD20Dummy.h @@ -0,0 +1,33 @@ +#ifndef DUMMIES_GYROL3GD20DUMMY_H_ +#define DUMMIES_GYROL3GD20DUMMY_H_ + +#include + +class GyroL3GD20Dummy : 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; + + GyroL3GD20Dummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie); + virtual ~GyroL3GD20Dummy(); + + 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_GYROL3GD20DUMMY_H_ */ diff --git a/dummies/ImtqDummy.cpp b/dummies/ImtqDummy.cpp new file mode 100644 index 00000000..ae9a072a --- /dev/null +++ b/dummies/ImtqDummy.cpp @@ -0,0 +1,45 @@ +#include "ImtqDummy.h" +#include + +ImtqDummy::ImtqDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie) + : DeviceHandlerBase(objectId, comif, comCookie) {} + +ImtqDummy::~ImtqDummy() {} + +void ImtqDummy::doStartUp() {} + +void ImtqDummy::doShutDown() {} + +ReturnValue_t ImtqDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { + return NOTHING_TO_SEND; +} + +ReturnValue_t ImtqDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) { + return NOTHING_TO_SEND; +} + +ReturnValue_t ImtqDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData, + size_t commandDataLen) { + return RETURN_OK; +} + +ReturnValue_t ImtqDummy::scanForReply(const uint8_t *start, size_t len, + DeviceCommandId_t *foundId, size_t *foundLen) { + return RETURN_OK; +} + +ReturnValue_t ImtqDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { + return RETURN_OK; +} + +void ImtqDummy::fillCommandAndReplyMap() { +} + +uint32_t ImtqDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; } + +ReturnValue_t ImtqDummy::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, + LocalDataPoolManager& poolManager) { + localDataPoolMap.emplace(IMTQ::MCU_TEMPERATURE, new PoolEntry({0})); + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/dummies/ImtqDummy.h b/dummies/ImtqDummy.h new file mode 100644 index 00000000..4b5557ef --- /dev/null +++ b/dummies/ImtqDummy.h @@ -0,0 +1,33 @@ +#ifndef DUMMIES_IMTQDUMMY_H_ +#define DUMMIES_IMTQDUMMY_H_ + +#include + +class ImtqDummy : 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; + + ImtqDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie); + virtual ~ImtqDummy(); + + 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_IMTQDUMMY_H_ */ diff --git a/dummies/MgmLIS3MDLDummy.cpp b/dummies/MgmLIS3MDLDummy.cpp new file mode 100644 index 00000000..b3794471 --- /dev/null +++ b/dummies/MgmLIS3MDLDummy.cpp @@ -0,0 +1,42 @@ +#include "MgmLIS3MDLDummy.h" + +#include "fsfw_hal/devicehandlers/devicedefinitions/MgmLIS3HandlerDefs.h" + +MgmLIS3MDLDummy::MgmLIS3MDLDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie) + : DeviceHandlerBase(objectId, comif, comCookie) {} + +MgmLIS3MDLDummy::~MgmLIS3MDLDummy() {} + +void MgmLIS3MDLDummy::doStartUp() {} + +void MgmLIS3MDLDummy::doShutDown() {} + +ReturnValue_t MgmLIS3MDLDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; } + +ReturnValue_t MgmLIS3MDLDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) { + return NOTHING_TO_SEND; +} + +ReturnValue_t MgmLIS3MDLDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData, size_t commandDataLen) { + return RETURN_OK; +} + +ReturnValue_t MgmLIS3MDLDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId, + size_t *foundLen) { + return RETURN_OK; +} + +ReturnValue_t MgmLIS3MDLDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { + return RETURN_OK; +} + +void MgmLIS3MDLDummy::fillCommandAndReplyMap() {} + +uint32_t MgmLIS3MDLDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; } + +ReturnValue_t MgmLIS3MDLDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, + LocalDataPoolManager &poolManager) { + localDataPoolMap.emplace(MGMLIS3MDL::TEMPERATURE_CELCIUS, new PoolEntry({0.0})); + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/dummies/MgmLIS3MDLDummy.h b/dummies/MgmLIS3MDLDummy.h new file mode 100644 index 00000000..86b3e433 --- /dev/null +++ b/dummies/MgmLIS3MDLDummy.h @@ -0,0 +1,33 @@ +#ifndef DUMMIES_MGMLIS3MDLDUMMY_H_ +#define DUMMIES_MGMLIS3MDLDUMMY_H_ + +#include + +class MgmLIS3MDLDummy : 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; + + MgmLIS3MDLDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie); + virtual ~MgmLIS3MDLDummy(); + + 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_MGMLIS3MDLDUMMY_H_ */ diff --git a/dummies/P60DockDummy.cpp b/dummies/P60DockDummy.cpp new file mode 100644 index 00000000..def20d7e --- /dev/null +++ b/dummies/P60DockDummy.cpp @@ -0,0 +1,43 @@ +#include "P60DockDummy.h" + +#include + +P60DockDummy::P60DockDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie) + : DeviceHandlerBase(objectId, comif, comCookie) {} + +P60DockDummy::~P60DockDummy() {} + +void P60DockDummy::doStartUp() {} + +void P60DockDummy::doShutDown() {} + +ReturnValue_t P60DockDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; } + +ReturnValue_t P60DockDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) { + return NOTHING_TO_SEND; +} + +ReturnValue_t P60DockDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData, size_t commandDataLen) { + return RETURN_OK; +} + +ReturnValue_t P60DockDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId, + size_t *foundLen) { + return RETURN_OK; +} + +ReturnValue_t P60DockDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { + return RETURN_OK; +} + +void P60DockDummy::fillCommandAndReplyMap() {} + +uint32_t P60DockDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; } + +ReturnValue_t P60DockDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, + LocalDataPoolManager &poolManager) { + localDataPoolMap.emplace(P60System::pool::P60DOCK_TEMPERATURE_1, new PoolEntry({0})); + localDataPoolMap.emplace(P60System::pool::P60DOCK_TEMPERATURE_2, new PoolEntry({0})); + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/dummies/P60DockDummy.h b/dummies/P60DockDummy.h new file mode 100644 index 00000000..9b67b155 --- /dev/null +++ b/dummies/P60DockDummy.h @@ -0,0 +1,33 @@ +#ifndef DUMMIES_P60DOCKDUMMY_H_ +#define DUMMIES_P60DOCKDUMMY_H_ + +#include + +class P60DockDummy : 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; + + P60DockDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie); + virtual ~P60DockDummy(); + + 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_P60DOCKDUMMY_H_ */ diff --git a/dummies/PduDummy.cpp b/dummies/PduDummy.cpp new file mode 100644 index 00000000..e955d401 --- /dev/null +++ b/dummies/PduDummy.cpp @@ -0,0 +1,42 @@ +#include "PduDummy.h" + +#include + +PduDummy::PduDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie) + : DeviceHandlerBase(objectId, comif, comCookie) {} + +PduDummy::~PduDummy() {} + +void PduDummy::doStartUp() {} + +void PduDummy::doShutDown() {} + +ReturnValue_t PduDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; } + +ReturnValue_t PduDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) { + return NOTHING_TO_SEND; +} + +ReturnValue_t PduDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData, size_t commandDataLen) { + return RETURN_OK; +} + +ReturnValue_t PduDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId, + size_t *foundLen) { + return RETURN_OK; +} + +ReturnValue_t PduDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { + return RETURN_OK; +} + +void PduDummy::fillCommandAndReplyMap() {} + +uint32_t PduDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; } + +ReturnValue_t PduDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, + LocalDataPoolManager &poolManager) { + localDataPoolMap.emplace(P60System::pool::PDU_TEMPERATURE, new PoolEntry({0})); + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/dummies/PduDummy.h b/dummies/PduDummy.h new file mode 100644 index 00000000..3e193e7c --- /dev/null +++ b/dummies/PduDummy.h @@ -0,0 +1,33 @@ +#ifndef DUMMIES_PDUDUMMY_H_ +#define DUMMIES_PDUDUMMY_H_ + +#include + +class PduDummy : 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; + + PduDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie); + virtual ~PduDummy(); + + 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_PDUDUMMY_H_ */ diff --git a/dummies/PlPcduDummy.cpp b/dummies/PlPcduDummy.cpp new file mode 100644 index 00000000..403b8e06 --- /dev/null +++ b/dummies/PlPcduDummy.cpp @@ -0,0 +1,45 @@ +#include "PlPcduDummy.h" +#include + +PlPcduDummy::PlPcduDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie) + : DeviceHandlerBase(objectId, comif, comCookie) {} + +PlPcduDummy::~PlPcduDummy() {} + +void PlPcduDummy::doStartUp() {} + +void PlPcduDummy::doShutDown() {} + +ReturnValue_t PlPcduDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { + return NOTHING_TO_SEND; +} + +ReturnValue_t PlPcduDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) { + return NOTHING_TO_SEND; +} + +ReturnValue_t PlPcduDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData, + size_t commandDataLen) { + return RETURN_OK; +} + +ReturnValue_t PlPcduDummy::scanForReply(const uint8_t *start, size_t len, + DeviceCommandId_t *foundId, size_t *foundLen) { + return RETURN_OK; +} + +ReturnValue_t PlPcduDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { + return RETURN_OK; +} + +void PlPcduDummy::fillCommandAndReplyMap() { +} + +uint32_t PlPcduDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; } + +ReturnValue_t PlPcduDummy::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, + LocalDataPoolManager& poolManager) { + localDataPoolMap.emplace(plpcdu::PlPcduPoolIds::TEMP, new PoolEntry({0.0})); + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/dummies/PlPcduDummy.h b/dummies/PlPcduDummy.h new file mode 100644 index 00000000..227eedf8 --- /dev/null +++ b/dummies/PlPcduDummy.h @@ -0,0 +1,34 @@ +#ifndef DUMMIES_PLPCDUDUMMY_H_ +#define DUMMIES_PLPCDUDUMMY_H_ + +#include +#include + +class PlPcduDummy : 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; + + PlPcduDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie); + virtual ~PlPcduDummy(); + + 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_PLPCDUDUMMY_H_ */ diff --git a/dummies/RwDummy.cpp b/dummies/RwDummy.cpp new file mode 100644 index 00000000..b9f8fd51 --- /dev/null +++ b/dummies/RwDummy.cpp @@ -0,0 +1,78 @@ +#include "RwDummy.h" +#include + +RwDummy::RwDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie) + : DeviceHandlerBase(objectId, comif, comCookie) {} + +RwDummy::~RwDummy() {} + +void RwDummy::doStartUp() {} + +void RwDummy::doShutDown() {} + +ReturnValue_t RwDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { + return NOTHING_TO_SEND; +} + +ReturnValue_t RwDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) { + return NOTHING_TO_SEND; +} + +ReturnValue_t RwDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData, + size_t commandDataLen) { + return RETURN_OK; +} + +ReturnValue_t RwDummy::scanForReply(const uint8_t *start, size_t len, + DeviceCommandId_t *foundId, size_t *foundLen) { + return RETURN_OK; +} + +ReturnValue_t RwDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { + return RETURN_OK; +} + +void RwDummy::fillCommandAndReplyMap() { +} + +uint32_t RwDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; } + +ReturnValue_t RwDummy::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, + LocalDataPoolManager& poolManager) { + localDataPoolMap.emplace(RwDefinitions::TEMPERATURE_C, new PoolEntry({0})); + + localDataPoolMap.emplace(RwDefinitions::CURR_SPEED, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::REFERENCE_SPEED, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::STATE, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::CLC_MODE, new PoolEntry({0})); + + localDataPoolMap.emplace(RwDefinitions::LAST_RESET_STATUS, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::CURRRENT_RESET_STATUS, new PoolEntry({0})); + + localDataPoolMap.emplace(RwDefinitions::TM_LAST_RESET_STATUS, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::TM_MCU_TEMPERATURE, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::PRESSURE_SENSOR_TEMPERATURE, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::PRESSURE, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::TM_RW_STATE, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::TM_CLC_MODE, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::TM_RW_CURR_SPEED, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::TM_RW_REF_SPEED, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::INVALID_CRC_PACKETS, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::INVALID_LEN_PACKETS, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::INVALID_CMD_PACKETS, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::EXECUTED_REPLIES, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::COMMAND_REPLIES, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::UART_BYTES_WRITTEN, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::UART_BYTES_READ, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::UART_PARITY_ERRORS, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::UART_NOISE_ERRORS, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::UART_FRAME_ERRORS, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::UART_REG_OVERRUN_ERRORS, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::UART_TOTAL_ERRORS, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::SPI_BYTES_WRITTEN, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::SPI_BYTES_READ, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::SPI_REG_OVERRUN_ERRORS, new PoolEntry({0})); + localDataPoolMap.emplace(RwDefinitions::SPI_TOTAL_ERRORS, new PoolEntry({0})); + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/dummies/RwDummy.h b/dummies/RwDummy.h new file mode 100644 index 00000000..e5738420 --- /dev/null +++ b/dummies/RwDummy.h @@ -0,0 +1,33 @@ +#ifndef DUMMIES_RWDUMMY_H_ +#define DUMMIES_RWDUMMY_H_ + +#include + +class RwDummy : 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; + + RwDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie); + virtual ~RwDummy(); + + 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_RWDUMMY_H_ */ diff --git a/dummies/StarTrackerDummy.cpp b/dummies/StarTrackerDummy.cpp new file mode 100644 index 00000000..7af0a0f7 --- /dev/null +++ b/dummies/StarTrackerDummy.cpp @@ -0,0 +1,45 @@ +#include "StarTrackerDummy.h" +#include + +StarTrackerDummy::StarTrackerDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie) + : DeviceHandlerBase(objectId, comif, comCookie) {} + +StarTrackerDummy::~StarTrackerDummy() {} + +void StarTrackerDummy::doStartUp() {} + +void StarTrackerDummy::doShutDown() {} + +ReturnValue_t StarTrackerDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { + return NOTHING_TO_SEND; +} + +ReturnValue_t StarTrackerDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) { + return NOTHING_TO_SEND; +} + +ReturnValue_t StarTrackerDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData, + size_t commandDataLen) { + return RETURN_OK; +} + +ReturnValue_t StarTrackerDummy::scanForReply(const uint8_t *start, size_t len, + DeviceCommandId_t *foundId, size_t *foundLen) { + return RETURN_OK; +} + +ReturnValue_t StarTrackerDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { + return RETURN_OK; +} + +void StarTrackerDummy::fillCommandAndReplyMap() { +} + +uint32_t StarTrackerDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; } + +ReturnValue_t StarTrackerDummy::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, + LocalDataPoolManager& poolManager) { + localDataPoolMap.emplace(startracker::MCU_TEMPERATURE, new PoolEntry({0})); + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/dummies/StarTrackerDummy.h b/dummies/StarTrackerDummy.h new file mode 100644 index 00000000..bc5534c7 --- /dev/null +++ b/dummies/StarTrackerDummy.h @@ -0,0 +1,33 @@ +#ifndef DUMMIES_STARTRACKERDUMMY_H_ +#define DUMMIES_STARTRACKERDUMMY_H_ + +#include + +class StarTrackerDummy : 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; + + StarTrackerDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie); + virtual ~StarTrackerDummy(); + + 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_STARTRACKERDUMMY_H_ */ diff --git a/dummies/SusDummy.cpp b/dummies/SusDummy.cpp new file mode 100644 index 00000000..439046a5 --- /dev/null +++ b/dummies/SusDummy.cpp @@ -0,0 +1,82 @@ +#include "SusDummy.h" + +#include + +#include +#include + +SusDummy::SusDummy() + : ExtendedControllerBase(objects::SUS_0_N_LOC_XFYFZM_PT_XF, objects::NO_OBJECT), + susSet(this) { + ObjectManager::instance()->insert(objects::SUS_6_R_LOC_XFYBZM_PT_XF, this); + ObjectManager::instance()->insert(objects::SUS_1_N_LOC_XBYFZM_PT_XB, this); + ObjectManager::instance()->insert(objects::SUS_7_R_LOC_XBYBZM_PT_XB, this); + ObjectManager::instance()->insert(objects::SUS_2_N_LOC_XFYBZB_PT_YB, this); + ObjectManager::instance()->insert(objects::SUS_8_R_LOC_XBYBZB_PT_YB, this); + ObjectManager::instance()->insert(objects::SUS_3_N_LOC_XFYBZF_PT_YF, this); + ObjectManager::instance()->insert(objects::SUS_9_R_LOC_XBYBZB_PT_YF, this); + ObjectManager::instance()->insert(objects::SUS_4_N_LOC_XMYFZF_PT_ZF, this); + ObjectManager::instance()->insert(objects::SUS_10_N_LOC_XMYBZF_PT_ZF, this); + ObjectManager::instance()->insert(objects::SUS_5_N_LOC_XFYMZB_PT_ZB, this); + ObjectManager::instance()->insert(objects::SUS_11_R_LOC_XBYMZB_PT_ZB, this); +} + +ReturnValue_t SusDummy::initialize() { + static bool done = false; + if (not done) { + done = true; + ReturnValue_t result = ExtendedControllerBase::initialize(); + if (result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + } + + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t SusDummy::handleCommandMessage(CommandMessage* message) { + return RETURN_FAILED; +} + +void SusDummy::performControlOperation() { + iteration++; + value = sin(iteration / 80. * M_PI + 10) * 10 - 10; + + susSet.read(); + susSet.temperatureCelcius = value; + if ((iteration % 100) < 20) { + susSet.setValidity(false, true); + } else { + susSet.setValidity(true, true); + } + susSet.commit(); +} + +ReturnValue_t SusDummy::initializeLocalDataPool( + localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) { + localDataPoolMap.emplace(SUS::SusPoolIds::TEMPERATURE_C, + new PoolEntry({0}, 1, true)); + localDataPoolMap.emplace(SUS::SusPoolIds::CHANNEL_VEC, new PoolEntry({0})); + + return RETURN_OK; +} + +LocalPoolDataSetBase* SusDummy::getDataSetHandle(sid_t sid) { + switch (sid.ownerSetId) { + case SUS::SUS_DATA_SET_ID: + return &susSet; + default: + return nullptr; + } +} + +ReturnValue_t SusDummy::checkModeCommand(Mode_t mode, Submode_t submode, + uint32_t* msToReachTheMode) { + if (submode != SUBMODE_NONE) { + return INVALID_SUBMODE; + } + if ((mode != MODE_OFF) && (mode != MODE_ON) && (mode != MODE_NORMAL)) { + return INVALID_MODE; + } + return RETURN_OK; +} diff --git a/dummies/SusDummy.h b/dummies/SusDummy.h new file mode 100644 index 00000000..bdabaafc --- /dev/null +++ b/dummies/SusDummy.h @@ -0,0 +1,27 @@ +#pragma once + +#include +#include + +class SusDummy : public ExtendedControllerBase { + public: + SusDummy(); + + ReturnValue_t initialize() override; + + protected: + virtual ReturnValue_t handleCommandMessage(CommandMessage* message) override; + virtual void performControlOperation() override; + virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, + LocalDataPoolManager& poolManager) override; + virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override; + + // Mode abstract functions + virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, + uint32_t* msToReachTheMode) override; + + private: + int iteration = 0; + float value = 0; + SUS::SusDataset susSet; +}; \ No newline at end of file diff --git a/dummies/SyrlinksDummy.cpp b/dummies/SyrlinksDummy.cpp new file mode 100644 index 00000000..8e940fb2 --- /dev/null +++ b/dummies/SyrlinksDummy.cpp @@ -0,0 +1,46 @@ +#include "SyrlinksDummy.h" +#include + +SyrlinksDummy::SyrlinksDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie) + : DeviceHandlerBase(objectId, comif, comCookie) {} + +SyrlinksDummy::~SyrlinksDummy() {} + +void SyrlinksDummy::doStartUp() {} + +void SyrlinksDummy::doShutDown() {} + +ReturnValue_t SyrlinksDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { + return NOTHING_TO_SEND; +} + +ReturnValue_t SyrlinksDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) { + return NOTHING_TO_SEND; +} + +ReturnValue_t SyrlinksDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData, + size_t commandDataLen) { + return RETURN_OK; +} + +ReturnValue_t SyrlinksDummy::scanForReply(const uint8_t *start, size_t len, + DeviceCommandId_t *foundId, size_t *foundLen) { + return RETURN_OK; +} + +ReturnValue_t SyrlinksDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { + return RETURN_OK; +} + +void SyrlinksDummy::fillCommandAndReplyMap() { +} + +uint32_t SyrlinksDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; } + +ReturnValue_t SyrlinksDummy::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, + LocalDataPoolManager& poolManager) { + localDataPoolMap.emplace(syrlinks::TEMP_BASEBAND_BOARD, new PoolEntry({0})); + localDataPoolMap.emplace(syrlinks::TEMP_POWER_AMPLIFIER, new PoolEntry({0})); + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/dummies/SyrlinksDummy.h b/dummies/SyrlinksDummy.h new file mode 100644 index 00000000..02d7095e --- /dev/null +++ b/dummies/SyrlinksDummy.h @@ -0,0 +1,33 @@ +#ifndef DUMMIES_SYRLINKSDUMMY_H_ +#define DUMMIES_SYRLINKSDUMMY_H_ + +#include + +class SyrlinksDummy : 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; + + SyrlinksDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie); + virtual ~SyrlinksDummy(); + + 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_SYRLINKSDUMMY_H_ */ diff --git a/dummies/TemperatureSensorsDummy.cpp b/dummies/TemperatureSensorsDummy.cpp new file mode 100644 index 00000000..b32b3fec --- /dev/null +++ b/dummies/TemperatureSensorsDummy.cpp @@ -0,0 +1,98 @@ +#include "TemperatureSensorsDummy.h" + +#include + +#include +#include + +TemperatureSensorsDummy::TemperatureSensorsDummy() + : ExtendedControllerBase(objects::RTD_0_IC3_PLOC_HEATSPREADER, objects::NO_OBJECT), + max31865Set(this, MAX31865::MAX31865_SET_ID) { + ObjectManager::instance()->insert(objects::RTD_1_IC4_PLOC_MISSIONBOARD, this); + ObjectManager::instance()->insert(objects::RTD_2_IC5_4K_CAMERA, this); + ObjectManager::instance()->insert(objects::RTD_3_IC6_DAC_HEATSPREADER, this); + ObjectManager::instance()->insert(objects::RTD_4_IC7_STARTRACKER, this); + ObjectManager::instance()->insert(objects::RTD_5_IC8_RW1_MX_MY, this); + ObjectManager::instance()->insert(objects::RTD_6_IC9_DRO, this); + ObjectManager::instance()->insert(objects::RTD_7_IC10_SCEX, this); + ObjectManager::instance()->insert(objects::RTD_8_IC11_X8, this); + ObjectManager::instance()->insert(objects::RTD_9_IC12_HPA, this); + ObjectManager::instance()->insert(objects::RTD_10_IC13_PL_TX, this); + ObjectManager::instance()->insert(objects::RTD_11_IC14_MPA, this); + ObjectManager::instance()->insert(objects::RTD_12_IC15_ACU, this); + ObjectManager::instance()->insert(objects::RTD_13_IC16_PLPCDU_HEATSPREADER, this); + ObjectManager::instance()->insert(objects::RTD_14_IC17_TCS_BOARD, this); + ObjectManager::instance()->insert(objects::RTD_15_IC18_IMTQ, this); + ObjectManager::instance()->insert(objects::TMP1075_HANDLER_1, this); + ObjectManager::instance()->insert(objects::TMP1075_HANDLER_2, this); +} + +ReturnValue_t TemperatureSensorsDummy::initialize() { + static bool done = false; + if (not done) { + done = true; + ReturnValue_t result = ExtendedControllerBase::initialize(); + if (result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + } + + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t TemperatureSensorsDummy::handleCommandMessage(CommandMessage* message) { + return RETURN_FAILED; +} + +void TemperatureSensorsDummy::performControlOperation() { + iteration++; + value = sin(iteration / 80. * M_PI) * 10; + + ReturnValue_t result = max31865Set.read(); + if (result != RETURN_OK) { + sif::warning << "Failed to read temperature from MAX31865 dataset" << std::endl; + } + max31865Set.rtdValue = value - 5; + max31865Set.temperatureCelcius = value; + if ((iteration % 100) < 20) { + max31865Set.setValidity(false, true); + } else { + max31865Set.setValidity(true, true); + } + max31865Set.commit(); +} + +ReturnValue_t TemperatureSensorsDummy::initializeLocalDataPool( + localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) { + localDataPoolMap.emplace(static_cast(MAX31865::PoolIds::RTD_VALUE), + new PoolEntry({0})); + localDataPoolMap.emplace(static_cast(MAX31865::PoolIds::TEMPERATURE_C), + new PoolEntry({0})); + localDataPoolMap.emplace(static_cast(MAX31865::PoolIds::LAST_FAULT_BYTE), + new PoolEntry({0})); + localDataPoolMap.emplace(static_cast(MAX31865::PoolIds::FAULT_BYTE), + new PoolEntry({0})); + + return RETURN_OK; +} + +LocalPoolDataSetBase* TemperatureSensorsDummy::getDataSetHandle(sid_t sid) { + sif::debug << "getHandle" << std::endl; + switch (sid.ownerSetId) { + case MAX31865::MAX31865_SET_ID: + return &max31865Set; + default: + return nullptr; + } +} + +ReturnValue_t TemperatureSensorsDummy::checkModeCommand(Mode_t mode, Submode_t submode, + uint32_t* msToReachTheMode) { + if (submode != SUBMODE_NONE) { + return INVALID_SUBMODE; + } + if ((mode != MODE_OFF) && (mode != MODE_ON) && (mode != MODE_NORMAL)) { + return INVALID_MODE; + } + return RETURN_OK; +} diff --git a/dummies/TemperatureSensorsDummy.h b/dummies/TemperatureSensorsDummy.h new file mode 100644 index 00000000..e41a9af0 --- /dev/null +++ b/dummies/TemperatureSensorsDummy.h @@ -0,0 +1,29 @@ +#pragma once + +#include +#include + +class TemperatureSensorsDummy : public ExtendedControllerBase { + public: + TemperatureSensorsDummy(); + + ReturnValue_t initialize() override; + + protected: + virtual ReturnValue_t handleCommandMessage(CommandMessage* message) override; + virtual void performControlOperation() override; + virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, + LocalDataPoolManager& poolManager) override; + virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override; + + // Mode abstract functions + virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, + uint32_t* msToReachTheMode) override; + + private: + int iteration = 0; + float value = 0; + MAX31865::Max31865Set max31865Set; + + void noise(); +}; diff --git a/fsfw b/fsfw index cda81fc8..7f3e5e42 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit cda81fc8415c3873c035aa7ebbfa3fe93d519f08 +Subproject commit 7f3e5e42bb209aa6d2f71ce644340fd27e9cc29b diff --git a/mission/devices/ComIFMock.cpp b/mission/devices/ComIFMock.cpp new file mode 100644 index 00000000..4d985f94 --- /dev/null +++ b/mission/devices/ComIFMock.cpp @@ -0,0 +1,46 @@ +#include "ComIFMock.h" + +#include "DeviceHandlerMock.h" + +ComIFMock::ComIFMock(object_id_t objectId) : SystemObject(objectId) {} + +ComIFMock::~ComIFMock() {} + +ReturnValue_t ComIFMock::initializeInterface(CookieIF *cookie) { return RETURN_OK; } + +ReturnValue_t ComIFMock::sendMessage(CookieIF *cookie, const uint8_t *sendData, size_t sendLen) { + data = *sendData; + return RETURN_OK; +} + +ReturnValue_t ComIFMock::getSendSuccess(CookieIF *cookie) { return RETURN_OK; } + +ReturnValue_t ComIFMock::requestReceiveMessage(CookieIF *cookie, size_t requestLen) { + return RETURN_OK; +} + +ReturnValue_t ComIFMock::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) { + switch (testCase) { + case TestCase::MISSED_REPLY: { + *size = 0; + return RETURN_OK; + } + case TestCase::SIMPLE_COMMAND_NOMINAL: { + *size = 1; + data = DeviceHandlerMock::SIMPLE_COMMAND_DATA; + *buffer = &data; + break; + } + case TestCase::PERIODIC_REPLY_NOMINAL: { + *size = 1; + data = DeviceHandlerMock::PERIODIC_REPLY_DATA; + *buffer = &data; + break; + } + default: + break; + } + return RETURN_OK; +} + +void ComIFMock::setTestCase(TestCase testCase_) { testCase = testCase_; } diff --git a/mission/devices/ComIFMock.h b/mission/devices/ComIFMock.h new file mode 100644 index 00000000..1463deb6 --- /dev/null +++ b/mission/devices/ComIFMock.h @@ -0,0 +1,37 @@ +#ifndef TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COMIFMOCK_H_ +#define TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COMIFMOCK_H_ + +#include +#include + +/** + * @brief The ComIFMock supports the simulation of various device communication error cases + * like incomplete or wrong replies and can be used to test the + * DeviceHandlerBase. + */ +class ComIFMock : public DeviceCommunicationIF, public SystemObject { + public: + enum class TestCase { SIMPLE_COMMAND_NOMINAL, PERIODIC_REPLY_NOMINAL, MISSED_REPLY }; + + ComIFMock(object_id_t objectId); + virtual ~ComIFMock(); + + virtual ReturnValue_t initializeInterface(CookieIF *cookie) override; + virtual ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t *sendData, + size_t sendLen) override; + virtual ReturnValue_t getSendSuccess(CookieIF *cookie) override; + virtual ReturnValue_t requestReceiveMessage(CookieIF *cookie, size_t requestLen) override; + virtual ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer, + size_t *size) override; + void setTestCase(TestCase testCase_); + + private: + TestCase testCase = TestCase::SIMPLE_COMMAND_NOMINAL; + + static const uint8_t SIMPLE_COMMAND_DATA = 1; + static const uint8_t PERIODIC_REPLY_DATA = 2; + + uint8_t data = 0; +}; + +#endif /* TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COMIFMOCK_H_ */ diff --git a/mission/devices/CookieIFMock.cpp b/mission/devices/CookieIFMock.cpp new file mode 100644 index 00000000..e9b03a6c --- /dev/null +++ b/mission/devices/CookieIFMock.cpp @@ -0,0 +1,5 @@ +#include "CookieIFMock.h" + +CookieIFMock::CookieIFMock() {} + +CookieIFMock::~CookieIFMock() {} diff --git a/mission/devices/CookieIFMock.h b/mission/devices/CookieIFMock.h new file mode 100644 index 00000000..5c868932 --- /dev/null +++ b/mission/devices/CookieIFMock.h @@ -0,0 +1,12 @@ +#ifndef TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COOKIEIFMOCK_H_ +#define TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COOKIEIFMOCK_H_ + +#include "fsfw/devicehandlers/CookieIF.h" + +class CookieIFMock : public CookieIF { + public: + CookieIFMock(); + virtual ~CookieIFMock(); +}; + +#endif /* TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COOKIEIFMOCK_H_ */