From 8d3fceea8f08c4f8f3aadc34e0d3aa3f5a7f75f6 Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" <–meierj@irs.uni-stuttgart.de> Date: Sun, 8 Aug 2021 15:26:18 +0200 Subject: [PATCH] set sequence flags in space packet base --- src/fsfw/action/ActionHelper.cpp | 11 +++++++++++ src/fsfw/tmtcpacket/SpacePacketBase.cpp | 5 +++++ src/fsfw/tmtcpacket/SpacePacketBase.h | 7 +++++++ 3 files changed, 23 insertions(+) diff --git a/src/fsfw/action/ActionHelper.cpp b/src/fsfw/action/ActionHelper.cpp index 3e9d121a..85c39f05 100644 --- a/src/fsfw/action/ActionHelper.cpp +++ b/src/fsfw/action/ActionHelper.cpp @@ -32,6 +32,17 @@ ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) { setQueueToUse(queueToUse_); } + if(queueToUse == nullptr) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "ActionHelper::initialize: No queue set" << std::endl; +#else + sif::printWarning("ActionHelper::initialize: No queue set\n"); +#endif +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + return HasReturnvaluesIF::RETURN_FAILED; + } + return HasReturnvaluesIF::RETURN_OK; } diff --git a/src/fsfw/tmtcpacket/SpacePacketBase.cpp b/src/fsfw/tmtcpacket/SpacePacketBase.cpp index e9a0b836..5dae94c9 100644 --- a/src/fsfw/tmtcpacket/SpacePacketBase.cpp +++ b/src/fsfw/tmtcpacket/SpacePacketBase.cpp @@ -54,6 +54,11 @@ void SpacePacketBase::setAPID( uint16_t new_apid ) { this->data->header.packet_id_l = ( new_apid & 0x00FF ); } +void SpacePacketBase::setSequenceFlags( uint8_t sequenceflags ) { + this->data->header.sequence_control_h &= 0x3F; + this->data->header.sequence_control_h |= sequenceflags << 6; +} + uint16_t SpacePacketBase::getPacketSequenceControl( void ) { return ( (this->data->header.sequence_control_h) << 8 ) + this->data->header.sequence_control_l; diff --git a/src/fsfw/tmtcpacket/SpacePacketBase.h b/src/fsfw/tmtcpacket/SpacePacketBase.h index 13cb3130..3cd3e552 100644 --- a/src/fsfw/tmtcpacket/SpacePacketBase.h +++ b/src/fsfw/tmtcpacket/SpacePacketBase.h @@ -109,6 +109,13 @@ public: * ignored. */ void setAPID( uint16_t setAPID ); + + /** + * Sets the sequence flags of a packet, which are bit 17 and 18 in the space packet header. + * @param The sequence flags to set + */ + void setSequenceFlags( uint8_t sequenceflags ); + /** * Returns the CCSDS packet sequence control field, which are the third and * the fourth byte of the CCSDS primary header.