eive-obsw/bsp_q7s/core/XiphosWdtHandler.h

34 lines
1.2 KiB
C
Raw Normal View History

2023-10-02 14:15:50 +02:00
#ifndef BSP_Q7S_CORE_XIPHOSWDTHANDLER_H_
#define BSP_Q7S_CORE_XIPHOSWDTHANDLER_H_
#include <fsfw/action/HasActionsIF.h>
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/tasks/ExecutableObjectIF.h>
#include <libxiphos.h>
2023-10-10 19:15:52 +02:00
class XiphosWdtHandler : public SystemObject, public ExecutableObjectIF, public HasActionsIF {
2023-10-02 14:15:50 +02:00
public:
2023-10-10 19:15:52 +02:00
enum ActionId { ENABLE = 0, DISABLE = 1 };
2023-10-02 14:15:50 +02:00
XiphosWdtHandler(object_id_t objectId);
ReturnValue_t performOperation(uint8_t opCode) override;
ReturnValue_t initialize() override;
2023-10-10 19:15:52 +02:00
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) override;
2023-10-11 13:56:05 +02:00
[[nodiscard]] virtual MessageQueueId_t getCommandQueue() const override;
2023-10-10 19:15:52 +02:00
2023-10-02 14:15:50 +02:00
private:
2023-10-10 19:15:52 +02:00
// Wrappers to ensure idempotency of trash C API.
ReturnValue_t enableWdt();
ReturnValue_t disableWdt();
2023-10-02 14:15:50 +02:00
// Timeout duration range specified by Xiphos: 0.001 seconds to 171 seconds. The libxiphos API
// expects an int, so I guess this translates to 1 to 171 seconds.
2023-10-10 12:19:42 +02:00
int timeoutSeconds = 60;
2023-10-02 14:15:50 +02:00
struct watchdog_s* wdtHandle = nullptr;
2023-10-10 19:15:52 +02:00
MessageQueueIF* requestQueue = nullptr;
ActionHelper actionHelper;
2023-10-02 14:15:50 +02:00
};
#endif /* BSP_Q7S_CORE_XIPHOSWDTHANDLER_H_ */