F´ Flight Software - C/C++ Documentation  NASA-v2.0.0
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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::OK : SendFileStatus::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  .srcFilename = {0},
165  .destFilename = {0},
166  .offset = offset,
167  .length = length,
168  .source = FileDownlink::PORT,
169  .opCode = 0,
170  .cmdSeq = 0,
171  .context = cntxId++
172  };
173 
174  FW_ASSERT(sourceFilename.length() < sizeof(entry.srcFilename));
175  FW_ASSERT(destFilename.length() < sizeof(entry.destFilename));
176  Fw::StringUtils::string_copy(entry.srcFilename, sourceFilename.toChar(), sizeof(entry.srcFilename));
177  Fw::StringUtils::string_copy(entry.destFilename, destFilename.toChar(), sizeof(entry.destFilename));
178 
179  Os::Queue::QueueStatus status = fileQueue.send((U8 *) &entry, sizeof(entry), 0, Os::Queue::QUEUE_NONBLOCKING);
180 
181  if(status != Os::Queue::QUEUE_OK) {
182  return SendFileResponse(SendFileStatus::ERROR, __UINT32_MAX__);
183  }
184  return SendFileResponse(SendFileStatus::OK, entry.context);
185  }
186 
187  void FileDownlink ::
188  pingIn_handler(
189  const NATIVE_INT_TYPE portNum,
190  U32 key
191  )
192  {
193  this->pingOut_out(0,key);
194  }
195 
196  void FileDownlink ::
197  bufferReturn_handler(
198  const NATIVE_INT_TYPE portNum,
199  Fw::Buffer &fwBuffer
200  )
201  {
202  //If this is a stale buffer (old, timed-out, or both), then ignore its return.
203  //File downlink actions only respond to the return of the most-recently-sent buffer.
204  if (this->lastBufferId != fwBuffer.getContext() + 1 ||
205  this->mode.get() == Mode::IDLE) {
206  return;
207  }
208  //Non-ignored buffers cannot be returned in "DOWNLINK" and "IDLE" state. Only in "WAIT", "CANCEL" state.
209  FW_ASSERT(this->mode.get() == Mode::WAIT || this->mode.get() == Mode::CANCEL, this->mode.get());
210  //If the last packet has been sent (and is returning now) then finish the file
211  if (this->lastCompletedType == Fw::FilePacket::T_END ||
212  this->lastCompletedType == Fw::FilePacket::T_CANCEL) {
213  finishHelper(this->lastCompletedType == Fw::FilePacket::T_CANCEL);
214  return;
215  }
216  //If waiting and a buffer is in-bound, then switch to downlink mode
217  else if (this->mode.get() == Mode::WAIT) {
218  this->mode.set(Mode::DOWNLINK);
219  }
220 
221  this->downlinkPacket();
222  }
223 
224  // ----------------------------------------------------------------------
225  // Command handler implementations
226  // ----------------------------------------------------------------------
227 
228  void FileDownlink ::
229  SendFile_cmdHandler(
230  const FwOpcodeType opCode,
231  const U32 cmdSeq,
232  const Fw::CmdStringArg& sourceFilename,
233  const Fw::CmdStringArg& destFilename
234  )
235  {
236  struct FileEntry entry = {
237  .srcFilename = {0},
238  .destFilename = {0},
239  .offset = 0,
240  .length = 0,
241  .source = FileDownlink::COMMAND,
242  .opCode = opCode,
243  .cmdSeq = cmdSeq,
244  .context =__UINT32_MAX__
245  };
246 
247  FW_ASSERT(sourceFilename.length() < sizeof(entry.srcFilename));
248  FW_ASSERT(destFilename.length() < sizeof(entry.destFilename));
249  Fw::StringUtils::string_copy(entry.srcFilename, sourceFilename.toChar(), sizeof(entry.srcFilename));
250  Fw::StringUtils::string_copy(entry.destFilename, destFilename.toChar(), sizeof(entry.destFilename));
251 
252  Os::Queue::QueueStatus status = fileQueue.send((U8 *) &entry, sizeof(entry), 0, Os::Queue::QUEUE_NONBLOCKING);
253 
254  if(status != Os::Queue::QUEUE_OK) {
255  this->cmdResponse_out(opCode, cmdSeq, Fw::COMMAND_EXECUTION_ERROR);
256  }
257  }
258 
259  void FileDownlink ::
260  SendPartial_cmdHandler(
261  FwOpcodeType opCode,
262  U32 cmdSeq,
263  const Fw::CmdStringArg& sourceFilename,
264  const Fw::CmdStringArg& destFilename,
265  U32 startOffset,
266  U32 length
267  )
268  {
269  struct FileEntry entry = {
270  .srcFilename = {0},
271  .destFilename = {0},
272  .offset = startOffset,
273  .length = length,
274  .source = FileDownlink::COMMAND,
275  .opCode = opCode,
276  .cmdSeq = cmdSeq,
277  .context = __UINT32_MAX__
278  };
279 
280  FW_ASSERT(sourceFilename.length() < sizeof(entry.srcFilename));
281  FW_ASSERT(destFilename.length() < sizeof(entry.destFilename));
282  Fw::StringUtils::string_copy(entry.srcFilename, sourceFilename.toChar(), sizeof(entry.srcFilename));
283  Fw::StringUtils::string_copy(entry.destFilename, destFilename.toChar(), sizeof(entry.destFilename));
284 
285  Os::Queue::QueueStatus status = fileQueue.send((U8 *) &entry, sizeof(entry), 0, Os::Queue::QUEUE_NONBLOCKING);
286 
287  if(status != Os::Queue::QUEUE_OK) {
288  this->cmdResponse_out(opCode, cmdSeq, Fw::COMMAND_EXECUTION_ERROR);
289  }
290  }
291 
292  void FileDownlink ::
293  Cancel_cmdHandler(
294  const FwOpcodeType opCode,
295  const U32 cmdSeq
296  )
297  {
298  //Must be able to cancel in both downlink and waiting states
299  if (this->mode.get() == Mode::DOWNLINK || this->mode.get() == Mode::WAIT) {
300  this->mode.set(Mode::CANCEL);
301  }
302  this->cmdResponse_out(opCode, cmdSeq, Fw::COMMAND_OK);
303  }
304 
305  // ----------------------------------------------------------------------
306  // Private helper methods
307  // ----------------------------------------------------------------------
308 
309  Fw::CommandResponse FileDownlink ::
310  statusToCmdResp(SendFileStatus status)
311  {
312  switch(status.e) {
313  case SendFileStatus::OK:
314  return Fw::COMMAND_OK;
315  case SendFileStatus::ERROR:
316  return Fw::COMMAND_EXECUTION_ERROR;
317  case SendFileStatus::INVALID:
318  return Fw::COMMAND_VALIDATION_ERROR;
320  return Fw::COMMAND_BUSY;
321  default:
322  // Trigger assertion if given unknown status
323  FW_ASSERT(false);
324  }
325 
326  // It's impossible to reach this, but added to suppress gcc missing return warning
327  return Fw::COMMAND_EXECUTION_ERROR;
328  }
329 
330  void FileDownlink ::
331  sendResponse(SendFileStatus resp)
332  {
333  if(this->curEntry.source == FileDownlink::COMMAND) {
334  this->cmdResponse_out(this->curEntry.opCode, this->curEntry.cmdSeq, statusToCmdResp(resp));
335  } else {
336  for(NATIVE_INT_TYPE i = 0; i < this->getNum_FileComplete_OutputPorts(); i++) {
337  if(this->isConnected_FileComplete_OutputPort(i)) {
338  this->FileComplete_out(i, Svc::SendFileResponse(resp, this->curEntry.context));
339  }
340  }
341  }
342  }
343 
344  void FileDownlink ::
345  sendFile(
346  const char* sourceFilename,
347  const char* destFilename,
348  U32 startOffset,
349  U32 length
350  )
351  {
352  // Open file for downlink
353  Os::File::Status status = this->file.open(
354  sourceFilename,
355  destFilename
356  );
357 
358  // Reject command if error when opening file
359  if (status != Os::File::OP_OK) {
360  this->mode.set(Mode::IDLE);
361  this->warnings.fileOpenError();
362  sendResponse(FILEDOWNLINK_COMMAND_FAILURES_DISABLED ? SendFileStatus::OK : SendFileStatus::ERROR);
363  return;
364  }
365 
366 
367  if (startOffset >= this->file.size) {
368  this->enterCooldown();
369  this->log_WARNING_HI_DownlinkPartialFail(this->file.sourceName, this->file.destName, startOffset, this->file.size);
370  sendResponse(FILEDOWNLINK_COMMAND_FAILURES_DISABLED ? SendFileStatus::OK : SendFileStatus::INVALID);
371  return;
372  } else if (startOffset + length > this->file.size) {
373  // If the amount to downlink is greater than the file size, emit a Warning and then allow
374  // the file to be downlinked anyway
375  this->log_WARNING_LO_DownlinkPartialWarning(startOffset, length, this->file.size, this->file.sourceName, this->file.destName);
376  length = this->file.size - startOffset;
377  }
378 
379  // Send file and switch to WAIT mode
380  this->getBuffer(this->buffer, FILE_PACKET);
381  this->sendStartPacket();
382  this->mode.set(Mode::WAIT);
383  this->sequenceIndex = 1;
384  this->curTimer = 0;
385  this->byteOffset = startOffset;
386  this->lastCompletedType = Fw::FilePacket::T_START;
387 
388  // zero length means read until end of file
389  if (length > 0) {
390  this->log_ACTIVITY_HI_SendStarted(length, this->file.sourceName, this->file.destName);
391  this->endOffset = startOffset + length;
392  }
393  else {
394  this->log_ACTIVITY_HI_SendStarted(this->file.size - startOffset, this->file.sourceName, this->file.destName);
395  this->endOffset = this->file.size;
396  }
397  }
398 
399  Os::File::Status FileDownlink ::
400  sendDataPacket(U32 &byteOffset)
401  {
402  FW_ASSERT(byteOffset < this->endOffset);
404  const U32 dataSize = (byteOffset + maxDataSize > this->endOffset) ? (this->endOffset - byteOffset) : maxDataSize;
405  U8 buffer[dataSize];
406  //This will be last data packet sent
407  if (dataSize + byteOffset == this->endOffset) {
408  this->lastCompletedType = Fw::FilePacket::T_DATA;
409  }
410 
411  const Os::File::Status status =
412  this->file.read(buffer, byteOffset, dataSize);
413  if (status != Os::File::OP_OK) {
414  this->warnings.fileRead(status);
415  return status;
416  }
417 
418  const Fw::FilePacket::DataPacket dataPacket = {
419  { Fw::FilePacket::T_DATA, this->sequenceIndex },
420  byteOffset,
421  (U16)dataSize,
422  buffer
423  };
424  ++this->sequenceIndex;
425  Fw::FilePacket filePacket;
426  filePacket.fromDataPacket(dataPacket);
427  this->sendFilePacket(filePacket);
428 
429  byteOffset += dataSize;
430 
431  return Os::File::OP_OK;
432 
433  }
434 
435  void FileDownlink ::
436  sendCancelPacket(void)
437  {
438  Fw::Buffer buffer;
439  const Fw::FilePacket::CancelPacket cancelPacket = {
440  { Fw::FilePacket::T_CANCEL, this->sequenceIndex }
441  };
442 
443  Fw::FilePacket filePacket;
444  filePacket.fromCancelPacket(cancelPacket);
445  this->getBuffer(buffer, CANCEL_PACKET);
446 
447  const Fw::SerializeStatus status = filePacket.toBuffer(buffer);
448  FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
449  this->bufferSendOut_out(0, buffer);
450  this->packetsSent.packetSent();
451  }
452 
453  void FileDownlink ::
454  sendEndPacket(void)
455  {
456  const Fw::FilePacket::Header header = {
458  this->sequenceIndex
459  };
460  Fw::FilePacket::EndPacket endPacket;
461  endPacket.header = header;
462 
463  CFDP::Checksum checksum;
464  this->file.getChecksum(checksum);
465  endPacket.setChecksum(checksum);
466 
467  Fw::FilePacket filePacket;
468  filePacket.fromEndPacket(endPacket);
469  this->sendFilePacket(filePacket);
470 
471  }
472 
473  void FileDownlink ::
474  sendStartPacket(void)
475  {
476  Fw::FilePacket::StartPacket startPacket;
477  startPacket.initialize(
478  this->file.size,
479  this->file.sourceName.toChar(),
480  this->file.destName.toChar()
481  );
482  Fw::FilePacket filePacket;
483  filePacket.fromStartPacket(startPacket);
484  this->sendFilePacket(filePacket);
485  }
486 
487  void FileDownlink ::
488  sendFilePacket(const Fw::FilePacket& filePacket)
489  {
490  const U32 bufferSize = filePacket.bufferSize();
491  FW_ASSERT(this->buffer.getData() != 0);
492  FW_ASSERT(this->buffer.getSize() >= bufferSize, bufferSize, this->buffer.getSize());
493  const Fw::SerializeStatus status = filePacket.toBuffer(this->buffer);
494  FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
495  // set the buffer size to the packet size
496  this->buffer.setSize(bufferSize);
497  this->bufferSendOut_out(0, this->buffer);
498  // restore buffer size to max
500  this->packetsSent.packetSent();
501  }
502 
503  void FileDownlink ::
504  enterCooldown(void)
505  {
506  this->file.osFile.close();
507  this->mode.set(Mode::COOLDOWN);
508  this->lastCompletedType = Fw::FilePacket::T_NONE;
509  this->curTimer = 0;
510  }
511 
512  void FileDownlink ::
513  downlinkPacket()
514  {
515  FW_ASSERT(this->lastCompletedType != Fw::FilePacket::T_NONE, this->lastCompletedType);
516  FW_ASSERT(this->mode.get() == Mode::CANCEL || this->mode.get() == Mode::DOWNLINK, this->mode.get());
517  //If canceled mode and currently downlinking data then send a cancel packet
518  if (this->mode.get() == Mode::CANCEL && this->lastCompletedType == Fw::FilePacket::T_START) {
519  this->sendCancelPacket();
520  this->lastCompletedType = Fw::FilePacket::T_CANCEL;
521  }
522  //If in downlink mode and currently downlinking data then continue with the next packer
523  else if (this->mode.get() == Mode::DOWNLINK && this->lastCompletedType == Fw::FilePacket::T_START) {
524  //Send the next packet, or fail doing so
525  const Os::File::Status status = this->sendDataPacket(this->byteOffset);
526  if (status != Os::File::OP_OK) {
527  this->log_WARNING_HI_SendDataFail(this->file.sourceName, this->byteOffset);
528  this->enterCooldown();
529  this->sendResponse(FILEDOWNLINK_COMMAND_FAILURES_DISABLED ? SendFileStatus::OK : SendFileStatus::ERROR);
530  //Don't go to wait state
531  return;
532  }
533  }
534  //If in downlink mode or cancel and finished downlinking data then send the last packet
535  else if (this->lastCompletedType == Fw::FilePacket::T_DATA) {
536  this->sendEndPacket();
537  this->lastCompletedType = Fw::FilePacket::T_END;
538  }
539  this->mode.set(Mode::WAIT);
540  this->curTimer = 0;
541  }
542 
543  void FileDownlink ::
544  finishHelper(bool cancel)
545  {
546  //Complete command and switch to IDLE
547  if (not cancel) {
548  this->filesSent.fileSent();
549  this->log_ACTIVITY_HI_FileSent(this->file.sourceName, this->file.destName);
550  } else {
551  this->log_ACTIVITY_HI_DownlinkCanceled(this->file.sourceName, this->file.destName);
552  }
553  this->enterCooldown();
554  sendResponse(SendFileStatus::OK);
555  }
556 
557  void FileDownlink ::
558  getBuffer(Fw::Buffer& buffer, PacketType type)
559  {
560  //Check type is correct
561  FW_ASSERT(type < COUNT_PACKET_TYPE && type >= 0, type);
562  // Wrap the buffer around our indexed memory.
563  buffer.setData(this->memoryStore[type]);
565  //Set a known ID to look for later
566  buffer.setContext(lastBufferId);
567  lastBufferId++;
568  }
569 } // 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
Os::FileSystem::BUSY
@ BUSY
Operand is in use by the system or by a process.
Definition: FileSystem.hpp:25
Fw
Definition: Buffer.cpp:21
Fw::FilePacket::fromCancelPacket
void fromCancelPacket(const CancelPacket &cancelPacket)
Definition: FilePacket.cpp:90