command message bugfix, CSB improvement

parameter helper diagnostic message
This commit is contained in:
Robin Müller 2020-08-01 16:39:17 +02:00
parent 18899a4c82
commit 58a4f4f8a1
4 changed files with 15 additions and 7 deletions

View File

@ -88,6 +88,7 @@ void CommandMessage::setToUnknownCommand() {
void CommandMessage::setReplyRejected(ReturnValue_t reason, void CommandMessage::setReplyRejected(ReturnValue_t reason,
Command_t initialCommand) { Command_t initialCommand) {
setCommand(REPLY_REJECTED);
setParameter(reason); setParameter(reason);
setParameter2(initialCommand); setParameter2(initialCommand);
} }

View File

@ -26,7 +26,6 @@ ReturnValue_t ParameterHelper::handleParameterMessage(CommandMessage *message) {
} }
break; break;
case ParameterMessage::CMD_PARAMETER_LOAD: { case ParameterMessage::CMD_PARAMETER_LOAD: {
uint8_t domain = HasParametersIF::getDomain( uint8_t domain = HasParametersIF::getDomain(
ParameterMessage::getParameterId(message)); ParameterMessage::getParameterId(message));
uint16_t parameterId = HasParametersIF::getMatrixId( uint16_t parameterId = HasParametersIF::getMatrixId(
@ -34,12 +33,14 @@ ReturnValue_t ParameterHelper::handleParameterMessage(CommandMessage *message) {
uint8_t index = HasParametersIF::getIndex( uint8_t index = HasParametersIF::getIndex(
ParameterMessage::getParameterId(message)); ParameterMessage::getParameterId(message));
const uint8_t *storedStream; const uint8_t *storedStream = nullptr;
size_t storedStreamSize; size_t storedStreamSize = 0;
result = storage->getData( result = storage->getData(
ParameterMessage::getStoreId(message), &storedStream, ParameterMessage::getStoreId(message), &storedStream,
&storedStreamSize); &storedStreamSize);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "ParameterHelper::handleParameterMessage: Getting"
" store data failed for load command." << std::endl;
break; break;
} }

View File

@ -5,6 +5,12 @@
#include <framework/parameters/ParameterMessage.h> #include <framework/parameters/ParameterMessage.h>
#include <framework/parameters/ReceivesParameterMessagesIF.h> #include <framework/parameters/ReceivesParameterMessagesIF.h>
/**
* @brief Helper class to handle parameter messages
* @details
* This class simplfiies handling of parameter messages, which are sent
* to a class which implements ReceivesParameterMessagesIF.
*/
class ParameterHelper { class ParameterHelper {
public: public:
ParameterHelper(ReceivesParameterMessagesIF *owner); ParameterHelper(ReceivesParameterMessagesIF *owner);

View File

@ -126,11 +126,11 @@ void CommandingServiceBase::handleCommandMessage(CommandMessage* reply) {
&nextCommand, iter->objectId, &isStep); &nextCommand, iter->objectId, &isStep);
/* If the child implementation does not implement special handling for /* If the child implementation does not implement special handling for
* rejected replies (RETURN_FAILED is returned), a failure verification * rejected replies (RETURN_FAILED or INVALID_REPLY is returned), a
* will be generated with the reason as the return code and the initial * failure verification will be generated with the reason as the
* command as failure parameter 1 */ * return code and the initial command as failure parameter 1 */
if(reply->getCommand() == CommandMessage::REPLY_REJECTED and if(reply->getCommand() == CommandMessage::REPLY_REJECTED and
result == RETURN_FAILED) { (result == RETURN_FAILED or result == INVALID_REPLY)) {
result = reply->getReplyRejectedReason(); result = reply->getReplyRejectedReason();
failureParameter1 = iter->command; failureParameter1 = iter->command;
} }