TMTC Stack Refactoring #106
@ -6,7 +6,7 @@
|
|||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/storagemanager/StorageManagerIF.h"
|
#include "fsfw/storagemanager/StorageManagerIF.h"
|
||||||
#include "fsfw/tmtcpacket/SpacePacketReader.h"
|
#include "fsfw/tmtcpacket/ccsds/SpacePacketReader.h"
|
||||||
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
|
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
|
||||||
#include "fsfw/tmtcservices/TmTcMessage.h"
|
#include "fsfw/tmtcservices/TmTcMessage.h"
|
||||||
|
|
||||||
|
@ -5,33 +5,25 @@
|
|||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/tmtcpacket/pus/tm/TmPacketStored.h"
|
#include "fsfw/tmtcpacket/pus/tm/TmPacketStored.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), packetSubCounter(0) {}
|
StorageManagerIF* tmStore, StorageManagerIF* ipcStore,
|
||||||
|
InternalErrorReporterIF* errReporter)
|
||||||
|
: PusServiceBase(objectId, apid, serviceId, ipcStore),
|
||||||
|
helper(tmStore, MessageQueueIF::NO_QUEUE, MessageQueueIF::NO_QUEUE, errReporter),
|
||||||
|
packetSubCounter(0) {}
|
||||||
|
|
||||||
Service17Test::~Service17Test() {}
|
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: {
|
||||||
#if FSFW_USE_PUS_C_TELEMETRY == 0
|
helper.preparePacket(apid, serviceId, Subservice::CONNECTION_TEST_REPORT, packetSubCounter);
|
||||||
TmPacketStoredPusA connectionPacket(apid, serviceId, Subservice::CONNECTION_TEST_REPORT,
|
helper.sendPacket();
|
||||||
packetSubCounter++);
|
|
||||||
#else
|
|
||||||
TmPacketStoredPusC connectionPacket(apid, serviceId, Subservice::CONNECTION_TEST_REPORT,
|
|
||||||
packetSubCounter++);
|
|
||||||
#endif
|
|
||||||
connectionPacket.sendPacket(requestQueue->getDefaultDestination(), requestQueue->getId());
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
case Subservice::EVENT_TRIGGER_TEST: {
|
case Subservice::EVENT_TRIGGER_TEST: {
|
||||||
#if FSFW_USE_PUS_C_TELEMETRY == 0
|
helper.preparePacket(apid, serviceId, Subservice::CONNECTION_TEST_REPORT, packetSubCounter++);
|
||||||
TmPacketStoredPusA connectionPacket(apid, serviceId, Subservice::CONNECTION_TEST_REPORT,
|
helper.sendPacket();
|
||||||
packetSubCounter++);
|
|
||||||
#else
|
|
||||||
TmPacketStoredPusC connectionPacket(apid, serviceId, Subservice::CONNECTION_TEST_REPORT,
|
|
||||||
packetSubCounter++);
|
|
||||||
#endif
|
|
||||||
connectionPacket.sendPacket(requestQueue->getDefaultDestination(), requestQueue->getId());
|
|
||||||
triggerEvent(TEST, 1234, 5678);
|
triggerEvent(TEST, 1234, 5678);
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
@ -41,3 +33,12 @@ ReturnValue_t Service17Test::handleRequest(uint8_t subservice) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Service17Test::performService() { return HasReturnvaluesIF::RETURN_OK; }
|
ReturnValue_t Service17Test::performService() { return HasReturnvaluesIF::RETURN_OK; }
|
||||||
|
|
||||||
|
ReturnValue_t Service17Test::initialize() {
|
||||||
|
ReturnValue_t result = PusServiceBase::initialize();
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
helper.setMsgDestination(requestQueue->getDefaultDestination());
|
||||||
|
helper.setMsgSource(requestQueue->getId());
|
||||||
|
if (tm) }
|
||||||
|
@ -3,6 +3,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"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Test Service
|
* @brief Test Service
|
||||||
@ -32,12 +33,16 @@ class Service17Test : public PusServiceBase {
|
|||||||
EVENT_TRIGGER_TEST = 128,
|
EVENT_TRIGGER_TEST = 128,
|
||||||
};
|
};
|
||||||
|
|
||||||
Service17Test(object_id_t objectId, uint16_t apid, uint8_t serviceId);
|
Service17Test(object_id_t objectId, uint16_t apid, uint8_t serviceId,
|
||||||
virtual ~Service17Test();
|
InternalErrorReporterIF* errReporter, StorageManagerIF* tmStore = nullptr,
|
||||||
virtual ReturnValue_t handleRequest(uint8_t subservice) override;
|
StorageManagerIF* ipcStore = nullptr);
|
||||||
virtual ReturnValue_t performService() override;
|
~Service17Test() override;
|
||||||
|
ReturnValue_t handleRequest(uint8_t subservice) override;
|
||||||
|
ReturnValue_t performService() override;
|
||||||
|
ReturnValue_t initialize() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
TmStoreHelper helper;
|
||||||
uint16_t packetSubCounter = 0;
|
uint16_t packetSubCounter = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/tmtcpacket/SpacePacketReader.h"
|
#include "fsfw/tmtcpacket/ccsds/SpacePacketReader.h"
|
||||||
|
|
||||||
#define CCSDS_DISTRIBUTOR_DEBUGGING 0
|
#define CCSDS_DISTRIBUTOR_DEBUGGING 0
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "CcsdsPacketCheckerBase.h"
|
#include "CcsdsPacketCheckerBase.h"
|
||||||
|
|
||||||
#include "fsfw/tcdistribution/definitions.h"
|
#include "fsfw/tcdistribution/definitions.h"
|
||||||
#include "fsfw/tmtcpacket/SpacePacketReader.h"
|
#include "fsfw/tmtcpacket/ccsds/SpacePacketReader.h"
|
||||||
|
|
||||||
CcsdsPacketCheckerBase::CcsdsPacketCheckerBase(uint16_t apid, ccsds::PacketType packetType_,
|
CcsdsPacketCheckerBase::CcsdsPacketCheckerBase(uint16_t apid, ccsds::PacketType packetType_,
|
||||||
uint8_t ccsdsVersion_)
|
uint8_t ccsdsVersion_)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define FSFW_TESTS_CCSDSPACKETCHECKERBASE_H
|
#define FSFW_TESTS_CCSDSPACKETCHECKERBASE_H
|
||||||
|
|
||||||
#include "CcsdsPacketCheckIF.h"
|
#include "CcsdsPacketCheckIF.h"
|
||||||
#include "fsfw/tmtcpacket/SpacePacketIF.h"
|
#include "fsfw/tmtcpacket/ccsds/SpacePacketIF.h"
|
||||||
|
|
||||||
class CcsdsPacketCheckerBase : public CcsdsPacketCheckIF, public HasReturnvaluesIF {
|
class CcsdsPacketCheckerBase : public CcsdsPacketCheckIF, public HasReturnvaluesIF {
|
||||||
public:
|
public:
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
target_sources(
|
target_sources(${LIB_FSFW_NAME} PRIVATE PacketStorageHelper.cpp)
|
||||||
${LIB_FSFW_NAME} PRIVATE SpacePacketReader.cpp SpacePacketCreator.cpp
|
|
||||||
PacketStorageHelper.cpp)
|
|
||||||
|
|
||||||
|
add_subdirectory(ccsds)
|
||||||
|
add_subdirectory(pus)
|
||||||
add_subdirectory(cfdp)
|
add_subdirectory(cfdp)
|
||||||
add_subdirectory(packetmatcher)
|
add_subdirectory(packetmatcher)
|
||||||
add_subdirectory(pus)
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef FSFW_TMTCPACKET_SPACEPACKETREADERIF_H
|
#ifndef FSFW_TMTCPACKET_SPACEPACKETREADERIF_H
|
||||||
#define FSFW_TMTCPACKET_SPACEPACKETREADERIF_H
|
#define FSFW_TMTCPACKET_SPACEPACKETREADERIF_H
|
||||||
|
|
||||||
#include "SpacePacketIF.h"
|
#include "fsfw/tmtcpacket/ccsds/SpacePacketIF.h"
|
||||||
|
|
||||||
class ReadablePacketIF {
|
class ReadablePacketIF {
|
||||||
public:
|
public:
|
||||||
|
@ -1,87 +0,0 @@
|
|||||||
#ifndef FSFW_TMTCPACKET_SPACEPACKETCREATOR_H
|
|
||||||
#define FSFW_TMTCPACKET_SPACEPACKETCREATOR_H
|
|
||||||
|
|
||||||
#include "SpacePacketIF.h"
|
|
||||||
#include "fsfw/serialize/SerializeIF.h"
|
|
||||||
|
|
||||||
struct PacketId {
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* Simple wrapper for Space Packet IDs. Does not check the APID for validity
|
|
||||||
* @param packetType_
|
|
||||||
* @param secHeaderFlag_
|
|
||||||
* @param apid_
|
|
||||||
*/
|
|
||||||
PacketId(ccsds::PacketType packetType_, bool secHeaderFlag_, uint16_t apid_)
|
|
||||||
: packetType(packetType_), secHeaderFlag(secHeaderFlag_), apid(apid_) {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NOTE: If the APID has an invalid value, the invalid bits will be cut off
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
[[nodiscard]] uint16_t raw() const {
|
|
||||||
return (static_cast<uint16_t>(packetType) << 12) |
|
|
||||||
(static_cast<uint16_t>(secHeaderFlag) << 11) | (apid & 0x7ff);
|
|
||||||
}
|
|
||||||
|
|
||||||
ccsds::PacketType packetType;
|
|
||||||
bool secHeaderFlag;
|
|
||||||
uint16_t apid;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PacketSeqCtrl {
|
|
||||||
public:
|
|
||||||
PacketSeqCtrl(ccsds::SequenceFlags seqFlags, uint16_t seqCount)
|
|
||||||
: seqFlags(seqFlags), seqCount(seqCount) {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NOTE: If the sequence control has an invalid value, the invalid bits will be cut off
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
[[nodiscard]] uint16_t raw() const {
|
|
||||||
return (static_cast<uint16_t>(seqFlags) << 14) | (seqCount & 0x3FFF);
|
|
||||||
}
|
|
||||||
ccsds::SequenceFlags seqFlags;
|
|
||||||
uint16_t seqCount;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SpacePacketParams {
|
|
||||||
PacketId packetId;
|
|
||||||
PacketSeqCtrl packetSeqCtrl;
|
|
||||||
uint16_t dataLen;
|
|
||||||
uint8_t version = 0b000;
|
|
||||||
};
|
|
||||||
|
|
||||||
class SpacePacketCreator : public SpacePacketIF, public SerializeIF {
|
|
||||||
public:
|
|
||||||
/*
|
|
||||||
SpacePacketCreator(ccsds::PacketType packetType, bool secHeaderFlag, uint16_t apid,
|
|
||||||
ccsds::SequenceFlags seqFlags, uint16_t seqCount, uint16_t dataLen,
|
|
||||||
uint8_t version = 0);
|
|
||||||
*/
|
|
||||||
explicit SpacePacketCreator(SpacePacketParams ¶ms);
|
|
||||||
[[nodiscard]] bool isValid() const;
|
|
||||||
[[nodiscard]] uint16_t getPacketId() const override;
|
|
||||||
[[nodiscard]] uint16_t getPacketSeqCtrl() const override;
|
|
||||||
[[nodiscard]] uint16_t getPacketDataLen() const override;
|
|
||||||
|
|
||||||
void setApid(uint16_t apid);
|
|
||||||
void setSeqCount(uint16_t seqCount);
|
|
||||||
void setSeqFlags(ccsds::SequenceFlags flags);
|
|
||||||
void setDataLen(uint16_t dataLen);
|
|
||||||
|
|
||||||
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize) const;
|
|
||||||
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
|
||||||
Endianness streamEndianness) const override;
|
|
||||||
|
|
||||||
[[nodiscard]] size_t getSerializedSize() const override;
|
|
||||||
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
|
|
||||||
Endianness streamEndianness) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void checkFieldValidity();
|
|
||||||
|
|
||||||
bool valid{};
|
|
||||||
SpacePacketParams params;
|
|
||||||
};
|
|
||||||
#endif // FSFW_TMTCPACKET_SPACEPACKETCREATOR_H
|
|
2
src/fsfw/tmtcpacket/ccsds/CMakeLists.txt
Normal file
2
src/fsfw/tmtcpacket/ccsds/CMakeLists.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
target_sources(${LIB_FSFW_NAME} PRIVATE SpacePacketReader.cpp
|
||||||
|
SpacePacketCreator.cpp header.cpp)
|
68
src/fsfw/tmtcpacket/ccsds/PacketId.h
Normal file
68
src/fsfw/tmtcpacket/ccsds/PacketId.h
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#ifndef FSFW_TMTCPACKET_PACKETID_H
|
||||||
|
#define FSFW_TMTCPACKET_PACKETID_H
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
#include "defs.h"
|
||||||
|
#include "fsfw/serialize/SerializeAdapter.h"
|
||||||
|
#include "fsfw/serialize/SerializeIF.h"
|
||||||
|
|
||||||
|
struct PacketId : public SerializeIF {
|
||||||
|
public:
|
||||||
|
PacketId() = default;
|
||||||
|
/**
|
||||||
|
* Simple wrapper for Space Packet IDs. Does not check the APID for validity
|
||||||
|
* @param packetType_
|
||||||
|
* @param secHeaderFlag_
|
||||||
|
* @param apid_
|
||||||
|
*/
|
||||||
|
PacketId(ccsds::PacketType packetType_, bool secHeaderFlag_, uint16_t apid_)
|
||||||
|
: packetType(packetType_), secHeaderFlag(secHeaderFlag_), apid(apid_) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTE: If the APID has an invalid value, the invalid bits will be cut off
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
[[nodiscard]] uint16_t raw() const {
|
||||||
|
return (static_cast<uint16_t>(packetType) << 12) |
|
||||||
|
(static_cast<uint16_t>(secHeaderFlag) << 11) | (apid & 0x7ff);
|
||||||
|
}
|
||||||
|
|
||||||
|
static PacketId fromRaw(uint16_t raw) {
|
||||||
|
uint8_t highByte = (raw >> 8) & 0xff;
|
||||||
|
uint8_t lowByte = raw & 0xff;
|
||||||
|
return {static_cast<ccsds::PacketType>((highByte >> 4) & 0b1),
|
||||||
|
static_cast<bool>((highByte >> 3) & 0b1),
|
||||||
|
static_cast<uint16_t>((highByte & 0b111) << 8 | lowByte)};
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
||||||
|
Endianness streamEndianness) const override {
|
||||||
|
uint16_t pscRaw = raw();
|
||||||
|
return SerializeAdapter::serialize(&pscRaw, buffer, size, maxSize, streamEndianness);
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] size_t getSerializedSize() const override { return 2; }
|
||||||
|
|
||||||
|
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
|
||||||
|
Endianness streamEndianness) override {
|
||||||
|
if (*size < 2) {
|
||||||
|
return SerializeIF::STREAM_TOO_SHORT;
|
||||||
|
}
|
||||||
|
uint8_t highByte = **buffer;
|
||||||
|
*buffer += 1;
|
||||||
|
uint8_t lowByte = **buffer;
|
||||||
|
*buffer += 1;
|
||||||
|
*size -= 2;
|
||||||
|
packetType = static_cast<ccsds::PacketType>((highByte >> 4) & 0b1);
|
||||||
|
secHeaderFlag = (highByte >> 3) & 0b1;
|
||||||
|
apid = static_cast<uint16_t>((highByte & 0b111) << 8 | lowByte);
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ccsds::PacketType packetType = ccsds::PacketType::TM;
|
||||||
|
bool secHeaderFlag = false;
|
||||||
|
uint16_t apid = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FSFW_TMTCPACKET_PACKETID_H
|
56
src/fsfw/tmtcpacket/ccsds/PacketSeqCtrl.h
Normal file
56
src/fsfw/tmtcpacket/ccsds/PacketSeqCtrl.h
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
#ifndef FSFW_TMTCPACKET_PACKETSEQCTRL_H
|
||||||
|
#define FSFW_TMTCPACKET_PACKETSEQCTRL_H
|
||||||
|
|
||||||
|
#include "defs.h"
|
||||||
|
#include "fsfw/serialize/SerializeAdapter.h"
|
||||||
|
#include "fsfw/serialize/SerializeIF.h"
|
||||||
|
|
||||||
|
struct PacketSeqCtrl : public SerializeIF {
|
||||||
|
public:
|
||||||
|
PacketSeqCtrl() = default;
|
||||||
|
|
||||||
|
PacketSeqCtrl(ccsds::SequenceFlags seqFlags, uint16_t seqCount)
|
||||||
|
: seqFlags(seqFlags), seqCount(seqCount) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTE: If the sequence control has an invalid value, the invalid bits will be cut off
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
[[nodiscard]] uint16_t raw() const {
|
||||||
|
return (static_cast<uint16_t>(seqFlags) << 14) | (seqCount & 0x3FFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
static PacketSeqCtrl fromRaw(uint16_t raw) {
|
||||||
|
uint8_t highByte = (raw >> 8) & 0xff;
|
||||||
|
uint8_t lowByte = raw & 0xff;
|
||||||
|
return {static_cast<ccsds::SequenceFlags>((highByte >> 6) & 0b11),
|
||||||
|
static_cast<uint16_t>(((highByte << 8) | lowByte) & 0x3FFF)};
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
||||||
|
Endianness streamEndianness) const override {
|
||||||
|
uint16_t packetIdRaw = raw();
|
||||||
|
return SerializeAdapter::serialize(&packetIdRaw, buffer, size, maxSize, streamEndianness);
|
||||||
|
}
|
||||||
|
[[nodiscard]] size_t getSerializedSize() const override { return 2; }
|
||||||
|
|
||||||
|
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
|
||||||
|
Endianness streamEndianness) override {
|
||||||
|
if (*size < 2) {
|
||||||
|
return SerializeIF::STREAM_TOO_SHORT;
|
||||||
|
}
|
||||||
|
uint8_t highByte = **buffer;
|
||||||
|
*buffer += 1;
|
||||||
|
uint8_t lowByte = **buffer;
|
||||||
|
*buffer += 1;
|
||||||
|
*size -= 2;
|
||||||
|
seqFlags = static_cast<ccsds::SequenceFlags>((highByte >> 6) & 0b11);
|
||||||
|
seqCount = ((highByte << 8) | lowByte) & 0x3FFF;
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ccsds::SequenceFlags seqFlags = ccsds::SequenceFlags::CONTINUATION;
|
||||||
|
uint16_t seqCount = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FSFW_TMTCPACKET_PACKETSEQCTRL_H
|
@ -1,13 +1,23 @@
|
|||||||
#include "SpacePacketCreator.h"
|
#include "SpacePacketCreator.h"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "fsfw/serialize/SerializeAdapter.h"
|
#include "fsfw/serialize/SerializeAdapter.h"
|
||||||
|
|
||||||
SpacePacketCreator::SpacePacketCreator(SpacePacketParams ¶ms_) : params(params_) {
|
SpacePacketCreator::SpacePacketCreator(SpacePacketParams params_) : params(std::move(params_)) {
|
||||||
checkFieldValidity();
|
checkFieldValidity();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t SpacePacketCreator::getPacketId() const { return params.packetId.raw(); }
|
SpacePacketCreator::SpacePacketCreator(ccsds::PacketType packetType, bool secHeaderFlag,
|
||||||
uint16_t SpacePacketCreator::getPacketSeqCtrl() const { return params.packetSeqCtrl.raw(); }
|
uint16_t apid, ccsds::SequenceFlags seqFlags,
|
||||||
|
uint16_t seqCount, uint16_t dataLen, uint8_t version)
|
||||||
|
: params(SpacePacketParams(PacketId(packetType, secHeaderFlag, apid),
|
||||||
|
PacketSeqCtrl(seqFlags, seqCount), dataLen)) {
|
||||||
|
params.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t SpacePacketCreator::getPacketIdRaw() const { return params.packetId.raw(); }
|
||||||
|
uint16_t SpacePacketCreator::getPacketSeqCtrlRaw() const { return params.packetSeqCtrl.raw(); }
|
||||||
uint16_t SpacePacketCreator::getPacketDataLen() const { return params.dataLen; }
|
uint16_t SpacePacketCreator::getPacketDataLen() const { return params.dataLen; }
|
||||||
|
|
||||||
ReturnValue_t SpacePacketCreator::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
ReturnValue_t SpacePacketCreator::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
53
src/fsfw/tmtcpacket/ccsds/SpacePacketCreator.h
Normal file
53
src/fsfw/tmtcpacket/ccsds/SpacePacketCreator.h
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#ifndef FSFW_TMTCPACKET_SPACEPACKETCREATOR_H
|
||||||
|
#define FSFW_TMTCPACKET_SPACEPACKETCREATOR_H
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#include "PacketId.h"
|
||||||
|
#include "PacketSeqCtrl.h"
|
||||||
|
#include "SpacePacketIF.h"
|
||||||
|
#include "fsfw/serialize/SerializeIF.h"
|
||||||
|
|
||||||
|
struct SpacePacketParams {
|
||||||
|
SpacePacketParams(PacketId packetId, PacketSeqCtrl psc, uint16_t dataLen)
|
||||||
|
: packetId(std::move(packetId)), packetSeqCtrl(std::move(psc)), dataLen(dataLen) {}
|
||||||
|
|
||||||
|
PacketId packetId{};
|
||||||
|
PacketSeqCtrl packetSeqCtrl{};
|
||||||
|
uint16_t dataLen = 0;
|
||||||
|
uint8_t version = 0b000;
|
||||||
|
};
|
||||||
|
|
||||||
|
class SpacePacketCreator : public SpacePacketIF, public SerializeIF {
|
||||||
|
public:
|
||||||
|
explicit SpacePacketCreator(SpacePacketParams params);
|
||||||
|
SpacePacketCreator(ccsds::PacketType packetType, bool secHeaderFlag, uint16_t apid,
|
||||||
|
ccsds::SequenceFlags seqFlags, uint16_t seqCount, uint16_t dataLen,
|
||||||
|
uint8_t version = 0);
|
||||||
|
|
||||||
|
[[nodiscard]] bool isValid() const;
|
||||||
|
[[nodiscard]] uint16_t getPacketIdRaw() const override;
|
||||||
|
[[nodiscard]] uint16_t getPacketSeqCtrlRaw() const override;
|
||||||
|
[[nodiscard]] uint16_t getPacketDataLen() const override;
|
||||||
|
|
||||||
|
void setApid(uint16_t apid);
|
||||||
|
void setSeqCount(uint16_t seqCount);
|
||||||
|
void setSeqFlags(ccsds::SequenceFlags flags);
|
||||||
|
void setDataLen(uint16_t dataLen);
|
||||||
|
|
||||||
|
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize) const;
|
||||||
|
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
||||||
|
Endianness streamEndianness) const override;
|
||||||
|
|
||||||
|
[[nodiscard]] size_t getSerializedSize() const override;
|
||||||
|
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
|
||||||
|
Endianness streamEndianness) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void checkFieldValidity();
|
||||||
|
|
||||||
|
SpacePacketCreator() = default;
|
||||||
|
bool valid{};
|
||||||
|
SpacePacketParams params;
|
||||||
|
};
|
||||||
|
#endif // FSFW_TMTCPACKET_SPACEPACKETCREATOR_H
|
@ -4,37 +4,10 @@
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#include "ccsds_header.h"
|
#include "PacketId.h"
|
||||||
|
#include "PacketSeqCtrl.h"
|
||||||
namespace ccsds {
|
#include "fsfw/tmtcpacket/ccsds/defs.h"
|
||||||
|
#include "header.h"
|
||||||
enum PacketType : uint8_t { TM = 0, TC = 1 };
|
|
||||||
|
|
||||||
enum SequenceFlags : uint8_t {
|
|
||||||
CONTINUATION = 0b00,
|
|
||||||
FIRST_SEGMENT = 0b01,
|
|
||||||
LAST_SEGMENT = 0b10,
|
|
||||||
UNSEGMENTED = 0b11
|
|
||||||
};
|
|
||||||
|
|
||||||
static const uint16_t LIMIT_APID = 2048; // 2^11
|
|
||||||
static const uint16_t LIMIT_SEQUENCE_COUNT = 16384; // 2^14
|
|
||||||
static const uint16_t APID_IDLE_PACKET = 0x7FF;
|
|
||||||
|
|
||||||
constexpr uint16_t getSpacePacketIdFromApid(bool isTc, uint16_t apid,
|
|
||||||
bool secondaryHeaderFlag = true) {
|
|
||||||
return ((isTc << 4) | (secondaryHeaderFlag << 3) | ((apid >> 8) & 0x07)) << 8 | (apid & 0x00ff);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr uint16_t getTcSpacePacketIdFromApid(uint16_t apid, bool secondaryHeaderFlag = true) {
|
|
||||||
return getSpacePacketIdFromApid(true, apid, secondaryHeaderFlag);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr uint16_t getTmSpacePacketIdFromApid(uint16_t apid, bool secondaryHeaderFlag = true) {
|
|
||||||
return getSpacePacketIdFromApid(false, apid, secondaryHeaderFlag);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ccsds
|
|
||||||
|
|
||||||
class SpacePacketIF {
|
class SpacePacketIF {
|
||||||
public:
|
public:
|
||||||
@ -45,7 +18,7 @@ class SpacePacketIF {
|
|||||||
/**
|
/**
|
||||||
* This is the minimum size of a SpacePacket.
|
* This is the minimum size of a SpacePacket.
|
||||||
*/
|
*/
|
||||||
static const uint16_t MINIMUM_SIZE = sizeof(CCSDSPrimaryHeader) + CRC_SIZE;
|
static const uint16_t MINIMUM_SIZE = sizeof(ccsds::PrimaryHeader) + CRC_SIZE;
|
||||||
|
|
||||||
virtual ~SpacePacketIF() = default;
|
virtual ~SpacePacketIF() = default;
|
||||||
|
|
||||||
@ -54,21 +27,25 @@ class SpacePacketIF {
|
|||||||
* the CCSDS packet ID
|
* the CCSDS packet ID
|
||||||
* @return The CCSDS packet ID
|
* @return The CCSDS packet ID
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] virtual uint16_t getPacketId() const = 0;
|
[[nodiscard]] virtual uint16_t getPacketIdRaw() const = 0;
|
||||||
/**
|
/**
|
||||||
* Returns the third and the fourth byte of the CCSDS header which are the packet sequence
|
* Returns the third and the fourth byte of the CCSDS header which are the packet sequence
|
||||||
* control field
|
* control field
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] virtual uint16_t getPacketSeqCtrl() const = 0;
|
[[nodiscard]] virtual uint16_t getPacketSeqCtrlRaw() const = 0;
|
||||||
/**
|
/**
|
||||||
* Returns the fifth and the sixth byte of the CCSDS header which is the packet length field
|
* Returns the fifth and the sixth byte of the CCSDS header which is the packet length field
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] virtual uint16_t getPacketDataLen() const = 0;
|
[[nodiscard]] virtual uint16_t getPacketDataLen() const = 0;
|
||||||
|
|
||||||
|
virtual PacketId getPacketId() { return PacketId::fromRaw(getPacketIdRaw()); }
|
||||||
|
|
||||||
|
virtual PacketSeqCtrl getPacketSeqCtrl() { return PacketSeqCtrl::fromRaw(getPacketSeqCtrlRaw()); }
|
||||||
|
|
||||||
[[nodiscard]] virtual uint16_t getApid() const {
|
[[nodiscard]] virtual uint16_t getApid() const {
|
||||||
uint16_t packetId = getPacketId();
|
uint16_t packetId = getPacketIdRaw();
|
||||||
// Uppermost 11 bits of packet ID
|
// Uppermost 11 bits of packet ID
|
||||||
return ((packetId >> 8) & 0b111) | (packetId & 0xFF);
|
return ((packetId >> 8) & 0b111) | (packetId & 0xFF);
|
||||||
}
|
}
|
||||||
@ -78,12 +55,12 @@ class SpacePacketIF {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] virtual uint8_t getVersion() const {
|
[[nodiscard]] virtual uint8_t getVersion() const {
|
||||||
uint16_t packetId = getPacketId();
|
uint16_t packetId = getPacketIdRaw();
|
||||||
return (packetId >> 13) & 0b111;
|
return (packetId >> 13) & 0b111;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] virtual ccsds::PacketType getPacketType() const {
|
[[nodiscard]] virtual ccsds::PacketType getPacketType() const {
|
||||||
return static_cast<ccsds::PacketType>((getPacketId() >> 12) & 0b1);
|
return static_cast<ccsds::PacketType>((getPacketIdRaw() >> 12) & 0b1);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] virtual bool isTc() const { return getPacketType() == ccsds::PacketType::TC; }
|
[[nodiscard]] virtual bool isTc() const { return getPacketType() == ccsds::PacketType::TC; }
|
||||||
@ -95,20 +72,20 @@ class SpacePacketIF {
|
|||||||
* which is checked with this method.
|
* which is checked with this method.
|
||||||
* @return Returns true if the bit is set and false if not.
|
* @return Returns true if the bit is set and false if not.
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] virtual bool hasSecHeader() const { return (getPacketId() >> 11) & 0b1; }
|
[[nodiscard]] virtual bool hasSecHeader() const { return (getPacketIdRaw() >> 11) & 0b1; }
|
||||||
|
|
||||||
[[nodiscard]] virtual ccsds::SequenceFlags getSequenceFlags() const {
|
[[nodiscard]] virtual ccsds::SequenceFlags getSequenceFlags() const {
|
||||||
return static_cast<ccsds::SequenceFlags>(getPacketSeqCtrl() >> 14 & 0b11);
|
return static_cast<ccsds::SequenceFlags>(getPacketSeqCtrlRaw() >> 14 & 0b11);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] virtual uint16_t getSequenceCount() const { return getPacketSeqCtrl() & 0x3FFF; }
|
[[nodiscard]] virtual uint16_t getSequenceCount() const { return getPacketSeqCtrlRaw() & 0x3FFF; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the full packet length based of the packet data length field
|
* Returns the full packet length based of the packet data length field
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] virtual size_t getFullPacketLen() const {
|
[[nodiscard]] virtual size_t getFullPacketLen() const {
|
||||||
return sizeof(CCSDSPrimaryHeader) + getPacketDataLen() + 1;
|
return ccsds::HEADER_LEN + getPacketDataLen() + 1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
#include "fsfw/tmtcpacket/SpacePacketReader.h"
|
#include "SpacePacketReader.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
@ -18,27 +18,24 @@ ReturnValue_t SpacePacketReader::checkLength() const {
|
|||||||
|
|
||||||
SpacePacketReader::~SpacePacketReader() = default;
|
SpacePacketReader::~SpacePacketReader() = default;
|
||||||
|
|
||||||
inline uint16_t SpacePacketReader::getPacketId() const {
|
inline uint16_t SpacePacketReader::getPacketIdRaw() const { return ccsds::getPacketId(*spHeader); }
|
||||||
return ((spHeader->packetIdHAndVersion) << 8) + spHeader->packetIdL;
|
|
||||||
}
|
|
||||||
|
|
||||||
const uint8_t* SpacePacketReader::getPacketData() { return packetDataField; }
|
const uint8_t* SpacePacketReader::getPacketData() { return packetDataField; }
|
||||||
|
|
||||||
ReturnValue_t SpacePacketReader::setData(uint8_t* pData, size_t maxSize_, void* args) {
|
ReturnValue_t SpacePacketReader::setData(uint8_t* pData, size_t maxSize_, void* args) {
|
||||||
setInternalFields(pData, maxSize_);
|
setInternalFields(pData, maxSize_);
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t SpacePacketReader::getPacketSeqCtrl() const {
|
uint16_t SpacePacketReader::getPacketSeqCtrlRaw() const {
|
||||||
return (spHeader->packetSeqCtrlH << 8) + spHeader->packetSeqCtrlL;
|
return ccsds::getPacketSeqCtrl(*spHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t SpacePacketReader::getPacketDataLen() const {
|
uint16_t SpacePacketReader::getPacketDataLen() const { return ccsds::getPacketLen(*spHeader); }
|
||||||
return (spHeader->packetLenH << 8) | spHeader->packetIdL;
|
|
||||||
}
|
|
||||||
void SpacePacketReader::setInternalFields(const uint8_t* data, size_t maxSize_) {
|
void SpacePacketReader::setInternalFields(const uint8_t* data, size_t maxSize_) {
|
||||||
maxSize = maxSize_;
|
maxSize = maxSize_;
|
||||||
spHeader = reinterpret_cast<const CCSDSPrimaryHeader*>(data);
|
spHeader = reinterpret_cast<const ccsds::PrimaryHeader*>(data);
|
||||||
packetDataField = data + sizeof(CCSDSPrimaryHeader);
|
packetDataField = data + ccsds::HEADER_LEN;
|
||||||
}
|
}
|
||||||
const uint8_t* SpacePacketReader::getFullData() {
|
const uint8_t* SpacePacketReader::getFullData() {
|
||||||
return reinterpret_cast<const uint8_t*>(spHeader);
|
return reinterpret_cast<const uint8_t*>(spHeader);
|
@ -1,13 +1,12 @@
|
|||||||
#ifndef FSFW_TMTCPACKET_SPACEPACKETBASE_H_
|
#ifndef FSFW_TMTCPACKET_SPACEPACKETBASE_H_
|
||||||
#define FSFW_TMTCPACKET_SPACEPACKETBASE_H_
|
#define FSFW_TMTCPACKET_SPACEPACKETBASE_H_
|
||||||
|
|
||||||
#include <fsfw/tmtcpacket/RedirectableDataPointerIF.h>
|
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
#include "ReadablePacketIF.h"
|
|
||||||
#include "ccsds_header.h"
|
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
|
#include "fsfw/tmtcpacket/ReadablePacketIF.h"
|
||||||
|
#include "fsfw/tmtcpacket/RedirectableDataPointerIF.h"
|
||||||
|
#include "fsfw/tmtcpacket/ccsds/defs.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup tmtcpackets Space Packets
|
* @defgroup tmtcpackets Space Packets
|
||||||
@ -46,8 +45,8 @@ class SpacePacketReader : public SpacePacketIF,
|
|||||||
*/
|
*/
|
||||||
~SpacePacketReader() override;
|
~SpacePacketReader() override;
|
||||||
|
|
||||||
[[nodiscard]] uint16_t getPacketId() const override;
|
[[nodiscard]] uint16_t getPacketIdRaw() const override;
|
||||||
[[nodiscard]] uint16_t getPacketSeqCtrl() const override;
|
[[nodiscard]] uint16_t getPacketSeqCtrlRaw() const override;
|
||||||
[[nodiscard]] uint16_t getPacketDataLen() const override;
|
[[nodiscard]] uint16_t getPacketDataLen() const override;
|
||||||
|
|
||||||
const uint8_t* getFullData() override;
|
const uint8_t* getFullData() override;
|
||||||
@ -70,7 +69,7 @@ class SpacePacketReader : public SpacePacketIF,
|
|||||||
* the packet header.
|
* the packet header.
|
||||||
* To be hardware-safe, all elements are of byte size.
|
* To be hardware-safe, all elements are of byte size.
|
||||||
*/
|
*/
|
||||||
const CCSDSPrimaryHeader* spHeader{};
|
const ccsds::PrimaryHeader* spHeader{};
|
||||||
const uint8_t* packetDataField{};
|
const uint8_t* packetDataField{};
|
||||||
size_t maxSize = 0;
|
size_t maxSize = 0;
|
||||||
|
|
36
src/fsfw/tmtcpacket/ccsds/defs.h
Normal file
36
src/fsfw/tmtcpacket/ccsds/defs.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#ifndef CCSDS_HEADER_H_
|
||||||
|
#define CCSDS_HEADER_H_
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace ccsds {
|
||||||
|
|
||||||
|
enum PacketType : uint8_t { TM = 0, TC = 1 };
|
||||||
|
|
||||||
|
enum SequenceFlags : uint8_t {
|
||||||
|
CONTINUATION = 0b00,
|
||||||
|
FIRST_SEGMENT = 0b01,
|
||||||
|
LAST_SEGMENT = 0b10,
|
||||||
|
UNSEGMENTED = 0b11
|
||||||
|
};
|
||||||
|
|
||||||
|
static const uint16_t LIMIT_APID = 2048; // 2^11
|
||||||
|
static const uint16_t LIMIT_SEQUENCE_COUNT = 16384; // 2^14
|
||||||
|
static const uint16_t APID_IDLE_PACKET = 0x7FF;
|
||||||
|
|
||||||
|
constexpr uint16_t getSpacePacketIdFromApid(bool isTc, uint16_t apid,
|
||||||
|
bool secondaryHeaderFlag = true) {
|
||||||
|
return ((isTc << 4) | (secondaryHeaderFlag << 3) | ((apid >> 8) & 0x07)) << 8 | (apid & 0x00ff);
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr uint16_t getTcSpacePacketIdFromApid(uint16_t apid, bool secondaryHeaderFlag = true) {
|
||||||
|
return getSpacePacketIdFromApid(true, apid, secondaryHeaderFlag);
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr uint16_t getTmSpacePacketIdFromApid(uint16_t apid, bool secondaryHeaderFlag = true) {
|
||||||
|
return getSpacePacketIdFromApid(false, apid, secondaryHeaderFlag);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ccsds
|
||||||
|
|
||||||
|
#endif /* CCSDS_HEADER_H_ */
|
29
src/fsfw/tmtcpacket/ccsds/header.cpp
Normal file
29
src/fsfw/tmtcpacket/ccsds/header.cpp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#include "header.h"
|
||||||
|
|
||||||
|
uint16_t ccsds::getPacketId(const PrimaryHeader &header) {
|
||||||
|
return ((header.packetIdHAndVersion & 0x1F00) << 8) + header.packetIdL;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t ccsds::getPacketSeqCtrl(const PrimaryHeader &header) {
|
||||||
|
return (header.packetSeqCtrlH << 8) | header.packetSeqCtrlL;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t ccsds::getVersion(const PrimaryHeader &header) {
|
||||||
|
return (header.packetIdHAndVersion >> 5) & 0b111;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t ccsds::getPacketLen(const PrimaryHeader &header) {
|
||||||
|
return (header.packetLenH << 8) | header.packetLenL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ccsds::setPacketId(PrimaryHeader &header, uint16_t packetId) {
|
||||||
|
header.packetIdHAndVersion = (packetId >> 8) & 0x1F;
|
||||||
|
header.packetIdL = packetId & 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ccsds::setApid(PrimaryHeader &header, uint16_t apid) {
|
||||||
|
uint16_t packetIdRaw = getPacketId(header);
|
||||||
|
packetIdRaw &= ~0x7FF;
|
||||||
|
packetIdRaw |= apid & 0x7FF;
|
||||||
|
setPacketId(header, packetIdRaw);
|
||||||
|
}
|
30
src/fsfw/tmtcpacket/ccsds/header.h
Normal file
30
src/fsfw/tmtcpacket/ccsds/header.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#ifndef FSFW_TMTCPACKET_HEADER_H
|
||||||
|
#define FSFW_TMTCPACKET_HEADER_H
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace ccsds {
|
||||||
|
|
||||||
|
static constexpr size_t HEADER_LEN = 6;
|
||||||
|
|
||||||
|
struct PrimaryHeader {
|
||||||
|
uint8_t packetIdHAndVersion;
|
||||||
|
uint8_t packetIdL;
|
||||||
|
uint8_t packetSeqCtrlH;
|
||||||
|
uint8_t packetSeqCtrlL;
|
||||||
|
uint8_t packetLenH;
|
||||||
|
uint8_t packetLenL;
|
||||||
|
};
|
||||||
|
|
||||||
|
uint16_t getPacketId(const PrimaryHeader& header);
|
||||||
|
uint16_t getPacketSeqCtrl(const PrimaryHeader& header);
|
||||||
|
uint8_t getVersion(const PrimaryHeader& header);
|
||||||
|
uint16_t getPacketLen(const PrimaryHeader& header);
|
||||||
|
|
||||||
|
void setPacketId(PrimaryHeader& header, uint16_t packetId);
|
||||||
|
void setApid(PrimaryHeader& header, uint16_t apid);
|
||||||
|
|
||||||
|
} // namespace ccsds
|
||||||
|
|
||||||
|
#endif // FSFW_TMTCPACKET_HEADER_H
|
@ -1,15 +0,0 @@
|
|||||||
#ifndef CCSDS_HEADER_H_
|
|
||||||
#define CCSDS_HEADER_H_
|
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
struct CCSDSPrimaryHeader {
|
|
||||||
uint8_t packetIdHAndVersion;
|
|
||||||
uint8_t packetIdL;
|
|
||||||
uint8_t packetSeqCtrlH;
|
|
||||||
uint8_t packetSeqCtrlL;
|
|
||||||
uint8_t packetLenH;
|
|
||||||
uint8_t packetLenL;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* CCSDS_HEADER_H_ */
|
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef FSFW_INC_FSFW_TMTCPACKET_CFDP_CFDPPACKET_H_
|
#ifndef FSFW_INC_FSFW_TMTCPACKET_CFDP_CFDPPACKET_H_
|
||||||
#define FSFW_INC_FSFW_TMTCPACKET_CFDP_CFDPPACKET_H_
|
#define FSFW_INC_FSFW_TMTCPACKET_CFDP_CFDPPACKET_H_
|
||||||
|
|
||||||
#include "fsfw/tmtcpacket/SpacePacketReader.h"
|
#include "fsfw/tmtcpacket/ccsds/SpacePacketReader.h"
|
||||||
|
|
||||||
class CfdpReader : public SpacePacketReader {
|
class CfdpReader : public SpacePacketReader {
|
||||||
public:
|
public:
|
||||||
|
@ -32,8 +32,8 @@ PacketMatchTree::~PacketMatchTree() = default;
|
|||||||
ReturnValue_t PacketMatchTree::addMatch(uint16_t apid, uint8_t type, uint8_t subtype) {
|
ReturnValue_t PacketMatchTree::addMatch(uint16_t apid, uint8_t type, uint8_t subtype) {
|
||||||
// We assume adding APID is always requested.
|
// We assume adding APID is always requested.
|
||||||
PusTmMinimal::TmPacketMinimalPointer data{};
|
PusTmMinimal::TmPacketMinimalPointer data{};
|
||||||
data.secHeader.service_type = type;
|
data.secHeader.service = type;
|
||||||
data.secHeader.service_subtype = subtype;
|
data.secHeader.subservice = subtype;
|
||||||
PusTmMinimal testPacket((uint8_t*)&data);
|
PusTmMinimal testPacket((uint8_t*)&data);
|
||||||
testPacket.setApid(apid);
|
testPacket.setApid(apid);
|
||||||
|
|
||||||
@ -122,13 +122,13 @@ ReturnValue_t PacketMatchTree::findOrInsertMatch(iterator startAt, VALUE_T test,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PacketMatchTree::removeMatch(uint16_t apid, uint8_t type, uint8_t subtype) {
|
ReturnValue_t PacketMatchTree::removeMatch(uint16_t apid, uint8_t type, uint8_t subtype) {
|
||||||
PusTmMinimal::TmPacketMinimalPointer data;
|
PusTmMinimal::TmPacketMinimalPointer data{};
|
||||||
data.secHeader.service_type = type;
|
data.secHeader.service = type;
|
||||||
data.secHeader.service_subtype = subtype;
|
data.secHeader.subservice = subtype;
|
||||||
PusTmMinimal testPacket((uint8_t*)&data);
|
PusTmMinimal testPacket((uint8_t*)&data);
|
||||||
testPacket.setApid(apid);
|
testPacket.setApid(apid);
|
||||||
iterator foundElement = findMatch(begin(), &testPacket);
|
iterator foundElement = findMatch(begin(), &testPacket);
|
||||||
if (foundElement == this->end()) {
|
if (foundElement == PacketMatchTree::end()) {
|
||||||
return NO_MATCH;
|
return NO_MATCH;
|
||||||
}
|
}
|
||||||
if (type == 0) {
|
if (type == 0) {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#include "fsfw/tmtcpacket/SpacePacketIF.h"
|
#include "fsfw/tmtcpacket/ccsds/SpacePacketIF.h"
|
||||||
|
|
||||||
class PusIF : public SpacePacketIF {
|
class PusIF : public SpacePacketIF {
|
||||||
public:
|
public:
|
||||||
|
@ -51,9 +51,9 @@ ReturnValue_t PusTcCreator::deSerialize(const uint8_t **buffer, size_t *size,
|
|||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t PusTcCreator::getPacketId() const { return spCreator.getPacketId(); }
|
uint16_t PusTcCreator::getPacketIdRaw() const { return spCreator.getPacketIdRaw(); }
|
||||||
|
|
||||||
uint16_t PusTcCreator::getPacketSeqCtrl() const { return spCreator.getPacketSeqCtrl(); }
|
uint16_t PusTcCreator::getPacketSeqCtrlRaw() const { return spCreator.getPacketSeqCtrlRaw(); }
|
||||||
|
|
||||||
uint16_t PusTcCreator::getPacketDataLen() const { return spCreator.getPacketDataLen(); }
|
uint16_t PusTcCreator::getPacketDataLen() const { return spCreator.getPacketDataLen(); }
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
#define FSFW_TMTCPACKET_TCPACKETDESERIALIZER_H
|
#define FSFW_TMTCPACKET_TCPACKETDESERIALIZER_H
|
||||||
|
|
||||||
#include "fsfw/tmtcpacket/RedirectableDataPointerIF.h"
|
#include "fsfw/tmtcpacket/RedirectableDataPointerIF.h"
|
||||||
#include "fsfw/tmtcpacket/SpacePacketCreator.h"
|
#include "fsfw/tmtcpacket/ccsds/SpacePacketCreator.h"
|
||||||
#include "fsfw/tmtcpacket/SpacePacketIF.h"
|
#include "fsfw/tmtcpacket/ccsds/SpacePacketIF.h"
|
||||||
#include "fsfw/tmtcpacket/pus/definitions.h"
|
#include "fsfw/tmtcpacket/pus/definitions.h"
|
||||||
#include "fsfw/tmtcpacket/pus/tc/PusTcIF.h"
|
#include "fsfw/tmtcpacket/pus/tc/PusTcIF.h"
|
||||||
|
|
||||||
@ -29,8 +29,8 @@ class PusTcCreator : public PusTcIF, public SerializeIF {
|
|||||||
[[nodiscard]] size_t getSerializedSize() const override;
|
[[nodiscard]] size_t getSerializedSize() const override;
|
||||||
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
|
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
|
||||||
Endianness streamEndianness) override;
|
Endianness streamEndianness) override;
|
||||||
[[nodiscard]] uint16_t getPacketId() const override;
|
[[nodiscard]] uint16_t getPacketIdRaw() const override;
|
||||||
[[nodiscard]] uint16_t getPacketSeqCtrl() const override;
|
[[nodiscard]] uint16_t getPacketSeqCtrlRaw() const override;
|
||||||
[[nodiscard]] uint16_t getPacketDataLen() const override;
|
[[nodiscard]] uint16_t getPacketDataLen() const override;
|
||||||
[[nodiscard]] uint8_t getPusVersion() const override;
|
[[nodiscard]] uint8_t getPusVersion() const override;
|
||||||
[[nodiscard]] uint8_t getAcknowledgeFlags() const override;
|
[[nodiscard]] uint8_t getAcknowledgeFlags() const override;
|
||||||
|
@ -45,7 +45,7 @@ class PusTcIF : public PusIF {
|
|||||||
public:
|
public:
|
||||||
~PusTcIF() override = default;
|
~PusTcIF() override = default;
|
||||||
static const size_t MIN_LEN =
|
static const size_t MIN_LEN =
|
||||||
(sizeof(CCSDSPrimaryHeader) + ecss::PusTcDataFieldHeader::MIN_LEN + 2);
|
(sizeof(ccsds::PrimaryHeader) + ecss::PusTcDataFieldHeader::MIN_LEN + 2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a getter for the packet's Ack field, which are the lowest four
|
* This is a getter for the packet's Ack field, which are the lowest four
|
||||||
|
@ -21,10 +21,10 @@ ReturnValue_t PusTcReader::parseData() {
|
|||||||
}
|
}
|
||||||
// Might become variable sized field in the future
|
// Might become variable sized field in the future
|
||||||
size_t secHeaderLen = ecss::PusTcDataFieldHeader::MIN_LEN;
|
size_t secHeaderLen = ecss::PusTcDataFieldHeader::MIN_LEN;
|
||||||
pointers.secHeaderStart = pointers.spHeaderStart + sizeof(CCSDSPrimaryHeader);
|
pointers.secHeaderStart = pointers.spHeaderStart + ccsds::HEADER_LEN;
|
||||||
// TODO: No support for spare bytes yet
|
// TODO: No support for spare bytes yet
|
||||||
pointers.userDataStart = pointers.secHeaderStart + secHeaderLen;
|
pointers.userDataStart = pointers.secHeaderStart + secHeaderLen;
|
||||||
appDataSize = size - (sizeof(CCSDSPrimaryHeader) + secHeaderLen);
|
appDataSize = size - (ccsds::HEADER_LEN + secHeaderLen);
|
||||||
pointers.crcStart = pointers.userDataStart + appDataSize;
|
pointers.crcStart = pointers.userDataStart + appDataSize;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
@ -50,8 +50,8 @@ uint16_t PusTcReader::getErrorControl() const {
|
|||||||
return pointers.crcStart[0] << 8 | pointers.crcStart[1];
|
return pointers.crcStart[0] << 8 | pointers.crcStart[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t PusTcReader::getPacketId() const { return spReader.getPacketId(); }
|
uint16_t PusTcReader::getPacketIdRaw() const { return spReader.getPacketIdRaw(); }
|
||||||
uint16_t PusTcReader::getPacketSeqCtrl() const { return spReader.getPacketSeqCtrl(); }
|
uint16_t PusTcReader::getPacketSeqCtrlRaw() const { return spReader.getPacketSeqCtrlRaw(); }
|
||||||
uint16_t PusTcReader::getPacketDataLen() const { return spReader.getPacketDataLen(); }
|
uint16_t PusTcReader::getPacketDataLen() const { return spReader.getPacketDataLen(); }
|
||||||
uint8_t PusTcReader::getPusVersion() const { return spReader.getVersion(); }
|
uint8_t PusTcReader::getPusVersion() const { return spReader.getVersion(); }
|
||||||
const uint8_t* PusTcReader::getFullData() { return pointers.spHeaderStart; }
|
const uint8_t* PusTcReader::getFullData() { return pointers.spHeaderStart; }
|
||||||
@ -64,6 +64,7 @@ ReturnValue_t PusTcReader::setData(uint8_t* pData, size_t size_, void* args) {
|
|||||||
}
|
}
|
||||||
ReturnValue_t PusTcReader::setData(const uint8_t* data, size_t size_) {
|
ReturnValue_t PusTcReader::setData(const uint8_t* data, size_t size_) {
|
||||||
setData(const_cast<uint8_t*>(data), size_, nullptr);
|
setData(const_cast<uint8_t*>(data), size_, nullptr);
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include "PusTcIF.h"
|
#include "PusTcIF.h"
|
||||||
#include "fsfw/tmtcpacket/RedirectableDataPointerIF.h"
|
#include "fsfw/tmtcpacket/RedirectableDataPointerIF.h"
|
||||||
#include "fsfw/tmtcpacket/SpacePacketReader.h"
|
#include "fsfw/tmtcpacket/ccsds/SpacePacketReader.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is the basic data handler for any ECSS PUS Telecommand packet.
|
* This class is the basic data handler for any ECSS PUS Telecommand packet.
|
||||||
@ -40,8 +40,8 @@ class PusTcReader : public PusTcIF, public ReadablePacketIF, public Redirectable
|
|||||||
* to the screen.
|
* to the screen.
|
||||||
*/
|
*/
|
||||||
// void print();
|
// void print();
|
||||||
[[nodiscard]] uint16_t getPacketId() const override;
|
[[nodiscard]] uint16_t getPacketIdRaw() const override;
|
||||||
[[nodiscard]] uint16_t getPacketSeqCtrl() const override;
|
[[nodiscard]] uint16_t getPacketSeqCtrlRaw() const override;
|
||||||
[[nodiscard]] uint16_t getPacketDataLen() const override;
|
[[nodiscard]] uint16_t getPacketDataLen() const override;
|
||||||
[[nodiscard]] uint8_t getPusVersion() const override;
|
[[nodiscard]] uint8_t getPusVersion() const override;
|
||||||
[[nodiscard]] uint8_t getAcknowledgeFlags() const override;
|
[[nodiscard]] uint8_t getAcknowledgeFlags() const override;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "../definitions.h"
|
#include "../definitions.h"
|
||||||
#include "PusTcReader.h"
|
#include "PusTcReader.h"
|
||||||
#include "fsfw/FSFW.h"
|
#include "fsfw/FSFW.h"
|
||||||
#include "fsfw/tmtcpacket/ccsds_header.h"
|
#include "fsfw/tmtcpacket/ccsds/defs.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This struct defines the data structure of a PUS Telecommand A packet when
|
* This struct defines the data structure of a PUS Telecommand A packet when
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
#include "PusTmCreator.h"
|
#include "PusTmCreator.h"
|
||||||
|
|
||||||
PusTmCreator::PusTmCreator(PusTmParams params_) : params(params_){};
|
PusTmCreator::PusTmCreator(PusTmParams& params_) : params(params_){};
|
||||||
|
|
||||||
uint16_t PusTmCreator::getPacketId() const { return 0; }
|
uint16_t PusTmCreator::getPacketIdRaw() const { return 0; }
|
||||||
uint16_t PusTmCreator::getPacketSeqCtrl() const { return 0; }
|
uint16_t PusTmCreator::getPacketSeqCtrlRaw() const { return 0; }
|
||||||
uint16_t PusTmCreator::getPacketDataLen() const { return 0; }
|
uint16_t PusTmCreator::getPacketDataLen() const { return 0; }
|
||||||
uint8_t PusTmCreator::getPusVersion() const { return 0; }
|
uint8_t PusTmCreator::getPusVersion() const { return 0; }
|
||||||
uint8_t PusTmCreator::getService() const { return 0; }
|
uint8_t PusTmCreator::getService() const { return 0; }
|
||||||
uint8_t PusTmCreator::getSubService() const { return 0; }
|
uint8_t PusTmCreator::getSubService() const { return 0; }
|
||||||
|
const uint8_t* PusTmCreator::getUserData(size_t& appDataLen) const { return nullptr; }
|
||||||
|
uint16_t PusTmCreator::getUserDataSize() const { return 0; }
|
||||||
|
@ -16,16 +16,18 @@ struct PusTmParams {
|
|||||||
class PusTmCreator : public PusIF {
|
class PusTmCreator : public PusIF {
|
||||||
public:
|
public:
|
||||||
~PusTmCreator() override = default;
|
~PusTmCreator() override = default;
|
||||||
explicit PusTmCreator(PusTmParams params);
|
explicit PusTmCreator(PusTmParams& params);
|
||||||
|
|
||||||
[[nodiscard]] uint16_t getPacketId() const override;
|
[[nodiscard]] uint16_t getPacketIdRaw() const override;
|
||||||
[[nodiscard]] uint16_t getPacketSeqCtrl() const override;
|
[[nodiscard]] uint16_t getPacketSeqCtrlRaw() const override;
|
||||||
[[nodiscard]] uint16_t getPacketDataLen() const override;
|
[[nodiscard]] uint16_t getPacketDataLen() const override;
|
||||||
[[nodiscard]] uint8_t getPusVersion() const override;
|
[[nodiscard]] uint8_t getPusVersion() const override;
|
||||||
[[nodiscard]] uint8_t getService() const override;
|
[[nodiscard]] uint8_t getService() const override;
|
||||||
[[nodiscard]] uint8_t getSubService() const override;
|
[[nodiscard]] uint8_t getSubService() const override;
|
||||||
|
const uint8_t* getUserData(size_t& appDataLen) const override;
|
||||||
|
[[nodiscard]] uint16_t getUserDataSize() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PusTmParams params;
|
PusTmParams& params;
|
||||||
};
|
};
|
||||||
#endif // FSFW_TMTCPACKET_TMPACKETCREATOR_H
|
#endif // FSFW_TMTCPACKET_TMPACKETCREATOR_H
|
||||||
|
@ -5,8 +5,9 @@
|
|||||||
|
|
||||||
#include "fsfw/tmtcpacket/pus/PacketTimestampInterpreterIF.h"
|
#include "fsfw/tmtcpacket/pus/PacketTimestampInterpreterIF.h"
|
||||||
|
|
||||||
|
PusTmMinimal::PusTmMinimal(mintm::MinimalPusTm* data) { tmData = data; }
|
||||||
PusTmMinimal::PusTmMinimal(uint8_t* data) {
|
PusTmMinimal::PusTmMinimal(uint8_t* data) {
|
||||||
this->tmData = reinterpret_cast<TmPacketMinimalPointer*>(data);
|
this->tmData = reinterpret_cast<mintm::MinimalPusTm*>(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
PusTmMinimal::~PusTmMinimal() = default;
|
PusTmMinimal::~PusTmMinimal() = default;
|
||||||
@ -27,8 +28,8 @@ void PusTmMinimal::setInterpretTimestampObject(PacketTimestampInterpreterIF* int
|
|||||||
PacketTimestampInterpreterIF* PusTmMinimal::timestampInterpreter = nullptr;
|
PacketTimestampInterpreterIF* PusTmMinimal::timestampInterpreter = nullptr;
|
||||||
// TODO: Implement all of this
|
// TODO: Implement all of this
|
||||||
ReturnValue_t PusTmMinimal::setData(uint8_t* dataPtr, size_t size, void* args) { return 0; }
|
ReturnValue_t PusTmMinimal::setData(uint8_t* dataPtr, size_t size, void* args) { return 0; }
|
||||||
uint16_t PusTmMinimal::getPacketId() const { return 0; }
|
uint16_t PusTmMinimal::getPacketIdRaw() const { return 0; }
|
||||||
uint16_t PusTmMinimal::getPacketSeqCtrl() const { return 0; }
|
uint16_t PusTmMinimal::getPacketSeqCtrlRaw() const { return 0; }
|
||||||
uint16_t PusTmMinimal::getPacketDataLen() const { return 0; }
|
uint16_t PusTmMinimal::getPacketDataLen() const { return 0; }
|
||||||
uint8_t PusTmMinimal::getPusVersion() const { return 0; }
|
uint8_t PusTmMinimal::getPusVersion() const { return 0; }
|
||||||
uint8_t PusTmMinimal::getService() const { return tmData->secHeader.service; }
|
uint8_t PusTmMinimal::getService() const { return tmData->secHeader.service; }
|
||||||
@ -36,7 +37,9 @@ uint8_t PusTmMinimal::getSubService() const { return tmData->secHeader.subservic
|
|||||||
const uint8_t* PusTmMinimal::getUserData(size_t& appDataLen) const { return nullptr; }
|
const uint8_t* PusTmMinimal::getUserData(size_t& appDataLen) const { return nullptr; }
|
||||||
uint16_t PusTmMinimal::getUserDataSize() const { return 0; }
|
uint16_t PusTmMinimal::getUserDataSize() const { return 0; }
|
||||||
uint8_t PusTmMinimal::getScTimeRefStatus() { return 0; }
|
uint8_t PusTmMinimal::getScTimeRefStatus() { return 0; }
|
||||||
uint16_t PusTmMinimal::getMessageTypeCounter() { return tmData->secHeader.messageTypeCounter; }
|
uint16_t PusTmMinimal::getMessageTypeCounter() {
|
||||||
|
return (tmData->secHeader.messageTypeH << 8) | tmData->secHeader.messageTypeL;
|
||||||
|
}
|
||||||
uint16_t PusTmMinimal::getDestId() { return 0; }
|
uint16_t PusTmMinimal::getDestId() { return 0; }
|
||||||
const uint8_t* PusTmMinimal::getTimestamp(size_t& timeStampLen) { return nullptr; }
|
const uint8_t* PusTmMinimal::getTimestamp(size_t& timeStampLen) { return nullptr; }
|
||||||
size_t PusTmMinimal::getTimestampLen() { return 0; }
|
size_t PusTmMinimal::getTimestampLen() { return 0; }
|
||||||
|
@ -3,10 +3,39 @@
|
|||||||
|
|
||||||
#include "PusTmIF.h"
|
#include "PusTmIF.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
#include "fsfw/tmtcpacket/SpacePacketReader.h"
|
#include "fsfw/tmtcpacket/ccsds/SpacePacketReader.h"
|
||||||
|
|
||||||
struct timeval;
|
struct timeval;
|
||||||
|
|
||||||
class PacketTimestampInterpreterIF;
|
class PacketTimestampInterpreterIF;
|
||||||
|
|
||||||
|
namespace mintm {
|
||||||
|
|
||||||
|
// NOTE: Only PUS C compatible!
|
||||||
|
struct PusTmMinimalSecHeader {
|
||||||
|
uint8_t versionAndScTimeRefStatus;
|
||||||
|
uint8_t service;
|
||||||
|
uint8_t subservice;
|
||||||
|
uint8_t messageTypeH;
|
||||||
|
uint8_t messageTypeL;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This struct defines the data structure of a PUS Telecommand Packet when
|
||||||
|
* accessed via a pointer.
|
||||||
|
* @ingroup tmtcpackets
|
||||||
|
*/
|
||||||
|
struct MinimalPusTm {
|
||||||
|
ccsds::PrimaryHeader primary;
|
||||||
|
PusTmMinimalSecHeader secHeader;
|
||||||
|
uint8_t rest;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Must include a checksum and is therefore at least one larger than the above struct.
|
||||||
|
static const uint16_t MINIMUM_SIZE = sizeof(MinimalPusTm) + 1;
|
||||||
|
|
||||||
|
} // namespace mintm
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a minimal version of a PUS TmPacket without any variable field, or,
|
* This is a minimal version of a PUS TmPacket without any variable field, or,
|
||||||
* in other words with Service Type, Subtype and subcounter only.
|
* in other words with Service Type, Subtype and subcounter only.
|
||||||
@ -15,6 +44,7 @@ class PacketTimestampInterpreterIF;
|
|||||||
*/
|
*/
|
||||||
class PusTmMinimal : public PusTmIF, public RedirectableDataPointerIF {
|
class PusTmMinimal : public PusTmIF, public RedirectableDataPointerIF {
|
||||||
public:
|
public:
|
||||||
|
explicit PusTmMinimal(mintm::MinimalPusTm* data);
|
||||||
/**
|
/**
|
||||||
* This is the default constructor.
|
* This is the default constructor.
|
||||||
* It sets its internal data pointer to the address passed and also
|
* It sets its internal data pointer to the address passed and also
|
||||||
@ -33,8 +63,8 @@ class PusTmMinimal : public PusTmIF, public RedirectableDataPointerIF {
|
|||||||
|
|
||||||
static void setInterpretTimestampObject(PacketTimestampInterpreterIF* interpreter);
|
static void setInterpretTimestampObject(PacketTimestampInterpreterIF* interpreter);
|
||||||
ReturnValue_t setData(uint8_t* dataPtr, size_t size, void* args) override;
|
ReturnValue_t setData(uint8_t* dataPtr, size_t size, void* args) override;
|
||||||
[[nodiscard]] uint16_t getPacketId() const override;
|
[[nodiscard]] uint16_t getPacketIdRaw() const override;
|
||||||
[[nodiscard]] uint16_t getPacketSeqCtrl() const override;
|
[[nodiscard]] uint16_t getPacketSeqCtrlRaw() const override;
|
||||||
[[nodiscard]] uint16_t getPacketDataLen() const override;
|
[[nodiscard]] uint16_t getPacketDataLen() const override;
|
||||||
[[nodiscard]] uint8_t getPusVersion() const override;
|
[[nodiscard]] uint8_t getPusVersion() const override;
|
||||||
[[nodiscard]] uint8_t getService() const override;
|
[[nodiscard]] uint8_t getService() const override;
|
||||||
@ -47,27 +77,6 @@ class PusTmMinimal : public PusTmIF, public RedirectableDataPointerIF {
|
|||||||
const uint8_t* getTimestamp(size_t& timeStampLen) override;
|
const uint8_t* getTimestamp(size_t& timeStampLen) override;
|
||||||
size_t getTimestampLen() override;
|
size_t getTimestampLen() override;
|
||||||
|
|
||||||
// NOTE: Only PUS C compatible!
|
|
||||||
struct PusTmMinimalSecHeader {
|
|
||||||
uint8_t versionAndScTimeRefStatus;
|
|
||||||
uint8_t service;
|
|
||||||
uint8_t subservice;
|
|
||||||
uint16_t messageTypeCounter;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This struct defines the data structure of a PUS Telecommand Packet when
|
|
||||||
* accessed via a pointer.
|
|
||||||
* @ingroup tmtcpackets
|
|
||||||
*/
|
|
||||||
struct TmPacketMinimalPointer {
|
|
||||||
CCSDSPrimaryHeader primary;
|
|
||||||
PusTmMinimalSecHeader secHeader;
|
|
||||||
uint8_t rest;
|
|
||||||
};
|
|
||||||
// Must include a checksum and is therefore at least one larger than the above struct.
|
|
||||||
static const uint16_t MINIMUM_SIZE = sizeof(TmPacketMinimalPointer) + 1;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* A pointer to a structure which defines the data structure of
|
* A pointer to a structure which defines the data structure of
|
||||||
@ -75,7 +84,7 @@ class PusTmMinimal : public PusTmIF, public RedirectableDataPointerIF {
|
|||||||
*
|
*
|
||||||
* To be hardware-safe, all elements are of byte size.
|
* To be hardware-safe, all elements are of byte size.
|
||||||
*/
|
*/
|
||||||
TmPacketMinimalPointer* tmData;
|
mintm::MinimalPusTm* tmData;
|
||||||
|
|
||||||
static PacketTimestampInterpreterIF* timestampInterpreter;
|
static PacketTimestampInterpreterIF* timestampInterpreter;
|
||||||
};
|
};
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "fsfw/objectmanager/SystemObjectIF.h"
|
#include "fsfw/objectmanager/SystemObjectIF.h"
|
||||||
#include "fsfw/timemanager/Clock.h"
|
#include "fsfw/timemanager/Clock.h"
|
||||||
#include "fsfw/timemanager/TimeStamperIF.h"
|
#include "fsfw/timemanager/TimeStamperIF.h"
|
||||||
#include "fsfw/tmtcpacket/SpacePacketReader.h"
|
#include "fsfw/tmtcpacket/ccsds/SpacePacketReader.h"
|
||||||
|
|
||||||
namespace Factory {
|
namespace Factory {
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "fsfw/objectmanager/SystemObjectIF.h"
|
#include "fsfw/objectmanager/SystemObjectIF.h"
|
||||||
#include "fsfw/timemanager/Clock.h"
|
#include "fsfw/timemanager/Clock.h"
|
||||||
#include "fsfw/timemanager/TimeStamperIF.h"
|
#include "fsfw/timemanager/TimeStamperIF.h"
|
||||||
#include "fsfw/tmtcpacket/SpacePacketReader.h"
|
#include "fsfw/tmtcpacket/ccsds/SpacePacketReader.h"
|
||||||
|
|
||||||
namespace Factory {
|
namespace Factory {
|
||||||
void setStaticFrameworkObjectIds();
|
void setStaticFrameworkObjectIds();
|
||||||
@ -35,7 +35,7 @@ struct PUSTmDataFieldHeaderPusC {
|
|||||||
* @ingroup tmtcpackets
|
* @ingroup tmtcpackets
|
||||||
*/
|
*/
|
||||||
struct TmPacketPointerPusC {
|
struct TmPacketPointerPusC {
|
||||||
CCSDSPrimaryHeader primary;
|
ccsds::PrimaryHeader primary;
|
||||||
PUSTmDataFieldHeaderPusC dataField;
|
PUSTmDataFieldHeaderPusC dataField;
|
||||||
uint8_t data;
|
uint8_t data;
|
||||||
};
|
};
|
||||||
@ -52,7 +52,7 @@ class TmPacketPusC : public TmPacketBase {
|
|||||||
* This constant defines the minimum size of a valid PUS Telemetry Packet.
|
* This constant defines the minimum size of a valid PUS Telemetry Packet.
|
||||||
*/
|
*/
|
||||||
static const uint32_t TM_PACKET_MIN_SIZE =
|
static const uint32_t TM_PACKET_MIN_SIZE =
|
||||||
(sizeof(CCSDSPrimaryHeader) + sizeof(PUSTmDataFieldHeaderPusC) + 2);
|
ccsds::HEADER_LEN + sizeof(PUSTmDataFieldHeaderPusC) + 2;
|
||||||
//! Maximum size of a TM Packet in this mission.
|
//! Maximum size of a TM Packet in this mission.
|
||||||
static const uint32_t MISSION_TM_PACKET_MAX_SIZE = fsfwconfig::FSFW_MAX_TM_PACKET_SIZE;
|
static const uint32_t MISSION_TM_PACKET_MAX_SIZE = fsfwconfig::FSFW_MAX_TM_PACKET_SIZE;
|
||||||
|
|
||||||
|
@ -1,72 +1,73 @@
|
|||||||
#ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTOREDPUSC_H_
|
//#ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTOREDPUSC_H_
|
||||||
#define FSFW_TMTCPACKET_PUS_TMPACKETSTOREDPUSC_H_
|
//#define FSFW_TMTCPACKET_PUS_TMPACKETSTOREDPUSC_H_
|
||||||
|
//
|
||||||
#include "TmPacketPusC.h"
|
//#include "TmPacketPusC.h"
|
||||||
#include "TmPacketStoredBase.h"
|
//#include "TmPacketStoredBase.h"
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* This class generates a ECSS PUS C Telemetry packet within a given
|
// * This class generates a ECSS PUS C Telemetry packet within a given
|
||||||
* intermediate storage.
|
// * intermediate storage.
|
||||||
* As most packets are passed between tasks with the help of a storage
|
// * As most packets are passed between tasks with the help of a storage
|
||||||
* anyway, it seems logical to create a Packet-In-Storage access class
|
// * anyway, it seems logical to create a Packet-In-Storage access class
|
||||||
* which saves the user almost all storage handling operation.
|
// * which saves the user almost all storage handling operation.
|
||||||
* Packets can both be newly created with the class and be "linked" to
|
// * Packets can both be newly created with the class and be "linked" to
|
||||||
* packets in a store with the help of a storeAddress.
|
// * packets in a store with the help of a storeAddress.
|
||||||
* @ingroup tmtcpackets
|
// * @ingroup tmtcpackets
|
||||||
*/
|
// */
|
||||||
class TmPacketStoredPusC : public TmPacketStoredBase, public TmPacketPusC {
|
// class TmPacketStoredPusC : public TmPacketStoredBase, public TmPacketPusC {
|
||||||
public:
|
// public:
|
||||||
/**
|
// /**
|
||||||
* This is a default constructor which does not set the data pointer.
|
// * This is a default constructor which does not set the data pointer.
|
||||||
* However, it does try to set the packet store.
|
// * However, it does try to set the packet store.
|
||||||
*/
|
// */
|
||||||
TmPacketStoredPusC(store_address_t setAddress);
|
// TmPacketStoredPusC(store_address_t setAddress);
|
||||||
/**
|
// /**
|
||||||
* With this constructor, new space is allocated in the packet store and
|
// * With this constructor, new space is allocated in the packet store and
|
||||||
* a new PUS Telemetry Packet is created there.
|
// * a new PUS Telemetry Packet is created there.
|
||||||
* Packet Application Data passed in data is copied into the packet.
|
// * Packet Application Data passed in data is copied into the packet.
|
||||||
* The Application data is passed in two parts, first a header, then a
|
// * The Application data is passed in two parts, first a header, then a
|
||||||
* data field. This allows building a Telemetry Packet from two separate
|
// * data field. This allows building a Telemetry Packet from two separate
|
||||||
* data sources.
|
// * data sources.
|
||||||
* @param apid Sets the packet's APID field.
|
// * @param apid Sets the packet's APID field.
|
||||||
* @param service Sets the packet's Service ID field.
|
// * @param service Sets the packet's Service ID field.
|
||||||
* This specifies the source service.
|
// * This specifies the source service.
|
||||||
* @param subservice Sets the packet's Service Subtype field.
|
// * @param subservice Sets the packet's Service Subtype field.
|
||||||
* This specifies the source sub-service.
|
// * This specifies the source sub-service.
|
||||||
* @param packet_counter Sets the Packet counter field of this packet
|
// * @param packet_counter Sets the Packet counter field of this packet
|
||||||
* @param data The payload data to be copied to the
|
// * @param data The payload data to be copied to the
|
||||||
* Application Data Field
|
// * Application Data Field
|
||||||
* @param size The amount of data to be copied.
|
// * @param size The amount of data to be copied.
|
||||||
* @param headerData The header Data of the Application field,
|
// * @param headerData The header Data of the Application field,
|
||||||
* will be copied in front of data
|
// * will be copied in front of data
|
||||||
* @param headerSize The size of the headerDataF
|
// * @param headerSize The size of the headerDataF
|
||||||
* @param destinationId Destination ID containing the application process ID as specified
|
// * @param destinationId Destination ID containing the application process ID as specified
|
||||||
* by PUS C
|
// * by PUS C
|
||||||
* @param timeRefField 4 bit time reference field as specified by PUS C
|
// * @param timeRefField 4 bit time reference field as specified by PUS C
|
||||||
*/
|
// */
|
||||||
TmPacketStoredPusC(uint16_t apid, uint8_t service, uint8_t subservice, uint16_t packetCounter = 0,
|
// TmPacketStoredPusC(uint16_t apid, uint8_t service, uint8_t subservice, uint16_t packetCounter =
|
||||||
const uint8_t* data = nullptr, uint32_t size = 0,
|
// 0,
|
||||||
const uint8_t* headerData = nullptr, uint32_t headerSize = 0,
|
// const uint8_t* data = nullptr, uint32_t size = 0,
|
||||||
uint16_t destinationId = 0, uint8_t timeRefField = 0);
|
// const uint8_t* headerData = nullptr, uint32_t headerSize = 0,
|
||||||
/**
|
// uint16_t destinationId = 0, uint8_t timeRefField = 0);
|
||||||
* Another ctor to directly pass structured content and header data to the
|
// /**
|
||||||
* packet to avoid additional buffers.
|
// * Another ctor to directly pass structured content and header data to the
|
||||||
*/
|
// * packet to avoid additional buffers.
|
||||||
TmPacketStoredPusC(uint16_t apid, uint8_t service, uint8_t subservice, uint16_t packetCounter,
|
// */
|
||||||
SerializeIF* content, SerializeIF* header = nullptr,
|
// TmPacketStoredPusC(uint16_t apid, uint8_t service, uint8_t subservice, uint16_t packetCounter,
|
||||||
uint16_t destinationId = 0, uint8_t timeRefField = 0);
|
// SerializeIF* content, SerializeIF* header = nullptr,
|
||||||
|
// uint16_t destinationId = 0, uint8_t timeRefField = 0);
|
||||||
uint8_t* getAllTmData() override;
|
//
|
||||||
|
// uint8_t* getAllTmData() override;
|
||||||
private:
|
//
|
||||||
/**
|
// private:
|
||||||
* Implementation required by base class
|
// /**
|
||||||
* @param newPointer
|
// * Implementation required by base class
|
||||||
* @param maxSize
|
// * @param newPointer
|
||||||
* @param args
|
// * @param maxSize
|
||||||
* @return
|
// * @param args
|
||||||
*/
|
// * @return
|
||||||
ReturnValue_t setData(uint8_t* newPointer, size_t maxSize, void* args) override;
|
// */
|
||||||
};
|
// ReturnValue_t setData(uint8_t* newPointer, size_t maxSize, void* args) override;
|
||||||
|
//};
|
||||||
#endif /* FSFW_TMTCPACKET_PUS_TMPACKETSTOREDPUSC_H_ */
|
//
|
||||||
|
//#endif /* FSFW_TMTCPACKET_PUS_TMPACKETSTOREDPUSC_H_ */
|
||||||
|
@ -6,4 +6,5 @@ target_sources(
|
|||||||
TmTcBridge.cpp
|
TmTcBridge.cpp
|
||||||
TmTcMessage.cpp
|
TmTcMessage.cpp
|
||||||
VerificationReporter.cpp
|
VerificationReporter.cpp
|
||||||
SpacePacketParser.cpp)
|
SpacePacketParser.cpp
|
||||||
|
TmStoreHelper.cpp)
|
||||||
|
@ -12,8 +12,8 @@ object_id_t PusServiceBase::packetSource = 0;
|
|||||||
object_id_t PusServiceBase::packetDestination = 0;
|
object_id_t PusServiceBase::packetDestination = 0;
|
||||||
|
|
||||||
PusServiceBase::PusServiceBase(object_id_t setObjectId, uint16_t setApid, uint8_t setServiceId,
|
PusServiceBase::PusServiceBase(object_id_t setObjectId, uint16_t setApid, uint8_t setServiceId,
|
||||||
StorageManagerIF* store_)
|
StorageManagerIF* ipcStore_)
|
||||||
: SystemObject(setObjectId), apid(setApid), serviceId(setServiceId), store(store_) {
|
: SystemObject(setObjectId), apid(setApid), serviceId(setServiceId), ipcStore(ipcStore_) {
|
||||||
requestQueue = QueueFactory::instance()->createMessageQueue(PUS_SERVICE_MAX_RECEPTION);
|
requestQueue = QueueFactory::instance()->createMessageQueue(PUS_SERVICE_MAX_RECEPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ void PusServiceBase::handleRequestQueue() {
|
|||||||
if (status == RETURN_OK) {
|
if (status == RETURN_OK) {
|
||||||
const uint8_t* dataPtr;
|
const uint8_t* dataPtr;
|
||||||
size_t dataLen = 0;
|
size_t dataLen = 0;
|
||||||
result = store->getData(message.getStorageId(), &dataPtr, &dataLen);
|
result = ipcStore->getData(message.getStorageId(), &dataPtr, &dataLen);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
// TODO: Warning?
|
// TODO: Warning?
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ void PusServiceBase::handleRequestQueue() {
|
|||||||
&this->currentPacket, result, 0, errorParameter1,
|
&this->currentPacket, result, 0, errorParameter1,
|
||||||
errorParameter2);
|
errorParameter2);
|
||||||
}
|
}
|
||||||
store->deleteData(message.getStorageId());
|
ipcStore->deleteData(message.getStorageId());
|
||||||
errorParameter1 = 0;
|
errorParameter1 = 0;
|
||||||
errorParameter2 = 0;
|
errorParameter2 = 0;
|
||||||
} else if (status == MessageQueueIF::EMPTY) {
|
} else if (status == MessageQueueIF::EMPTY) {
|
||||||
@ -112,6 +112,12 @@ ReturnValue_t PusServiceBase::initialize() {
|
|||||||
}
|
}
|
||||||
this->requestQueue->setDefaultDestination(destService->getReportReceptionQueue());
|
this->requestQueue->setDefaultDestination(destService->getReportReceptionQueue());
|
||||||
distributor->registerService(this);
|
distributor->registerService(this);
|
||||||
|
if (ipcStore == nullptr) {
|
||||||
|
ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
||||||
|
if (ipcStore == nullptr) {
|
||||||
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
|
}
|
||||||
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ class PusServiceBase : public ExecutableObjectIF,
|
|||||||
* The Service Identifier as specified in ECSS PUS.
|
* The Service Identifier as specified in ECSS PUS.
|
||||||
*/
|
*/
|
||||||
PusServiceBase(object_id_t setObjectId, uint16_t setApid, uint8_t setServiceId,
|
PusServiceBase(object_id_t setObjectId, uint16_t setApid, uint8_t setServiceId,
|
||||||
StorageManagerIF* store);
|
StorageManagerIF* ipcStore);
|
||||||
/**
|
/**
|
||||||
* The destructor is empty.
|
* The destructor is empty.
|
||||||
*/
|
*/
|
||||||
@ -144,7 +144,7 @@ class PusServiceBase : public ExecutableObjectIF,
|
|||||||
* It is deleted after handleRequest was executed.
|
* It is deleted after handleRequest was executed.
|
||||||
*/
|
*/
|
||||||
// TcPacketStoredPus currentPacket;
|
// TcPacketStoredPus currentPacket;
|
||||||
StorageManagerIF* store;
|
StorageManagerIF* ipcStore;
|
||||||
PusTcReader currentPacket;
|
PusTcReader currentPacket;
|
||||||
|
|
||||||
static object_id_t packetSource;
|
static object_id_t packetSource;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef FSFW_TMTCSERVICES_SOURCESEQUENCECOUNTER_H_
|
#ifndef FSFW_TMTCSERVICES_SOURCESEQUENCECOUNTER_H_
|
||||||
#define FSFW_TMTCSERVICES_SOURCESEQUENCECOUNTER_H_
|
#define FSFW_TMTCSERVICES_SOURCESEQUENCECOUNTER_H_
|
||||||
|
|
||||||
#include "../tmtcpacket/SpacePacketReader.h"
|
#include "fsfw/tmtcpacket/ccsds/SpacePacketReader.h"
|
||||||
|
|
||||||
class SourceSequenceCounter {
|
class SourceSequenceCounter {
|
||||||
private:
|
private:
|
||||||
|
43
src/fsfw/tmtcservices/TmStoreHelper.cpp
Normal file
43
src/fsfw/tmtcservices/TmStoreHelper.cpp
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#include "TmStoreHelper.h"
|
||||||
|
|
||||||
|
#include "TmTcMessage.h"
|
||||||
|
#include "fsfw/ipc/MessageQueueSenderIF.h"
|
||||||
|
|
||||||
|
TmStoreHelper::TmStoreHelper(StorageManagerIF *tmStore, MessageQueueId_t tmtcMsgDest,
|
||||||
|
MessageQueueId_t tmtcMsgSrc, InternalErrorReporterIF *reporter)
|
||||||
|
: creator(params),
|
||||||
|
tmtcMsgDest(tmtcMsgDest),
|
||||||
|
tmtcMsgSrc(tmtcMsgSrc),
|
||||||
|
errReporter(reporter),
|
||||||
|
tmStore(tmStore) {}
|
||||||
|
|
||||||
|
void TmStoreHelper::preparePacket(uint16_t apid, uint8_t service, uint8_t subservice,
|
||||||
|
uint16_t counter) {
|
||||||
|
// TODO: Implement
|
||||||
|
// creator.setApid(apid);
|
||||||
|
params.service = service;
|
||||||
|
params.subservice = subservice;
|
||||||
|
params.messageTypeCounter = counter;
|
||||||
|
// TODO: Implement serialize and then serialize into the store
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t TmStoreHelper::sendPacket() {
|
||||||
|
TmTcMessage tmMessage(currentAddr);
|
||||||
|
ReturnValue_t result = MessageQueueSenderIF::sendMessage(tmtcMsgDest, &tmMessage, tmtcMsgSrc);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
tmStore->deleteData(currentAddr);
|
||||||
|
if (errReporter != nullptr) {
|
||||||
|
errReporter->lostTm();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TmStoreHelper::setMsgDestination(MessageQueueId_t msgDest) { tmtcMsgDest = msgDest; }
|
||||||
|
|
||||||
|
void TmStoreHelper::setMsgSource(MessageQueueId_t msgSrc) { tmtcMsgSrc = msgSrc; }
|
||||||
|
|
||||||
|
void TmStoreHelper::setInternalErrorReporter(InternalErrorReporterIF *reporter) {
|
||||||
|
errReporter = reporter;
|
||||||
|
}
|
33
src/fsfw/tmtcservices/TmStoreHelper.h
Normal file
33
src/fsfw/tmtcservices/TmStoreHelper.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#ifndef FSFW_TMTCSERVICES_STOREHELPER_H
|
||||||
|
#define FSFW_TMTCSERVICES_STOREHELPER_H
|
||||||
|
|
||||||
|
#include "fsfw/internalerror/InternalErrorReporterIF.h"
|
||||||
|
#include "fsfw/ipc/MessageQueueMessageIF.h"
|
||||||
|
#include "fsfw/storagemanager/StorageManagerIF.h"
|
||||||
|
#include "fsfw/tmtcpacket/pus/tm/PusTmCreator.h"
|
||||||
|
|
||||||
|
// TODO: Serializing a packet into a store and sending the message are two different tasks
|
||||||
|
// Move them into separate classes
|
||||||
|
class TmStoreHelper {
|
||||||
|
public:
|
||||||
|
TmStoreHelper(StorageManagerIF* tmStore, MessageQueueId_t tmtcMsgDest,
|
||||||
|
MessageQueueId_t tmtcMsgSrc, InternalErrorReporterIF* reporter);
|
||||||
|
|
||||||
|
void setInternalErrorReporter(InternalErrorReporterIF* reporter);
|
||||||
|
void setMsgDestination(MessageQueueId_t msgDest);
|
||||||
|
void setMsgSource(MessageQueueId_t msgSrc);
|
||||||
|
void preparePacket(uint16_t apid, uint8_t service, uint8_t subservice, uint16_t counter);
|
||||||
|
ReturnValue_t sendPacket();
|
||||||
|
|
||||||
|
private:
|
||||||
|
PusTmParams params{};
|
||||||
|
PusTmCreator creator;
|
||||||
|
|
||||||
|
bool doErrorReporting = true;
|
||||||
|
MessageQueueId_t tmtcMsgDest;
|
||||||
|
MessageQueueId_t tmtcMsgSrc;
|
||||||
|
InternalErrorReporterIF* errReporter;
|
||||||
|
store_address_t currentAddr{};
|
||||||
|
StorageManagerIF* tmStore;
|
||||||
|
};
|
||||||
|
#endif // FSFW_TMTCSERVICES_STOREHELPER_H
|
@ -22,8 +22,8 @@ void VerificationReporter::sendSuccessReport(uint8_t set_report_id, PusTcReader*
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PusVerificationMessage message(set_report_id, currentPacket->getAcknowledgeFlags(),
|
PusVerificationMessage message(set_report_id, currentPacket->getAcknowledgeFlags(),
|
||||||
currentPacket->getPacketId(), currentPacket->getPacketSeqCtrl(), 0,
|
currentPacket->getPacketIdRaw(),
|
||||||
set_step);
|
currentPacket->getPacketSeqCtrlRaw(), 0, set_step);
|
||||||
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, &message);
|
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, &message);
|
||||||
if (status != HasReturnvaluesIF::RETURN_OK) {
|
if (status != HasReturnvaluesIF::RETURN_OK) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
@ -59,9 +59,9 @@ void VerificationReporter::sendFailureReport(uint8_t report_id, PusTcReader* cur
|
|||||||
if (currentPacket == nullptr) {
|
if (currentPacket == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PusVerificationMessage message(report_id, currentPacket->getAcknowledgeFlags(),
|
PusVerificationMessage message(
|
||||||
currentPacket->getPacketId(), currentPacket->getPacketSeqCtrl(),
|
report_id, currentPacket->getAcknowledgeFlags(), currentPacket->getPacketIdRaw(),
|
||||||
error_code, step, parameter1, parameter2);
|
currentPacket->getPacketSeqCtrlRaw(), error_code, step, parameter1, parameter2);
|
||||||
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, &message);
|
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, &message);
|
||||||
if (status != HasReturnvaluesIF::RETURN_OK) {
|
if (status != HasReturnvaluesIF::RETURN_OK) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
@ -2,11 +2,12 @@
|
|||||||
#include <catch2/catch_test_macros.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "fsfw/tmtcpacket/SpacePacketCreator.h"
|
#include "fsfw/tmtcpacket/ccsds/SpacePacketCreator.h"
|
||||||
|
|
||||||
TEST_CASE("CCSDS Creator", "[ccsds-creator]") {
|
TEST_CASE("CCSDS Creator", "[ccsds-creator]") {
|
||||||
SpacePacketCreator base = SpacePacketCreator(ccsds::PacketType::TC, true, 0x02,
|
auto params = SpacePacketParams(PacketId(ccsds::PacketType::TC, true, 0x02),
|
||||||
ccsds::SequenceFlags::FIRST_SEGMENT, 0x34, 0x16);
|
PacketSeqCtrl(ccsds::SequenceFlags::FIRST_SEGMENT, 0x34), 0x16);
|
||||||
|
SpacePacketCreator base = SpacePacketCreator(params);
|
||||||
std::array<uint8_t, 6> buf{};
|
std::array<uint8_t, 6> buf{};
|
||||||
uint8_t* bufPtr = buf.data();
|
uint8_t* bufPtr = buf.data();
|
||||||
size_t serLen = 0;
|
size_t serLen = 0;
|
||||||
@ -27,7 +28,7 @@ TEST_CASE("CCSDS Creator", "[ccsds-creator]") {
|
|||||||
REQUIRE(base.getSequenceCount() == 0x34);
|
REQUIRE(base.getSequenceCount() == 0x34);
|
||||||
REQUIRE(base.getPacketDataLen() == 0x16);
|
REQUIRE(base.getPacketDataLen() == 0x16);
|
||||||
REQUIRE(base.getPacketType() == ccsds::PacketType::TC);
|
REQUIRE(base.getPacketType() == ccsds::PacketType::TC);
|
||||||
REQUIRE(base.getPacketId() == 0x1802);
|
REQUIRE(base.getPacketIdRaw() == 0x1802);
|
||||||
REQUIRE(base.getSerializedSize() == 6);
|
REQUIRE(base.getSerializedSize() == 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,17 +72,15 @@ TEST_CASE("CCSDS Creator", "[ccsds-creator]") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SECTION("Invalid APID") {
|
SECTION("Invalid APID") {
|
||||||
SpacePacketCreator invalid =
|
SpacePacketCreator invalid = SpacePacketCreator(
|
||||||
SpacePacketCreator(PacketId(ccsds::PacketType::TC, true, 0xFFFF),
|
ccsds::PacketType::TC, true, 0xFFFF, ccsds::SequenceFlags::FIRST_SEGMENT, 0x34, 0x16);
|
||||||
PacketSeqCtrl(ccsds::SequenceFlags::FIRST_SEGMENT, 0x34), 0x16);
|
|
||||||
REQUIRE(not invalid.isValid());
|
REQUIRE(not invalid.isValid());
|
||||||
REQUIRE(invalid.serialize(&bufPtr, &serLen, buf.size()) == HasReturnvaluesIF::RETURN_FAILED);
|
REQUIRE(invalid.serialize(&bufPtr, &serLen, buf.size()) == HasReturnvaluesIF::RETURN_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("Invalid Seq Count") {
|
SECTION("Invalid Seq Count") {
|
||||||
SpacePacketCreator invalid =
|
SpacePacketCreator invalid = SpacePacketCreator(
|
||||||
SpacePacketCreator(PacketId(ccsds::PacketType::TC, true, 0x02),
|
ccsds::PacketType::TC, true, 0x02, ccsds::SequenceFlags::FIRST_SEGMENT, 0xFFFF, 0x16);
|
||||||
PacketSeqCtrl(ccsds::SequenceFlags::FIRST_SEGMENT, 0xFFFF), 0x16);
|
|
||||||
REQUIRE(not invalid.isValid());
|
REQUIRE(not invalid.isValid());
|
||||||
REQUIRE(invalid.serialize(&bufPtr, &serLen, buf.size()) == HasReturnvaluesIF::RETURN_FAILED);
|
REQUIRE(invalid.serialize(&bufPtr, &serLen, buf.size()) == HasReturnvaluesIF::RETURN_FAILED);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <catch2/catch_test_macros.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
|
||||||
#include "fsfw/tmtcpacket/SpacePacketReader.h"
|
#include "fsfw/tmtcpacket/ccsds/SpacePacketReader.h"
|
||||||
|
|
||||||
TEST_CASE("CCSDS Reader", "[ccsds-reader]") {}
|
TEST_CASE("CCSDS Reader", "[ccsds-reader]") {}
|
Loading…
Reference in New Issue
Block a user