GomSpace commands #293

Merged
meierj merged 6 commits from mueller/new-gomspace-commdsn into develop 2022-09-02 12:40:45 +02:00
5 changed files with 32 additions and 4 deletions
Showing only changes of commit 6ae0249fdc - Show all commits

View File

@ -176,6 +176,16 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
if (result != 0) { if (result != 0) {
return returnvalue::FAILED; return returnvalue::FAILED;
} }
} else if(req == GOMSPACE::SpecialRequestTypes::LOAD_TABLE) {
if(sendLen < 2) {
return returnvalue::FAILED;
}
const TableInfo* tableInfo = reinterpret_cast<const TableInfo*>(sendData);
int result = gs_rparam_load(cspAddress, cspCookie->getTimeout(), tableInfo->sourceTable,
tableInfo->targetTable);
if (result != 0) {
return returnvalue::FAILED;
}
} }
} else { } else {
/* No CSP fixed port was selected. Send data to the specified port and /* No CSP fixed port was selected. Send data to the specified port and

View File

@ -1,10 +1,11 @@
#include "CspCookie.h" #include "CspCookie.h"
using namespace GOMSPACE;
CspCookie::CspCookie(uint16_t maxReplyLength_, uint8_t cspAddress_, uint32_t timeoutMs) CspCookie::CspCookie(uint16_t maxReplyLength_, uint8_t cspAddress_, uint32_t timeoutMs)
: maxReplyLength(maxReplyLength_), : maxReplyLength(maxReplyLength_),
cspAddress(cspAddress_), cspAddress(cspAddress_),
timeoutMs(timeoutMs), timeoutMs(timeoutMs),
reqType(GOMSPACE::DEFAULT_COM_IF) {} reqType(SpecialRequestTypes::DEFAULT_COM_IF) {}
CspCookie::~CspCookie() {} CspCookie::~CspCookie() {}

View File

@ -109,6 +109,20 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d
} }
break; break;
} }
case (GOMSPACE::LOAD_TABLE): {
if (commandDataLen != 2) {
return HasActionsIF::INVALID_PARAMETERS;
}
auto* info = reinterpret_cast<GOMSPACE::TableInfo*>(cspPacket);
info->sourceTable = commandData[0];
info->targetTable = commandData[1];
rawPacket = cspPacket;
rawPacketLen = sizeof(GOMSPACE::TableInfo);
cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM);
cspCookie->setRequest(SpecialRequestTypes::LOAD_TABLE, 0);
rememberCommandId = deviceCommand;
break;
}
case (GOMSPACE::SAVE_TABLE_FILE): { case (GOMSPACE::SAVE_TABLE_FILE): {
if (commandDataLen > 2) { if (commandDataLen > 2) {
return HasActionsIF::INVALID_PARAMETERS; return HasActionsIF::INVALID_PARAMETERS;
@ -171,6 +185,7 @@ void GomspaceDeviceHandler::fillCommandAndReplyMap() {
this->insertInCommandMap(GOMSPACE::PRINT_LATCHUPS); this->insertInCommandMap(GOMSPACE::PRINT_LATCHUPS);
insertInCommandMap(GOMSPACE::SAVE_TABLE_FILE); insertInCommandMap(GOMSPACE::SAVE_TABLE_FILE);
insertInCommandMap(GOMSPACE::SAVE_TABLE_DEFAULT); insertInCommandMap(GOMSPACE::SAVE_TABLE_DEFAULT);
insertInCommandMap(GOMSPACE::LOAD_TABLE);
} }
ReturnValue_t GomspaceDeviceHandler::scanForReply(const uint8_t* start, size_t remainingSize, ReturnValue_t GomspaceDeviceHandler::scanForReply(const uint8_t* start, size_t remainingSize,

View File

@ -25,7 +25,7 @@ struct TableInfo {
enum DeviceType { PDU, ACU, P60DOCK }; enum DeviceType { PDU, ACU, P60DOCK };
enum SpecialRequestTypes { enum class SpecialRequestTypes {
DEFAULT_COM_IF, DEFAULT_COM_IF,
GET_PDU_HK, GET_PDU_HK,
GET_PDU_CONFIG, GET_PDU_CONFIG,
@ -33,7 +33,8 @@ enum SpecialRequestTypes {
GET_ACU_CONFIG, GET_ACU_CONFIG,
GET_P60DOCK_HK, GET_P60DOCK_HK,
GET_P60DOCK_CONFIG, GET_P60DOCK_CONFIG,
SAVE_TABLE SAVE_TABLE,
LOAD_TABLE
}; };
enum CspPorts : uint8_t { enum CspPorts : uint8_t {
@ -70,6 +71,7 @@ static const DeviceCommandId_t REQUEST_HK_TABLE = 16; //!< [EXPORT] : [COMM
static const DeviceCommandId_t REQUEST_CONFIG_TABLE = 17; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t REQUEST_CONFIG_TABLE = 17; //!< [EXPORT] : [COMMAND]
static const DeviceCommandId_t SAVE_TABLE_FILE = 18; static const DeviceCommandId_t SAVE_TABLE_FILE = 18;
static const DeviceCommandId_t SAVE_TABLE_DEFAULT = 19; static const DeviceCommandId_t SAVE_TABLE_DEFAULT = 19;
static const DeviceCommandId_t LOAD_TABLE = 20;
static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND]
// Not implemented yet // Not implemented yet

2
tmtc

@ -1 +1 @@
Subproject commit e162e5c51b0bf08b2018e4169a07eed1e4f7eacb Subproject commit 6085c6543c0beb24cc427fae16d1fa2897a2fe5a