#ifndef MISSION_DEVICES_P60DOCKHANDLER_H_ #define MISSION_DEVICES_P60DOCKHANDLER_H_ #include #include 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; } 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: static const uint8_t MAX_PACKET_LEN = 36; static const uint8_t PARAM_SET_OK = 1; static const uint8_t PING_REPLY_SIZE = 2; /* Device commands are derived from the rparam.h of the gomspace lib */ static const DeviceCommandId_t PING = 0x1; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t NONE = 0x2; // Set when no command is pending static const DeviceCommandId_t PARAM_GET = 0x00; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t PARAM_SET = 0xFF; //!< [EXPORT] : [COMMAND] uint8_t rememberRequestedSize = 0; uint8_t rememberCommandId = NONE; uint8_t cspPacket[MAX_PACKET_LEN]; }; #endif /* MISSION_DEVICES_P60DOCKHANDLER_H_ */