eive-obsw/bsp_linux/comIF/P60DockComIF.h

59 lines
1.8 KiB
C++

/*
* P60DockComIF.h
*
* Created on: 01.12.2020
* Author: jakob
*/
#ifndef BSP_LINUX_COMIF_P60DOCKCOMIF_H_
#define BSP_LINUX_COMIF_P60DOCKCOMIF_H_
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <gomspace/libcsp/include/csp/csp_types.h>
#include <gomspace/libcsp/include/csp/csp_error.h>
#include <gomspace/libparam_client/include/gs/param/types.h>
#include <gs/param/internal/types.h>
#include <p60dock.h>
/**
* @brief This is the communication interface to the cubesat space protocol
* stack. The physical layer used for this implementation is CAN.
* @author Jakob Meier
*/
class P60DockComIF: public DeviceCommunicationIF, public SystemObject {
public:
static const uint16_t maxReplyLength = 412;
P60DockComIF(object_id_t objectId);
virtual ~P60DockComIF();
ReturnValue_t initializeInterface(CookieIF * cookie) override;
ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t * sendData,
size_t sendLen) override;
ReturnValue_t getSendSuccess(CookieIF *cookie) override;
ReturnValue_t requestReceiveMessage(CookieIF *cookie,
size_t requestLen) override;
ReturnValue_t readReceivedMessage(CookieIF *cookie,
uint8_t **readData, size_t *readLen) override;
private:
/* This is the CSP address of the OBC. */
uint8_t cspClientAddress = 1;
/* Interface struct for csp protocol stack */
csp_iface_t csp_if;
/* Table definitions. According to gomspace software documentation there
* exist four tables each identified by a number*/
uint8_t moduleCfgTableNum = 1;
uint8_t calibrationParamTableNum = 2;
uint8_t tmTableNum = 4;
/* Replies of P60 dock are written to this buffer */
uint8_t replyBuffer[P60DockComIF::maxReplyLength];
gs_param_table_instance_t table;
};
#endif /* BSP_LINUX_COMIF_P60DOCKCOMIF_H_ */