F´ Flight Software - C/C++ Documentation  NASA-v2.0.1
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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->header.initialize(FilePacket::T_CANCEL, sequenceIndex);
22  }
23 
25  bufferSize(void) const
26  {
27  return this->header.bufferSize();
28  }
29 
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 }
Fw::SerialBuffer
A variable-length serializable buffer.
Definition: SerialBuffer.hpp:24
Fw::FilePacket::CancelPacket::header
Header header
The packet header.
Definition: FilePacket.hpp:266
Fw::SerializeStatus
SerializeStatus
forward declaration for string
Definition: Serializable.hpp:14
Fw::FW_DESERIALIZE_SIZE_MISMATCH
@ FW_DESERIALIZE_SIZE_MISMATCH
Data was left in in the buffer, but not enough to deserialize.
Definition: Serializable.hpp:20
Fw::Buffer::getData
U8 * getData() const
Definition: Buffer.cpp:56
Fw::Buffer
Definition: Buffer.hpp:43
Fw::FilePacket::T_CANCEL
@ T_CANCEL
Definition: FilePacket.hpp:40
Assert.hpp
Fw::FW_SERIALIZE_OK
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.
Definition: Serializable.hpp:15
Fw::SerializeBufferBase::getBuffLeft
NATIVE_UINT_TYPE getBuffLeft() const
returns how much deserialization buffer is left
Definition: Serializable.cpp:614
Fw::Buffer::getSize
U32 getSize() const
Definition: Buffer.cpp:60
FW_ASSERT
#define FW_ASSERT(...)
Definition: Assert.hpp:9
Fw::FilePacket::CancelPacket::toBuffer
SerializeStatus toBuffer(Buffer &buffer) const
Convert this CancelPacket to a Buffer.
Definition: CancelPacket.cpp:31
FilePacket.hpp
Fw::FilePacket::CancelPacket::initialize
void initialize(const U32 sequenceIndex)
Initialize a cancel packet.
Definition: CancelPacket.cpp:19
Fw::FilePacket::Header::type
Type type
The packet type.
Definition: FilePacket.hpp:90
Fw::FilePacket::CancelPacket::bufferSize
U32 bufferSize(void) const
Compute the buffer size needed to hold this CancelPacket.
Definition: CancelPacket.cpp:25
Fw
Definition: Buffer.cpp:21