eive-obsw/mission/devices/MGMHandlerRM3100.h

56 lines
1.7 KiB
C
Raw Normal View History

2020-09-30 22:14:44 +02:00
#ifndef MISSION_DEVICES_MGMRM3100HANDLER_H_
#define MISSION_DEVICES_MGMRM3100HANDLER_H_
2020-10-01 02:06:39 +02:00
#include "devicedefinitions/MGMHandlerRM3100Definitions.h"
2020-09-30 22:14:44 +02:00
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
class MGMHandlerRM3100: public DeviceHandlerBase {
public:
MGMHandlerRM3100(object_id_t objectId, object_id_t deviceCommunication,
CookieIF* comCookie);
virtual ~MGMHandlerRM3100();
protected:
/* DeviceHandlerBase overrides */
virtual ReturnValue_t buildTransitionDeviceCommand(
DeviceCommandId_t *id) override;
virtual void doStartUp() override;
virtual void doShutDown() override;
virtual ReturnValue_t buildNormalDeviceCommand(
DeviceCommandId_t *id) override;
virtual ReturnValue_t buildCommandFromCommand(
DeviceCommandId_t deviceCommand, const uint8_t *commandData,
size_t commandDataLen) override;
virtual ReturnValue_t scanForReply(const uint8_t *start, size_t len,
DeviceCommandId_t *foundId, size_t *foundLen) override;
virtual ReturnValue_t interpretDeviceReply(DeviceCommandId_t id,
const uint8_t *packet) override;
private:
enum InternalState {
2020-12-21 19:50:01 +01:00
STATE_NONE,
STATE_CONFIGURE_CMM,
STATE_READ_CMM,
// The cycle count states are propably not going to be used because
// the default cycle count will be used.
STATE_CONFIGURE_CYCLE_COUNT,
STATE_READ_CYCLE_COUNT,
STATE_CONFIGURE_TMRC,
STATE_READ_TMRC,
STATE_NORMAL
2020-09-30 22:14:44 +02:00
};
InternalState internalState = InternalState::STATE_NONE;
2020-12-21 19:50:01 +01:00
bool commandExecuted = false;
2020-12-21 19:52:00 +01:00
uint8_t commandBuffer[9];
uint8_t commandBufferLen = 0;
uint8_t cmmRegValue = RM3100::CMM_VALUE;
uint8_t tmrcRegValue = RM3100::TMRC_DEFAULT_VALUE;
2020-09-30 22:14:44 +02:00
};
#endif /* MISSION_DEVICEHANDLING_MGMRM3100HANDLER_H_ */