F´ Flight Software - C/C++ Documentation  NASA-v2.0.1
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 
13 #include <Fw/Types/Assert.hpp>
14 #include <Fw/Types/BasicTypes.hpp>
16 #include <Fw/Types/StringUtils.hpp>
17 
18 namespace Svc {
19 
20  // ----------------------------------------------------------------------
21  // Construction, initialization, and destruction
22  // ----------------------------------------------------------------------
23 
26  const char *const name
27  ) :
28  FileDownlinkComponentBase(name),
29  configured(false),
30  filesSent(this),
31  packetsSent(this),
32  warnings(this),
33  sequenceIndex(0),
34  curTimer(0),
35  bufferSize(0),
36  byteOffset(0),
37  endOffset(0),
38  lastCompletedType(Fw::FilePacket::T_NONE),
39  lastBufferId(0),
40  curEntry(),
41  cntxId(0)
42  {
43  }
44 
45  void FileDownlink ::
47  const NATIVE_INT_TYPE queueDepth,
48  const NATIVE_INT_TYPE instance
49  )
50  {
51  FileDownlinkComponentBase::init(queueDepth, instance);
52  }
53 
54  void FileDownlink ::
56  U32 timeout,
57  U32 cooldown,
58  U32 cycleTime,
59  U32 fileQueueDepth
60  )
61  {
62  this->timeout = timeout;
63  this->cooldown = cooldown;
64  this->cycleTime = cycleTime;
65  this->configured = true;
66 
67  Os::Queue::QueueStatus stat = fileQueue.create(
68  Fw::EightyCharString("fileDownlinkQueue"),
69  fileQueueDepth,
70  sizeof(struct FileEntry)
71  );
72  FW_ASSERT(stat == Os::Queue::QUEUE_OK, stat);
73  }
74 
75  void FileDownlink ::
77  NATIVE_INT_TYPE identifier,
78  NATIVE_INT_TYPE priority,
79  NATIVE_INT_TYPE stackSize,
80  NATIVE_INT_TYPE cpuAffinity
81  )
82  {
83  FW_ASSERT(this->configured == true);
84  FileDownlinkComponentBase::start(identifier, priority, stackSize, cpuAffinity);
85  }
86 
89  {
90 
91  }
92 
93  // ----------------------------------------------------------------------
94  // Handler implementations for user-defined typed input ports
95  // ----------------------------------------------------------------------
96 
97  void FileDownlink ::
98  Run_handler(
99  const NATIVE_INT_TYPE portNum,
100  NATIVE_UINT_TYPE context
101  )
102  {
103  switch(this->mode.get())
104  {
105  case Mode::IDLE: {
106  NATIVE_INT_TYPE real_size = 0;
107  NATIVE_INT_TYPE prio = 0;
108  Os::Queue::QueueStatus stat = fileQueue.receive(
109  (U8 *) &this->curEntry,
110  sizeof(this->curEntry),
111  real_size,
112  prio,
114  );
115 
116  if(stat != Os::Queue::QUEUE_OK || sizeof(this->curEntry) != real_size) {
117  return;
118  }
119 
120  sendFile(
121  this->curEntry.srcFilename,
122  this->curEntry.destFilename,
123  this->curEntry.offset,
124  this->curEntry.length
125  );
126  break;
127  }
128  case Mode::COOLDOWN: {
129  if (this->curTimer >= this->cooldown) {
130  this->curTimer = 0;
131  this->mode.set(Mode::IDLE);
132  } else {
133  this->curTimer += cycleTime;
134  }
135  break;
136  }
137  case Mode::WAIT: {
138  //If current timeout is too-high and we are waiting for a packet, issue a timeout
139  if (this->curTimer >= this->timeout) {
140  this->curTimer = 0;
141  this->log_WARNING_HI_DownlinkTimeout(this->file.sourceName, this->file.destName);
142  this->enterCooldown();
143  this->sendResponse(FILEDOWNLINK_COMMAND_FAILURES_DISABLED ? SendFileStatus::STATUS_OK : SendFileStatus::STATUS_ERROR);
144  } else { //Otherwise update the current counter
145  this->curTimer += cycleTime;
146  }
147  break;
148  }
149  default:
150  break;
151  }
152  }
153 
154  Svc::SendFileResponse FileDownlink ::
155  SendFile_handler(
156  const NATIVE_INT_TYPE portNum,
157  sourceFileNameString sourceFilename, // lgtm[cpp/large-parameter] dictated by command architecture
158  destFileNameString destFilename, // lgtm[cpp/large-parameter] dictated by command architecture
159  U32 offset,
160  U32 length
161  )
162  {
163  struct FileEntry entry;
164  entry.srcFilename[0] = 0;
165  entry.destFilename[0] = 0;
166  entry.offset = offset;
167  entry.length = length;
168  entry.source = FileDownlink::PORT;
169  entry.opCode = 0;
170  entry.cmdSeq = 0;
171  entry.context = cntxId++;
172 
173  FW_ASSERT(sourceFilename.length() < sizeof(entry.srcFilename));
174  FW_ASSERT(destFilename.length() < sizeof(entry.destFilename));
175  Fw::StringUtils::string_copy(entry.srcFilename, sourceFilename.toChar(), sizeof(entry.srcFilename));
176  Fw::StringUtils::string_copy(entry.destFilename, destFilename.toChar(), sizeof(entry.destFilename));
177 
178  Os::Queue::QueueStatus status = fileQueue.send((U8 *) &entry, sizeof(entry), 0, Os::Queue::QUEUE_NONBLOCKING);
179 
180  if(status != Os::Queue::QUEUE_OK) {
181  return SendFileResponse(SendFileStatus::STATUS_ERROR, __UINT32_MAX__);
182  }
183  return SendFileResponse(SendFileStatus::STATUS_OK, entry.context);
184  }
185 
186  void FileDownlink ::
187  pingIn_handler(
188  const NATIVE_INT_TYPE portNum,
189  U32 key
190  )
191  {
192  this->pingOut_out(0,key);
193  }
194 
195  void FileDownlink ::
196  bufferReturn_handler(
197  const NATIVE_INT_TYPE portNum,
198  Fw::Buffer &fwBuffer
199  )
200  {
201  //If this is a stale buffer (old, timed-out, or both), then ignore its return.
202  //File downlink actions only respond to the return of the most-recently-sent buffer.
203  if (this->lastBufferId != fwBuffer.getContext() + 1 ||
204  this->mode.get() == Mode::IDLE) {
205  return;
206  }
207  //Non-ignored buffers cannot be returned in "DOWNLINK" and "IDLE" state. Only in "WAIT", "CANCEL" state.
208  FW_ASSERT(this->mode.get() == Mode::WAIT || this->mode.get() == Mode::CANCEL, this->mode.get());
209  //If the last packet has been sent (and is returning now) then finish the file
210  if (this->lastCompletedType == Fw::FilePacket::T_END ||
211  this->lastCompletedType == Fw::FilePacket::T_CANCEL) {
212  finishHelper(this->lastCompletedType == Fw::FilePacket::T_CANCEL);
213  return;
214  }
215  //If waiting and a buffer is in-bound, then switch to downlink mode
216  else if (this->mode.get() == Mode::WAIT) {
217  this->mode.set(Mode::DOWNLINK);
218  }
219 
220  this->downlinkPacket();
221  }
222 
223  // ----------------------------------------------------------------------
224  // Command handler implementations
225  // ----------------------------------------------------------------------
226 
227  void FileDownlink ::
228  SendFile_cmdHandler(
229  const FwOpcodeType opCode,
230  const U32 cmdSeq,
231  const Fw::CmdStringArg& sourceFilename,
232  const Fw::CmdStringArg& destFilename
233  )
234  {
235  struct FileEntry entry;
236  entry.srcFilename[0] = 0;
237  entry.destFilename[0] = 0;
238  entry.offset = 0;
239  entry.length = 0;
240  entry.source = FileDownlink::COMMAND;
241  entry.opCode = opCode;
242  entry.cmdSeq = cmdSeq;
243  entry.context = __UINT32_MAX__;
244 
245  FW_ASSERT(sourceFilename.length() < sizeof(entry.srcFilename));
246  FW_ASSERT(destFilename.length() < sizeof(entry.destFilename));
247  Fw::StringUtils::string_copy(entry.srcFilename, sourceFilename.toChar(), sizeof(entry.srcFilename));
248  Fw::StringUtils::string_copy(entry.destFilename, destFilename.toChar(), sizeof(entry.destFilename));
249 
250  Os::Queue::QueueStatus status = fileQueue.send((U8 *) &entry, sizeof(entry), 0, Os::Queue::QUEUE_NONBLOCKING);
251 
252  if(status != Os::Queue::QUEUE_OK) {
253  this->cmdResponse_out(opCode, cmdSeq, Fw::COMMAND_EXECUTION_ERROR);
254  }
255  }
256 
257  void FileDownlink ::
258  SendPartial_cmdHandler(
259  FwOpcodeType opCode,
260  U32 cmdSeq,
261  const Fw::CmdStringArg& sourceFilename,
262  const Fw::CmdStringArg& destFilename,
263  U32 startOffset,
264  U32 length
265  )
266  {
267  struct FileEntry entry;
268  entry.srcFilename[0] = 0;
269  entry.destFilename[0] = 0;
270  entry.offset = startOffset;
271  entry.length = length;
272  entry.source = FileDownlink::COMMAND;
273  entry.opCode = opCode;
274  entry.cmdSeq = cmdSeq;
275  entry.context = __UINT32_MAX__;
276 
277  FW_ASSERT(sourceFilename.length() < sizeof(entry.srcFilename));
278  FW_ASSERT(destFilename.length() < sizeof(entry.destFilename));
279  Fw::StringUtils::string_copy(entry.srcFilename, sourceFilename.toChar(), sizeof(entry.srcFilename));
280  Fw::StringUtils::string_copy(entry.destFilename, destFilename.toChar(), sizeof(entry.destFilename));
281 
282  Os::Queue::QueueStatus status = fileQueue.send((U8 *) &entry, sizeof(entry), 0, Os::Queue::QUEUE_NONBLOCKING);
283 
284  if(status != Os::Queue::QUEUE_OK) {
285  this->cmdResponse_out(opCode, cmdSeq, Fw::COMMAND_EXECUTION_ERROR);
286  }
287  }
288 
289  void FileDownlink ::
290  Cancel_cmdHandler(
291  const FwOpcodeType opCode,
292  const U32 cmdSeq
293  )
294  {
295  //Must be able to cancel in both downlink and waiting states
296  if (this->mode.get() == Mode::DOWNLINK || this->mode.get() == Mode::WAIT) {
297  this->mode.set(Mode::CANCEL);
298  }
299  this->cmdResponse_out(opCode, cmdSeq, Fw::COMMAND_OK);
300  }
301 
302  // ----------------------------------------------------------------------
303  // Private helper methods
304  // ----------------------------------------------------------------------
305 
306  Fw::CommandResponse FileDownlink ::
307  statusToCmdResp(SendFileStatus status)
308  {
309  switch(status.e) {
310  case SendFileStatus::STATUS_OK:
311  return Fw::COMMAND_OK;
312  case SendFileStatus::STATUS_ERROR:
313  return Fw::COMMAND_EXECUTION_ERROR;
314  case SendFileStatus::STATUS_INVALID:
315  return Fw::COMMAND_VALIDATION_ERROR;
316  case SendFileStatus::STATUS_BUSY:
317  return Fw::COMMAND_BUSY;
318  default:
319  // Trigger assertion if given unknown status
320  FW_ASSERT(false);
321  }
322 
323  // It's impossible to reach this, but added to suppress gcc missing return warning
324  return Fw::COMMAND_EXECUTION_ERROR;
325  }
326 
327  void FileDownlink ::
328  sendResponse(SendFileStatus resp)
329  {
330  if(this->curEntry.source == FileDownlink::COMMAND) {
331  this->cmdResponse_out(this->curEntry.opCode, this->curEntry.cmdSeq, statusToCmdResp(resp));
332  } else {
333  for(NATIVE_INT_TYPE i = 0; i < this->getNum_FileComplete_OutputPorts(); i++) {
334  if(this->isConnected_FileComplete_OutputPort(i)) {
335  this->FileComplete_out(i, Svc::SendFileResponse(resp, this->curEntry.context));
336  }
337  }
338  }
339  }
340 
341  void FileDownlink ::
342  sendFile(
343  const char* sourceFilename,
344  const char* destFilename,
345  U32 startOffset,
346  U32 length
347  )
348  {
349  // Open file for downlink
350  Os::File::Status status = this->file.open(
351  sourceFilename,
352  destFilename
353  );
354 
355  // Reject command if error when opening file
356  if (status != Os::File::OP_OK) {
357  this->mode.set(Mode::IDLE);
358  this->warnings.fileOpenError();
359  sendResponse(FILEDOWNLINK_COMMAND_FAILURES_DISABLED ? SendFileStatus::STATUS_OK : SendFileStatus::STATUS_ERROR);
360  return;
361  }
362 
363 
364  if (startOffset >= this->file.size) {
365  this->enterCooldown();
366  this->log_WARNING_HI_DownlinkPartialFail(this->file.sourceName, this->file.destName, startOffset, this->file.size);
367  sendResponse(FILEDOWNLINK_COMMAND_FAILURES_DISABLED ? SendFileStatus::STATUS_OK : SendFileStatus::STATUS_INVALID);
368  return;
369  } else if (startOffset + length > this->file.size) {
370  // If the amount to downlink is greater than the file size, emit a Warning and then allow
371  // the file to be downlinked anyway
372  this->log_WARNING_LO_DownlinkPartialWarning(startOffset, length, this->file.size, this->file.sourceName, this->file.destName);
373  length = this->file.size - startOffset;
374  }
375 
376  // Send file and switch to WAIT mode
377  this->getBuffer(this->buffer, FILE_PACKET);
378  this->sendStartPacket();
379  this->mode.set(Mode::WAIT);
380  this->sequenceIndex = 1;
381  this->curTimer = 0;
382  this->byteOffset = startOffset;
383  this->lastCompletedType = Fw::FilePacket::T_START;
384 
385  // zero length means read until end of file
386  if (length > 0) {
387  this->log_ACTIVITY_HI_SendStarted(length, this->file.sourceName, this->file.destName);
388  this->endOffset = startOffset + length;
389  }
390  else {
391  this->log_ACTIVITY_HI_SendStarted(this->file.size - startOffset, this->file.sourceName, this->file.destName);
392  this->endOffset = this->file.size;
393  }
394  }
395 
396  Os::File::Status FileDownlink ::
397  sendDataPacket(U32 &byteOffset)
398  {
399  FW_ASSERT(byteOffset < this->endOffset);
401  const U32 dataSize = (byteOffset + maxDataSize > this->endOffset) ? (this->endOffset - byteOffset) : maxDataSize;
402  U8 buffer[dataSize];
403  //This will be last data packet sent
404  if (dataSize + byteOffset == this->endOffset) {
405  this->lastCompletedType = Fw::FilePacket::T_DATA;
406  }
407 
408  const Os::File::Status status =
409  this->file.read(buffer, byteOffset, dataSize);
410  if (status != Os::File::OP_OK) {
411  this->warnings.fileRead(status);
412  return status;
413  }
414 
415  const Fw::FilePacket::DataPacket dataPacket = {
416  { Fw::FilePacket::T_DATA, this->sequenceIndex },
417  byteOffset,
418  (U16)dataSize,
419  buffer
420  };
421  ++this->sequenceIndex;
422  Fw::FilePacket filePacket;
423  filePacket.fromDataPacket(dataPacket);
424  this->sendFilePacket(filePacket);
425 
426  byteOffset += dataSize;
427 
428  return Os::File::OP_OK;
429 
430  }
431 
432  void FileDownlink ::
433  sendCancelPacket(void)
434  {
435  Fw::Buffer buffer;
436  const Fw::FilePacket::CancelPacket cancelPacket = {
437  { Fw::FilePacket::T_CANCEL, this->sequenceIndex }
438  };
439 
440  Fw::FilePacket filePacket;
441  filePacket.fromCancelPacket(cancelPacket);
442  this->getBuffer(buffer, CANCEL_PACKET);
443 
444  const Fw::SerializeStatus status = filePacket.toBuffer(buffer);
445  FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
446  this->bufferSendOut_out(0, buffer);
447  this->packetsSent.packetSent();
448  }
449 
450  void FileDownlink ::
451  sendEndPacket(void)
452  {
453  const Fw::FilePacket::Header header = {
455  this->sequenceIndex
456  };
457  Fw::FilePacket::EndPacket endPacket;
458  endPacket.header = header;
459 
460  CFDP::Checksum checksum;
461  this->file.getChecksum(checksum);
462  endPacket.setChecksum(checksum);
463 
464  Fw::FilePacket filePacket;
465  filePacket.fromEndPacket(endPacket);
466  this->sendFilePacket(filePacket);
467 
468  }
469 
470  void FileDownlink ::
471  sendStartPacket(void)
472  {
473  Fw::FilePacket::StartPacket startPacket;
474  startPacket.initialize(
475  this->file.size,
476  this->file.sourceName.toChar(),
477  this->file.destName.toChar()
478  );
479  Fw::FilePacket filePacket;
480  filePacket.fromStartPacket(startPacket);
481  this->sendFilePacket(filePacket);
482  }
483 
484  void FileDownlink ::
485  sendFilePacket(const Fw::FilePacket& filePacket)
486  {
487  const U32 bufferSize = filePacket.bufferSize();
488  FW_ASSERT(this->buffer.getData() != 0);
489  FW_ASSERT(this->buffer.getSize() >= bufferSize, bufferSize, this->buffer.getSize());
490  const Fw::SerializeStatus status = filePacket.toBuffer(this->buffer);
491  FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
492  // set the buffer size to the packet size
493  this->buffer.setSize(bufferSize);
494  this->bufferSendOut_out(0, this->buffer);
495  // restore buffer size to max
497  this->packetsSent.packetSent();
498  }
499 
500  void FileDownlink ::
501  enterCooldown(void)
502  {
503  this->file.osFile.close();
504  this->mode.set(Mode::COOLDOWN);
505  this->lastCompletedType = Fw::FilePacket::T_NONE;
506  this->curTimer = 0;
507  }
508 
509  void FileDownlink ::
510  downlinkPacket()
511  {
512  FW_ASSERT(this->lastCompletedType != Fw::FilePacket::T_NONE, this->lastCompletedType);
513  FW_ASSERT(this->mode.get() == Mode::CANCEL || this->mode.get() == Mode::DOWNLINK, this->mode.get());
514  //If canceled mode and currently downlinking data then send a cancel packet
515  if (this->mode.get() == Mode::CANCEL && this->lastCompletedType == Fw::FilePacket::T_START) {
516  this->sendCancelPacket();
517  this->lastCompletedType = Fw::FilePacket::T_CANCEL;
518  }
519  //If in downlink mode and currently downlinking data then continue with the next packer
520  else if (this->mode.get() == Mode::DOWNLINK && this->lastCompletedType == Fw::FilePacket::T_START) {
521  //Send the next packet, or fail doing so
522  const Os::File::Status status = this->sendDataPacket(this->byteOffset);
523  if (status != Os::File::OP_OK) {
524  this->log_WARNING_HI_SendDataFail(this->file.sourceName, this->byteOffset);
525  this->enterCooldown();
526  this->sendResponse(FILEDOWNLINK_COMMAND_FAILURES_DISABLED ? SendFileStatus::STATUS_OK : SendFileStatus::STATUS_ERROR);
527  //Don't go to wait state
528  return;
529  }
530  }
531  //If in downlink mode or cancel and finished downlinking data then send the last packet
532  else if (this->lastCompletedType == Fw::FilePacket::T_DATA) {
533  this->sendEndPacket();
534  this->lastCompletedType = Fw::FilePacket::T_END;
535  }
536  this->mode.set(Mode::WAIT);
537  this->curTimer = 0;
538  }
539 
540  void FileDownlink ::
541  finishHelper(bool cancel)
542  {
543  //Complete command and switch to IDLE
544  if (not cancel) {
545  this->filesSent.fileSent();
546  this->log_ACTIVITY_HI_FileSent(this->file.sourceName, this->file.destName);
547  } else {
548  this->log_ACTIVITY_HI_DownlinkCanceled(this->file.sourceName, this->file.destName);
549  }
550  this->enterCooldown();
551  sendResponse(SendFileStatus::STATUS_OK);
552  }
553 
554  void FileDownlink ::
555  getBuffer(Fw::Buffer& buffer, PacketType type)
556  {
557  //Check type is correct
558  FW_ASSERT(type < COUNT_PACKET_TYPE && type >= 0, type);
559  // Wrap the buffer around our indexed memory.
560  buffer.setData(this->memoryStore[type]);
562  //Set a known ID to look for later
563  buffer.setContext(lastBufferId);
564  lastBufferId++;
565  }
566 } // end namespace Svc
Os::Queue::create
QueueStatus create(const Fw::StringBase &name, NATIVE_INT_TYPE depth, NATIVE_INT_TYPE msgSize)
create a message queue
Definition: QueueCommon.cpp:41
Fw::FilePacket::DataPacket::HEADERSIZE
@ HEADERSIZE
Definition: FilePacket.hpp:181
Fw::SerializeStatus
SerializeStatus
forward declaration for string
Definition: Serializable.hpp:14
Fw::CmdStringArg::toChar
const char * toChar(void) const
Definition: CmdString.cpp:34
Fw::FilePacket::toBuffer
SerializeStatus toBuffer(Buffer &buffer) const
Definition: FilePacket.cpp:117
Fw::Buffer::setContext
void setContext(U32 context)
Definition: Buffer.cpp:82
Fw::Buffer::getData
U8 * getData() const
Definition: Buffer.cpp:56
Fw::FilePacket::CancelPacket
The type of a cancel packet.
Definition: FilePacket.hpp:259
U8
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.hpp:76
Svc::FILEDOWNLINK_INTERNAL_BUFFER_SIZE
static const U32 FILEDOWNLINK_INTERNAL_BUFFER_SIZE
Definition: FileDownlinkCfg.hpp:23
Fw::FilePacket::StartPacket
The type of a start packet.
Definition: FilePacket.hpp:118
Fw::Buffer::setData
void setData(U8 *data)
Definition: Buffer.cpp:68
Os::Queue::QueueStatus
QueueStatus
Definition: Queue.hpp:27
Fw::EightyCharString
Definition: EightyCharString.hpp:10
Svc::FILEDOWNLINK_COMMAND_FAILURES_DISABLED
static const bool FILEDOWNLINK_COMMAND_FAILURES_DISABLED
Definition: FileDownlinkCfg.hpp:20
Fw::Buffer::getContext
U32 getContext() const
Definition: Buffer.cpp:64
Fw::FilePacket::DataPacket
The type of a data packet.
Definition: FilePacket.hpp:162
Fw::FilePacket::fromDataPacket
void fromDataPacket(const DataPacket &dataPacket)
Definition: FilePacket.cpp:76
Fw::FilePacket::Header
The type of a packet header.
Definition: FilePacket.hpp:83
Fw::Buffer
Definition: Buffer.hpp:43
Fw::FilePacket::T_CANCEL
@ T_CANCEL
Definition: FilePacket.hpp:40
StringUtils.hpp
Fw::CmdStringArg
Definition: CmdString.hpp:11
Fw::FilePacket::EndPacket
The type of an end packet.
Definition: FilePacket.hpp:216
Assert.hpp
Fw::FW_SERIALIZE_OK
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.
Definition: Serializable.hpp:15
Os::Queue::send
QueueStatus send(const Fw::SerializeBufferBase &buffer, NATIVE_INT_TYPE priority, QueueBlocking block)
send a message
Definition: QueueCommon.cpp:13
Fw::FilePacket::EndPacket::header
Header header
The packet header.
Definition: FilePacket.hpp:223
EightyCharString.hpp
Fw::FilePacket
A file packet.
Definition: FilePacket.hpp:27
Fw::FilePacket::T_NONE
@ T_NONE
Definition: FilePacket.hpp:41
Os::Queue::receive
QueueStatus receive(Fw::SerializeBufferBase &buffer, NATIVE_INT_TYPE &priority, QueueBlocking block)
receive a message
Definition: QueueCommon.cpp:22
Fw::FilePacket::bufferSize
U32 bufferSize(void) const
Definition: FilePacket.cpp:97
Fw::Buffer::getSize
U32 getSize() const
Definition: Buffer.cpp:60
Fw::StringUtils::string_copy
char * string_copy(char *destination, const char *source, U32 num)
copy string with null-termination guaranteed
Definition: StringUtils.cpp:4
FwOpcodeType
#define FwOpcodeType
Type representation for a command opcode.
Definition: FpConfig.hpp:62
Fw::Buffer::setSize
void setSize(U32 size)
Definition: Buffer.cpp:75
Fw::FilePacket::fromStartPacket
void fromStartPacket(const StartPacket &startPacket)
Definition: FilePacket.cpp:69
NATIVE_UINT_TYPE
unsigned int NATIVE_UINT_TYPE
native unsigned integer type declaration
Definition: BasicTypes.hpp:30
Fw::FilePacket::EndPacket::setChecksum
void setChecksum(const CFDP::Checksum &checksum)
Set the checksum.
Definition: EndPacket.cpp:47
Fw::FilePacket::T_START
@ T_START
Definition: FilePacket.hpp:37
FW_ASSERT
#define FW_ASSERT(...)
Definition: Assert.hpp:9
CFDP::Checksum
Class representing a CFDP checksum.
Definition: Checksum.hpp:23
Os::Queue::QUEUE_OK
@ QUEUE_OK
message sent/received okay
Definition: Queue.hpp:28
Fw::FilePacket::fromEndPacket
void fromEndPacket(const EndPacket &endPacket)
Definition: FilePacket.cpp:83
Fw::FilePacket::T_END
@ T_END
Definition: FilePacket.hpp:39
Svc
Definition: ActiveRateGroupImplCfg.hpp:18
Os::Queue::QUEUE_NONBLOCKING
@ QUEUE_NONBLOCKING
Queue receive always returns even if there is no message.
Definition: Queue.hpp:42
Os::File::Status
Status
Definition: File.hpp:24
BasicTypes.hpp
Declares ISF basic types.
Os::File::OP_OK
@ OP_OK
Operation was successful.
Definition: File.hpp:25
Fw::CmdStringArg::length
NATIVE_UINT_TYPE length(void) const
Get length of string.
Definition: CmdString.cpp:30
NATIVE_INT_TYPE
int NATIVE_INT_TYPE
native integer type declaration
Definition: BasicTypes.hpp:29
Fw::FilePacket::StartPacket::initialize
void initialize(const U32 fileSize, const char *const sourcePath, const char *const destinationPath)
Initialize a StartPacket with sequence number 0.
Definition: StartPacket.cpp:19
Fw::FilePacket::T_DATA
@ T_DATA
Definition: FilePacket.hpp:38
Fw
Definition: Buffer.cpp:21
Fw::FilePacket::fromCancelPacket
void fromCancelPacket(const CancelPacket &cancelPacket)
Definition: FilePacket.cpp:90