fsfw/src/fsfw/tmtcpacket/packetmatcher/ApidMatcher.h

36 lines
1.3 KiB
C
Raw Normal View History

2021-06-14 15:14:57 +02:00
#ifndef FSFW_TMTCPACKET_PACKETMATCHER_APIDMATCHER_H_
#define FSFW_TMTCPACKET_PACKETMATCHER_APIDMATCHER_H_
2020-08-13 20:53:35 +02:00
#include "../../globalfunctions/matching/SerializeableMatcherIF.h"
#include "../../serialize/SerializeAdapter.h"
2021-06-14 10:19:01 +02:00
#include "../../tmtcpacket/pus/tm/TmPacketMinimal.h"
2022-02-02 10:29:30 +01:00
class ApidMatcher : public SerializeableMatcherIF<TmPacketMinimal*> {
private:
uint16_t apid;
public:
2022-07-18 10:20:26 +02:00
explicit ApidMatcher(uint16_t setApid) : apid(setApid) {}
explicit ApidMatcher(TmPacketMinimal* test) : apid(test->getApid()) {}
bool match(TmPacketMinimal* packet) override {
if (packet->getApid() == apid) {
2022-02-02 10:29:30 +01:00
return true;
} else {
return false;
2021-06-14 15:14:57 +02:00
}
2022-02-02 10:29:30 +01:00
}
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
2022-07-18 10:20:26 +02:00
Endianness streamEndianness) const override {
2022-02-02 10:29:30 +01:00
return SerializeAdapter::serialize(&apid, buffer, size, maxSize, streamEndianness);
}
2022-07-18 10:20:26 +02:00
[[nodiscard]] size_t getSerializedSize() const override {
return SerializeAdapter::getSerializedSize(&apid);
}
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness) override {
2022-02-02 10:29:30 +01:00
return SerializeAdapter::deSerialize(&apid, buffer, size, streamEndianness);
}
};
2022-07-18 10:20:26 +02:00
#endif /* FSFW_TMTCPACKET_PACKETMATCHER_APIDMATCHER_H_ */