changed all table parsing to use gom space API
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

This commit is contained in:
2022-08-26 13:42:58 +02:00
parent efb0bce718
commit a7482b657a
16 changed files with 131 additions and 187 deletions

View File

@ -1 +1 @@
target_sources(${OBSW_NAME} PUBLIC CspComIF.cpp CspCookie.cpp)
target_sources(${OBSW_NAME} PUBLIC CspComIF.cpp)

View File

@ -5,8 +5,12 @@
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
#include <p60pdu.h>
#include <p60acu.h>
#include <p60dock.h>
#include "CspCookie.h"
#include "mission/csp/CspCookie.h"
using namespace GOMSPACE;
CspComIF::CspComIF(object_id_t objectId) : SystemObject(objectId) {}
@ -82,7 +86,7 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
uint8_t cspPort;
uint16_t querySize = 0;
if(cspCookie->getRequest() == CspCookie::SpecialRequestTypes::DEFAULT_COM_IF) {
if(cspCookie->getRequest() == GOMSPACE::SpecialRequestTypes::DEFAULT_COM_IF) {
/* Extract csp port and bytes to query from command buffer */
result = getPortAndQuerySize(&sendData, &sendLen, &cspPort, &querySize);
if (result != HasReturnvaluesIF::RETURN_OK) {
@ -94,21 +98,32 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
}
uint8_t cspAddress = cspCookie->getCspAddress();
switch (cspPort) {
case (GOMSPACE::CspPorts::CSP_PING): {
case (CspPorts::CSP_PING): {
initiatePingRequest(cspAddress, querySize);
break;
}
case (GOMSPACE::CspPorts::CSP_REBOOT): {
case (CspPorts::CSP_REBOOT): {
csp_reboot(cspAddress);
break;
}
case (GOMSPACE::CspPorts::P60_PORT_GNDWDT_RESET_ENUM):
case (GOMSPACE::CspPorts::P60_PORT_RPARAM_ENUM): {
if(cspCookie->getRequest() == CspCookie::SpecialRequestTypes::GET_PDU_HK) {
case (CspPorts::P60_PORT_GNDWDT_RESET_ENUM):
case (CspPorts::P60_PORT_RPARAM_ENUM): {
if(cspCookie->getRequest() != SpecialRequestTypes::DEFAULT_COM_IF) {
param_index_t requestStruct{};
requestStruct.physaddr = cspDeviceMap[cspAddress].data();
if(!p60pdu_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
return HasReturnvaluesIF::RETURN_FAILED;
if(cspCookie->getRequest() == GOMSPACE::SpecialRequestTypes::GET_PDU_HK) {
if(!p60pdu_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
return HasReturnvaluesIF::RETURN_FAILED;
}
} else if(cspCookie->getRequest() == GOMSPACE::SpecialRequestTypes::GET_ACU_HK) {
if(!p60acu_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
return HasReturnvaluesIF::RETURN_FAILED;
}
} else if(cspCookie->getRequest() == GOMSPACE::SpecialRequestTypes::GET_P60DOCK_HK) {
if(!p60dock_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
return HasReturnvaluesIF::RETURN_FAILED;
}
}
} else {
/* No CSP fixed port was selected. Send data to the specified port and

View File

@ -1,38 +0,0 @@
#include "CspCookie.h"
CspCookie::CspCookie(uint16_t maxReplyLength_, uint8_t cspAddress_, uint32_t timeoutMs)
: maxReplyLength(maxReplyLength_), cspAddress(cspAddress_), timeoutMs(timeoutMs),
reqType(DEFAULT_COM_IF) {}
CspCookie::~CspCookie() {}
uint16_t CspCookie::getMaxReplyLength() { return maxReplyLength; }
uint8_t CspCookie::getCspAddress() {
return cspAddress;
}
CspCookie::SpecialRequestTypes CspCookie::getRequest() const {
return reqType;
}
void CspCookie::setRequest(SpecialRequestTypes request, size_t replyLen_) {
reqType = request;
replyLen = replyLen_;
}
uint8_t CspCookie::getCspPort() const {
return cspPort;
}
uint32_t CspCookie::getTimeout() const {
return timeoutMs;
}
void CspCookie::setCspPort(uint8_t port) {
cspPort = port;
}
size_t CspCookie::getReplyLen() const {
return replyLen;
}

View File

@ -1,47 +0,0 @@
#ifndef LINUX_CSP_CSPCOOKIE_H_
#define LINUX_CSP_CSPCOOKIE_H_
#include <fsfw/devicehandlers/CookieIF.h>
#include <cstdint>
#include <cstddef>
/**
* @brief This is the cookie for devices supporting the CSP (CubeSat Space
* Protocol).
* @author J. Meier
*/
class CspCookie : public CookieIF {
public:
enum SpecialRequestTypes {
DEFAULT_COM_IF,
GET_PDU_HK,
GET_PDU_CONFIG,
GET_ACU_HK,
GET_ACU_CONFIG,
GET_P60DOCK_HK,
GET_P60DOCK_CONFIG
};
CspCookie(uint16_t maxReplyLength_, uint8_t cspAddress_, uint32_t timeoutMs);
virtual ~CspCookie();
void setCspPort(uint8_t port);
uint8_t getCspPort() const;
uint16_t getMaxReplyLength();
SpecialRequestTypes getRequest() const;
void setRequest(SpecialRequestTypes request, size_t replyLen);
size_t getReplyLen() const;
uint8_t getCspAddress();
uint32_t getTimeout() const;
private:
uint8_t cspPort;
uint16_t maxReplyLength;
uint8_t cspAddress;
size_t replyLen = 0;
uint32_t timeoutMs;
SpecialRequestTypes reqType;
};
#endif /* LINUX_CSP_CSPCOOKIE_H_ */