F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
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 
16 namespace Fw {
17 
19  initialize(const U32 sequenceIndex)
20  {
21  this->m_header.initialize(FilePacket::T_CANCEL, sequenceIndex);
22  }
23 
25  bufferSize() const
26  {
27  return this->m_header.bufferSize();
28  }
29 
31  toBuffer(Buffer& buffer) const
32  {
33  SerialBuffer serialBuffer(
34  buffer.getData(),
35  buffer.getSize()
36  );
37  return this->m_header.toSerialBuffer(serialBuffer);
38  }
39 
40  SerializeStatus FilePacket::CancelPacket ::
41  fromSerialBuffer(SerialBuffer& serialBuffer)
42  {
43 
44  FW_ASSERT(this->m_header.m_type == T_CANCEL);
45 
46  if (serialBuffer.getBuffLeft() != 0) {
48  }
49 
50  return FW_SERIALIZE_OK;
51 
52  }
53 
54 }
#define FW_ASSERT(...)
Definition: Assert.hpp:14
U8 * getData() const
Definition: Buffer.cpp:68
U32 getSize() const
Definition: Buffer.cpp:72
SerializeStatus toBuffer(Buffer &buffer) const
Convert this CancelPacket to a Buffer.
U32 bufferSize() const
Compute the buffer size needed to hold this CancelPacket.
void initialize(const U32 sequenceIndex)
Initialize a cancel packet.
A variable-length serializable buffer.
Serializable::SizeType getBuffLeft() const
returns how much deserialization buffer is left
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.