2016-06-15 23:48:41 +02:00
|
|
|
#ifndef FRAMEWORK_TMTCPACKET_PACKETMATCHER_APIDMATCHER_H_
|
|
|
|
#define FRAMEWORK_TMTCPACKET_PACKETMATCHER_APIDMATCHER_H_
|
|
|
|
|
|
|
|
#include <framework/globalfunctions/matching/SerializeableMatcherIF.h>
|
|
|
|
#include <framework/serialize/SerializeAdapter.h>
|
|
|
|
#include <framework/tmtcpacket/pus/TmPacketMinimal.h>
|
|
|
|
|
|
|
|
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-05 17:58:39 +02:00
|
|
|
ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
|
|
|
const size_t max_size, bool bigEndian) const {
|
|
|
|
return SerializeAdapter<uint16_t>::serialize(&apid, buffer,
|
|
|
|
size, max_size, bigEndian);
|
2016-06-15 23:48:41 +02:00
|
|
|
}
|
2020-04-05 21:54:11 +02:00
|
|
|
size_t getSerializedSize() const {
|
2016-06-15 23:48:41 +02:00
|
|
|
return SerializeAdapter<uint16_t>::getSerializedSize(&apid);
|
|
|
|
}
|
2020-04-15 15:53:46 +02:00
|
|
|
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
2016-06-15 23:48:41 +02:00
|
|
|
bool bigEndian) {
|
2020-04-15 15:53:46 +02:00
|
|
|
return SerializeAdapter<uint16_t>::deSerialize(&apid, buffer,
|
|
|
|
size, bigEndian);
|
2016-06-15 23:48:41 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* FRAMEWORK_TMTCPACKET_PACKETMATCHER_APIDMATCHER_H_ */
|