added test to retrieve pdu config
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

This commit is contained in:
2022-08-26 14:28:06 +02:00
parent e804d433aa
commit 8c110460a6
24 changed files with 185 additions and 170 deletions

View File

@ -4,9 +4,11 @@
#include <fsfw/serialize/SerializeAdapter.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
#include <p60pdu.h>
#include <p60acu.h>
#include <p60dock.h>
#include <p60pdu.h>
#include <param/param_string.h>
#include <param/rparam_client.h>
#include "mission/csp/CspCookie.h"
@ -86,7 +88,7 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
uint8_t cspPort;
uint16_t querySize = 0;
if(cspCookie->getRequest() == GOMSPACE::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 != returnvalue::OK) {
@ -96,6 +98,11 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
cspPort = cspCookie->getCspPort();
querySize = cspCookie->getReplyLen();
}
if (querySize > cspCookie->getMaxReplyLength()) {
sif::error << "Query size " << querySize << " is larger than maximum allowed "
<< cspCookie->getMaxReplyLength() << std::endl;
return returnvalue::FAILED;
}
uint8_t cspAddress = cspCookie->getCspAddress();
switch (cspPort) {
case (CspPorts::CSP_PING): {
@ -108,22 +115,32 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
}
case (CspPorts::P60_PORT_GNDWDT_RESET_ENUM):
case (CspPorts::P60_PORT_RPARAM_ENUM): {
if(cspCookie->getRequest() != SpecialRequestTypes::DEFAULT_COM_IF) {
if (cspCookie->getRequest() != SpecialRequestTypes::DEFAULT_COM_IF) {
param_index_t requestStruct{};
requestStruct.physaddr = cspDeviceMap[cspAddress].data();
if(cspCookie->getRequest() == GOMSPACE::SpecialRequestTypes::GET_PDU_HK) {
if(!p60pdu_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
auto req = cspCookie->getRequest();
if (req == GOMSPACE::SpecialRequestTypes::GET_PDU_HK) {
if (!p60pdu_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
return returnvalue::FAILED;
}
} else if(cspCookie->getRequest() == GOMSPACE::SpecialRequestTypes::GET_ACU_HK) {
if(!p60acu_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
} else if (req == GOMSPACE::SpecialRequestTypes::GET_ACU_HK) {
if (!p60acu_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
return returnvalue::FAILED;
}
} else if(cspCookie->getRequest() == GOMSPACE::SpecialRequestTypes::GET_P60DOCK_HK) {
if(!p60dock_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
} else if (req == GOMSPACE::SpecialRequestTypes::GET_P60DOCK_HK) {
if (!p60dock_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
return returnvalue::FAILED;
}
} else if (req == GOMSPACE::SpecialRequestTypes::GET_PDU_CONFIG) {
requestStruct.table = p60pdu_config;
requestStruct.mem_id = P60PDU_PARAM;
requestStruct.count = p60pdu_config_count;
requestStruct.size = P60PDU_PARAM_SIZE;
int result = rparam_get_full_table(&requestStruct, cspAddress, P60_PORT_RPARAM,
requestStruct.mem_id, cspCookie->getTimeout());
param_list(&requestStruct, 1);
return (result == 0);
}
} else {
/* No CSP fixed port was selected. Send data to the specified port and