some simplifications
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
parent
3d71cce30b
commit
4e92fd4421
@ -86,48 +86,41 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d
|
||||
break;
|
||||
}
|
||||
case (GOMSPACE::REQUEST_HK_TABLE): {
|
||||
auto reqType = SpecialRequestTypes::DEFAULT_COM_IF;
|
||||
if (getObjectId() == objects::PDU1_HANDLER or getObjectId() == objects::PDU2_HANDLER) {
|
||||
reqType = SpecialRequestTypes::GET_PDU_HK;
|
||||
} else if (getObjectId() == objects::ACU_HANDLER) {
|
||||
reqType = SpecialRequestTypes::GET_ACU_HK;
|
||||
} else if (getObjectId() == objects::P60DOCK_HANDLER) {
|
||||
reqType = SpecialRequestTypes::GET_P60DOCK_HK;
|
||||
DeviceType devType;
|
||||
if(getDevType(devType) != returnvalue::OK) {
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
result = generateRequestFullTableCmd(reqType, GOMSPACE::TableIds::HK, tableCfg.hkTableSize,
|
||||
deviceCommand, cspCookie);
|
||||
result =
|
||||
generateRequestFullHkTableCmd(devType, tableCfg.hkTableSize, deviceCommand, cspCookie);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (GOMSPACE::REQUEST_CONFIG_TABLE): {
|
||||
auto reqType = SpecialRequestTypes::DEFAULT_COM_IF;
|
||||
if (getObjectId() == objects::PDU1_HANDLER or getObjectId() == objects::PDU2_HANDLER) {
|
||||
reqType = SpecialRequestTypes::GET_PDU_CONFIG;
|
||||
} else if (getObjectId() == objects::ACU_HANDLER) {
|
||||
reqType = SpecialRequestTypes::GET_ACU_CONFIG;
|
||||
} else if (getObjectId() == objects::P60DOCK_HANDLER) {
|
||||
reqType = SpecialRequestTypes::GET_P60DOCK_CONFIG;
|
||||
DeviceType devType;
|
||||
if(getDevType(devType) != returnvalue::OK) {
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
result = generateRequestFullTableCmd(reqType, GOMSPACE::TableIds::CONFIG,
|
||||
tableCfg.cfgTableSize, deviceCommand, cspCookie);
|
||||
result = generateRequestFullCfgTableCmd(devType, tableCfg.cfgTableSize,
|
||||
deviceCommand, cspCookie);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (GOMSPACE::SAVE_TABLE_FILE): {
|
||||
if(commandDataLen > 2) {
|
||||
if (commandDataLen > 2) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
auto* info = reinterpret_cast<GOMSPACE::TableInfo*>(cspPacket);
|
||||
if(commandData[0] != 0 and commandData[0] != 1 and commandData[0] != 2 and commandData[0] != 4) {
|
||||
if (commandData[0] != 0 and commandData[0] != 1 and commandData[0] != 2 and
|
||||
commandData[0] != 4) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
info->sourceTable = commandData[0];
|
||||
if (info->sourceTable != 4) {
|
||||
if(commandDataLen == 2) {
|
||||
if (commandDataLen == 2) {
|
||||
info->targetTable = commandData[1];
|
||||
} else {
|
||||
info->targetTable = info->sourceTable;
|
||||
@ -142,11 +135,11 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d
|
||||
break;
|
||||
}
|
||||
case (GOMSPACE::SAVE_TABLE_DEFAULT): {
|
||||
if(commandDataLen != 1) {
|
||||
if (commandDataLen != 1) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
auto* info = reinterpret_cast<GOMSPACE::TableInfo*>(cspPacket);
|
||||
if(commandData[0] != 0 and commandData[0] != 1 and commandData[0] != 2) {
|
||||
if (commandData[0] != 0 and commandData[0] != 1 and commandData[0] != 2) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
info->sourceTable = commandData[0];
|
||||
@ -486,6 +479,19 @@ bool GomspaceDeviceHandler::validTableId(uint8_t id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ReturnValue_t GomspaceDeviceHandler::getDevType(GOMSPACE::DeviceType& type) const {
|
||||
if (getObjectId() == objects::PDU1_HANDLER or getObjectId() == objects::PDU2_HANDLER) {
|
||||
type = DeviceType::PDU;
|
||||
} else if (getObjectId() == objects::ACU_HANDLER) {
|
||||
type = DeviceType::ACU;
|
||||
} else if (getObjectId() == objects::P60DOCK_HANDLER) {
|
||||
type = DeviceType::P60DOCK;
|
||||
} else {
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() {
|
||||
WatchdogResetCommand watchdogResetCommand;
|
||||
size_t cspPacketLen = 0;
|
||||
@ -505,19 +511,40 @@ ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t GomspaceDeviceHandler::generateRequestFullTableCmd(SpecialRequestTypes reqType,
|
||||
uint8_t tableId,
|
||||
uint16_t tableReplySize,
|
||||
DeviceCommandId_t id,
|
||||
CspCookie* cspCookie) {
|
||||
uint16_t querySize = tableReplySize;
|
||||
if (reqType == SpecialRequestTypes::DEFAULT_COM_IF) {
|
||||
sif::warning << "Default communication for table requests not implemented anymore" << std::endl;
|
||||
return returnvalue::FAILED;
|
||||
ReturnValue_t GomspaceDeviceHandler::generateRequestFullHkTableCmd(DeviceType dev,
|
||||
uint16_t tableReplySize,
|
||||
DeviceCommandId_t id,
|
||||
CspCookie* cspCookie) {
|
||||
if (dev == DeviceType::ACU) {
|
||||
cspCookie->setRequest(SpecialRequestTypes::GET_ACU_HK, tableReplySize);
|
||||
} else if (dev == DeviceType::P60DOCK) {
|
||||
cspCookie->setRequest(SpecialRequestTypes::GET_P60DOCK_HK, tableReplySize);
|
||||
} else if (dev == DeviceType::PDU) {
|
||||
cspCookie->setRequest(SpecialRequestTypes::GET_PDU_HK, tableReplySize);
|
||||
}
|
||||
cspCookie->setRequest(reqType, tableReplySize);
|
||||
cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM);
|
||||
rememberRequestedSize = querySize;
|
||||
rememberRequestedSize = tableReplySize;
|
||||
rememberCommandId = id;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t GomspaceDeviceHandler::generateRequestFullCfgTableCmd(DeviceType dev,
|
||||
uint16_t tableReplySize,
|
||||
DeviceCommandId_t id,
|
||||
CspCookie* cspCookie) {
|
||||
if (dev == DeviceType::ACU) {
|
||||
cspCookie->setRequest(SpecialRequestTypes::GET_ACU_CONFIG, tableReplySize);
|
||||
} else if (dev == DeviceType::P60DOCK) {
|
||||
cspCookie->setRequest(SpecialRequestTypes::GET_P60DOCK_CONFIG, tableReplySize);
|
||||
} else if (dev == DeviceType::PDU) {
|
||||
cspCookie->setRequest(SpecialRequestTypes::GET_PDU_CONFIG, tableReplySize);
|
||||
}
|
||||
cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM);
|
||||
// Unfortunately, this does not work..
|
||||
// cspPacket[0] = defaultTable;
|
||||
// rawPacket = cspPacket;
|
||||
// rawPacketLen = 1;
|
||||
rememberRequestedSize = tableReplySize;
|
||||
rememberCommandId = id;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
@ -82,10 +82,21 @@ class GomspaceDeviceHandler : public DeviceHandlerBase {
|
||||
* @brief The command to generate a request to receive the full housekeeping table is device
|
||||
* specific. Thus the child has to build this command.
|
||||
*/
|
||||
virtual ReturnValue_t generateRequestFullTableCmd(GOMSPACE::SpecialRequestTypes reqType,
|
||||
uint8_t tableId, uint16_t tableSize,
|
||||
DeviceCommandId_t id, CspCookie* cspCookie);
|
||||
|
||||
ReturnValue_t generateRequestFullHkTableCmd(GOMSPACE::DeviceType devType, uint16_t tableSize,
|
||||
DeviceCommandId_t id, CspCookie *cspCookie);
|
||||
/**
|
||||
* Unfortunately, it was not possible to specify the table ID (e.g. request table from
|
||||
* default store)
|
||||
* @param devType
|
||||
* @param tableSize
|
||||
* @param id
|
||||
* @param cspCookie
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t generateRequestFullCfgTableCmd(GOMSPACE::DeviceType devType,
|
||||
uint16_t tableSize, DeviceCommandId_t id,
|
||||
CspCookie *cspCookie);
|
||||
ReturnValue_t getDevType(GOMSPACE::DeviceType& type) const;
|
||||
/**
|
||||
* This command handles printing the HK table to the console. This is useful for debugging
|
||||
* purposes
|
||||
|
@ -23,6 +23,8 @@ struct TableInfo {
|
||||
uint8_t targetTable;
|
||||
};
|
||||
|
||||
enum DeviceType { PDU, ACU, P60DOCK };
|
||||
|
||||
enum SpecialRequestTypes {
|
||||
DEFAULT_COM_IF,
|
||||
GET_PDU_HK,
|
||||
@ -68,7 +70,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 SAVE_TABLE_FILE = 18;
|
||||
static const DeviceCommandId_t SAVE_TABLE_DEFAULT = 19;
|
||||
static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND]
|
||||
static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND]
|
||||
|
||||
// Not implemented yet
|
||||
// static const DeviceCommandId_t REQUEST_CALIB_TABLE = 18; //!< [EXPORT] : [COMMAND]
|
||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
||||
Subproject commit cc31a756856623ecc2eec80e155557ac208f10a2
|
||||
Subproject commit abecbe44016313f1b51a29d1358fccb9f541d542
|
Loading…
Reference in New Issue
Block a user