create TM base class
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
parent
3b575acd55
commit
4bf22f689a
@ -226,7 +226,7 @@ static const size_t MAX_DATA_CAPACITY = 1016;
|
||||
static const size_t MAX_PACKET_SIZE = 1024;
|
||||
|
||||
static constexpr size_t MIN_PAYLOAD_LEN = SECONDARY_HEADER_LEN + CRC_LEN;
|
||||
static constexpr size_t MIN_TC_LEN = ccsds::HEADER_LEN + MIN_PAYLOAD_LEN;
|
||||
static constexpr size_t MIN_TMTC_LEN = ccsds::HEADER_LEN + MIN_PAYLOAD_LEN;
|
||||
static constexpr size_t PAYLOAD_OFFSET = ccsds::HEADER_LEN + SECONDARY_HEADER_LEN;
|
||||
|
||||
struct UpdateParams {
|
||||
@ -386,6 +386,25 @@ class TcBase : public ploc::SpTcBase {
|
||||
}
|
||||
};
|
||||
|
||||
class TmBase: public ploc::SpTmReader {
|
||||
public:
|
||||
TmBase(const uint8_t* data, size_t maxSize): ploc::SpTmReader(data, maxSize) {
|
||||
if(maxSize < MIN_TMTC_LEN) {
|
||||
sif::error << "SupvTcBase::SupvTcBase: Passed buffer is too small" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t getServiceId() {
|
||||
return getPacketData()[TIMESTAMP_LEN];
|
||||
}
|
||||
|
||||
const uint8_t* getPayloadStart() {
|
||||
return getPacketData() + SECONDARY_HEADER_LEN;
|
||||
}
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
class NoPayloadPacket : public TcBase {
|
||||
public:
|
||||
NoPayloadPacket(TcParams params, uint16_t apid, uint8_t serviceId)
|
||||
|
@ -859,8 +859,9 @@ ReturnValue_t PlocSupvHelper::handleEventBufferReception(ploc::SpTmReader& reade
|
||||
file.close();
|
||||
return EVENT_BUFFER_REPLY_INVALID_APID;
|
||||
}
|
||||
file.write(reinterpret_cast<const char*>(reader.getPacketData()),
|
||||
reader.getPayloadDataLength());
|
||||
// TODO: Fix
|
||||
// file.write(reinterpret_cast<const char*>(reader.getPacketData()),
|
||||
// reader.getPayloadDataLength());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -102,11 +102,6 @@ class SpTmReader : public SpacePacketReader {
|
||||
return setReadOnlyData(buf, maxSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the payload data length (data field length without CRC)
|
||||
*/
|
||||
uint16_t getPayloadDataLength() { return getPacketDataLen() - 2; }
|
||||
|
||||
ReturnValue_t checkCrc() {
|
||||
if (CRC::crc16ccitt(getFullData(), getFullPacketLen()) != 0) {
|
||||
return returnvalue::FAILED;
|
||||
|
Loading…
x
Reference in New Issue
Block a user