doc improved, new returnvalue

This commit is contained in:
Robin Müller 2020-10-19 00:43:10 +02:00
parent 75e67ce5f8
commit 22e4e464c7
4 changed files with 15 additions and 7 deletions

View File

@ -26,12 +26,12 @@ void ParameterMessage::setParameterDumpReply(CommandMessage* message,
void ParameterMessage::setParameterLoadCommand(CommandMessage* message,
ParameterId_t id, store_address_t storeId, uint8_t ptc, uint8_t pfc,
uint8_t row, uint8_t column) {
uint8_t rows = 1, uint8_t columns = 1) {
message->setCommand(CMD_PARAMETER_LOAD);
message->setParameter(id);
message->setParameter2(storeId.raw);
uint32_t packedParameterSettings = (ptc << 24) | (pfc << 16) |
(row << 8) | column;
(rows << 8) | columns;
message->setParameter3(packedParameterSettings);
}

View File

@ -28,14 +28,14 @@ public:
* @param message
* @param id
* @param storeId
* @param ptc
* @param pfc
* @param row
* @param column
* @param ptc Type information according to CCSDS/ECSS standards
* @param pfc Type information according to CCSDS/ECSS standards
* @param rows Set number of rows in parameter set, minimum one.
* @param columns Set number of columns in parameter set, minimum one
*/
static void setParameterLoadCommand(CommandMessage* message,
ParameterId_t id, store_address_t storeId, uint8_t ptc,
uint8_t pfc, uint8_t row, uint8_t column);
uint8_t pfc, uint8_t rows, uint8_t columns);
static void clear(CommandMessage* message);
};

View File

@ -202,6 +202,8 @@ ReturnValue_t ParameterWrapper::set(const uint8_t *stream, size_t streamSize,
ReturnValue_t ParameterWrapper::copyFrom(const ParameterWrapper *from,
uint16_t startWritingAtIndex) {
// TODO: Optional diagnostic output (which can be disabled in FSFWConfig)
// to determined faulty implementations and configuration errors quickly.
if (data == nullptr) {
return READONLY;
}
@ -214,6 +216,11 @@ ReturnValue_t ParameterWrapper::copyFrom(const ParameterWrapper *from,
return DATATYPE_MISSMATCH;
}
// The smallest allowed value for rows and columns is one.
if(rows == 0 or columns == 0) {
return COLUMN_OR_ROWS_ZERO;
}
//check if from fits into this
uint8_t startingRow = 0;
uint8_t startingColumn = 0;

View File

@ -22,6 +22,7 @@ public:
static const ReturnValue_t SOURCE_NOT_SET = MAKE_RETURN_CODE(0x05);
static const ReturnValue_t OUT_OF_BOUNDS = MAKE_RETURN_CODE(0x06);
static const ReturnValue_t NOT_SET = MAKE_RETURN_CODE(0x07);
static const ReturnValue_t COLUMN_OR_ROWS_ZERO = MAKE_RETURN_CODE(0x08);
ParameterWrapper();
ParameterWrapper(Type type, uint8_t rows, uint8_t columns, void *data);