add setter function for source seq counter
This commit is contained in:
parent
fb2e480705
commit
73bf1cc229
@ -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 "fsfw/tmtcpacket/ccsds/SpacePacketReader.h"
|
#include "fsfw/tmtcpacket/ccsds/defs.h"
|
||||||
|
|
||||||
class SourceSequenceCounter {
|
class SourceSequenceCounter {
|
||||||
private:
|
private:
|
||||||
@ -9,6 +9,7 @@ class SourceSequenceCounter {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
SourceSequenceCounter(uint16_t initialSequenceCount = 0) : sequenceCount(initialSequenceCount) {}
|
SourceSequenceCounter(uint16_t initialSequenceCount = 0) : sequenceCount(initialSequenceCount) {}
|
||||||
|
|
||||||
void increment() { sequenceCount = (sequenceCount + 1) % (ccsds::LIMIT_SEQUENCE_COUNT); }
|
void increment() { sequenceCount = (sequenceCount + 1) % (ccsds::LIMIT_SEQUENCE_COUNT); }
|
||||||
void decrement() { sequenceCount = (sequenceCount - 1) % (ccsds::LIMIT_SEQUENCE_COUNT); }
|
void decrement() { sequenceCount = (sequenceCount - 1) % (ccsds::LIMIT_SEQUENCE_COUNT); }
|
||||||
uint16_t get() const { return this->sequenceCount; }
|
uint16_t get() const { return this->sequenceCount; }
|
||||||
@ -25,6 +26,7 @@ class SourceSequenceCounter {
|
|||||||
sequenceCount = newCount;
|
sequenceCount = newCount;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
void set(uint16_t sequenceCount) { this->sequenceCount = sequenceCount; }
|
||||||
|
|
||||||
operator uint16_t() { return this->get(); }
|
operator uint16_t() { return this->get(); }
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user