Update FSFW from upstream #71
@ -96,13 +96,13 @@ ReturnValue_t CService200ModeCommanding::handleReply(const CommandMessage *reply
|
|||||||
ReturnValue_t CService200ModeCommanding::prepareModeReply(const CommandMessage *reply,
|
ReturnValue_t CService200ModeCommanding::prepareModeReply(const CommandMessage *reply,
|
||||||
object_id_t objectId) {
|
object_id_t objectId) {
|
||||||
ModePacket modeReplyPacket(objectId, ModeMessage::getMode(reply), ModeMessage::getSubmode(reply));
|
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,
|
ReturnValue_t CService200ModeCommanding::prepareWrongModeReply(const CommandMessage *reply,
|
||||||
object_id_t objectId) {
|
object_id_t objectId) {
|
||||||
ModePacket wrongModeReply(objectId, ModeMessage::getMode(reply), ModeMessage::getSubmode(reply));
|
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) {
|
if (result == RETURN_OK) {
|
||||||
// We want to produce an error here in any case because the mode was not correct
|
// We want to produce an error here in any case because the mode was not correct
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
@ -113,7 +113,7 @@ ReturnValue_t CService200ModeCommanding::prepareWrongModeReply(const CommandMess
|
|||||||
ReturnValue_t CService200ModeCommanding::prepareCantReachModeReply(const CommandMessage *reply,
|
ReturnValue_t CService200ModeCommanding::prepareCantReachModeReply(const CommandMessage *reply,
|
||||||
object_id_t objectId) {
|
object_id_t objectId) {
|
||||||
CantReachModePacket cantReachModePacket(objectId, ModeMessage::getCantReachModeReason(reply));
|
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) {
|
if (result == RETURN_OK) {
|
||||||
// We want to produce an error here in any case because the mode was not reached
|
// We want to produce an error here in any case because the mode was not reached
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
|
@ -6,20 +6,20 @@
|
|||||||
#include "fsfw/tmtcservices/tmHelpers.h"
|
#include "fsfw/tmtcservices/tmHelpers.h"
|
||||||
|
|
||||||
Service17Test::Service17Test(object_id_t objectId, uint16_t apid, uint8_t serviceId)
|
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;
|
Service17Test::~Service17Test() = default;
|
||||||
|
|
||||||
ReturnValue_t Service17Test::handleRequest(uint8_t subservice) {
|
ReturnValue_t Service17Test::handleRequest(uint8_t subservice) {
|
||||||
switch (subservice) {
|
switch (subservice) {
|
||||||
case Subservice::CONNECTION_TEST: {
|
case Subservice::CONNECTION_TEST: {
|
||||||
storeHelper.preparePacket(serviceId, Subservice::CONNECTION_TEST_REPORT, packetSubCounter);
|
return tmHelper.sendTmPacket(Subservice::CONNECTION_TEST_REPORT);
|
||||||
return telemetry::storeAndSendTmPacket(storeHelper, sendHelper);
|
|
||||||
}
|
}
|
||||||
case Subservice::EVENT_TRIGGER_TEST: {
|
case Subservice::EVENT_TRIGGER_TEST: {
|
||||||
storeHelper.preparePacket(serviceId, Subservice::CONNECTION_TEST_REPORT, packetSubCounter++);
|
|
||||||
triggerEvent(TEST, 1234, 5678);
|
triggerEvent(TEST, 1234, 5678);
|
||||||
return telemetry::storeAndSendTmPacket(storeHelper, sendHelper);
|
return tmHelper.sendTmPacket(Subservice::EVENT_TRIGGER_TEST);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return AcceptsTelecommandsIF::INVALID_SUBSERVICE;
|
return AcceptsTelecommandsIF::INVALID_SUBSERVICE;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "fsfw/objectmanager/SystemObject.h"
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
#include "fsfw/tmtcservices/PusServiceBase.h"
|
#include "fsfw/tmtcservices/PusServiceBase.h"
|
||||||
#include "fsfw/tmtcservices/TmStoreHelper.h"
|
#include "fsfw/tmtcservices/TmStoreHelper.h"
|
||||||
|
#include "fsfw/tmtcservices/TmStoreAndSendHelper.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Test Service
|
* @brief Test Service
|
||||||
@ -45,8 +46,7 @@ class Service17Test : public PusServiceBase {
|
|||||||
protected:
|
protected:
|
||||||
TmStoreHelper storeHelper;
|
TmStoreHelper storeHelper;
|
||||||
TmSendHelper sendHelper;
|
TmSendHelper sendHelper;
|
||||||
|
TmStoreAndSendWrapper tmHelper;
|
||||||
uint16_t packetSubCounter = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FSFW_PUS_SERVICE17TEST_H_ */
|
#endif /* FSFW_PUS_SERVICE17TEST_H_ */
|
||||||
|
@ -15,7 +15,8 @@ Service1TelecommandVerification::Service1TelecommandVerification(object_id_t obj
|
|||||||
apid(apid),
|
apid(apid),
|
||||||
serviceId(serviceId),
|
serviceId(serviceId),
|
||||||
targetDestination(targetDestination),
|
targetDestination(targetDestination),
|
||||||
storeHelper(apid) {
|
storeHelper(apid),
|
||||||
|
tmHelper(serviceId, storeHelper, sendHelper) {
|
||||||
tmQueue = QueueFactory::instance()->createMessageQueue(messageQueueDepth);
|
tmQueue = QueueFactory::instance()->createMessageQueue(messageQueueDepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +70,7 @@ ReturnValue_t Service1TelecommandVerification::generateFailureReport(
|
|||||||
message->getParameter1(), message->getParameter2());
|
message->getParameter1(), message->getParameter2());
|
||||||
storeHelper.preparePacket(serviceId, message->getReportId(), packetSubCounter++);
|
storeHelper.preparePacket(serviceId, message->getReportId(), packetSubCounter++);
|
||||||
storeHelper.setSourceDataSerializable(report);
|
storeHelper.setSourceDataSerializable(report);
|
||||||
return telemetry::storeAndSendTmPacket(storeHelper, sendHelper);
|
return tmHelper.storeAndSendTmPacket();
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Service1TelecommandVerification::generateSuccessReport(
|
ReturnValue_t Service1TelecommandVerification::generateSuccessReport(
|
||||||
@ -78,7 +79,7 @@ ReturnValue_t Service1TelecommandVerification::generateSuccessReport(
|
|||||||
message->getTcSequenceControl(), message->getStep());
|
message->getTcSequenceControl(), message->getStep());
|
||||||
storeHelper.preparePacket(serviceId, message->getReportId(), packetSubCounter++);
|
storeHelper.preparePacket(serviceId, message->getReportId(), packetSubCounter++);
|
||||||
storeHelper.setSourceDataSerializable(report);
|
storeHelper.setSourceDataSerializable(report);
|
||||||
return telemetry::storeAndSendTmPacket(storeHelper, sendHelper);
|
return tmHelper.storeAndSendTmPacket();
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Service1TelecommandVerification::initialize() {
|
ReturnValue_t Service1TelecommandVerification::initialize() {
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "fsfw/tmtcservices/PusVerificationReport.h"
|
#include "fsfw/tmtcservices/PusVerificationReport.h"
|
||||||
#include "fsfw/tmtcservices/TmSendHelper.h"
|
#include "fsfw/tmtcservices/TmSendHelper.h"
|
||||||
#include "fsfw/tmtcservices/TmStoreHelper.h"
|
#include "fsfw/tmtcservices/TmStoreHelper.h"
|
||||||
|
#include "fsfw/tmtcservices/TmStoreAndSendHelper.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Verify TC acceptance, start, progress and execution.
|
* @brief Verify TC acceptance, start, progress and execution.
|
||||||
@ -84,6 +85,7 @@ class Service1TelecommandVerification : public AcceptsVerifyMessageIF,
|
|||||||
|
|
||||||
TmSendHelper sendHelper;
|
TmSendHelper sendHelper;
|
||||||
TmStoreHelper storeHelper;
|
TmStoreHelper storeHelper;
|
||||||
|
TmStoreAndSendWrapper tmHelper;
|
||||||
StorageManagerIF* tmStore = nullptr;
|
StorageManagerIF* tmStore = nullptr;
|
||||||
MessageQueueIF* tmQueue = nullptr;
|
MessageQueueIF* tmQueue = nullptr;
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ Service20ParameterManagement::Service20ParameterManagement(object_id_t objectId,
|
|||||||
: CommandingServiceBase(objectId, apid, serviceId, numberOfParallelCommands,
|
: CommandingServiceBase(objectId, apid, serviceId, numberOfParallelCommands,
|
||||||
commandTimeoutSeconds) {}
|
commandTimeoutSeconds) {}
|
||||||
|
|
||||||
Service20ParameterManagement::~Service20ParameterManagement() {}
|
Service20ParameterManagement::~Service20ParameterManagement() = default;
|
||||||
|
|
||||||
ReturnValue_t Service20ParameterManagement::isValidSubservice(uint8_t subservice) {
|
ReturnValue_t Service20ParameterManagement::isValidSubservice(uint8_t subservice) {
|
||||||
switch (static_cast<Subservice>(subservice)) {
|
switch (static_cast<Subservice>(subservice)) {
|
||||||
@ -64,7 +64,7 @@ ReturnValue_t Service20ParameterManagement::checkAndAcquireTargetID(object_id_t*
|
|||||||
ReturnValue_t Service20ParameterManagement::checkInterfaceAndAcquireMessageQueue(
|
ReturnValue_t Service20ParameterManagement::checkInterfaceAndAcquireMessageQueue(
|
||||||
MessageQueueId_t* messageQueueToSet, object_id_t* objectId) {
|
MessageQueueId_t* messageQueueToSet, object_id_t* objectId) {
|
||||||
// check ReceivesParameterMessagesIF property of target
|
// check ReceivesParameterMessagesIF property of target
|
||||||
ReceivesParameterMessagesIF* possibleTarget =
|
auto* possibleTarget =
|
||||||
ObjectManager::instance()->get<ReceivesParameterMessagesIF>(*objectId);
|
ObjectManager::instance()->get<ReceivesParameterMessagesIF>(*objectId);
|
||||||
if (possibleTarget == nullptr) {
|
if (possibleTarget == nullptr) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
@ -177,7 +177,7 @@ ReturnValue_t Service20ParameterManagement::handleReply(const CommandMessage* re
|
|||||||
ParameterId_t parameterId = ParameterMessage::getParameterId(reply);
|
ParameterId_t parameterId = ParameterMessage::getParameterId(reply);
|
||||||
ParameterDumpReply parameterReply(objectId, parameterId, parameterData.second.data(),
|
ParameterDumpReply parameterReply(objectId, parameterId, parameterData.second.data(),
|
||||||
parameterData.second.size());
|
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;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -148,7 +148,7 @@ void Service2DeviceAccess::sendWiretappingTm(CommandMessage* reply, uint8_t subs
|
|||||||
// Init our dummy packet and correct endianness of object ID before
|
// Init our dummy packet and correct endianness of object ID before
|
||||||
// sending it back.
|
// sending it back.
|
||||||
WiretappingPacket tmPacket(DeviceHandlerMessage::getDeviceObjectId(reply), data);
|
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(); }
|
MessageQueueId_t Service2DeviceAccess::getDeviceQueue() { return commandQueue->getId(); }
|
||||||
|
@ -12,6 +12,7 @@ Service5EventReporting::Service5EventReporting(object_id_t objectId, uint16_t ap
|
|||||||
uint32_t messageQueueDepth)
|
uint32_t messageQueueDepth)
|
||||||
: PusServiceBase(objectId, apid, serviceId),
|
: PusServiceBase(objectId, apid, serviceId),
|
||||||
storeHelper(apid),
|
storeHelper(apid),
|
||||||
|
tmHelper(serviceId, storeHelper, sendHelper),
|
||||||
maxNumberReportsPerCycle(maxNumberReportsPerCycle) {
|
maxNumberReportsPerCycle(maxNumberReportsPerCycle) {
|
||||||
eventQueue = QueueFactory::instance()->createMessageQueue(messageQueueDepth);
|
eventQueue = QueueFactory::instance()->createMessageQueue(messageQueueDepth);
|
||||||
}
|
}
|
||||||
@ -46,9 +47,9 @@ ReturnValue_t Service5EventReporting::performService() {
|
|||||||
ReturnValue_t Service5EventReporting::generateEventReport(EventMessage message) {
|
ReturnValue_t Service5EventReporting::generateEventReport(EventMessage message) {
|
||||||
EventReport report(message.getEventId(), message.getReporter(), message.getParameter1(),
|
EventReport report(message.getEventId(), message.getReporter(), message.getParameter1(),
|
||||||
message.getParameter2());
|
message.getParameter2());
|
||||||
storeHelper.preparePacket(serviceId, message.getSeverity(), packetSubCounter);
|
storeHelper.preparePacket(serviceId, message.getSeverity(), tmHelper.sendCounter);
|
||||||
storeHelper.setSourceDataSerializable(report);
|
storeHelper.setSourceDataSerializable(report);
|
||||||
ReturnValue_t result = telemetry::storeAndSendTmPacket(storeHelper, sendHelper);
|
ReturnValue_t result = tmHelper.storeAndSendTmPacket();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "Service5EventReporting::generateEventReport: "
|
sif::warning << "Service5EventReporting::generateEventReport: "
|
||||||
@ -59,8 +60,6 @@ ReturnValue_t Service5EventReporting::generateEventReport(EventMessage message)
|
|||||||
"Service5EventReporting::generateEventReport: "
|
"Service5EventReporting::generateEventReport: "
|
||||||
"Could not send TM packet\n");
|
"Could not send TM packet\n");
|
||||||
#endif
|
#endif
|
||||||
} else {
|
|
||||||
packetSubCounter++;
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define FSFW_PUS_SERVICE5EVENTREPORTING_H_
|
#define FSFW_PUS_SERVICE5EVENTREPORTING_H_
|
||||||
|
|
||||||
#include "fsfw/events/EventMessage.h"
|
#include "fsfw/events/EventMessage.h"
|
||||||
|
#include "fsfw/tmtcservices/TmStoreAndSendHelper.h"
|
||||||
#include "fsfw/tmtcservices/PusServiceBase.h"
|
#include "fsfw/tmtcservices/PusServiceBase.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,11 +75,11 @@ class Service5EventReporting : public PusServiceBase {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint16_t packetSubCounter = 0;
|
|
||||||
MessageQueueIF* eventQueue = nullptr;
|
MessageQueueIF* eventQueue = nullptr;
|
||||||
bool enableEventReport = true;
|
bool enableEventReport = true;
|
||||||
TmSendHelper sendHelper;
|
TmSendHelper sendHelper;
|
||||||
TmStoreHelper storeHelper;
|
TmStoreHelper storeHelper;
|
||||||
|
TmStoreAndSendWrapper tmHelper;
|
||||||
const uint8_t maxNumberReportsPerCycle;
|
const uint8_t maxNumberReportsPerCycle;
|
||||||
|
|
||||||
ReturnValue_t generateEventReport(EventMessage message);
|
ReturnValue_t generateEventReport(EventMessage message);
|
||||||
|
@ -138,7 +138,7 @@ ReturnValue_t Service8FunctionManagement::handleDataReply(const CommandMessage*
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
DataReply dataReply(objectId, actionId, buffer, size);
|
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);
|
auto deletionResult = ipcStore->deleteData(storeId);
|
||||||
if (deletionResult != HasReturnvaluesIF::RETURN_OK) {
|
if (deletionResult != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
@ -32,7 +32,7 @@ class Service8FunctionManagement : public CommandingServiceBase {
|
|||||||
public:
|
public:
|
||||||
Service8FunctionManagement(object_id_t objectId, uint16_t apid, uint8_t serviceId,
|
Service8FunctionManagement(object_id_t objectId, uint16_t apid, uint8_t serviceId,
|
||||||
uint8_t numParallelCommands = 4, uint16_t commandTimeoutSeconds = 60);
|
uint8_t numParallelCommands = 4, uint16_t commandTimeoutSeconds = 60);
|
||||||
virtual ~Service8FunctionManagement();
|
~Service8FunctionManagement() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* CSB abstract functions implementation . See CSB documentation. */
|
/* CSB abstract functions implementation . See CSB documentation. */
|
||||||
|
@ -10,9 +10,9 @@ class PusIF : public SpacePacketIF {
|
|||||||
public:
|
public:
|
||||||
static constexpr uint8_t INTERFACE_ID = CLASS_ID::PUS_IF;
|
static constexpr uint8_t INTERFACE_ID = CLASS_ID::PUS_IF;
|
||||||
static constexpr ReturnValue_t INVALID_PUS_VERSION =
|
static constexpr ReturnValue_t INVALID_PUS_VERSION =
|
||||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 0);
|
retval::makeCode(INTERFACE_ID, 0);
|
||||||
static constexpr ReturnValue_t INVALID_CRC_16 =
|
static constexpr ReturnValue_t INVALID_CRC_16 =
|
||||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 1);
|
retval::makeCode(INTERFACE_ID, 1);
|
||||||
|
|
||||||
~PusIF() override = default;
|
~PusIF() override = default;
|
||||||
/**
|
/**
|
||||||
|
@ -133,3 +133,11 @@ ReturnValue_t PusTmCreator::setSerializableUserData(SerializeIF& serializable) {
|
|||||||
updateSpLengthField();
|
updateSpLengthField();
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PusTmCreator::setService(uint8_t service) {
|
||||||
|
pusParams.secHeader.service = service;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PusTmCreator::setSubservice(uint8_t subservice) {
|
||||||
|
pusParams.secHeader.subservice = subservice;
|
||||||
|
}
|
||||||
|
@ -49,6 +49,8 @@ class PusTmCreator : public SerializeIF, public PusTmIF, public CustomUserDataIF
|
|||||||
SpacePacketParams& getSpParams();
|
SpacePacketParams& getSpParams();
|
||||||
void setApid(uint16_t apid);
|
void setApid(uint16_t apid);
|
||||||
void setDestId(uint16_t destId);
|
void setDestId(uint16_t destId);
|
||||||
|
void setService(uint8_t service);
|
||||||
|
void setSubservice(uint8_t subservice);
|
||||||
void setMessageTypeCounter(uint16_t messageTypeCounter);
|
void setMessageTypeCounter(uint16_t messageTypeCounter);
|
||||||
PusTmParams& getParams();
|
PusTmParams& getParams();
|
||||||
void updateSpLengthField();
|
void updateSpLengthField();
|
||||||
|
@ -21,6 +21,7 @@ CommandingServiceBase::CommandingServiceBase(object_id_t setObjectId, uint16_t a
|
|||||||
service(service),
|
service(service),
|
||||||
timeoutSeconds(commandTimeoutSeconds),
|
timeoutSeconds(commandTimeoutSeconds),
|
||||||
tmStoreHelper(apid),
|
tmStoreHelper(apid),
|
||||||
|
tmHelper(service, tmStoreHelper, tmSendHelper),
|
||||||
commandMap(numberOfParallelCommands) {
|
commandMap(numberOfParallelCommands) {
|
||||||
commandQueue = QueueFactory::instance()->createMessageQueue(queueDepth);
|
commandQueue = QueueFactory::instance()->createMessageQueue(queueDepth);
|
||||||
requestQueue = 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,
|
ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, const uint8_t* sourceData,
|
||||||
size_t sourceDataLen) {
|
size_t sourceDataLen) {
|
||||||
tmStoreHelper.preparePacket(service, subservice, tmPacketCounter);
|
return tmHelper.sendTmPacket(subservice, sourceData, sourceDataLen);
|
||||||
tmStoreHelper.setSourceDataRaw(sourceData, sourceDataLen);
|
|
||||||
ReturnValue_t result = telemetry::storeAndSendTmPacket(tmStoreHelper, tmSendHelper);
|
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
this->tmPacketCounter++;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, object_id_t objectId,
|
ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, object_id_t objectId,
|
||||||
const uint8_t* data, size_t dataLen) {
|
const uint8_t* data, size_t dataLen) {
|
||||||
telemetry::DataWithObjectIdPrefix dataWithObjId(objectId, data, dataLen);
|
return tmHelper.sendTmPacket(subservice, 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, SerializeIF& sourceData) {
|
ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, SerializeIF& sourceData) {
|
||||||
tmStoreHelper.preparePacket(service, subservice, tmPacketCounter);
|
return tmHelper.sendTmPacket(subservice, sourceData);
|
||||||
tmStoreHelper.setSourceDataSerializable(sourceData);
|
|
||||||
ReturnValue_t result = telemetry::storeAndSendTmPacket(tmStoreHelper, tmSendHelper);
|
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
this->tmPacketCounter++;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandingServiceBase::startExecution(store_address_t storeId, CommandMapIter iter) {
|
void CommandingServiceBase::startExecution(store_address_t storeId, CommandMapIter iter) {
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "TmStoreHelper.h"
|
#include "TmStoreHelper.h"
|
||||||
#include "VerificationReporter.h"
|
#include "VerificationReporter.h"
|
||||||
#include "fsfw/FSFW.h"
|
#include "fsfw/FSFW.h"
|
||||||
|
#include "fsfw/tmtcservices/TmStoreAndSendHelper.h"
|
||||||
#include "fsfw/container/FIFO.h"
|
#include "fsfw/container/FIFO.h"
|
||||||
#include "fsfw/container/FixedMap.h"
|
#include "fsfw/container/FixedMap.h"
|
||||||
#include "fsfw/ipc/CommandMessage.h"
|
#include "fsfw/ipc/CommandMessage.h"
|
||||||
@ -251,18 +252,15 @@ class CommandingServiceBase : public SystemObject,
|
|||||||
|
|
||||||
const uint16_t timeoutSeconds;
|
const uint16_t timeoutSeconds;
|
||||||
|
|
||||||
uint8_t tmPacketCounter = 0;
|
|
||||||
|
|
||||||
StorageManagerIF* ipcStore = nullptr;
|
|
||||||
|
|
||||||
PusTcReader tcReader;
|
PusTcReader tcReader;
|
||||||
TmStoreHelper tmStoreHelper;
|
TmStoreHelper tmStoreHelper;
|
||||||
TmSendHelper tmSendHelper;
|
TmSendHelper tmSendHelper;
|
||||||
|
TmStoreAndSendWrapper tmHelper;
|
||||||
|
|
||||||
StorageManagerIF* tcStore = nullptr;
|
StorageManagerIF* tcStore = nullptr;
|
||||||
|
StorageManagerIF* ipcStore = nullptr;
|
||||||
|
|
||||||
MessageQueueIF* commandQueue = nullptr;
|
MessageQueueIF* commandQueue = nullptr;
|
||||||
|
|
||||||
MessageQueueIF* requestQueue = nullptr;
|
MessageQueueIF* requestQueue = nullptr;
|
||||||
|
|
||||||
VerificationReporter verificationReporter;
|
VerificationReporter verificationReporter;
|
||||||
@ -286,33 +284,12 @@ class CommandingServiceBase : public SystemObject,
|
|||||||
*/
|
*/
|
||||||
PeriodicTaskIF* executingTask = nullptr;
|
PeriodicTaskIF* executingTask = nullptr;
|
||||||
|
|
||||||
/**
|
[[deprecated("Use function with same name provided by tmHelper")]]
|
||||||
* @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);
|
ReturnValue_t sendTmPacket(uint8_t subservice, const uint8_t* sourceData, size_t sourceDataLen);
|
||||||
|
[[deprecated("Use function with same name provided by tmHelper")]]
|
||||||
/**
|
|
||||||
* @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,
|
ReturnValue_t sendTmPacket(uint8_t subservice, object_id_t objectId, const uint8_t* data,
|
||||||
size_t dataLen);
|
size_t dataLen);
|
||||||
|
[[deprecated("Use function with same name provided by tmHelper")]]
|
||||||
/**
|
|
||||||
* @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);
|
ReturnValue_t sendTmPacket(uint8_t subservice, SerializeIF& sourceData);
|
||||||
|
|
||||||
void checkAndExecuteFifo(CommandMapIter& iter);
|
void checkAndExecuteFifo(CommandMapIter& iter);
|
||||||
|
@ -16,7 +16,7 @@ class TmSendHelper {
|
|||||||
explicit TmSendHelper(InternalErrorReporterIF& reporter);
|
explicit TmSendHelper(InternalErrorReporterIF& reporter);
|
||||||
|
|
||||||
void setMsgQueue(MessageQueueIF& queue);
|
void setMsgQueue(MessageQueueIF& queue);
|
||||||
MessageQueueIF* getMsgQueue() const;
|
[[nodiscard]] MessageQueueIF* getMsgQueue() const;
|
||||||
|
|
||||||
void setDefaultDestination(MessageQueueId_t msgDest);
|
void setDefaultDestination(MessageQueueId_t msgDest);
|
||||||
[[nodiscard]] MessageQueueId_t getDefaultDestination() const;
|
[[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(MessageQueueId_t dest, const store_address_t& storeId);
|
||||||
ReturnValue_t sendPacket(const store_address_t& storeId);
|
ReturnValue_t sendPacket(const store_address_t& storeId);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MessageQueueId_t defaultDest = MessageQueueIF::NO_QUEUE;
|
MessageQueueId_t defaultDest = MessageQueueIF::NO_QUEUE;
|
||||||
bool ignoreFault = false;
|
bool ignoreFault = false;
|
||||||
|
@ -1,3 +1,51 @@
|
|||||||
#include "TmStoreAndSendHelper.h"
|
#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();
|
||||||
|
}
|
||||||
|
@ -4,15 +4,51 @@
|
|||||||
#include "TmSendHelper.h"
|
#include "TmSendHelper.h"
|
||||||
#include "TmStoreHelper.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:
|
public:
|
||||||
StoreAndSendWrapper(TmStoreHelper& storeHelper, TmSendHelper& sendHelper)
|
TmStoreAndSendWrapper(uint8_t defaultService, TmStoreHelper& storeHelper, TmSendHelper& sendHelper);
|
||||||
: storeHelper(storeHelper), sendHelper(sendHelper) {}
|
ReturnValue_t storeAndSendTmPacket();
|
||||||
ReturnValue_t storeAndSendTmPacket(TmStoreHelper& storeHelper, TmSendHelper& sendHelper,
|
|
||||||
bool delOnFailure = true);
|
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;
|
TmStoreHelper& storeHelper;
|
||||||
TmSendHelper& sendHelper;
|
TmSendHelper& sendHelper;
|
||||||
bool delOnFailure = true;
|
bool delOnFailure = true;
|
||||||
|
uint8_t defaultService = 0;
|
||||||
|
uint16_t sendCounter = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FSFW_TMTCSERVICES_TMSTOREANDSENDHELPER_H
|
#endif // FSFW_TMTCSERVICES_TMSTOREANDSENDHELPER_H
|
||||||
|
@ -71,3 +71,7 @@ PusTmCreator& TmStoreHelper::getCreatorRef() { return creator; }
|
|||||||
TimeStamperIF* TmStoreHelper::getTimeStamper() const { return creator.getTimestamper(); }
|
TimeStamperIF* TmStoreHelper::getTimeStamper() const { return creator.getTimestamper(); }
|
||||||
|
|
||||||
uint16_t TmStoreHelper::getApid() const { return creator.getApid(); }
|
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); }
|
||||||
|
@ -27,6 +27,8 @@ class TmStoreHelper {
|
|||||||
[[nodiscard]] uint16_t getApid() const;
|
[[nodiscard]] uint16_t getApid() const;
|
||||||
|
|
||||||
[[nodiscard]] const store_address_t& getCurrentAddr() 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 setSourceDataRaw(const uint8_t* data, size_t len);
|
||||||
ReturnValue_t setSourceDataSerializable(SerializeIF& serializable);
|
ReturnValue_t setSourceDataSerializable(SerializeIF& serializable);
|
||||||
|
|
||||||
|
@ -1,16 +1 @@
|
|||||||
#include "tmHelpers.h"
|
#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;
|
|
||||||
}
|
|
||||||
|
@ -32,26 +32,26 @@ class CommandExecutor {
|
|||||||
|
|
||||||
//! [EXPORT] : [COMMENT] Execution of the current command has finished
|
//! [EXPORT] : [COMMENT] Execution of the current command has finished
|
||||||
static constexpr ReturnValue_t EXECUTION_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
|
//! [EXPORT] : [COMMENT] Command is pending. This will also be returned if the user tries
|
||||||
//! to load another command but a command is still pending
|
//! 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
|
//! [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
|
//! [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]
|
//! [EXPORT] : [COMMENT]
|
||||||
static constexpr ReturnValue_t NO_COMMAND_LOADED_OR_PENDING =
|
static constexpr ReturnValue_t NO_COMMAND_LOADED_OR_PENDING =
|
||||||
HasReturnvaluesIF::makeReturnCode(CLASS_ID, 4);
|
retval::makeCode(CLASS_ID, 4);
|
||||||
static constexpr ReturnValue_t PCLOSE_CALL_ERROR = HasReturnvaluesIF::makeReturnCode(CLASS_ID, 6);
|
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
|
* Constructor. Is initialized with maximum size of internal buffer to read data from the
|
||||||
* executed process.
|
* executed process.
|
||||||
* @param maxSize
|
* @param maxSize
|
||||||
*/
|
*/
|
||||||
CommandExecutor(const size_t maxSize);
|
explicit CommandExecutor(size_t maxSize);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a new command which should be executed
|
* Load a new command which should be executed
|
||||||
|
@ -68,11 +68,6 @@ TEST_CASE("TM Send Helper", "[tm-send-helper]") {
|
|||||||
storeId = storeHelper.getCurrentAddr();
|
storeId = storeHelper.getCurrentAddr();
|
||||||
REQUIRE(sendHelper.sendPacket(storeId) == HasReturnvaluesIF::RETURN_OK);
|
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.wasMessageSent());
|
||||||
REQUIRE(msgQueue.numberOfSentMessagesToDefault() == 1);
|
REQUIRE(msgQueue.numberOfSentMessagesToDefault() == 1);
|
||||||
TmTcMessage msg;
|
TmTcMessage msg;
|
||||||
|
Loading…
Reference in New Issue
Block a user