adding files manually

This commit is contained in:
Robin Müller 2022-09-14 20:10:41 +02:00
parent 0ce568ad26
commit 0849c8a08d
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
29 changed files with 196 additions and 146 deletions

View File

@ -51,6 +51,6 @@ ReturnValue_t CfdpHandler::performOperation(uint8_t opCode) {
return returnvalue::OK;
}
uint16_t CfdpHandler::getIdentifier() { return 0; }
uint32_t CfdpHandler::getIdentifier() const { return 0; }
MessageQueueId_t CfdpHandler::getRequestQueue() { return this->requestQueue->getId(); }
MessageQueueId_t CfdpHandler::getRequestQueue() const { return this->requestQueue->getId(); }

View File

@ -25,8 +25,8 @@ class CfdpHandler : public ExecutableObjectIF, public AcceptsTelecommandsIF, pub
virtual ReturnValue_t handleRequest(store_address_t storeId);
virtual ReturnValue_t initialize() override;
virtual uint16_t getIdentifier() override;
MessageQueueId_t getRequestQueue() override;
uint32_t getIdentifier() const override;
MessageQueueId_t getRequestQueue() const override;
ReturnValue_t performOperation(uint8_t opCode) override;
protected:

View File

@ -10,8 +10,8 @@
CService200ModeCommanding::CService200ModeCommanding(object_id_t objectId, uint16_t apid,
uint8_t serviceId, uint8_t numParallelCommands,
uint16_t commandTimeoutSeconds)
: CommandingServiceBase(objectId, apid, serviceId, numParallelCommands, commandTimeoutSeconds) {
}
: CommandingServiceBase(objectId, apid, "PUS 200 Mode MGMT", serviceId, numParallelCommands,
commandTimeoutSeconds) {}
CService200ModeCommanding::~CService200ModeCommanding() {}

View File

@ -10,8 +10,8 @@ CService201HealthCommanding::CService201HealthCommanding(object_id_t objectId, u
uint8_t serviceId,
uint8_t numParallelCommands,
uint16_t commandTimeoutSeconds)
: CommandingServiceBase(objectId, apid, serviceId, numParallelCommands, commandTimeoutSeconds) {
}
: CommandingServiceBase(objectId, apid, "PUS 201 Health MGMT", serviceId, numParallelCommands,
commandTimeoutSeconds) {}
ReturnValue_t CService201HealthCommanding::isValidSubservice(uint8_t subservice) {
switch (subservice) {

View File

@ -16,7 +16,9 @@ inline Service11TelecommandScheduling<MAX_NUM_TCS>::Service11TelecommandScheduli
: PusServiceBase(params),
RELEASE_TIME_MARGIN_SECONDS(releaseTimeMarginSeconds),
debugMode(debugMode),
tcRecipient(tcRecipient) {}
tcRecipient(tcRecipient) {
params.name = "PUS 11 TC Scheduling";
}
template <size_t MAX_NUM_TCS>
inline Service11TelecommandScheduling<MAX_NUM_TCS>::~Service11TelecommandScheduling() = default;

View File

@ -8,7 +8,9 @@
Service17Test::Service17Test(PsbParams params)
: PusServiceBase(params),
storeHelper(params.apid),
tmHelper(params.serviceId, storeHelper, sendHelper) {}
tmHelper(params.serviceId, storeHelper, sendHelper) {
params.name = "PUS 17 Test";
}
Service17Test::~Service17Test() = default;

View File

@ -11,8 +11,8 @@ Service20ParameterManagement::Service20ParameterManagement(object_id_t objectId,
uint8_t serviceId,
uint8_t numberOfParallelCommands,
uint16_t commandTimeoutSeconds)
: CommandingServiceBase(objectId, apid, serviceId, numberOfParallelCommands,
commandTimeoutSeconds) {}
: CommandingServiceBase(objectId, apid, "PUS 20 Parameter MGMT", serviceId,
numberOfParallelCommands, commandTimeoutSeconds) {}
Service20ParameterManagement::~Service20ParameterManagement() = default;

View File

@ -14,8 +14,8 @@
Service2DeviceAccess::Service2DeviceAccess(object_id_t objectId, uint16_t apid, uint8_t serviceId,
uint8_t numberOfParallelCommands,
uint16_t commandTimeoutSeconds)
: CommandingServiceBase(objectId, apid, serviceId, numberOfParallelCommands,
commandTimeoutSeconds) {}
: CommandingServiceBase(objectId, apid, "PUS 2 Raw Commanding", serviceId,
numberOfParallelCommands, commandTimeoutSeconds) {}
Service2DeviceAccess::~Service2DeviceAccess() {}

View File

@ -5,7 +5,7 @@
#include "fsfw/pus/servicepackets/Service3Packets.h"
Service3Housekeeping::Service3Housekeeping(object_id_t objectId, uint16_t apid, uint8_t serviceId)
: CommandingServiceBase(objectId, apid, serviceId, NUM_OF_PARALLEL_COMMANDS,
: CommandingServiceBase(objectId, apid, "PUS 3 HK", serviceId, NUM_OF_PARALLEL_COMMANDS,
COMMAND_TIMEOUT_SECONDS) {}
Service3Housekeeping::~Service3Housekeeping() {}

View File

@ -13,6 +13,7 @@ Service5EventReporting::Service5EventReporting(PsbParams params, size_t maxNumbe
storeHelper(params.apid),
tmHelper(params.serviceId, storeHelper, sendHelper),
maxNumberReportsPerCycle(maxNumberReportsPerCycle) {
psbParams.name = "PUS 5 Event Reporting";
eventQueue = QueueFactory::instance()->createMessageQueue(messageQueueDepth);
}

View File

@ -12,8 +12,8 @@ Service8FunctionManagement::Service8FunctionManagement(object_id_t objectId, uin
uint8_t serviceId,
uint8_t numParallelCommands,
uint16_t commandTimeoutSeconds)
: CommandingServiceBase(objectId, apid, serviceId, numParallelCommands, commandTimeoutSeconds) {
}
: CommandingServiceBase(objectId, apid, "PUS 8 Functional Commanding", serviceId,
numParallelCommands, commandTimeoutSeconds) {}
Service8FunctionManagement::~Service8FunctionManagement() {}

View File

@ -5,7 +5,9 @@
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/timemanager/CCSDSTime.h"
Service9TimeManagement::Service9TimeManagement(PsbParams params) : PusServiceBase(params) {}
Service9TimeManagement::Service9TimeManagement(PsbParams params) : PusServiceBase(params) {
params.name = "PUS 9 Time MGMT";
}
Service9TimeManagement::~Service9TimeManagement() = default;

View File

@ -33,9 +33,9 @@ class CFDPDistributor : public TcDistributor,
*/
~CFDPDistributor() override;
ReturnValue_t registerHandler(AcceptsTelecommandsIF* handler) override;
MessageQueueId_t getRequestQueue() override;
MessageQueueId_t getRequestQueue() const override;
ReturnValue_t initialize() override;
uint16_t getIdentifier() override;
uint32_t getIdentifier() const override;
protected:
uint16_t apid;

View File

@ -1,9 +1,4 @@
target_sources(
${LIB_FSFW_NAME}
PRIVATE CCSDSDistributor.cpp
PusDistributor.cpp
TcDistributor.cpp
PusPacketChecker.cpp
TcPacketCheckCFDP.cpp
CFDPDistributor.cpp
CcsdsPacketChecker.cpp)
PRIVATE CcsdsDistributor.cpp PusDistributor.cpp TcDistributorBase.cpp
PusPacketChecker.cpp TcPacketCheckCFDP.cpp CcsdsPacketChecker.cpp)

View File

@ -10,19 +10,19 @@ ReturnValue_t CcsdsPacketChecker::checkPacket(const SpacePacketReader& currentPa
size_t packetLen) {
if (checkApid) {
if (currentPacket.getApid() != apid) {
return tcdistrib::INVALID_APID;
return tmtcdistrib::INVALID_APID;
}
}
if (currentPacket.getVersion() != ccsdsVersion) {
return tcdistrib::INVALID_CCSDS_VERSION;
return tmtcdistrib::INVALID_CCSDS_VERSION;
}
if (currentPacket.getPacketType() != packetType) {
return tcdistrib::INVALID_PACKET_TYPE;
return tmtcdistrib::INVALID_PACKET_TYPE;
}
// This assumes that the getFullPacketLen version uses the space packet data length field
if (currentPacket.getFullPacketLen() != packetLen) {
return tcdistrib::INCOMPLETE_PACKET;
return tmtcdistrib::INCOMPLETE_PACKET;
}
return returnvalue::OK;
}

View File

@ -3,14 +3,14 @@
#include "definitions.h"
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/tcdistribution/CCSDSDistributorIF.h"
#include "fsfw/tcdistribution/CcsdsDistributorIF.h"
#include "fsfw/tmtcservices/PusVerificationReport.h"
#define PUS_DISTRIBUTOR_DEBUGGING 0
PusDistributor::PusDistributor(uint16_t setApid, object_id_t setObjectId,
CCSDSDistributorIF* distributor, StorageManagerIF* store_)
: TcDistributor(setObjectId),
CcsdsDistributorIF* distributor, StorageManagerIF* store_)
: TcDistributorBase(setObjectId),
store(store_),
checker(setApid, ccsds::PacketType::TC),
ccsdsDistributor(distributor),
@ -18,42 +18,41 @@ PusDistributor::PusDistributor(uint16_t setApid, object_id_t setObjectId,
PusDistributor::~PusDistributor() = default;
PusDistributor::TcMqMapIter PusDistributor::selectDestination() {
ReturnValue_t PusDistributor::selectDestination(MessageQueueId_t& destId) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 && PUS_DISTRIBUTOR_DEBUGGING == 1
store_address_t storeId = currentMessage.getStorageId();
sif::debug << "PUSDistributor::handlePacket received: " << storeId.poolIndex << ", "
<< storeId.packetIndex << std::endl;
#endif
auto queueMapIt = queueMap.end();
// TODO: Need to set the data
const uint8_t* packetPtr = nullptr;
size_t packetLen = 0;
if (store->getData(currentMessage.getStorageId(), &packetPtr, &packetLen) != returnvalue::OK) {
return queueMapIt;
}
ReturnValue_t result = reader.setReadOnlyData(packetPtr, packetLen);
ReturnValue_t result =
store->getData(currentMessage.getStorageId(), &packetPtr, &packetLen) != returnvalue::OK;
if (result != returnvalue::OK) {
tcStatus = PACKET_LOST;
return queueMapIt;
return result;
}
result = reader.setReadOnlyData(packetPtr, packetLen);
if (result != returnvalue::OK) {
tcStatus = PACKET_LOST;
return result;
}
// CRC check done by checker
result = reader.parseDataWithoutCrcCheck();
if (result != returnvalue::OK) {
tcStatus = PACKET_LOST;
return queueMapIt;
return result;
}
if (reader.getFullData() != nullptr) {
tcStatus = checker.checkPacket(reader, reader.getFullPacketLen());
if (tcStatus != returnvalue::OK) {
checkerFailurePrinter();
}
uint32_t queue_id = reader.getService();
queueMapIt = queueMap.find(queue_id);
} else {
tcStatus = PACKET_LOST;
}
if (queueMapIt == this->queueMap.end()) {
uint8_t pusId = reader.getService();
auto iter = receiverMap.find(pusId);
if (iter == receiverMap.end()) {
tcStatus = DESTINATION_NOT_FOUND;
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
@ -63,16 +62,15 @@ PusDistributor::TcMqMapIter PusDistributor::selectDestination() {
#endif /* !FSFW_CPP_OSTREAM_ENABLED == 1 */
#endif
}
if (tcStatus != returnvalue::OK) {
return this->queueMap.end();
destId = iter->second.destId;
} else {
return queueMapIt;
tcStatus = PACKET_LOST;
}
return tcStatus;
}
ReturnValue_t PusDistributor::registerService(AcceptsTelecommandsIF* service) {
uint16_t serviceId = service->getIdentifier();
ReturnValue_t PusDistributor::registerService(const AcceptsTelecommandsIF& service) {
uint16_t serviceId = service.getIdentifier();
#if PUS_DISTRIBUTOR_DEBUGGING == 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "Service ID: " << static_cast<int>(serviceId) << std::endl;
@ -80,8 +78,8 @@ ReturnValue_t PusDistributor::registerService(AcceptsTelecommandsIF* service) {
sif::printInfo("Service ID: %d\n", static_cast<int>(serviceId));
#endif
#endif
MessageQueueId_t queue = service->getRequestQueue();
auto returnPair = queueMap.emplace(serviceId, queue);
MessageQueueId_t queue = service.getRequestQueue();
auto returnPair = receiverMap.emplace(serviceId, ServiceInfo(service.getName(), queue));
if (not returnPair.second) {
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
@ -97,7 +95,7 @@ ReturnValue_t PusDistributor::registerService(AcceptsTelecommandsIF* service) {
return returnvalue::OK;
}
MessageQueueId_t PusDistributor::getRequestQueue() { return tcQueue->getId(); }
MessageQueueId_t PusDistributor::getRequestQueue() const { return tcQueue->getId(); }
ReturnValue_t PusDistributor::callbackAfterSending(ReturnValue_t queueStatus) {
if (queueStatus != returnvalue::OK) {
@ -115,7 +113,7 @@ ReturnValue_t PusDistributor::callbackAfterSending(ReturnValue_t queueStatus) {
}
}
uint16_t PusDistributor::getIdentifier() { return checker.getApid(); }
uint32_t PusDistributor::getIdentifier() const { return checker.getApid(); }
ReturnValue_t PusDistributor::initialize() {
if (store == nullptr) {
@ -130,7 +128,7 @@ ReturnValue_t PusDistributor::initialize() {
sif::error << " Make sure it exists and implements CCSDSDistributorIF!" << std::endl;
#else
sif::printError("PusDistributor::initialize: Packet source invalid\n");
sif::printError("Make sure it exists and implements CCSDSDistributorIF\n");
sif::printError("Make sure it exists and implements CcsdsDistributorIF\n");
#endif
return ObjectManagerIF::CHILD_INIT_FAILED;
}
@ -141,28 +139,29 @@ ReturnValue_t PusDistributor::initialize() {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
}
return ccsdsDistributor->registerApplication(this);
return ccsdsDistributor->registerApplication(CcsdsDistributorIF::DestInfo(*this, false));
}
void PusDistributor::checkerFailurePrinter() const {
#if FSFW_VERBOSE_LEVEL >= 1
const char* keyword = "unnamed error";
if (tcStatus == tcdistrib::INCORRECT_CHECKSUM) {
keyword = "checksum";
} else if (tcStatus == tcdistrib::INCORRECT_PRIMARY_HEADER) {
keyword = "incorrect primary header";
} else if (tcStatus == tcdistrib::INVALID_APID) {
keyword = "illegal APID";
} else if (tcStatus == tcdistrib::INCORRECT_SECONDARY_HEADER) {
keyword = "incorrect secondary header";
} else if (tcStatus == tcdistrib::INCOMPLETE_PACKET) {
keyword = "incomplete packet";
const char* reason = "Unknown reason";
if (tcStatus == tmtcdistrib::INCORRECT_CHECKSUM) {
reason = "Checksum Error";
} else if (tcStatus == tmtcdistrib::INCORRECT_PRIMARY_HEADER) {
reason = "Incorrect Primary Header";
} else if (tcStatus == tmtcdistrib::INVALID_APID) {
reason = "Illegal APID";
} else if (tcStatus == tmtcdistrib::INCORRECT_SECONDARY_HEADER) {
reason = "Incorrect Secondary Header";
} else if (tcStatus == tmtcdistrib::INCOMPLETE_PACKET) {
reason = "Incomplete packet";
}
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "PUSDistributor::handlePacket: Packet format invalid, " << keyword << " error"
<< std::endl;
sif::warning << "PUSDistributor::handlePacket: Check failed: " << reason << std::endl;
#else
sif::printWarning("PUSDistributor::handlePacket: Packet format invalid, %s error\n", keyword);
sif::printWarning("PUSDistributor::handlePacket: Check failed: %s\n", reason);
#endif
#endif
}
const char* PusDistributor::getName() const { return "PUS Distributor"; }

View File

@ -1,15 +1,17 @@
#ifndef FSFW_TCDISTRIBUTION_PUSDISTRIBUTOR_H_
#define FSFW_TCDISTRIBUTION_PUSDISTRIBUTOR_H_
#include "PUSDistributorIF.h"
#include <map>
#include "PusDistributorIF.h"
#include "PusPacketChecker.h"
#include "TcDistributor.h"
#include "TcDistributorBase.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/tmtcpacket/pus/tc.h"
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
#include "fsfw/tmtcservices/VerificationReporter.h"
class CCSDSDistributorIF;
class CcsdsDistributorIF;
/**
* This class accepts PUS Telecommands and forwards them to Application
@ -17,7 +19,9 @@ class CCSDSDistributorIF;
* sends acceptance success or failure messages.
* @ingroup tc_distribution
*/
class PusDistributor : public TcDistributor, public PUSDistributorIF, public AcceptsTelecommandsIF {
class PusDistributor : public TcDistributorBase,
public PusDistributorIF,
public AcceptsTelecommandsIF {
public:
/**
* The ctor passes @c set_apid to the checker class and calls the
@ -25,20 +29,31 @@ class PusDistributor : public TcDistributor, public PUSDistributorIF, public Acc
* @param setApid The APID of this receiving Application.
* @param setObjectId Object ID of the distributor itself
* @param setPacketSource Object ID of the source of TC packets.
* Must implement CCSDSDistributorIF.
* Must implement CcsdsDistributorIF.
*/
PusDistributor(uint16_t setApid, object_id_t setObjectId, CCSDSDistributorIF* packetSource,
PusDistributor(uint16_t setApid, object_id_t setObjectId, CcsdsDistributorIF* packetSource,
StorageManagerIF* store = nullptr);
[[nodiscard]] const char* getName() const override;
/**
* The destructor is empty.
*/
~PusDistributor() override;
ReturnValue_t registerService(AcceptsTelecommandsIF* service) override;
MessageQueueId_t getRequestQueue() override;
ReturnValue_t registerService(const AcceptsTelecommandsIF& service) override;
[[nodiscard]] MessageQueueId_t getRequestQueue() const override;
ReturnValue_t initialize() override;
uint16_t getIdentifier() override;
[[nodiscard]] uint32_t getIdentifier() const override;
protected:
struct ServiceInfo {
ServiceInfo(const char* name, MessageQueueId_t destId) : name(name), destId(destId) {}
const char* name;
MessageQueueId_t destId;
};
/// PUS recipient map. The key value will generally be the PUS Service
using PusReceiverMap = std::map<uint8_t, ServiceInfo>;
PusReceiverMap receiverMap;
StorageManagerIF* store;
/**
* This attribute contains the class, that performs a formal packet check.
@ -50,7 +65,7 @@ class PusDistributor : public TcDistributor, public PUSDistributorIF, public Acc
*/
VerificationReporterIF* verifyChannel = nullptr;
//! Cached for initialization
CCSDSDistributorIF* ccsdsDistributor = nullptr;
CcsdsDistributorIF* ccsdsDistributor = nullptr;
PusTcReader reader;
/**
@ -67,7 +82,7 @@ class PusDistributor : public TcDistributor, public PUSDistributorIF, public Acc
* @return Iterator to map entry of found service id
* or iterator to @c map.end().
*/
TcMqMapIter selectDestination() override;
ReturnValue_t selectDestination(MessageQueueId_t& destId) override;
/**
* The callback here handles the generation of acceptance
* success/failure messages.

View File

@ -12,17 +12,17 @@ PusPacketChecker::PusPacketChecker(uint16_t apid, ccsds::PacketType packetType_,
ReturnValue_t PusPacketChecker::checkPacket(const PusTcReader& pusPacket, size_t packetLen) {
// Other primary header fields are checked by base class
if (not pusPacket.hasSecHeader()) {
return tcdistrib::INVALID_SEC_HEADER_FIELD;
return tmtcdistrib::INVALID_SEC_HEADER_FIELD;
}
uint16_t calculated_crc = CRC::crc16ccitt(pusPacket.getFullData(), pusPacket.getFullPacketLen());
if (calculated_crc != 0) {
return tcdistrib::INCORRECT_CHECKSUM;
return tmtcdistrib::INCORRECT_CHECKSUM;
}
if (pusPacket.getApid() != apid) {
return tcdistrib::INVALID_APID;
return tmtcdistrib::INVALID_APID;
}
if (pusPacket.getPusVersion() != pusVersion) {
return tcdistrib::INVALID_PUS_VERSION;
return tmtcdistrib::INVALID_PUS_VERSION;
}
return returnvalue::OK;
}

View File

@ -3,16 +3,19 @@
#include <cstdint>
#include "fsfw/events/Event.h"
#include "fsfw/events/fwSubsystemIdRanges.h"
#include "fsfw/returnvalues/FwClassIds.h"
#include "fsfw/returnvalues/returnvalue.h"
namespace tcdistrib {
static const uint8_t INTERFACE_ID = CLASS_ID::PACKET_CHECK;
static constexpr ReturnValue_t INVALID_CCSDS_VERSION = MAKE_RETURN_CODE(0);
static constexpr ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(1);
static constexpr ReturnValue_t INVALID_PACKET_TYPE = MAKE_RETURN_CODE(2);
static constexpr ReturnValue_t INVALID_SEC_HEADER_FIELD = MAKE_RETURN_CODE(3);
static constexpr ReturnValue_t INCORRECT_PRIMARY_HEADER = MAKE_RETURN_CODE(4);
namespace tmtcdistrib {
static const uint8_t INTERFACE_ID = CLASS_ID::TMTC_DISTRIBUTION;
static constexpr ReturnValue_t NO_DESTINATION_FOUND = returnvalue::makeCode(INTERFACE_ID, 0);
static constexpr ReturnValue_t INVALID_CCSDS_VERSION = MAKE_RETURN_CODE(1);
static constexpr ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(2);
static constexpr ReturnValue_t INVALID_PACKET_TYPE = MAKE_RETURN_CODE(3);
static constexpr ReturnValue_t INVALID_SEC_HEADER_FIELD = MAKE_RETURN_CODE(4);
static constexpr ReturnValue_t INCORRECT_PRIMARY_HEADER = MAKE_RETURN_CODE(5);
static constexpr ReturnValue_t INCOMPLETE_PACKET = MAKE_RETURN_CODE(5);
static constexpr ReturnValue_t INVALID_PUS_VERSION = MAKE_RETURN_CODE(6);
@ -20,5 +23,9 @@ static constexpr ReturnValue_t INCORRECT_CHECKSUM = MAKE_RETURN_CODE(7);
static constexpr ReturnValue_t ILLEGAL_PACKET_SUBTYPE = MAKE_RETURN_CODE(8);
static constexpr ReturnValue_t INCORRECT_SECONDARY_HEADER = MAKE_RETURN_CODE(9);
}; // namespace tcdistrib
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::TMTC_DISTRIBUTION;
//! P1: Returnvalue, P2: 0 for TM issues, 1 for TC issues
static constexpr Event HANDLE_PACKET_FAILED = event::makeEvent(SUBSYSTEM_ID, 0, severity::LOW);
}; // namespace tmtcdistrib
#endif // FSFW_TMTCPACKET_DEFINITIONS_H

View File

@ -21,20 +21,22 @@ class AcceptsTelecommandsIF {
* @brief The virtual destructor as it is mandatory for C++ interfaces.
*/
virtual ~AcceptsTelecommandsIF() = default;
[[nodiscard]] virtual const char* getName() const = 0;
/**
* @brief Getter for the service id.
* @details Any receiving service (at least any PUS service) shall have a
* service ID. If the receiver can handle Telecommands, but for
* some reason has no service id, it shall return 0.
* @return The service ID or 0.
* @brief Getter for a generic identifier ID.
* @details Any receiving service (at least any PUS service) shall have an identifier. For
* example, this could be the APID for a receiver expecting generic PUS packets, or a PUS
* service for a component expecting specific PUS service packets.
* @return The identifier.
*/
virtual uint16_t getIdentifier() = 0;
[[nodiscard]] virtual uint32_t getIdentifier() const = 0;
/**
* @brief This method returns the message queue id of the telecommand
* receiving message queue.
* @return The telecommand reception message queue id.
*/
virtual MessageQueueId_t getRequestQueue() = 0;
[[nodiscard]] virtual MessageQueueId_t getRequestQueue() const = 0;
};
#endif /* FRAMEWORK_TMTCSERVICES_ACCEPTSTELECOMMANDSIF_H_ */

View File

@ -14,6 +14,8 @@ class AcceptsTelemetryIF {
* @brief The virtual destructor as it is mandatory for C++ interfaces.
*/
virtual ~AcceptsTelemetryIF() = default;
[[nodiscard]] virtual const char* getName() const = 0;
/**
* @brief This method returns the message queue id of the telemetry
* receiving message queue.

View File

@ -3,7 +3,7 @@
#include "fsfw/ipc/QueueFactory.h"
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/tcdistribution/PUSDistributorIF.h"
#include "fsfw/tcdistribution/PusDistributorIF.h"
#include "fsfw/tmtcpacket/pus/tc.h"
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
#include "fsfw/tmtcservices/TmTcMessage.h"
@ -14,7 +14,8 @@ object_id_t CommandingServiceBase::defaultPacketSource = objects::NO_OBJECT;
object_id_t CommandingServiceBase::defaultPacketDestination = objects::NO_OBJECT;
CommandingServiceBase::CommandingServiceBase(object_id_t setObjectId, uint16_t apid,
uint8_t service, uint8_t numberOfParallelCommands,
const char* name, uint8_t service,
uint8_t numberOfParallelCommands,
uint16_t commandTimeoutSeconds, size_t queueDepth,
VerificationReporterIF* verificationReporter)
: SystemObject(setObjectId),
@ -24,7 +25,8 @@ CommandingServiceBase::CommandingServiceBase(object_id_t setObjectId, uint16_t a
tmStoreHelper(apid),
tmHelper(service, tmStoreHelper, tmSendHelper),
verificationReporter(verificationReporter),
commandMap(numberOfParallelCommands) {
commandMap(numberOfParallelCommands),
name(name) {
commandQueue = QueueFactory::instance()->createMessageQueue(queueDepth);
requestQueue = QueueFactory::instance()->createMessageQueue(queueDepth);
}
@ -50,9 +52,9 @@ ReturnValue_t CommandingServiceBase::performOperation(uint8_t opCode) {
return returnvalue::OK;
}
uint16_t CommandingServiceBase::getIdentifier() { return service; }
uint32_t CommandingServiceBase::getIdentifier() const { return service; }
MessageQueueId_t CommandingServiceBase::getRequestQueue() { return requestQueue->getId(); }
MessageQueueId_t CommandingServiceBase::getRequestQueue() const { return requestQueue->getId(); }
ReturnValue_t CommandingServiceBase::initialize() {
ReturnValue_t result = SystemObject::initialize();
@ -68,7 +70,7 @@ ReturnValue_t CommandingServiceBase::initialize() {
if (packetSource == objects::NO_OBJECT) {
packetSource = defaultPacketSource;
}
auto* distributor = ObjectManager::instance()->get<PUSDistributorIF>(packetSource);
auto* distributor = ObjectManager::instance()->get<PusDistributorIF>(packetSource);
if (packetForwarding == nullptr or distributor == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
@ -79,7 +81,7 @@ ReturnValue_t CommandingServiceBase::initialize() {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
distributor->registerService(this);
distributor->registerService(*this);
requestQueue->setDefaultDestination(packetForwarding->getReportReceptionQueue());
ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
@ -489,3 +491,5 @@ void CommandingServiceBase::prepareVerificationSuccessWithFullInfo(
successParams.tcPsc = tcInfo.tcSequenceControl;
successParams.ackFlags = tcInfo.ackFlags;
}
const char* CommandingServiceBase::getName() const { return name; }

View File

@ -75,7 +75,7 @@ class CommandingServiceBase : public SystemObject,
* @param setPacketDestination
* @param queueDepth
*/
CommandingServiceBase(object_id_t setObjectId, uint16_t apid, uint8_t service,
CommandingServiceBase(object_id_t setObjectId, uint16_t apid, const char* name, uint8_t service,
uint8_t numberOfParallelCommands, uint16_t commandTimeoutSeconds,
size_t queueDepth = 20, VerificationReporterIF* reporter = nullptr);
~CommandingServiceBase() override;
@ -105,7 +105,7 @@ class CommandingServiceBase : public SystemObject,
*/
ReturnValue_t performOperation(uint8_t opCode) override;
uint16_t getIdentifier() override;
uint32_t getIdentifier() const override;
/**
* Returns the requestQueue MessageQueueId_t
@ -114,7 +114,7 @@ class CommandingServiceBase : public SystemObject,
*
* @return requestQueue messageQueueId_t
*/
MessageQueueId_t getRequestQueue() override;
MessageQueueId_t getRequestQueue() const override;
/**
* Returns the commandQueue MessageQueueId_t
@ -133,6 +133,7 @@ class CommandingServiceBase : public SystemObject,
* @param task Pointer to the taskIF of this task
*/
void setTaskIF(PeriodicTaskIF* task) override;
const char* getName() const override;
protected:
/**
@ -283,6 +284,8 @@ class CommandingServiceBase : public SystemObject,
uint32_t failureParameter1 = 0;
uint32_t failureParameter2 = 0;
const char* name = "";
static object_id_t defaultPacketSource;
object_id_t packetSource = objects::NO_OBJECT;
static object_id_t defaultPacketDestination;

View File

@ -3,7 +3,7 @@
#include "fsfw/ipc/QueueFactory.h"
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/tcdistribution/PUSDistributorIF.h"
#include "fsfw/tcdistribution/PusDistributorIF.h"
#include "fsfw/timemanager/CdsShortTimeStamper.h"
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
#include "fsfw/tmtcservices/PusVerificationReport.h"
@ -82,9 +82,9 @@ void PusServiceBase::handleRequestQueue() {
}
}
uint16_t PusServiceBase::getIdentifier() { return psbParams.serviceId; }
uint32_t PusServiceBase::getIdentifier() const { return psbParams.serviceId; }
MessageQueueId_t PusServiceBase::getRequestQueue() {
MessageQueueId_t PusServiceBase::getRequestQueue() const {
if (psbParams.reqQueue == nullptr) {
return MessageQueueIF::NO_QUEUE;
}
@ -111,7 +111,7 @@ ReturnValue_t PusServiceBase::initialize() {
}
if (psbParams.pusDistributor == nullptr) {
psbParams.pusDistributor = ObjectManager::instance()->get<PUSDistributorIF>(PUS_DISTRIBUTOR);
psbParams.pusDistributor = ObjectManager::instance()->get<PusDistributorIF>(PUS_DISTRIBUTOR);
if (psbParams.pusDistributor != nullptr) {
registerService(*psbParams.pusDistributor);
}
@ -193,8 +193,8 @@ void PusServiceBase::setVerificationReporter(VerificationReporterIF& reporter) {
psbParams.verifReporter = &reporter;
}
ReturnValue_t PusServiceBase::registerService(PUSDistributorIF& distributor) {
return distributor.registerService(this);
ReturnValue_t PusServiceBase::registerService(PusDistributorIF& distributor) {
return distributor.registerService(*this);
}
void PusServiceBase::setTmReceiver(AcceptsTelemetryIF& tmReceiver_) {
@ -202,3 +202,5 @@ void PusServiceBase::setTmReceiver(AcceptsTelemetryIF& tmReceiver_) {
}
void PusServiceBase::setRequestQueue(MessageQueueIF& reqQueue) { psbParams.reqQueue = &reqQueue; }
const char* PusServiceBase::getName() const { return psbParams.name; }

View File

@ -22,9 +22,13 @@ class StorageManagerIF;
struct PsbParams {
PsbParams() = default;
PsbParams(uint16_t apid, AcceptsTelemetryIF* tmReceiver) : apid(apid), tmReceiver(tmReceiver) {}
PsbParams(const char* name, uint16_t apid, AcceptsTelemetryIF* tmReceiver)
: name(name), apid(apid), tmReceiver(tmReceiver) {}
PsbParams(object_id_t objectId, uint16_t apid, uint8_t serviceId)
: objectId(objectId), apid(apid), serviceId(serviceId) {}
PsbParams(const char* name, object_id_t objectId, uint16_t apid, uint8_t serviceId)
: name(name), objectId(objectId), apid(apid), serviceId(serviceId) {}
const char* name = "";
object_id_t objectId = objects::NO_OBJECT;
uint16_t apid = 0;
uint8_t serviceId = 0;
@ -187,11 +191,12 @@ class PusServiceBase : public ExecutableObjectIF,
* @c returnvalue::FAILED else.
*/
ReturnValue_t performOperation(uint8_t opCode) override;
uint16_t getIdentifier() override;
MessageQueueId_t getRequestQueue() override;
uint32_t getIdentifier() const override;
MessageQueueId_t getRequestQueue() const override;
ReturnValue_t initialize() override;
void setTaskIF(PeriodicTaskIF* taskHandle) override;
[[nodiscard]] const char* getName() const override;
protected:
/**
@ -200,6 +205,7 @@ class PusServiceBase : public ExecutableObjectIF,
* Will be set by setTaskIF(), which is called on task creation.
*/
PeriodicTaskIF* taskHandle = nullptr;
/**
* One of two error parameters for additional error information.
*/

View File

@ -7,9 +7,10 @@
#define TMTCBRIDGE_WIRETAPPING 0
TmTcBridge::TmTcBridge(object_id_t objectId, object_id_t tcDestination, object_id_t tmStoreId,
object_id_t tcStoreId)
TmTcBridge::TmTcBridge(const char* name, object_id_t objectId, object_id_t tcDestination,
object_id_t tmStoreId, object_id_t tcStoreId)
: SystemObject(objectId),
name(name),
tmStoreId(tmStoreId),
tcStoreId(tcStoreId),
tcDestination(tcDestination)
@ -67,8 +68,7 @@ ReturnValue_t TmTcBridge::initialize() {
#endif
return ObjectManagerIF::CHILD_INIT_FAILED;
}
AcceptsTelecommandsIF* tcDistributor =
ObjectManager::instance()->get<AcceptsTelecommandsIF>(tcDestination);
auto* tcDistributor = ObjectManager::instance()->get<AcceptsTelecommandsIF>(tcDestination);
if (tcDistributor == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "TmTcBridge::initialize: TC Distributor invalid" << std::endl;
@ -246,14 +246,16 @@ MessageQueueId_t TmTcBridge::getReportReceptionQueue(uint8_t virtualChannel) {
void TmTcBridge::printData(uint8_t* data, size_t dataLen) { arrayprinter::print(data, dataLen); }
uint16_t TmTcBridge::getIdentifier() {
uint32_t TmTcBridge::getIdentifier() const {
// This is no PUS service, so we just return 0
return 0;
}
MessageQueueId_t TmTcBridge::getRequestQueue() {
MessageQueueId_t TmTcBridge::getRequestQueue() const {
// Default implementation: Relay TC messages to TC distributor directly.
return tmTcReceptionQueue->getDefaultDestination();
}
void TmTcBridge::setFifoToOverwriteOldData(bool overwriteOld) { this->overwriteOld = overwriteOld; }
const char* TmTcBridge::getName() const { return name; }

View File

@ -22,9 +22,9 @@ class TmTcBridge : public AcceptsTelemetryIF,
static constexpr uint8_t DEFAULT_STORED_DATA_SENT_PER_CYCLE = 5;
static constexpr uint8_t DEFAULT_DOWNLINK_PACKETS_STORED = 10;
TmTcBridge(object_id_t objectId, object_id_t tcDestination, object_id_t tmStoreId,
object_id_t tcStoreId);
virtual ~TmTcBridge();
TmTcBridge(const char* name, object_id_t objectId, object_id_t tcDestination,
object_id_t tmStoreId, object_id_t tcStoreId);
~TmTcBridge() override;
/**
* Set number of packets sent per performOperation().Please note that this
@ -57,21 +57,24 @@ class TmTcBridge : public AcceptsTelemetryIF,
* Initializes necessary FSFW components for the TMTC Bridge
* @return
*/
virtual ReturnValue_t initialize() override;
ReturnValue_t initialize() override;
/**
* @brief Handles TMTC reception
*/
virtual ReturnValue_t performOperation(uint8_t operationCode = 0) override;
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
/** AcceptsTelemetryIF override */
virtual MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0) override;
MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0) override;
/** AcceptsTelecommandsIF override */
virtual uint16_t getIdentifier() override;
virtual MessageQueueId_t getRequestQueue() override;
uint32_t getIdentifier() const override;
MessageQueueId_t getRequestQueue() const override;
const char* getName() const override;
protected:
const char* name = "";
//! Cached for initialize function.
object_id_t tmStoreId = objects::NO_OBJECT;
object_id_t tcStoreId = objects::NO_OBJECT;

View File

@ -9,3 +9,5 @@ AcceptsTmMock::AcceptsTmMock(MessageQueueId_t queueToReturn)
MessageQueueId_t AcceptsTmMock::getReportReceptionQueue(uint8_t virtualChannel) {
return returnedQueue;
}
const char* AcceptsTmMock::getName() const { return "TM Acceptor Mock"; }

View File

@ -10,6 +10,7 @@ class AcceptsTmMock : public SystemObject, public AcceptsTelemetryIF {
explicit AcceptsTmMock(MessageQueueId_t queueToReturn);
MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel) override;
const char* getName() const override;
MessageQueueId_t returnedQueue;
};