F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FileDownlink.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FileDownlink.hpp
3 // \author bocchino, mstarch
4 // \brief hpp file for FileDownlink component implementation class
5 //
6 // \copyright
7 // Copyright 2009-2015, by the California Institute of Technology.
8 // ALL RIGHTS RESERVED. United States Government Sponsorship
9 // acknowledged.
10 // ======================================================================
11 
12 #include <Fw/Com/ComPacket.hpp>
13 #include <Fw/FPrimeBasicTypes.hpp>
14 #include <Fw/Types/Assert.hpp>
15 #include <Fw/Types/StringUtils.hpp>
16 #include <Os/QueueString.hpp>
18 #include <limits>
19 
20 namespace Svc {
21 
22 // ----------------------------------------------------------------------
23 // Construction, initialization, and destruction
24 // ----------------------------------------------------------------------
25 
26 FileDownlink ::FileDownlink(const char* const name)
28  m_configured(false),
29  m_filesSent(this),
30  m_packetsSent(this),
31  m_warnings(this),
32  m_sequenceIndex(0),
33  m_curTimer(0),
34  m_bufferSize(0),
35  m_byteOffset(0),
36  m_endOffset(0),
37  m_lastCompletedType(Fw::FilePacket::T_NONE),
38  m_lastBufferId(0),
39  m_curEntry(),
40  m_cntxId(0) {}
41 
42 void FileDownlink ::configure(U32 timeout, U32 cooldown, U32 cycleTime, U32 fileQueueDepth) {
43  this->m_timeout = timeout;
44  this->m_cooldown = cooldown;
45  this->m_cycleTime = cycleTime;
46  this->m_configured = true;
47 
48  Os::Queue::Status stat =
49  m_fileQueue.create(this->getInstance(), Os::QueueString("fileDownlinkQueue"),
50  static_cast<FwSizeType>(fileQueueDepth), static_cast<FwSizeType>(sizeof(struct FileEntry)));
51  FW_ASSERT(stat == Os::Queue::OP_OK, static_cast<FwAssertArgType>(stat));
52 }
53 
55  this->m_fileQueue.teardown();
57 }
58 
60  FW_ASSERT(this->m_configured == true);
61 }
62 
64 
65 // ----------------------------------------------------------------------
66 // Handler implementations for user-defined typed input ports
67 // ----------------------------------------------------------------------
68 
69 void FileDownlink ::Run_handler(const FwIndexType portNum, U32 context) {
70  switch (this->m_mode.get()) {
71  case Mode::IDLE: {
72  FwSizeType real_size = 0;
73  FwQueuePriorityType prio = 0;
74  Os::Queue::Status stat = m_fileQueue.receive(reinterpret_cast<U8*>(&this->m_curEntry),
75  static_cast<FwSizeType>(sizeof(this->m_curEntry)),
76  Os::Queue::BlockingType::NONBLOCKING, real_size, prio);
77 
78  if (stat != Os::Queue::Status::OP_OK || sizeof(this->m_curEntry) != real_size) {
79  return;
80  }
81 
82  sendFile(this->m_curEntry.srcFilename, this->m_curEntry.destFilename, this->m_curEntry.offset,
83  this->m_curEntry.length);
84  break;
85  }
86  case Mode::COOLDOWN: {
87  if (this->m_curTimer >= this->m_cooldown) {
88  this->m_curTimer = 0;
89  this->m_mode.set(Mode::IDLE);
90  } else {
91  this->m_curTimer += m_cycleTime;
92  }
93  break;
94  }
95  case Mode::WAIT: {
96  // If current timeout is too-high and we are waiting for a packet, issue a timeout
97  if (this->m_curTimer >= this->m_timeout) {
98  this->m_curTimer = 0;
99  this->log_WARNING_HI_DownlinkTimeout(this->m_file.getSourceName(), this->m_file.getDestName());
100  this->enterCooldown();
103  } else { // Otherwise update the current counter
104  this->m_curTimer += m_cycleTime;
105  }
106  break;
107  }
108  default:
109  break;
110  }
111 }
112 
113 Svc::SendFileResponse FileDownlink ::SendFile_handler(
114  const FwIndexType portNum,
115  const Fw::StringBase& sourceFilename, // lgtm[cpp/large-parameter] dictated by command architecture
116  const Fw::StringBase& destFilename, // lgtm[cpp/large-parameter] dictated by command architecture
117  U32 offset,
118  U32 length) {
119  struct FileEntry entry;
120  entry.srcFilename[0] = 0;
121  entry.destFilename[0] = 0;
122  entry.offset = offset;
123  entry.length = length;
124  entry.source = FileDownlink::PORT;
125  entry.opCode = 0;
126  entry.cmdSeq = 0;
127  entry.context = m_cntxId++;
128 
129  FW_ASSERT(sourceFilename.length() < sizeof(entry.srcFilename));
130  FW_ASSERT(destFilename.length() < sizeof(entry.destFilename));
131  (void)Fw::StringUtils::string_copy(entry.srcFilename, sourceFilename.toChar(),
132  static_cast<FwSizeType>(sizeof(entry.srcFilename)));
133  (void)Fw::StringUtils::string_copy(entry.destFilename, destFilename.toChar(),
134  static_cast<FwSizeType>(sizeof(entry.destFilename)));
135 
136  Os::Queue::Status status = m_fileQueue.send(reinterpret_cast<U8*>(&entry), static_cast<FwSizeType>(sizeof(entry)),
137  0, Os::Queue::BlockingType::NONBLOCKING);
138 
139  if (status != Os::Queue::Status::OP_OK) {
140  return SendFileResponse(SendFileStatus::STATUS_ERROR, std::numeric_limits<U32>::max());
141  }
142  return SendFileResponse(SendFileStatus::STATUS_OK, entry.context);
143 }
144 
145 void FileDownlink ::pingIn_handler(const FwIndexType portNum, U32 key) {
146  this->pingOut_out(0, key);
147 }
148 
149 void FileDownlink ::bufferReturn_handler(const FwIndexType portNum, Fw::Buffer& fwBuffer) {
150  // If this is a stale buffer (old, timed-out, or both), then ignore its return.
151  // File downlink actions only respond to the return of the most-recently-sent buffer.
152  if (this->m_lastBufferId != fwBuffer.getContext() + 1 || this->m_mode.get() == Mode::IDLE) {
153  return;
154  }
155  // Non-ignored buffers cannot be returned in "DOWNLINK" and "IDLE" state. Only in "WAIT", "CANCEL" state.
156  FW_ASSERT(this->m_mode.get() == Mode::WAIT || this->m_mode.get() == Mode::CANCEL,
157  static_cast<FwAssertArgType>(this->m_mode.get()));
158  // If the last packet has been sent (and is returning now) then finish the file
159  if (this->m_lastCompletedType == Fw::FilePacket::T_END || this->m_lastCompletedType == Fw::FilePacket::T_CANCEL) {
160  finishHelper(this->m_lastCompletedType == Fw::FilePacket::T_CANCEL);
161  return;
162  }
163  // If waiting and a buffer is in-bound, then switch to downlink mode
164  else if (this->m_mode.get() == Mode::WAIT) {
165  this->m_mode.set(Mode::DOWNLINK);
166  }
167 
168  this->downlinkPacket();
169 }
170 
171 // ----------------------------------------------------------------------
172 // Command handler implementations
173 // ----------------------------------------------------------------------
174 
175 void FileDownlink ::SendFile_cmdHandler(const FwOpcodeType opCode,
176  const U32 cmdSeq,
177  const Fw::CmdStringArg& sourceFilename,
178  const Fw::CmdStringArg& destFilename) {
179  struct FileEntry entry;
180  entry.srcFilename[0] = 0;
181  entry.destFilename[0] = 0;
182  entry.offset = 0;
183  entry.length = 0;
184  entry.source = FileDownlink::COMMAND;
185  entry.opCode = opCode;
186  entry.cmdSeq = cmdSeq;
187  entry.context = std::numeric_limits<U32>::max();
188 
189  FW_ASSERT(sourceFilename.length() < sizeof(entry.srcFilename));
190  FW_ASSERT(destFilename.length() < sizeof(entry.destFilename));
191  (void)Fw::StringUtils::string_copy(entry.srcFilename, sourceFilename.toChar(),
192  static_cast<FwSizeType>(sizeof(entry.srcFilename)));
193  (void)Fw::StringUtils::string_copy(entry.destFilename, destFilename.toChar(),
194  static_cast<FwSizeType>(sizeof(entry.destFilename)));
195 
196  Os::Queue::Status status = m_fileQueue.send(reinterpret_cast<U8*>(&entry), static_cast<FwSizeType>(sizeof(entry)),
197  0, Os::Queue::BlockingType::NONBLOCKING);
198 
199  if (status != Os::Queue::Status::OP_OK) {
200  this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::EXECUTION_ERROR);
201  }
202 }
203 
204 void FileDownlink ::SendPartial_cmdHandler(FwOpcodeType opCode,
205  U32 cmdSeq,
206  const Fw::CmdStringArg& sourceFilename,
207  const Fw::CmdStringArg& destFilename,
208  U32 startOffset,
209  U32 length) {
210  struct FileEntry entry;
211  entry.srcFilename[0] = 0;
212  entry.destFilename[0] = 0;
213  entry.offset = startOffset;
214  entry.length = length;
215  entry.source = FileDownlink::COMMAND;
216  entry.opCode = opCode;
217  entry.cmdSeq = cmdSeq;
218  entry.context = std::numeric_limits<U32>::max();
219 
220  FW_ASSERT(sourceFilename.length() < sizeof(entry.srcFilename));
221  FW_ASSERT(destFilename.length() < sizeof(entry.destFilename));
222  (void)Fw::StringUtils::string_copy(entry.srcFilename, sourceFilename.toChar(),
223  static_cast<FwSizeType>(sizeof(entry.srcFilename)));
224  (void)Fw::StringUtils::string_copy(entry.destFilename, destFilename.toChar(),
225  static_cast<FwSizeType>(sizeof(entry.destFilename)));
226 
227  Os::Queue::Status status = m_fileQueue.send(reinterpret_cast<U8*>(&entry), static_cast<FwSizeType>(sizeof(entry)),
228  0, Os::Queue::BlockingType::NONBLOCKING);
229 
230  if (status != Os::Queue::Status::OP_OK) {
231  this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::EXECUTION_ERROR);
232  }
233 }
234 
235 void FileDownlink ::Cancel_cmdHandler(const FwOpcodeType opCode, const U32 cmdSeq) {
236  // Must be able to cancel in both downlink and waiting states
237  if (this->m_mode.get() == Mode::DOWNLINK || this->m_mode.get() == Mode::WAIT) {
238  this->m_mode.set(Mode::CANCEL);
239  }
240  this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
241 }
242 
243 // ----------------------------------------------------------------------
244 // Private helper methods
245 // ----------------------------------------------------------------------
246 
247 Fw::CmdResponse FileDownlink ::statusToCmdResp(SendFileStatus status) {
248  switch (status.e) {
250  return Fw::CmdResponse::OK;
256  return Fw::CmdResponse::BUSY;
257  default:
258  // Trigger assertion if given unknown status
259  FW_ASSERT(false);
260  }
261 
262  // It's impossible to reach this, but added to suppress gcc missing return warning
264 }
265 
266 void FileDownlink ::sendResponse(SendFileStatus resp) {
267  if (this->m_curEntry.source == FileDownlink::COMMAND) {
268  this->cmdResponse_out(this->m_curEntry.opCode, this->m_curEntry.cmdSeq, statusToCmdResp(resp));
269  } else {
270  for (FwIndexType i = 0; i < this->getNum_FileComplete_OutputPorts(); i++) {
272  this->FileComplete_out(i, Svc::SendFileResponse(resp, this->m_curEntry.context));
273  }
274  }
275  }
276 }
277 
278 void FileDownlink ::sendFile(const char* sourceFilename, const char* destFilename, U32 startOffset, U32 length) {
279  // Open file for downlink
280  Os::File::Status status = this->m_file.open(sourceFilename, destFilename);
281 
282  // Reject command if error when opening file
283  if (status != Os::File::OP_OK) {
284  this->m_mode.set(Mode::IDLE);
285  this->m_warnings.fileOpenError();
287  return;
288  }
289 
290  if (startOffset >= this->m_file.getSize()) {
291  this->enterCooldown();
292  this->log_WARNING_HI_DownlinkPartialFail(this->m_file.getSourceName(), this->m_file.getDestName(), startOffset,
293  this->m_file.getSize());
296  return;
297  } else if (startOffset + length > this->m_file.getSize()) {
298  // If the amount to downlink is greater than the file size, emit a Warning and then allow
299  // the file to be downlinked anyway
300  this->log_WARNING_LO_DownlinkPartialWarning(startOffset, length, this->m_file.getSize(),
301  this->m_file.getSourceName(), this->m_file.getDestName());
302  length = this->m_file.getSize() - startOffset;
303  }
304 
305  // Send file and switch to WAIT mode
306  this->getBuffer(this->m_buffer, FILE_PACKET);
307  this->sendStartPacket();
308  this->m_mode.set(Mode::WAIT);
309  this->m_sequenceIndex = 1;
310  this->m_curTimer = 0;
311  this->m_byteOffset = startOffset;
312  this->m_lastCompletedType = Fw::FilePacket::T_START;
313 
314  // zero length means read until end of file
315  if (length > 0) {
316  this->log_ACTIVITY_HI_SendStarted(length, this->m_file.getSourceName(), this->m_file.getDestName());
317  this->m_endOffset = startOffset + length;
318  } else {
319  this->log_ACTIVITY_HI_SendStarted(this->m_file.getSize() - startOffset, this->m_file.getSourceName(),
320  this->m_file.getDestName());
321  this->m_endOffset = this->m_file.getSize();
322  }
323 }
324 
325 Os::File::Status FileDownlink ::sendDataPacket(U32& byteOffset) {
326  FW_ASSERT(byteOffset < this->m_endOffset);
327  const U32 maxDataSize =
329  const U32 dataSize =
330  (byteOffset + maxDataSize > this->m_endOffset) ? (this->m_endOffset - byteOffset) : maxDataSize;
331  U8 buffer[maxDataSize];
332  // This will be last data packet sent
333  if (dataSize + byteOffset == this->m_endOffset) {
334  this->m_lastCompletedType = Fw::FilePacket::T_DATA;
335  }
336 
337  const Os::File::Status status = this->m_file.read(buffer, byteOffset, dataSize);
338  if (status != Os::File::OP_OK) {
339  this->m_warnings.fileRead(status);
340  return status;
341  }
342 
343  Fw::FilePacket::DataPacket dataPacket;
344  dataPacket.initialize(this->m_sequenceIndex, byteOffset, static_cast<U16>(dataSize), buffer);
345  ++this->m_sequenceIndex;
346  Fw::FilePacket filePacket;
347  filePacket.fromDataPacket(dataPacket);
348  this->sendFilePacket(filePacket);
349 
350  byteOffset += dataSize;
351 
352  return Os::File::OP_OK;
353 }
354 
355 void FileDownlink ::sendCancelPacket() {
356  Fw::Buffer buffer;
357  Fw::FilePacket::CancelPacket cancelPacket;
358  cancelPacket.initialize(this->m_sequenceIndex);
359 
360  Fw::FilePacket filePacket;
361  filePacket.fromCancelPacket(cancelPacket);
362  this->getBuffer(buffer, CANCEL_PACKET);
363  FW_ASSERT(buffer.getSize() >= filePacket.bufferSize() + sizeof(FwPacketDescriptorType),
364  static_cast<FwAssertArgType>(buffer.getSize()),
365  static_cast<FwAssertArgType>(filePacket.bufferSize() + sizeof(FwPacketDescriptorType)));
366 
367  // Serialize the packet descriptor FW_PACKET_FILE to the buffer
368  Fw::SerializeStatus status =
369  buffer.getSerializer().serializeFrom(static_cast<FwPacketDescriptorType>(Fw::ComPacketType::FW_PACKET_FILE));
370  FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
371  Fw::Buffer offsetBuffer(buffer.getData() + sizeof(FwPacketDescriptorType),
372  buffer.getSize() - static_cast<Fw::Buffer::SizeType>(sizeof(FwPacketDescriptorType)));
373  // Serialize the filePacket content into the buffer
374  status = filePacket.toBuffer(offsetBuffer);
375  FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
376  this->bufferSendOut_out(0, buffer);
377  this->m_packetsSent.packetSent();
378 }
379 
380 void FileDownlink ::sendEndPacket() {
381  CFDP::Checksum checksum;
382  this->m_file.getChecksum(checksum);
383 
384  Fw::FilePacket::EndPacket endPacket;
385  endPacket.initialize(this->m_sequenceIndex, checksum);
386 
387  Fw::FilePacket filePacket;
388  filePacket.fromEndPacket(endPacket);
389  this->sendFilePacket(filePacket);
390 }
391 
392 void FileDownlink ::sendStartPacket() {
393  Fw::FilePacket::StartPacket startPacket;
394  startPacket.initialize(this->m_file.getSize(), this->m_file.getSourceName().toChar(),
395  this->m_file.getDestName().toChar());
396  Fw::FilePacket filePacket;
397  filePacket.fromStartPacket(startPacket);
398  this->sendFilePacket(filePacket);
399 }
400 
401 void FileDownlink ::sendFilePacket(const Fw::FilePacket& filePacket) {
402  const U32 bufferSize = filePacket.bufferSize() + static_cast<U32>(sizeof(FwPacketDescriptorType));
403  FW_ASSERT(this->m_buffer.getData() != nullptr);
404  FW_ASSERT(this->m_buffer.getSize() >= bufferSize, static_cast<FwAssertArgType>(bufferSize),
405  static_cast<FwAssertArgType>(this->m_buffer.getSize()));
406  // Serialize packet descriptor FW_PACKET_FILE to the buffer
407  Fw::SerializeStatus status = this->m_buffer.getSerializer().serializeFrom(
408  static_cast<FwPacketDescriptorType>(Fw::ComPacketType::FW_PACKET_FILE));
409  FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
410  // Serialize the filePacket content into the buffer, offset by the size of the packet descriptor
411  Fw::Buffer offsetBuffer(
412  this->m_buffer.getData() + sizeof(FwPacketDescriptorType),
413  this->m_buffer.getSize() - static_cast<Fw::Buffer::SizeType>(sizeof(FwPacketDescriptorType)));
414  status = filePacket.toBuffer(offsetBuffer);
415  FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
416  // set the buffer size to the packet size
417  this->m_buffer.setSize(bufferSize);
418  this->bufferSendOut_out(0, this->m_buffer);
419  // restore buffer size to max
421  this->m_packetsSent.packetSent();
422 }
423 
424 void FileDownlink ::enterCooldown() {
425  this->m_file.getOsFile().close();
426  this->m_mode.set(Mode::COOLDOWN);
427  this->m_lastCompletedType = Fw::FilePacket::T_NONE;
428  this->m_curTimer = 0;
429 }
430 
431 void FileDownlink ::downlinkPacket() {
432  FW_ASSERT(this->m_lastCompletedType != Fw::FilePacket::T_NONE,
433  static_cast<FwAssertArgType>(this->m_lastCompletedType));
434  FW_ASSERT(this->m_mode.get() == Mode::CANCEL || this->m_mode.get() == Mode::DOWNLINK,
435  static_cast<FwAssertArgType>(this->m_mode.get()));
436  // If canceled mode and currently downlinking data then send a cancel packet
437  if (this->m_mode.get() == Mode::CANCEL && this->m_lastCompletedType == Fw::FilePacket::T_START) {
438  this->sendCancelPacket();
439  this->m_lastCompletedType = Fw::FilePacket::T_CANCEL;
440  }
441  // If in downlink mode and currently downlinking data then continue with the next packer
442  else if (this->m_mode.get() == Mode::DOWNLINK && this->m_lastCompletedType == Fw::FilePacket::T_START) {
443  // Send the next packet, or fail doing so
444  const Os::File::Status status = this->sendDataPacket(this->m_byteOffset);
445  if (status != Os::File::OP_OK) {
446  this->log_WARNING_HI_SendDataFail(this->m_file.getSourceName(), this->m_byteOffset);
447  this->enterCooldown();
450  // Don't go to wait state
451  return;
452  }
453  }
454  // If in downlink mode or cancel and finished downlinking data then send the last packet
455  else if (this->m_lastCompletedType == Fw::FilePacket::T_DATA) {
456  this->sendEndPacket();
457  this->m_lastCompletedType = Fw::FilePacket::T_END;
458  }
459  this->m_mode.set(Mode::WAIT);
460  this->m_curTimer = 0;
461 }
462 
463 void FileDownlink ::finishHelper(bool cancel) {
464  // Complete command and switch to IDLE
465  if (not cancel) {
466  this->m_filesSent.fileSent();
467  this->log_ACTIVITY_HI_FileSent(this->m_file.getSourceName(), this->m_file.getDestName());
468  } else {
469  this->log_ACTIVITY_HI_DownlinkCanceled(this->m_file.getSourceName(), this->m_file.getDestName());
470  }
471  this->enterCooldown();
472  sendResponse(SendFileStatus::STATUS_OK);
473 }
474 
475 void FileDownlink ::getBuffer(Fw::Buffer& buffer, PacketType type) {
476  // Check type is correct
477  FW_ASSERT(type < COUNT_PACKET_TYPE && type >= 0, static_cast<FwAssertArgType>(type));
478  // Wrap the buffer around our indexed memory.
479  buffer.setData(this->m_memoryStore[type]);
481  // Set a known ID to look for later
482  buffer.setContext(m_lastBufferId);
483  m_lastBufferId++;
484 }
485 } // end namespace Svc
Serialization/Deserialization operation was successful.
void setData(U8 *data)
Definition: Buffer.cpp:68
Status create(FwEnumStoreType id, const Fw::ConstStringBase &name, FwSizeType depth, FwSizeType messageSize) override
create queue storage through delegate
Definition: Queue.cpp:22
U16 FwPacketDescriptorType
The width of packet descriptors when they are serialized by the framework.
void fromCancelPacket(const CancelPacket &cancelPacket)
Definition: FilePacket.cpp:68
FwIdType FwOpcodeType
The type of a command opcode.
Operation succeeded.
Definition: Os.hpp:26
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
void fromDataPacket(const DataPacket &dataPacket)
Definition: FilePacket.cpp:58
PlatformSizeType FwSizeType
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
Definition: Queue.cpp:71
void setContext(U32 context)
Definition: Buffer.cpp:82
void setSize(FwSizeType size)
Definition: Buffer.cpp:75
The type of a cancel packet.
Definition: FilePacket.hpp:273
Status
status returned from the queue send function
Definition: Queue.hpp:30
void fromEndPacket(const EndPacket &endPacket)
Definition: FilePacket.cpp:63
The type of a data packet.
Definition: FilePacket.hpp:171
U32 getContext() const
Definition: Buffer.cpp:64
FwEnumStoreType getInstance() const
U8 * getData() const
Definition: Buffer.cpp:56
virtual const CHAR * toChar() const =0
Convert to a C-style char*.
void fromStartPacket(const StartPacket &startPacket)
Definition: FilePacket.cpp:53
Enum representing a command response.
SerializeStatus toBuffer(Buffer &buffer) const
Definition: FilePacket.cpp:91
SerializeStatus
forward declaration for string
Class representing a 32-bit checksum as mandated by the CCSDS File Delivery Protocol.
Definition: Checksum.hpp:53
U32 bufferSize() const
Definition: FilePacket.cpp:73
char * string_copy(char *destination, const char *source, FwSizeType num)
copy string with null-termination guaranteed
Definition: StringUtils.cpp:7
The type of a start packet.
Definition: FilePacket.hpp:121
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
Definition: Queue.cpp:54
void deinit()
Allows de-initialization on teardown.
void teardown() override
teardown the queue
Definition: Queue.cpp:49
Command successfully executed.
void initialize(const U32 fileSize, const char *const sourcePath, const char *const destinationPath)
Initialize a StartPacket with sequence number 0.
Definition: StartPacket.cpp:18
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:53
FwSizeType getSize() const
Definition: Buffer.cpp:60
PlatformQueuePriorityType FwQueuePriorityType
The type of queue priorities used.
Command had execution error.
const char * toChar() const
Convert to a C-style char*.
Definition: CmdString.hpp:50
Operation was successful.
Definition: File.hpp:40
PlatformIndexType FwIndexType
FwSizeType SizeType
The size type for a buffer - for backwards compatibility.
Definition: Buffer.hpp:61
Send file response struct.
Command failed validation.
RateGroupDivider component implementation.
virtual SizeType length() const
Get the length of the string.
message sent/received okay
Definition: Queue.hpp:31
A file packet.
Definition: FilePacket.hpp:33
static const U32 FILEDOWNLINK_INTERNAL_BUFFER_SIZE
void initialize(const U32 sequenceIndex, const U32 byteOffset, const U16 dataSize, const U8 *const data)
Initialize a data packet.
Definition: DataPacket.cpp:18
static const bool FILEDOWNLINK_COMMAND_FAILURES_DISABLED
Implementation of malloc based allocator.
void initialize(const U32 sequenceIndex, const CFDP::Checksum &checksum)
Initialize an end packet.
Definition: EndPacket.cpp:20
void initialize(const U32 sequenceIndex)
Initialize a cancel packet.
ExternalSerializeBufferWithMemberCopy getSerializer()
Definition: Buffer.cpp:95
#define FW_ASSERT(...)
Definition: Assert.hpp:14
PlatformAssertArgType FwAssertArgType
The type of arguments to assert functions.
The type of an end packet.
Definition: FilePacket.hpp:230