eive-obsw/mission/devices/P60DockHandler.h

53 lines
2.1 KiB
C
Raw Normal View History

2020-11-19 18:24:03 +01:00
#ifndef MISSION_DEVICES_P60DOCKHANDLER_H_
#define MISSION_DEVICES_P60DOCKHANDLER_H_
2020-12-04 14:14:08 +01:00
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include <bsp_linux/comIF/cookies/P60DockCookie.h>
2020-12-04 14:14:08 +01:00
2020-12-14 08:42:48 +01:00
namespace P60Dock{
/* The maximum size of a reply from the P60 dock. Maximum size is reached
* when retrieving the full parameter configuration table. 412 bytes of
* payload data and 12 bytes of CSP header data. */
static const uint16_t MAX_REPLY_LENGTH = 424;
}
2020-12-04 14:14:08 +01:00
class P60DockHandler: public DeviceHandlerBase {
public:
P60DockHandler(object_id_t objectId, object_id_t comIF,
CookieIF * comCookie);
virtual ~P60DockHandler();
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;
private:
2020-12-14 08:42:48 +01:00
static const uint8_t MAX_PACKET_LEN = 36;
2020-12-16 15:17:10 +01:00
static const uint8_t PARAM_SET_OK = 1;
static const uint8_t PING_REPLY_SIZE = 2;
2020-12-14 08:42:48 +01:00
/* Device commands are derived from the rparam.h of the gomspace lib */
2020-12-04 14:14:08 +01:00
static const DeviceCommandId_t PING = 0x1; //!< [EXPORT] : [COMMAND]
2020-12-14 08:42:48 +01:00
static const DeviceCommandId_t NONE = 0x2; // Set when no command is pending
2020-12-17 13:26:00 +01:00
static const DeviceCommandId_t REBOOT = 0x4; //!< [EXPORT] : [COMMAND]
static const DeviceCommandId_t GNDWDT_RESET = 0x9; //!< [EXPORT] : [COMMAND]
2020-12-14 08:42:48 +01:00
static const DeviceCommandId_t PARAM_GET = 0x00; //!< [EXPORT] : [COMMAND]
static const DeviceCommandId_t PARAM_SET = 0xFF; //!< [EXPORT] : [COMMAND]
2020-12-04 14:14:08 +01:00
2020-12-14 08:42:48 +01:00
uint8_t rememberRequestedSize = 0;
uint8_t rememberCommandId = NONE;
uint8_t cspPacket[MAX_PACKET_LEN];
2020-12-04 14:14:08 +01:00
};
2020-11-19 18:24:03 +01:00
#endif /* MISSION_DEVICES_P60DOCKHANDLER_H_ */