add setter function for source seq counter

This commit is contained in:
Robin Müller 2024-04-29 13:18:29 +02:00
parent fb2e480705
commit 73bf1cc229
Signed by: muellerr
GPG Key ID: A649FB78196E3849

View File

@ -1,7 +1,7 @@
#ifndef FSFW_TMTCSERVICES_SOURCESEQUENCECOUNTER_H_
#define FSFW_TMTCSERVICES_SOURCESEQUENCECOUNTER_H_
#include "fsfw/tmtcpacket/ccsds/SpacePacketReader.h"
#include "fsfw/tmtcpacket/ccsds/defs.h"
class SourceSequenceCounter {
private:
@ -9,6 +9,7 @@ class SourceSequenceCounter {
public:
SourceSequenceCounter(uint16_t initialSequenceCount = 0) : sequenceCount(initialSequenceCount) {}
void increment() { sequenceCount = (sequenceCount + 1) % (ccsds::LIMIT_SEQUENCE_COUNT); }
void decrement() { sequenceCount = (sequenceCount - 1) % (ccsds::LIMIT_SEQUENCE_COUNT); }
uint16_t get() const { return this->sequenceCount; }
@ -25,6 +26,7 @@ class SourceSequenceCounter {
sequenceCount = newCount;
return *this;
}
void set(uint16_t sequenceCount) { this->sequenceCount = sequenceCount; }
operator uint16_t() { return this->get(); }
};