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 "../datapool/PoolEntryIF.h"
#include "../housekeeping/HousekeepingMessage.h"
#include "../ipc/MessageQueueSenderIF.h"
#include "../serviceinterface/ServiceInterface.h"
#include "fsfw/datapool/PoolEntryIF.h"
#include "fsfw/housekeeping/HousekeepingMessage.h"
#include "fsfw/ipc/MessageQueueSenderIF.h"
#include "fsfw/serviceinterface.h"
#include "LocalDataPoolManager.h"
#include "localPoolDefinitions.h"

View File

@ -1,9 +1,9 @@
#ifndef 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

View File

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

View File

@ -1,3 +1,4 @@
#include "fsfw/FSFW.h"
#include "fsfw/tcdistribution/CcsdsDistributor.h"
#include "definitions.h"
@ -9,7 +10,9 @@
CcsdsDistributor::CcsdsDistributor(uint16_t setDefaultApid, object_id_t setObjectId,
CcsdsPacketCheckIF* packetChecker)
: TcDistributorBase(setObjectId), defaultApid(setDefaultApid), packetChecker(packetChecker) {}
: TcDistributorBase(setObjectId),
defaultApid(setDefaultApid),
packetChecker(packetChecker) {}
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
<< currentPacket.getApid() << std::dec << std::endl;
#endif
auto position = receiverMap.find(currentPacket.getApid());
if (position != receiverMap.end()) {
destId = position->second.destId;
auto iter = receiverMap.find(currentPacket.getApid());
if (iter != receiverMap.end()) {
destId = iter->second.destId;
if (iter->second.removeHeader) {
handleCcsdsHeaderRemoval();
}
} else {
// The APID was not found. Forward packet to main SW-APID anyway to
// create acceptance failure report.
auto iter = receiverMap.find(defaultApid);
iter = receiverMap.find(defaultApid);
if (iter != receiverMap.end()) {
destId = iter->second.destId;
} else {
@ -69,6 +75,7 @@ ReturnValue_t CcsdsDistributor::selectDestination(MessageQueueId_t& destId) {
}
void CcsdsDistributor::handlePacketCheckFailure(ReturnValue_t result) {
#if FSFW_VERBOSE_LEVEL >= 1
const char* reason = "Unknown reason";
if (result == tcdistrib::INVALID_CCSDS_VERSION) {
reason = "Invalid CCSDS version";
@ -79,7 +86,6 @@ void CcsdsDistributor::handlePacketCheckFailure(ReturnValue_t result) {
} else if (result == tcdistrib::INVALID_PACKET_TYPE) {
reason = "Invalid Packet Type TM detected";
}
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "CCSDS packet check failed: " << reason << std::endl;
#else
@ -144,3 +150,16 @@ void CcsdsDistributor::print() {
}
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;
MessageQueueId_t getRequestQueue() const override;
[[nodiscard]] MessageQueueId_t getRequestQueue() const override;
ReturnValue_t registerApplication(DestInfo info) override;
uint32_t getIdentifier() const override;
[[nodiscard]] uint32_t getIdentifier() const override;
ReturnValue_t initialize() override;
[[nodiscard]] const char* getName() const override;
@ -63,6 +63,7 @@ class CcsdsDistributor : public TcDistributorBase,
static void handlePacketCheckFailure(ReturnValue_t result);
ReturnValue_t handleCcsdsHeaderRemoval();
void print();
/**
* The default APID, where packets with unknown APID are sent to.

View File

@ -17,7 +17,7 @@ class CcsdsDistributorIF {
struct DestInfo {
DestInfo(const char* name, uint16_t apid, MessageQueueId_t destId, bool 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) {
apid = ccsdsReceiver.getIdentifier();
destId = ccsdsReceiver.getRequestQueue();

View File

@ -55,6 +55,6 @@ ReturnValue_t CcsdsUnpacker::performOperation(uint8_t operationCode) {
void CcsdsUnpacker::setDifferentTargetStore(StorageManagerIF& otherTargetStore) {
targetStore = &otherTargetStore;
}
ReturnValue_t CcsdsUnpacker::performOperation(uint8_t operationCode) { return 0; }
uint32_t CcsdsUnpacker::getIdentifier() 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
* member.
* As different child classes unpack the incoming packet differently
* (i.e. as a CCSDS Space Packet or as a PUS Telecommand Packet), it
* is not tried to unpack the packet information within this class.
* (i.e. as a CCSDS Space Packet or as a PUS Telecommand Packet), no unpacking will be
* done in this class.
*/
TmTcMessage currentMessage;
/**
* This method shall unpack the routing information from the incoming
* 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;
/**

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,3 +1,4 @@
#include "fsfw/FSFW.h"
#include "PollingSequenceFactory.h"
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
@ -20,7 +21,7 @@ ReturnValue_t pst::pollingSequenceInitDefault(FixedTimeslotTaskIF *thisSequence)
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
return HasReturnvaluesIF::RETURN_OK;
} else {
#if FSFW_CPP_OSTREAM_ENABLED
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "pst::pollingSequenceInitDefault: Sequence invalid!" << std::endl;
#else
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(psb2.initialize() == result::OK);
REQUIRE(pusDistrib.registerCallCount == 1);
REQUIRE(pusDistrib.lastServiceArg == &psb2);
REQUIRE(pusDistrib.registeredServies.front() == &psb2);
}
SECTION("Auto Initialize Packet Destination") {