2016-06-15 23:48:41 +02:00
|
|
|
#ifndef FRAMEWORK_TMTCPACKET_PACKETMATCHER_APIDMATCHER_H_
|
|
|
|
#define FRAMEWORK_TMTCPACKET_PACKETMATCHER_APIDMATCHER_H_
|
|
|
|
|
2020-08-13 20:53:35 +02:00
|
|
|
#include "../../globalfunctions/matching/SerializeableMatcherIF.h"
|
|
|
|
#include "../../serialize/SerializeAdapter.h"
|
|
|
|
#include "../../tmtcpacket/pus/TmPacketMinimal.h"
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
class ApidMatcher: public SerializeableMatcherIF<TmPacketMinimal*> {
|
|
|
|
private:
|
|
|
|
uint16_t apid;
|
|
|
|
public:
|
|
|
|
ApidMatcher(uint16_t setApid) :
|
|
|
|
apid(setApid) {
|
|
|
|
}
|
2018-07-12 16:29:32 +02:00
|
|
|
ApidMatcher(TmPacketMinimal* test) :
|
|
|
|
apid(test->getAPID()) {
|
|
|
|
}
|
2016-06-15 23:48:41 +02:00
|
|
|
bool match(TmPacketMinimal* packet) {
|
|
|
|
if (packet->getAPID() == apid) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2020-04-21 22:28:43 +02:00
|
|
|
ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
|
|
|
size_t maxSize, Endianness streamEndianness) const {
|
|
|
|
return SerializeAdapter::serialize(&apid, buffer, size, maxSize, streamEndianness);
|
2016-06-15 23:48:41 +02:00
|
|
|
}
|
2020-04-21 22:28:43 +02:00
|
|
|
size_t getSerializedSize() const {
|
2020-04-21 21:34:03 +02:00
|
|
|
return SerializeAdapter::getSerializedSize(&apid);
|
2016-06-15 23:48:41 +02:00
|
|
|
}
|
2020-04-21 22:28:43 +02:00
|
|
|
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_ */
|