mirror of
https://github.com/nasa/fprime.git
synced 2025-12-11 23:38:06 -06:00
* Fixed shadow warnings from Fprime * Fix unit tests * Fix missing shadow warnings * Fix condition in cmake * Fix cmake * Fixes from review * Fixed mistake in PathName * Fixing comment --------- Co-authored-by: M Starch <LeStarch@googlemail.com>
94 lines
2.0 KiB
C++
94 lines
2.0 KiB
C++
// ======================================================================
|
|
// \title EndPacket.cpp
|
|
// \author bocchino
|
|
// \brief cpp file for FilePacket::EndPacket
|
|
//
|
|
// \copyright
|
|
// Copyright 2009-2016, by the California Institute of Technology.
|
|
// ALL RIGHTS RESERVED. United States Government Sponsorship
|
|
// acknowledged.
|
|
//
|
|
// ======================================================================
|
|
|
|
#include <cstring>
|
|
|
|
#include <Fw/FilePacket/FilePacket.hpp>
|
|
#include <Fw/Types/Assert.hpp>
|
|
|
|
namespace Fw {
|
|
|
|
void FilePacket::EndPacket ::
|
|
initialize(
|
|
const U32 sequenceIndex,
|
|
const CFDP::Checksum& checksum
|
|
)
|
|
{
|
|
this->header.initialize(FilePacket::T_END, sequenceIndex);
|
|
this->setChecksum(checksum);
|
|
}
|
|
|
|
U32 FilePacket::EndPacket ::
|
|
bufferSize() const
|
|
{
|
|
return this->header.bufferSize() + sizeof(this->m_checksumValue);
|
|
}
|
|
|
|
SerializeStatus FilePacket::EndPacket ::
|
|
toBuffer(Buffer& buffer) const
|
|
{
|
|
SerialBuffer serialBuffer(
|
|
buffer.getData(),
|
|
buffer.getSize()
|
|
);
|
|
return this->toSerialBuffer(serialBuffer);
|
|
}
|
|
|
|
void FilePacket::EndPacket ::
|
|
setChecksum(const CFDP::Checksum& checksum)
|
|
{
|
|
this->m_checksumValue = checksum.getValue();
|
|
}
|
|
|
|
|
|
void FilePacket::EndPacket ::
|
|
getChecksum(CFDP::Checksum& checksum) const
|
|
{
|
|
CFDP::Checksum c(this->m_checksumValue);
|
|
checksum = c;
|
|
}
|
|
|
|
SerializeStatus FilePacket::EndPacket ::
|
|
fromSerialBuffer(SerialBuffer& serialBuffer)
|
|
{
|
|
|
|
FW_ASSERT(this->header.type == T_END);
|
|
|
|
const SerializeStatus status =
|
|
serialBuffer.deserialize(this->m_checksumValue);
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
SerializeStatus FilePacket::EndPacket ::
|
|
toSerialBuffer(SerialBuffer& serialBuffer) const
|
|
{
|
|
|
|
FW_ASSERT(this->header.type == T_END);
|
|
|
|
SerializeStatus status;
|
|
|
|
status = this->header.toSerialBuffer(serialBuffer);
|
|
if (status != FW_SERIALIZE_OK)
|
|
return status;
|
|
|
|
status = serialBuffer.serialize(this->m_checksumValue);
|
|
if (status != FW_SERIALIZE_OK)
|
|
return status;
|
|
|
|
return FW_SERIALIZE_OK;
|
|
|
|
}
|
|
|
|
}
|