F´ Flight Software - C/C++ Documentation NASA-v1.6.0
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
CancelPacket.cpp
Go to the documentation of this file.
1// ======================================================================
2// \title CancelPacket.cpp
3// \author bocchino
4// \brief cpp file for FilePacket::CancelPacket
5//
6// \copyright
7// Copyright 2009-2016, by the California Institute of Technology.
8// ALL RIGHTS RESERVED. United States Government Sponsorship
9// acknowledged.
10//
11// ======================================================================
12
14#include <Fw/Types/Assert.hpp>
15
16namespace Fw {
17
18 void FilePacket::CancelPacket ::
19 initialize(const U32 sequenceIndex)
20 {
21 this->header.initialize(FilePacket::T_CANCEL, sequenceIndex);
22 }
23
24 U32 FilePacket::CancelPacket ::
25 bufferSize() const
26 {
27 return this->header.bufferSize();
28 }
29
30 SerializeStatus FilePacket::CancelPacket ::
31 toBuffer(Buffer& buffer) const
32 {
33 SerialBuffer serialBuffer(
34 buffer.getData(),
35 buffer.getSize()
36 );
37 return this->header.toSerialBuffer(serialBuffer);
38 }
39
40 SerializeStatus FilePacket::CancelPacket ::
41 fromSerialBuffer(SerialBuffer& serialBuffer)
42 {
43
44 FW_ASSERT(this->header.type == T_CANCEL);
45
46 if (serialBuffer.getBuffLeft() != 0)
48
49 return FW_SERIALIZE_OK;
50
51 }
52
53}
#define FW_ASSERT(...)
Definition Assert.hpp:7
U8 * getData() const
Definition Buffer.cpp:60
U32 getSize() const
Definition Buffer.cpp:64
A variable-length serializable buffer.
NATIVE_UINT_TYPE getBuffLeft() const
returns how much deserialization buffer is left
Definition Buffer.cpp:21
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.
@ FW_DESERIALIZE_SIZE_MISMATCH
Data was left in the buffer, but not enough to deserialize.