fsfw/src/fsfw/tmtcpacket/pus/tm/TmPacketMinimal.cpp

41 lines
1.3 KiB
C++
Raw Normal View History

2021-07-13 20:58:45 +02:00
#include "fsfw/tmtcpacket/pus/tm/TmPacketMinimal.h"
2021-06-14 10:19:01 +02:00
#include <cstddef>
#include <ctime>
2022-02-02 10:29:30 +01:00
#include "fsfw/tmtcpacket/pus/PacketTimestampInterpreterIF.h"
2022-07-18 10:42:56 +02:00
TmPacketMinimal::TmPacketMinimal(const uint8_t* set_data) : SpacePacketReader(set_data) {
2022-02-02 10:29:30 +01:00
this->tm_data = (TmPacketMinimalPointer*)set_data;
}
2022-02-02 10:29:30 +01:00
TmPacketMinimal::~TmPacketMinimal() {}
2022-02-02 10:29:30 +01:00
uint8_t TmPacketMinimal::getService() { return tm_data->data_field.service_type; }
2022-02-02 10:29:30 +01:00
uint8_t TmPacketMinimal::getSubService() { return tm_data->data_field.service_subtype; }
uint8_t TmPacketMinimal::getPacketSubcounter() { return tm_data->data_field.subcounter; }
ReturnValue_t TmPacketMinimal::getPacketTime(timeval* timestamp) {
2022-02-02 10:29:30 +01:00
if (timestampInterpreter == NULL) {
return HasReturnvaluesIF::RETURN_FAILED;
}
return timestampInterpreter->getPacketTime(this, timestamp);
}
ReturnValue_t TmPacketMinimal::getPacketTimeRaw(const uint8_t** timePtr, uint32_t* size) {
2022-02-02 10:29:30 +01:00
if (timestampInterpreter == NULL) {
return HasReturnvaluesIF::RETURN_FAILED;
}
return timestampInterpreter->getPacketTimeRaw(this, timePtr, size);
}
void TmPacketMinimal::setInterpretTimestampObject(PacketTimestampInterpreterIF* interpreter) {
2022-02-02 10:29:30 +01:00
if (TmPacketMinimal::timestampInterpreter == NULL) {
TmPacketMinimal::timestampInterpreter = interpreter;
}
}
PacketTimestampInterpreterIF* TmPacketMinimal::timestampInterpreter = NULL;