2021-06-14 15:14:57 +02:00
|
|
|
#ifndef FSFW_TMTCPACKET_PACKETMATCHER_APIDMATCHER_H_
|
|
|
|
#define FSFW_TMTCPACKET_PACKETMATCHER_APIDMATCHER_H_
|
2016-06-15 23:48:41 +02:00
|
|
|
|
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"
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
class ApidMatcher: public SerializeableMatcherIF<TmPacketMinimal*> {
|
|
|
|
private:
|
2021-06-14 15:14:57 +02:00
|
|
|
uint16_t apid;
|
2016-06-15 23:48:41 +02:00
|
|
|
public:
|
2021-06-14 15:14:57 +02:00
|
|
|
ApidMatcher(uint16_t setApid) :
|
|
|
|
apid(setApid) {
|
|
|
|
}
|
|
|
|
ApidMatcher(TmPacketMinimal* test) :
|
|
|
|
apid(test->getAPID()) {
|
|
|
|
}
|
|
|
|
bool match(TmPacketMinimal* packet) {
|
|
|
|
if (packet->getAPID() == apid) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
|
|
|
size_t maxSize, Endianness streamEndianness) const {
|
|
|
|
return SerializeAdapter::serialize(&apid, buffer, size, maxSize, streamEndianness);
|
|
|
|
}
|
|
|
|
size_t getSerializedSize() const {
|
|
|
|
return SerializeAdapter::getSerializedSize(&apid);
|
|
|
|
}
|
|
|
|
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
|
|
|
Endianness streamEndianness) {
|
|
|
|
return SerializeAdapter::deSerialize(&apid, buffer, size, streamEndianness);
|
|
|
|
}
|
2016-06-15 23:48:41 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* FRAMEWORK_TMTCPACKET_PACKETMATCHER_APIDMATCHER_H_ */
|