added additional TM store and send helper

This commit is contained in:
Robin Müller 2022-07-26 11:09:57 +02:00
parent 4ed028000d
commit 500a5602bd
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
24 changed files with 154 additions and 111 deletions

View File

@ -96,13 +96,13 @@ ReturnValue_t CService200ModeCommanding::handleReply(const CommandMessage *reply
ReturnValue_t CService200ModeCommanding::prepareModeReply(const CommandMessage *reply,
object_id_t objectId) {
ModePacket modeReplyPacket(objectId, ModeMessage::getMode(reply), ModeMessage::getSubmode(reply));
return sendTmPacket(Subservice::REPLY_MODE_REPLY, modeReplyPacket);
return tmHelper.sendTmPacket(Subservice::REPLY_MODE_REPLY, modeReplyPacket);
}
ReturnValue_t CService200ModeCommanding::prepareWrongModeReply(const CommandMessage *reply,
object_id_t objectId) {
ModePacket wrongModeReply(objectId, ModeMessage::getMode(reply), ModeMessage::getSubmode(reply));
ReturnValue_t result = sendTmPacket(Subservice::REPLY_WRONG_MODE_REPLY, wrongModeReply);
ReturnValue_t result = tmHelper.sendTmPacket(Subservice::REPLY_WRONG_MODE_REPLY, wrongModeReply);
if (result == RETURN_OK) {
// We want to produce an error here in any case because the mode was not correct
return RETURN_FAILED;
@ -113,7 +113,7 @@ ReturnValue_t CService200ModeCommanding::prepareWrongModeReply(const CommandMess
ReturnValue_t CService200ModeCommanding::prepareCantReachModeReply(const CommandMessage *reply,
object_id_t objectId) {
CantReachModePacket cantReachModePacket(objectId, ModeMessage::getCantReachModeReason(reply));
ReturnValue_t result = sendTmPacket(Subservice::REPLY_CANT_REACH_MODE, cantReachModePacket);
ReturnValue_t result = tmHelper.sendTmPacket(Subservice::REPLY_CANT_REACH_MODE, cantReachModePacket);
if (result == RETURN_OK) {
// We want to produce an error here in any case because the mode was not reached
return RETURN_FAILED;

View File

@ -6,20 +6,20 @@
#include "fsfw/tmtcservices/tmHelpers.h"
Service17Test::Service17Test(object_id_t objectId, uint16_t apid, uint8_t serviceId)
: PusServiceBase(objectId, apid, serviceId), storeHelper(apid), packetSubCounter(0) {}
: PusServiceBase(objectId, apid, serviceId),
storeHelper(apid),
tmHelper(serviceId, storeHelper, sendHelper) {}
Service17Test::~Service17Test() = default;
ReturnValue_t Service17Test::handleRequest(uint8_t subservice) {
switch (subservice) {
case Subservice::CONNECTION_TEST: {
storeHelper.preparePacket(serviceId, Subservice::CONNECTION_TEST_REPORT, packetSubCounter);
return telemetry::storeAndSendTmPacket(storeHelper, sendHelper);
return tmHelper.sendTmPacket(Subservice::CONNECTION_TEST_REPORT);
}
case Subservice::EVENT_TRIGGER_TEST: {
storeHelper.preparePacket(serviceId, Subservice::CONNECTION_TEST_REPORT, packetSubCounter++);
triggerEvent(TEST, 1234, 5678);
return telemetry::storeAndSendTmPacket(storeHelper, sendHelper);
return tmHelper.sendTmPacket(Subservice::EVENT_TRIGGER_TEST);
}
default:
return AcceptsTelecommandsIF::INVALID_SUBSERVICE;

View File

@ -4,6 +4,7 @@
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/tmtcservices/PusServiceBase.h"
#include "fsfw/tmtcservices/TmStoreHelper.h"
#include "fsfw/tmtcservices/TmStoreAndSendHelper.h"
/**
* @brief Test Service
@ -45,8 +46,7 @@ class Service17Test : public PusServiceBase {
protected:
TmStoreHelper storeHelper;
TmSendHelper sendHelper;
uint16_t packetSubCounter = 0;
TmStoreAndSendWrapper tmHelper;
};
#endif /* FSFW_PUS_SERVICE17TEST_H_ */

View File

@ -15,7 +15,8 @@ Service1TelecommandVerification::Service1TelecommandVerification(object_id_t obj
apid(apid),
serviceId(serviceId),
targetDestination(targetDestination),
storeHelper(apid) {
storeHelper(apid),
tmHelper(serviceId, storeHelper, sendHelper) {
tmQueue = QueueFactory::instance()->createMessageQueue(messageQueueDepth);
}
@ -69,7 +70,7 @@ ReturnValue_t Service1TelecommandVerification::generateFailureReport(
message->getParameter1(), message->getParameter2());
storeHelper.preparePacket(serviceId, message->getReportId(), packetSubCounter++);
storeHelper.setSourceDataSerializable(report);
return telemetry::storeAndSendTmPacket(storeHelper, sendHelper);
return tmHelper.storeAndSendTmPacket();
}
ReturnValue_t Service1TelecommandVerification::generateSuccessReport(
@ -78,7 +79,7 @@ ReturnValue_t Service1TelecommandVerification::generateSuccessReport(
message->getTcSequenceControl(), message->getStep());
storeHelper.preparePacket(serviceId, message->getReportId(), packetSubCounter++);
storeHelper.setSourceDataSerializable(report);
return telemetry::storeAndSendTmPacket(storeHelper, sendHelper);
return tmHelper.storeAndSendTmPacket();
}
ReturnValue_t Service1TelecommandVerification::initialize() {

View File

@ -9,6 +9,7 @@
#include "fsfw/tmtcservices/PusVerificationReport.h"
#include "fsfw/tmtcservices/TmSendHelper.h"
#include "fsfw/tmtcservices/TmStoreHelper.h"
#include "fsfw/tmtcservices/TmStoreAndSendHelper.h"
/**
* @brief Verify TC acceptance, start, progress and execution.
@ -84,6 +85,7 @@ class Service1TelecommandVerification : public AcceptsVerifyMessageIF,
TmSendHelper sendHelper;
TmStoreHelper storeHelper;
TmStoreAndSendWrapper tmHelper;
StorageManagerIF* tmStore = nullptr;
MessageQueueIF* tmQueue = nullptr;

View File

@ -14,7 +14,7 @@ Service20ParameterManagement::Service20ParameterManagement(object_id_t objectId,
: CommandingServiceBase(objectId, apid, serviceId, numberOfParallelCommands,
commandTimeoutSeconds) {}
Service20ParameterManagement::~Service20ParameterManagement() {}
Service20ParameterManagement::~Service20ParameterManagement() = default;
ReturnValue_t Service20ParameterManagement::isValidSubservice(uint8_t subservice) {
switch (static_cast<Subservice>(subservice)) {
@ -64,7 +64,7 @@ ReturnValue_t Service20ParameterManagement::checkAndAcquireTargetID(object_id_t*
ReturnValue_t Service20ParameterManagement::checkInterfaceAndAcquireMessageQueue(
MessageQueueId_t* messageQueueToSet, object_id_t* objectId) {
// check ReceivesParameterMessagesIF property of target
ReceivesParameterMessagesIF* possibleTarget =
auto* possibleTarget =
ObjectManager::instance()->get<ReceivesParameterMessagesIF>(*objectId);
if (possibleTarget == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
@ -177,7 +177,7 @@ ReturnValue_t Service20ParameterManagement::handleReply(const CommandMessage* re
ParameterId_t parameterId = ParameterMessage::getParameterId(reply);
ParameterDumpReply parameterReply(objectId, parameterId, parameterData.second.data(),
parameterData.second.size());
sendTmPacket(static_cast<uint8_t>(Subservice::PARAMETER_DUMP_REPLY), parameterReply);
tmHelper.sendTmPacket(static_cast<uint8_t>(Subservice::PARAMETER_DUMP_REPLY), parameterReply);
return HasReturnvaluesIF::RETURN_OK;
}
default:

View File

@ -148,7 +148,7 @@ void Service2DeviceAccess::sendWiretappingTm(CommandMessage* reply, uint8_t subs
// Init our dummy packet and correct endianness of object ID before
// sending it back.
WiretappingPacket tmPacket(DeviceHandlerMessage::getDeviceObjectId(reply), data);
sendTmPacket(subservice, tmPacket.objectId, tmPacket.data, size);
tmHelper.sendTmPacket(subservice, tmPacket.objectId, tmPacket.data, size);
}
MessageQueueId_t Service2DeviceAccess::getDeviceQueue() { return commandQueue->getId(); }

View File

@ -12,6 +12,7 @@ Service5EventReporting::Service5EventReporting(object_id_t objectId, uint16_t ap
uint32_t messageQueueDepth)
: PusServiceBase(objectId, apid, serviceId),
storeHelper(apid),
tmHelper(serviceId, storeHelper, sendHelper),
maxNumberReportsPerCycle(maxNumberReportsPerCycle) {
eventQueue = QueueFactory::instance()->createMessageQueue(messageQueueDepth);
}
@ -46,9 +47,9 @@ ReturnValue_t Service5EventReporting::performService() {
ReturnValue_t Service5EventReporting::generateEventReport(EventMessage message) {
EventReport report(message.getEventId(), message.getReporter(), message.getParameter1(),
message.getParameter2());
storeHelper.preparePacket(serviceId, message.getSeverity(), packetSubCounter);
storeHelper.preparePacket(serviceId, message.getSeverity(), tmHelper.sendCounter);
storeHelper.setSourceDataSerializable(report);
ReturnValue_t result = telemetry::storeAndSendTmPacket(storeHelper, sendHelper);
ReturnValue_t result = tmHelper.storeAndSendTmPacket();
if (result != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "Service5EventReporting::generateEventReport: "
@ -59,8 +60,6 @@ ReturnValue_t Service5EventReporting::generateEventReport(EventMessage message)
"Service5EventReporting::generateEventReport: "
"Could not send TM packet\n");
#endif
} else {
packetSubCounter++;
}
return result;
}

View File

@ -2,6 +2,7 @@
#define FSFW_PUS_SERVICE5EVENTREPORTING_H_
#include "fsfw/events/EventMessage.h"
#include "fsfw/tmtcservices/TmStoreAndSendHelper.h"
#include "fsfw/tmtcservices/PusServiceBase.h"
/**
@ -74,11 +75,11 @@ class Service5EventReporting : public PusServiceBase {
};
private:
uint16_t packetSubCounter = 0;
MessageQueueIF* eventQueue = nullptr;
bool enableEventReport = true;
TmSendHelper sendHelper;
TmStoreHelper storeHelper;
TmStoreAndSendWrapper tmHelper;
const uint8_t maxNumberReportsPerCycle;
ReturnValue_t generateEventReport(EventMessage message);

View File

@ -138,7 +138,7 @@ ReturnValue_t Service8FunctionManagement::handleDataReply(const CommandMessage*
return result;
}
DataReply dataReply(objectId, actionId, buffer, size);
result = sendTmPacket(static_cast<uint8_t>(Subservice::REPLY_DIRECT_COMMANDING_DATA), dataReply);
result = tmHelper.sendTmPacket(static_cast<uint8_t>(Subservice::REPLY_DIRECT_COMMANDING_DATA), dataReply);
auto deletionResult = ipcStore->deleteData(storeId);
if (deletionResult != HasReturnvaluesIF::RETURN_OK) {

View File

@ -32,7 +32,7 @@ class Service8FunctionManagement : public CommandingServiceBase {
public:
Service8FunctionManagement(object_id_t objectId, uint16_t apid, uint8_t serviceId,
uint8_t numParallelCommands = 4, uint16_t commandTimeoutSeconds = 60);
virtual ~Service8FunctionManagement();
~Service8FunctionManagement() override;
protected:
/* CSB abstract functions implementation . See CSB documentation. */

View File

@ -10,9 +10,9 @@ class PusIF : public SpacePacketIF {
public:
static constexpr uint8_t INTERFACE_ID = CLASS_ID::PUS_IF;
static constexpr ReturnValue_t INVALID_PUS_VERSION =
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 0);
retval::makeCode(INTERFACE_ID, 0);
static constexpr ReturnValue_t INVALID_CRC_16 =
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 1);
retval::makeCode(INTERFACE_ID, 1);
~PusIF() override = default;
/**

View File

@ -133,3 +133,11 @@ ReturnValue_t PusTmCreator::setSerializableUserData(SerializeIF& serializable) {
updateSpLengthField();
return HasReturnvaluesIF::RETURN_OK;
}
void PusTmCreator::setService(uint8_t service) {
pusParams.secHeader.service = service;
}
void PusTmCreator::setSubservice(uint8_t subservice) {
pusParams.secHeader.subservice = subservice;
}

View File

@ -49,6 +49,8 @@ class PusTmCreator : public SerializeIF, public PusTmIF, public CustomUserDataIF
SpacePacketParams& getSpParams();
void setApid(uint16_t apid);
void setDestId(uint16_t destId);
void setService(uint8_t service);
void setSubservice(uint8_t subservice);
void setMessageTypeCounter(uint16_t messageTypeCounter);
PusTmParams& getParams();
void updateSpLengthField();

View File

@ -21,6 +21,7 @@ CommandingServiceBase::CommandingServiceBase(object_id_t setObjectId, uint16_t a
service(service),
timeoutSeconds(commandTimeoutSeconds),
tmStoreHelper(apid),
tmHelper(service, tmStoreHelper, tmSendHelper),
commandMap(numberOfParallelCommands) {
commandQueue = QueueFactory::instance()->createMessageQueue(queueDepth);
requestQueue = QueueFactory::instance()->createMessageQueue(queueDepth);
@ -286,35 +287,16 @@ void CommandingServiceBase::handleRequestQueue() {
ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, const uint8_t* sourceData,
size_t sourceDataLen) {
tmStoreHelper.preparePacket(service, subservice, tmPacketCounter);
tmStoreHelper.setSourceDataRaw(sourceData, sourceDataLen);
ReturnValue_t result = telemetry::storeAndSendTmPacket(tmStoreHelper, tmSendHelper);
if (result == HasReturnvaluesIF::RETURN_OK) {
this->tmPacketCounter++;
}
return result;
return tmHelper.sendTmPacket(subservice, sourceData, sourceDataLen);
}
ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, object_id_t objectId,
const uint8_t* data, size_t dataLen) {
telemetry::DataWithObjectIdPrefix dataWithObjId(objectId, data, dataLen);
tmStoreHelper.preparePacket(service, subservice, tmPacketCounter);
tmStoreHelper.setSourceDataSerializable(dataWithObjId);
ReturnValue_t result = telemetry::storeAndSendTmPacket(tmStoreHelper, tmSendHelper);
if (result == HasReturnvaluesIF::RETURN_OK) {
this->tmPacketCounter++;
}
return result;
return tmHelper.sendTmPacket(subservice, objectId, data, dataLen);
}
ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, SerializeIF& sourceData) {
tmStoreHelper.preparePacket(service, subservice, tmPacketCounter);
tmStoreHelper.setSourceDataSerializable(sourceData);
ReturnValue_t result = telemetry::storeAndSendTmPacket(tmStoreHelper, tmSendHelper);
if (result == HasReturnvaluesIF::RETURN_OK) {
this->tmPacketCounter++;
}
return result;
return tmHelper.sendTmPacket(subservice, sourceData);
}
void CommandingServiceBase::startExecution(store_address_t storeId, CommandMapIter iter) {

View File

@ -6,6 +6,7 @@
#include "TmStoreHelper.h"
#include "VerificationReporter.h"
#include "fsfw/FSFW.h"
#include "fsfw/tmtcservices/TmStoreAndSendHelper.h"
#include "fsfw/container/FIFO.h"
#include "fsfw/container/FixedMap.h"
#include "fsfw/ipc/CommandMessage.h"
@ -251,18 +252,15 @@ class CommandingServiceBase : public SystemObject,
const uint16_t timeoutSeconds;
uint8_t tmPacketCounter = 0;
StorageManagerIF* ipcStore = nullptr;
PusTcReader tcReader;
TmStoreHelper tmStoreHelper;
TmSendHelper tmSendHelper;
TmStoreAndSendWrapper tmHelper;
StorageManagerIF* tcStore = nullptr;
StorageManagerIF* ipcStore = nullptr;
MessageQueueIF* commandQueue = nullptr;
MessageQueueIF* requestQueue = nullptr;
VerificationReporter verificationReporter;
@ -286,33 +284,12 @@ class CommandingServiceBase : public SystemObject,
*/
PeriodicTaskIF* executingTask = nullptr;
/**
* @brief Send TM data from pointer to data.
* If a header is supplied it is added before data
* @param subservice Number of subservice
* @param sourceData Custom source data
* @param sourceDataLen Lenght of data in the Packet
*/
[[deprecated("Use function with same name provided by tmHelper")]]
ReturnValue_t sendTmPacket(uint8_t subservice, const uint8_t* sourceData, size_t sourceDataLen);
/**
* @brief To send TM packets of objects that still need to be serialized
* and consist of an object ID with appended data.
* @param subservice Number of subservice
* @param objectId ObjectId is placed before data
* @param data Data to append to the packet
* @param dataLen Length of Data
*/
[[deprecated("Use function with same name provided by tmHelper")]]
ReturnValue_t sendTmPacket(uint8_t subservice, object_id_t objectId, const uint8_t* data,
size_t dataLen);
/**
* @brief To send packets which are contained inside a class implementing
* SerializeIF.
* @param subservice Number of subservice
* @param content This is a pointer to the serialized packet
* @param header Serialize IF header which will be placed before content
*/
[[deprecated("Use function with same name provided by tmHelper")]]
ReturnValue_t sendTmPacket(uint8_t subservice, SerializeIF& sourceData);
void checkAndExecuteFifo(CommandMapIter& iter);

View File

@ -16,7 +16,7 @@ class TmSendHelper {
explicit TmSendHelper(InternalErrorReporterIF& reporter);
void setMsgQueue(MessageQueueIF& queue);
MessageQueueIF* getMsgQueue() const;
[[nodiscard]] MessageQueueIF* getMsgQueue() const;
void setDefaultDestination(MessageQueueId_t msgDest);
[[nodiscard]] MessageQueueId_t getDefaultDestination() const;
@ -28,6 +28,7 @@ class TmSendHelper {
ReturnValue_t sendPacket(MessageQueueId_t dest, const store_address_t& storeId);
ReturnValue_t sendPacket(const store_address_t& storeId);
private:
MessageQueueId_t defaultDest = MessageQueueIF::NO_QUEUE;
bool ignoreFault = false;

View File

@ -1,3 +1,51 @@
#include "TmStoreAndSendHelper.h"
#include "tmHelpers.h"
StoreAndSendWrapper::StoreAndSendWrapper(TmStoreHelper& storeHelper, TmSendHelper& sendHelper) {}
TmStoreAndSendWrapper::TmStoreAndSendWrapper(
uint8_t defaultService, TmStoreHelper& storeHelper, TmSendHelper& sendHelper)
: storeHelper(storeHelper), sendHelper(sendHelper), defaultService(defaultService){}
ReturnValue_t TmStoreAndSendWrapper::storeAndSendTmPacket() {
ReturnValue_t result = storeHelper.addPacketToStore();
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
result = sendHelper.sendPacket(storeHelper.getCurrentAddr());
if (result != HasReturnvaluesIF::RETURN_OK) {
if (delOnFailure) {
storeHelper.deletePacket();
}
return result;
}
if(incrementSendCounter) {
sendCounter++;
}
return result;
}
ReturnValue_t TmStoreAndSendWrapper::sendTmPacket(uint8_t subservice, const uint8_t* sourceData,
size_t sourceDataLen) {
storeHelper.preparePacket(defaultService, subservice, sendCounter);
storeHelper.setSourceDataRaw(sourceData, sourceDataLen);
return storeAndSendTmPacket();
}
ReturnValue_t TmStoreAndSendWrapper::sendTmPacket(uint8_t subservice, object_id_t objectId,
const uint8_t* data, size_t dataLen) {
telemetry::DataWithObjectIdPrefix dataWithObjId(objectId, data, dataLen);
storeHelper.preparePacket(defaultService, subservice, sendCounter);
storeHelper.setSourceDataSerializable(dataWithObjId);
return storeAndSendTmPacket();
}
ReturnValue_t TmStoreAndSendWrapper::sendTmPacket(uint8_t subservice, SerializeIF& sourceData) {
storeHelper.preparePacket(defaultService, subservice, sendCounter);
storeHelper.setSourceDataSerializable(sourceData);
return storeAndSendTmPacket();
}
ReturnValue_t TmStoreAndSendWrapper::sendTmPacket(uint8_t subservice) {
storeHelper.preparePacket(defaultService, subservice, sendCounter);
storeHelper.setSourceDataRaw(nullptr, 0);
return storeAndSendTmPacket();
}

View File

@ -4,15 +4,51 @@
#include "TmSendHelper.h"
#include "TmStoreHelper.h"
class StoreAndSendWrapper {
/**
* Wrapper class intended to help with PUS TM handling. This wrapper class also caches the current packet count
* and the service ID
*/
class TmStoreAndSendWrapper {
public:
StoreAndSendWrapper(TmStoreHelper& storeHelper, TmSendHelper& sendHelper)
: storeHelper(storeHelper), sendHelper(sendHelper) {}
ReturnValue_t storeAndSendTmPacket(TmStoreHelper& storeHelper, TmSendHelper& sendHelper,
bool delOnFailure = true);
TmStoreAndSendWrapper(uint8_t defaultService, TmStoreHelper& storeHelper, TmSendHelper& sendHelper);
ReturnValue_t storeAndSendTmPacket();
ReturnValue_t sendTmPacket(uint8_t subservice);
/**
* @brief Send TM data from pointer to data.
* If a header is supplied it is added before data
* @param subservice Number of subservice
* @param sourceData Custom source data
* @param sourceDataLen Lenght of data in the Packet
*/
ReturnValue_t sendTmPacket(uint8_t subservice, const uint8_t* sourceData, size_t sourceDataLen);
/**
* @brief To send TM packets of objects that still need to be serialized
* and consist of an object ID with appended data.
* @param subservice Number of subservice
* @param objectId ObjectId is placed before data
* @param data Data to append to the packet
* @param dataLen Length of Data
*/
ReturnValue_t sendTmPacket(uint8_t subservice, object_id_t objectId, const uint8_t* data,
size_t dataLen);
/**
* @brief To send packets which are contained inside a class implementing
* SerializeIF.
* @param subservice Number of subservice
* @param content This is a pointer to the serialized packet
* @param header Serialize IF header which will be placed before content
*/
ReturnValue_t sendTmPacket(uint8_t subservice, SerializeIF& sourceData);
bool incrementSendCounter = true;
TmStoreHelper& storeHelper;
TmSendHelper& sendHelper;
bool delOnFailure = true;
uint8_t defaultService = 0;
uint16_t sendCounter = 0;
};
#endif // FSFW_TMTCSERVICES_TMSTOREANDSENDHELPER_H

View File

@ -71,3 +71,7 @@ PusTmCreator& TmStoreHelper::getCreatorRef() { return creator; }
TimeStamperIF* TmStoreHelper::getTimeStamper() const { return creator.getTimestamper(); }
uint16_t TmStoreHelper::getApid() const { return creator.getApid(); }
ReturnValue_t TmStoreHelper::setService(uint8_t service) { creator.setService(service); }
ReturnValue_t TmStoreHelper::setSubservice(uint8_t subservice) { creator.setSubservice(subservice); }

View File

@ -27,6 +27,8 @@ class TmStoreHelper {
[[nodiscard]] uint16_t getApid() const;
[[nodiscard]] const store_address_t& getCurrentAddr() const;
ReturnValue_t setService(uint8_t service);
ReturnValue_t setSubservice(uint8_t subservice);
ReturnValue_t setSourceDataRaw(const uint8_t* data, size_t len);
ReturnValue_t setSourceDataSerializable(SerializeIF& serializable);

View File

@ -1,16 +1 @@
#include "tmHelpers.h"
ReturnValue_t telemetry::storeAndSendTmPacket(TmStoreHelper &storeHelper, TmSendHelper &sendHelper,
bool delOnFailure) {
ReturnValue_t result = storeHelper.addPacketToStore();
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
result = sendHelper.sendPacket(storeHelper.getCurrentAddr());
if (result != HasReturnvaluesIF::RETURN_OK) {
if (delOnFailure) {
storeHelper.deletePacket();
}
}
return result;
}

View File

@ -32,26 +32,26 @@ class CommandExecutor {
//! [EXPORT] : [COMMENT] Execution of the current command has finished
static constexpr ReturnValue_t EXECUTION_FINISHED =
HasReturnvaluesIF::makeReturnCode(CLASS_ID, 0);
retval::makeCode(CLASS_ID, 0);
//! [EXPORT] : [COMMENT] Command is pending. This will also be returned if the user tries
//! to load another command but a command is still pending
static constexpr ReturnValue_t COMMAND_PENDING = HasReturnvaluesIF::makeReturnCode(CLASS_ID, 1);
static constexpr ReturnValue_t COMMAND_PENDING = retval::makeCode(CLASS_ID, 1);
//! [EXPORT] : [COMMENT] Some bytes have been read from the executing process
static constexpr ReturnValue_t BYTES_READ = HasReturnvaluesIF::makeReturnCode(CLASS_ID, 2);
static constexpr ReturnValue_t BYTES_READ = retval::makeCode(CLASS_ID, 2);
//! [EXPORT] : [COMMENT] Command execution failed
static constexpr ReturnValue_t COMMAND_ERROR = HasReturnvaluesIF::makeReturnCode(CLASS_ID, 3);
static constexpr ReturnValue_t COMMAND_ERROR = retval::makeCode(CLASS_ID, 3);
//! [EXPORT] : [COMMENT]
static constexpr ReturnValue_t NO_COMMAND_LOADED_OR_PENDING =
HasReturnvaluesIF::makeReturnCode(CLASS_ID, 4);
static constexpr ReturnValue_t PCLOSE_CALL_ERROR = HasReturnvaluesIF::makeReturnCode(CLASS_ID, 6);
retval::makeCode(CLASS_ID, 4);
static constexpr ReturnValue_t PCLOSE_CALL_ERROR =retval::makeCode(CLASS_ID, 6);
/**
* Constructor. Is initialized with maximum size of internal buffer to read data from the
* executed process.
* @param maxSize
*/
CommandExecutor(const size_t maxSize);
explicit CommandExecutor(size_t maxSize);
/**
* Load a new command which should be executed

View File

@ -68,11 +68,6 @@ TEST_CASE("TM Send Helper", "[tm-send-helper]") {
storeId = storeHelper.getCurrentAddr();
REQUIRE(sendHelper.sendPacket(storeId) == HasReturnvaluesIF::RETURN_OK);
}
SECTION("Helper Wrapper") {
REQUIRE(telemetry::storeAndSendTmPacket(storeHelper, sendHelper) ==
HasReturnvaluesIF::RETURN_OK);
storeId = storeHelper.getCurrentAddr();
}
REQUIRE(msgQueue.wasMessageSent());
REQUIRE(msgQueue.numberOfSentMessagesToDefault() == 1);
TmTcMessage msg;