2016-06-15 23:48:41 +02:00
|
|
|
#ifndef FRAMEWORK_TMTCPACKET_PACKETMATCHER_SUBSERVICEMATCHER_H_
|
|
|
|
#define FRAMEWORK_TMTCPACKET_PACKETMATCHER_SUBSERVICEMATCHER_H_
|
|
|
|
|
|
|
|
#include <framework/globalfunctions/matching/SerializeableMatcherIF.h>
|
|
|
|
#include <framework/serialize/SerializeAdapter.h>
|
|
|
|
#include <framework/tmtcpacket/pus/TmPacketMinimal.h>
|
|
|
|
|
|
|
|
class SubServiceMatcher: public SerializeableMatcherIF<TmPacketMinimal*> {
|
|
|
|
public:
|
|
|
|
SubServiceMatcher(uint8_t subService) :
|
|
|
|
subService(subService) {
|
|
|
|
}
|
2018-07-12 16:29:32 +02:00
|
|
|
SubServiceMatcher(TmPacketMinimal* test) :
|
|
|
|
subService(test->getSubService()) {
|
|
|
|
}
|
2016-06-15 23:48:41 +02:00
|
|
|
bool match(TmPacketMinimal* packet) {
|
|
|
|
if (packet->getSubService() == subService) {
|
|
|
|
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<uint8_t>::serialize(&subService, 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<uint8_t>::getSerializedSize(&subService);
|
|
|
|
}
|
2020-04-05 22:42:48 +02:00
|
|
|
ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
2016-06-15 23:48:41 +02:00
|
|
|
bool bigEndian) {
|
|
|
|
return SerializeAdapter<uint8_t>::deSerialize(&subService, buffer, size, bigEndian);
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
uint8_t subService;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* FRAMEWORK_TMTCPACKET_PACKETMATCHER_SUBSERVICEMATCHER_H_ */
|