2016-06-15 23:48:41 +02:00
|
|
|
#ifndef FRAMEWORK_TMTCPACKET_PACKETMATCHER_SERVICEMATCHER_H_
|
|
|
|
#define FRAMEWORK_TMTCPACKET_PACKETMATCHER_SERVICEMATCHER_H_
|
|
|
|
|
|
|
|
#include <framework/globalfunctions/matching/SerializeableMatcherIF.h>
|
|
|
|
#include <framework/serialize/SerializeAdapter.h>
|
|
|
|
#include <framework/tmtcpacket/pus/TmPacketMinimal.h>
|
|
|
|
|
|
|
|
class ServiceMatcher: public SerializeableMatcherIF<TmPacketMinimal*> {
|
|
|
|
private:
|
|
|
|
uint8_t service;
|
|
|
|
public:
|
|
|
|
ServiceMatcher(uint8_t setService) :
|
|
|
|
service(setService) {
|
|
|
|
}
|
2018-07-12 16:29:32 +02:00
|
|
|
ServiceMatcher(TmPacketMinimal* test) :
|
|
|
|
service(test->getService()) {
|
|
|
|
}
|
2016-06-15 23:48:41 +02:00
|
|
|
bool match(TmPacketMinimal* packet) {
|
|
|
|
if (packet->getService() == service) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
|
|
|
|
const uint32_t max_size, bool bigEndian) const {
|
2020-04-21 21:34:03 +02:00
|
|
|
return SerializeAdapter::serialize(&service, buffer, size, max_size, bigEndian);
|
2016-06-15 23:48:41 +02:00
|
|
|
}
|
|
|
|
uint32_t getSerializedSize() const {
|
2020-04-21 21:34:03 +02:00
|
|
|
return SerializeAdapter::getSerializedSize(&service);
|
2016-06-15 23:48:41 +02:00
|
|
|
}
|
|
|
|
ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
|
|
|
bool bigEndian) {
|
2020-04-21 21:34:03 +02:00
|
|
|
return SerializeAdapter::deSerialize(&service, buffer, size, bigEndian);
|
2016-06-15 23:48:41 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* FRAMEWORK_TMTCPACKET_PACKETMATCHER_SERVICEMATCHER_H_ */
|