Learning how Device Handlers do not work (yet)

This commit is contained in:
Paul Nehlich
2023-10-19 07:26:44 +02:00
parent 96de564b2b
commit fa432e50a3
5 changed files with 71 additions and 4 deletions

View File

@ -7,6 +7,8 @@
#include <mission/controller/PrintController.h>
#include <mission/controller/BlinkController.h>
#include <mission/devices/LightHandler.h>
#include "fsfw/events/EventManager.h"
#include "fsfw/health/HealthTable.h"
#include "fsfw/internalerror/InternalErrorReporter.h"
@ -63,4 +65,7 @@ void ObjectFactory::produce(void *args) {
new PrintController(123);
new BlinkController(124);
new LightHandler(125, new ComIF(), *CookieIF);
}

View File

@ -1 +1 @@
target_sources(${TARGET_NAME} PRIVATE main.cpp controller/PrintController.cpp controller/BlinkController.cpp)
target_sources(${TARGET_NAME} PRIVATE main.cpp controller/PrintController.cpp controller/BlinkController.cpp devices/LightHandler.h devices/LightHandler.cpp)

View File

@ -1,3 +0,0 @@
//
// Created by nehlichp on 02.10.23.
//

View File

@ -0,0 +1,25 @@
#include <mission/devices/LightHandler.h>
LightHandler::LightHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie)
: DeviceHandlerBase(objectId, comIF, comCookie) {}
LightHandler::~LightHandler() {}
void LightHandler::doStartUp() {}
void LightHandler::doShutDown() {}
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) {
return returnvalue::OK;
}
ReturnValue_t LightHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
return returnvalue::OK;
}

View File

@ -0,0 +1,40 @@
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
/**
* @brief Device Handler for any simple led directly connected to a GPIO
* @details
* Documentation of device: Datasheet available in the internet.
*
*
* @author Paul Nehlich
* @ingroup devices
*/
class LightHandler : public DeviceHandlerBase {
public:
LightHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie);
virtual ~LightHandler();
protected:
/* DeviceHandlerBase abstract function implementation */
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);
void fillCommandAndReplyMap() override;
ReturnValue_t scanForReply(const uint8_t *start, size_t remainingSize, DeviceCommandId_t *foundId,
size_t *foundLen) override;
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override;
void setNormalDatapoolEntriesInvalid() override;
/* DeviceHandlerBase overrides */
void debugInterface(uint8_t positionTracker = 0, object_id_t objectId = 0,
uint32_t parameter = 0) override;
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
ReturnValue_t getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches) override;
};