use sanitized include file

This commit is contained in:
Robin Müller 2022-08-01 14:23:52 +02:00
parent aa978205d8
commit bf540ebb49
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
15 changed files with 53 additions and 26 deletions

View File

@ -3,10 +3,10 @@
#include <map> #include <map>
#include "../datapool/PoolEntryIF.h" #include "fsfw/datapool/PoolEntryIF.h"
#include "../housekeeping/HousekeepingMessage.h" #include "fsfw/housekeeping/HousekeepingMessage.h"
#include "../ipc/MessageQueueSenderIF.h" #include "fsfw/ipc/MessageQueueSenderIF.h"
#include "../serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface.h"
#include "LocalDataPoolManager.h" #include "LocalDataPoolManager.h"
#include "localPoolDefinitions.h" #include "localPoolDefinitions.h"

View File

@ -1,9 +1,9 @@
#ifndef FRAMEWORK_SERVICEINTERFACE_SERVICEINTERFACEBUFFER_H_ #ifndef FRAMEWORK_SERVICEINTERFACE_SERVICEINTERFACEBUFFER_H_
#define FRAMEWORK_SERVICEINTERFACE_SERVICEINTERFACEBUFFER_H_ #define FRAMEWORK_SERVICEINTERFACE_SERVICEINTERFACEBUFFER_H_
#include <FSFWConfig.h> #include "fsfw/FSFW.h"
#include "../returnvalues/HasReturnvaluesIF.h" #include "fsfw/returnvalues/HasReturnvaluesIF.h"
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1

View File

@ -1,7 +1,7 @@
#ifndef FRAMEWORK_SERVICEINTERFACE_SERVICEINTERFACESTREAM_H_ #ifndef FRAMEWORK_SERVICEINTERFACE_SERVICEINTERFACESTREAM_H_
#define FRAMEWORK_SERVICEINTERFACE_SERVICEINTERFACESTREAM_H_ #define FRAMEWORK_SERVICEINTERFACE_SERVICEINTERFACESTREAM_H_
#include <FSFWConfig.h> #include "fsfw/FSFW.h"
#include "ServiceInterfaceBuffer.h" #include "ServiceInterfaceBuffer.h"

View File

@ -1,3 +1,4 @@
#include "fsfw/FSFW.h"
#include "fsfw/tcdistribution/CcsdsDistributor.h" #include "fsfw/tcdistribution/CcsdsDistributor.h"
#include "definitions.h" #include "definitions.h"
@ -9,7 +10,9 @@
CcsdsDistributor::CcsdsDistributor(uint16_t setDefaultApid, object_id_t setObjectId, CcsdsDistributor::CcsdsDistributor(uint16_t setDefaultApid, object_id_t setObjectId,
CcsdsPacketCheckIF* packetChecker) CcsdsPacketCheckIF* packetChecker)
: TcDistributorBase(setObjectId), defaultApid(setDefaultApid), packetChecker(packetChecker) {} : TcDistributorBase(setObjectId),
defaultApid(setDefaultApid),
packetChecker(packetChecker) {}
CcsdsDistributor::~CcsdsDistributor() = default; CcsdsDistributor::~CcsdsDistributor() = default;
@ -52,13 +55,16 @@ ReturnValue_t CcsdsDistributor::selectDestination(MessageQueueId_t& destId) {
sif::info << "CCSDSDistributor::selectDestination has packet with APID 0x" << std::hex sif::info << "CCSDSDistributor::selectDestination has packet with APID 0x" << std::hex
<< currentPacket.getApid() << std::dec << std::endl; << currentPacket.getApid() << std::dec << std::endl;
#endif #endif
auto position = receiverMap.find(currentPacket.getApid()); auto iter = receiverMap.find(currentPacket.getApid());
if (position != receiverMap.end()) { if (iter != receiverMap.end()) {
destId = position->second.destId; destId = iter->second.destId;
if (iter->second.removeHeader) {
handleCcsdsHeaderRemoval();
}
} else { } else {
// The APID was not found. Forward packet to main SW-APID anyway to // The APID was not found. Forward packet to main SW-APID anyway to
// create acceptance failure report. // create acceptance failure report.
auto iter = receiverMap.find(defaultApid); iter = receiverMap.find(defaultApid);
if (iter != receiverMap.end()) { if (iter != receiverMap.end()) {
destId = iter->second.destId; destId = iter->second.destId;
} else { } else {
@ -69,6 +75,7 @@ ReturnValue_t CcsdsDistributor::selectDestination(MessageQueueId_t& destId) {
} }
void CcsdsDistributor::handlePacketCheckFailure(ReturnValue_t result) { void CcsdsDistributor::handlePacketCheckFailure(ReturnValue_t result) {
#if FSFW_VERBOSE_LEVEL >= 1
const char* reason = "Unknown reason"; const char* reason = "Unknown reason";
if (result == tcdistrib::INVALID_CCSDS_VERSION) { if (result == tcdistrib::INVALID_CCSDS_VERSION) {
reason = "Invalid CCSDS version"; reason = "Invalid CCSDS version";
@ -79,7 +86,6 @@ void CcsdsDistributor::handlePacketCheckFailure(ReturnValue_t result) {
} else if (result == tcdistrib::INVALID_PACKET_TYPE) { } else if (result == tcdistrib::INVALID_PACKET_TYPE) {
reason = "Invalid Packet Type TM detected"; reason = "Invalid Packet Type TM detected";
} }
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "CCSDS packet check failed: " << reason << std::endl; sif::warning << "CCSDS packet check failed: " << reason << std::endl;
#else #else
@ -144,3 +150,16 @@ void CcsdsDistributor::print() {
} }
const char* CcsdsDistributor::getName() const { return "CCSDS Distributor"; } const char* CcsdsDistributor::getName() const { return "CCSDS Distributor"; }
ReturnValue_t CcsdsDistributor::handleCcsdsHeaderRemoval() {
currentMessage;
auto accessorPair = tcStore->getData(currentMessage.getStorageId());
if(accessorPair.first != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << __func__ << ": Getting TC data failed" << std::endl;
#else
sif::printError("%s: Getting TC data failed\n", __func__);
#endif
return accessorPair.first;
}
}

View File

@ -37,9 +37,9 @@ class CcsdsDistributor : public TcDistributorBase,
*/ */
~CcsdsDistributor() override; ~CcsdsDistributor() override;
MessageQueueId_t getRequestQueue() const override; [[nodiscard]] MessageQueueId_t getRequestQueue() const override;
ReturnValue_t registerApplication(DestInfo info) override; ReturnValue_t registerApplication(DestInfo info) override;
uint32_t getIdentifier() const override; [[nodiscard]] uint32_t getIdentifier() const override;
ReturnValue_t initialize() override; ReturnValue_t initialize() override;
[[nodiscard]] const char* getName() const override; [[nodiscard]] const char* getName() const override;
@ -63,6 +63,7 @@ class CcsdsDistributor : public TcDistributorBase,
static void handlePacketCheckFailure(ReturnValue_t result); static void handlePacketCheckFailure(ReturnValue_t result);
ReturnValue_t handleCcsdsHeaderRemoval();
void print(); void print();
/** /**
* The default APID, where packets with unknown APID are sent to. * The default APID, where packets with unknown APID are sent to.

View File

@ -17,7 +17,7 @@ class CcsdsDistributorIF {
struct DestInfo { struct DestInfo {
DestInfo(const char* name, uint16_t apid, MessageQueueId_t destId, bool removeHeader) DestInfo(const char* name, uint16_t apid, MessageQueueId_t destId, bool removeHeader)
: name(name), apid(apid), destId(destId), removeHeader(removeHeader) {} : name(name), apid(apid), destId(destId), removeHeader(removeHeader) {}
DestInfo(const char* name, AcceptsTelecommandsIF& ccsdsReceiver, bool removeHeader_) DestInfo(const char* name, const AcceptsTelecommandsIF& ccsdsReceiver, bool removeHeader_)
: name(name) { : name(name) {
apid = ccsdsReceiver.getIdentifier(); apid = ccsdsReceiver.getIdentifier();
destId = ccsdsReceiver.getRequestQueue(); destId = ccsdsReceiver.getRequestQueue();

View File

@ -55,6 +55,6 @@ ReturnValue_t CcsdsUnpacker::performOperation(uint8_t operationCode) {
void CcsdsUnpacker::setDifferentTargetStore(StorageManagerIF& otherTargetStore) { void CcsdsUnpacker::setDifferentTargetStore(StorageManagerIF& otherTargetStore) {
targetStore = &otherTargetStore; targetStore = &otherTargetStore;
} }
ReturnValue_t CcsdsUnpacker::performOperation(uint8_t operationCode) { return 0; }
uint32_t CcsdsUnpacker::getIdentifier() const { return 0; } uint32_t CcsdsUnpacker::getIdentifier() const { return 0; }
MessageQueueId_t CcsdsUnpacker::getRequestQueue() const { return 0; } MessageQueueId_t CcsdsUnpacker::getRequestQueue() const { return 0; }

View File

@ -65,15 +65,16 @@ class TcDistributorBase : public SystemObject, public ExecutableObjectIF, public
* The last received incoming packet information is stored in this * The last received incoming packet information is stored in this
* member. * member.
* As different child classes unpack the incoming packet differently * As different child classes unpack the incoming packet differently
* (i.e. as a CCSDS Space Packet or as a PUS Telecommand Packet), it * (i.e. as a CCSDS Space Packet or as a PUS Telecommand Packet), no unpacking will be
* is not tried to unpack the packet information within this class. * done in this class.
*/ */
TmTcMessage currentMessage; TmTcMessage currentMessage;
/** /**
* This method shall unpack the routing information from the incoming * This method shall unpack the routing information from the incoming
* packet and select the map entry which represents the packet's target. * packet and select the map entry which represents the packet's target.
* @return An iterator to the map element to forward to or queuMap.end(). * @return
* - @c RETURN_OK if a desitnation was selected successfully
*/ */
virtual ReturnValue_t selectDestination(MessageQueueId_t& destId) = 0; virtual ReturnValue_t selectDestination(MessageQueueId_t& destId) = 0;
/** /**

View File

@ -1,3 +1,4 @@
#include "fsfw/FSFW.h"
#include "CatchDefinitions.h" #include "CatchDefinitions.h"
#include <fsfw/objectmanager/ObjectManager.h> #include <fsfw/objectmanager/ObjectManager.h>

View File

@ -1,6 +1,7 @@
#ifndef FSFW_UNITTEST_CORE_CATCHDEFINITIONS_H_ #ifndef FSFW_UNITTEST_CORE_CATCHDEFINITIONS_H_
#define FSFW_UNITTEST_CORE_CATCHDEFINITIONS_H_ #define FSFW_UNITTEST_CORE_CATCHDEFINITIONS_H_
#include "fsfw/FSFW.h"
#include <fsfw/ipc/messageQueueDefinitions.h> #include <fsfw/ipc/messageQueueDefinitions.h>
#include <fsfw/returnvalues/HasReturnvaluesIF.h> #include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/storagemanager/StorageManagerIF.h> #include <fsfw/storagemanager/StorageManagerIF.h>

View File

@ -1,3 +1,4 @@
#include "fsfw/FSFW.h"
#include "CatchDefinitions.h" #include "CatchDefinitions.h"
#include "CatchFactory.h" #include "CatchFactory.h"

View File

@ -5,8 +5,8 @@ PusDistributorMock::PusDistributorMock() : SystemObject(objects::NO_OBJECT, fals
PusDistributorMock::PusDistributorMock(object_id_t registeredId) PusDistributorMock::PusDistributorMock(object_id_t registeredId)
: SystemObject(registeredId, true) {} : SystemObject(registeredId, true) {}
ReturnValue_t PusDistributorMock::registerService(AcceptsTelecommandsIF *service) { ReturnValue_t PusDistributorMock::registerService(const AcceptsTelecommandsIF& service) {
registerCallCount++; registerCallCount++;
lastServiceArg = service; registeredServies.push_back(&service);
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }

View File

@ -4,13 +4,15 @@
#include "fsfw/objectmanager/SystemObject.h" #include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/tcdistribution/PusDistributorIF.h" #include "fsfw/tcdistribution/PusDistributorIF.h"
#include <vector>
class PusDistributorMock : public SystemObject, public PusDistributorIF { class PusDistributorMock : public SystemObject, public PusDistributorIF {
public: public:
PusDistributorMock(); PusDistributorMock();
explicit PusDistributorMock(object_id_t registeredId); explicit PusDistributorMock(object_id_t registeredId);
unsigned int registerCallCount = 0; unsigned int registerCallCount = 0;
AcceptsTelecommandsIF* lastServiceArg = nullptr; std::vector<const AcceptsTelecommandsIF*> registeredServies;
ReturnValue_t registerService(AcceptsTelecommandsIF* service) override; ReturnValue_t registerService(const AcceptsTelecommandsIF& service) override;
}; };
#endif // FSFW_TESTS_PUSDISTRIBUTORMOCK_H #endif // FSFW_TESTS_PUSDISTRIBUTORMOCK_H

View File

@ -1,3 +1,4 @@
#include "fsfw/FSFW.h"
#include "PollingSequenceFactory.h" #include "PollingSequenceFactory.h"
#include <fsfw/devicehandlers/DeviceHandlerIF.h> #include <fsfw/devicehandlers/DeviceHandlerIF.h>
@ -20,7 +21,7 @@ ReturnValue_t pst::pollingSequenceInitDefault(FixedTimeslotTaskIF *thisSequence)
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) { if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} else { } else {
#if FSFW_CPP_OSTREAM_ENABLED #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "pst::pollingSequenceInitDefault: Sequence invalid!" << std::endl; sif::error << "pst::pollingSequenceInitDefault: Sequence invalid!" << std::endl;
#else #else
sif::printError("pst::pollingSequenceInitDefault: Sequence invalid!"); sif::printError("pst::pollingSequenceInitDefault: Sequence invalid!");

View File

@ -192,7 +192,7 @@ TEST_CASE("Pus Service Base", "[pus-service-base]") {
REQUIRE(PsbMock::getStaticPusDistributor() == distributorId); REQUIRE(PsbMock::getStaticPusDistributor() == distributorId);
REQUIRE(psb2.initialize() == result::OK); REQUIRE(psb2.initialize() == result::OK);
REQUIRE(pusDistrib.registerCallCount == 1); REQUIRE(pusDistrib.registerCallCount == 1);
REQUIRE(pusDistrib.lastServiceArg == &psb2); REQUIRE(pusDistrib.registeredServies.front() == &psb2);
} }
SECTION("Auto Initialize Packet Destination") { SECTION("Auto Initialize Packet Destination") {