IMQT wip
This commit is contained in:
79
mission/devices/IMTQHandler.h
Normal file
79
mission/devices/IMTQHandler.h
Normal file
@ -0,0 +1,79 @@
|
||||
#ifndef MISSION_DEVICES_IMTQHANDLER_H_
|
||||
#define MISSION_DEVICES_IMTQHANDLER_H_
|
||||
|
||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||
#include <mission/devices/devicedefinitions/IMTQHandlerDefinitions.h>
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* @brief This is the device handler for the ISIS Magnetorquer iMTQ.
|
||||
*
|
||||
* @author J. Meier
|
||||
*/
|
||||
class IMTQHandler: public DeviceHandlerBase {
|
||||
public:
|
||||
|
||||
IMTQHandler(object_id_t objectId, object_id_t comIF,
|
||||
CookieIF * comCookie);
|
||||
virtual ~IMTQHandler();
|
||||
|
||||
/**
|
||||
* @brief Sets mode to MODE_NORMAL. Can be used for debugging.
|
||||
*/
|
||||
void setModeNormal();
|
||||
|
||||
protected:
|
||||
void doStartUp() override;
|
||||
void doShutDown() override;
|
||||
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override;
|
||||
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t * id) override;
|
||||
void fillCommandAndReplyMap() override;
|
||||
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||
const uint8_t * commandData,size_t commandDataLen) 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;
|
||||
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) override;
|
||||
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||
|
||||
private:
|
||||
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::IMTQ_HANDLER;
|
||||
|
||||
static const ReturnValue_t INVALID_COMMAND_CODE = MAKE_RETURN_CODE(0xA0);
|
||||
static const ReturnValue_t PARAMETER_MISSING = MAKE_RETURN_CODE(0xA1);
|
||||
static const ReturnValue_t PARAMETER_INVALID = MAKE_RETURN_CODE(0xA2);
|
||||
static const ReturnValue_t CC_UNAVAILABLE = MAKE_RETURN_CODE(0xA3);
|
||||
static const ReturnValue_t INTERNAL_PROCESSING_ERROR = MAKE_RETURN_CODE(0xA4);
|
||||
static const ReturnValue_t REJECTED_WITHOUT_REASON = MAKE_RETURN_CODE(0xA5);
|
||||
static const ReturnValue_t CMD_ERR_UNKNOWN = MAKE_RETURN_CODE(0xA6);
|
||||
|
||||
|
||||
IMTQ::EngHkDataset engHkDataset;
|
||||
|
||||
uint8_t commandBuffer[IMTQ::MAX_COMMAND_SIZE];
|
||||
|
||||
/**
|
||||
* @brief Each reply contains a status byte giving information about a request. This function
|
||||
* parses this byte and returns the associated failure message.
|
||||
*
|
||||
* @param packet Pointer to the received message containing the status byte.
|
||||
*
|
||||
* @return The return code derived from the received status byte.
|
||||
*/
|
||||
ReturnValue_t parseStatusByte(const uint8_t* packet);
|
||||
|
||||
/**
|
||||
* @brief This function fills the engineering housekeeping dataset with the received data.
|
||||
|
||||
* @param packet Pointer to the received data.
|
||||
*
|
||||
*/
|
||||
void fillEngHkDataset(const uint8_t* packet);
|
||||
};
|
||||
|
||||
#endif /* MISSION_DEVICES_IMTQHANDLER_H_ */
|
Reference in New Issue
Block a user