F´ Flight Software - C/C++ Documentation  NASA-v1.5.0
A framework for building embedded system applications to NASA flight quality standards.
FileUplinkComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FileUplinkComponentAc.cpp
3 // \author Auto-generated
4 // \brief cpp file for FileUplink component base 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 
13 #include <stdio.h>
14 #include <FpConfig.hpp>
16 #include <Fw/Types/Assert.hpp>
17 #if FW_ENABLE_TEXT_LOGGING
19 #endif
20 
21 
22 namespace Svc {
23 
24  // ----------------------------------------------------------------------
25  // Anonymous namespace to prevent name collisions
26  // ----------------------------------------------------------------------
27 
28  namespace {
29 
30  typedef enum {
31  FILEUPLINK_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
32  BUFFERSENDIN_BUFFERSEND,
33  PINGIN_PING
34  } MsgTypeEnum;
35 
36  // Get the max size by doing a union of the input port serialization sizes.
37 
38  typedef union {
41  } BuffUnion;
42 
43  // Define a message buffer class large enough to handle all the
44  // asynchronous inputs to the component
45 
46  class ComponentIpcSerializableBuffer :
48  {
49 
50  public:
51 
52  enum {
53  // Max. message size = size of data + message id + port
54  SERIALIZATION_SIZE =
55  sizeof(BuffUnion) +
56  sizeof(NATIVE_INT_TYPE) +
57  sizeof(NATIVE_INT_TYPE)
58  };
59 
60  NATIVE_UINT_TYPE getBuffCapacity(void) const {
61  return sizeof(m_buff);
62  }
63 
64  U8* getBuffAddr(void) {
65  return m_buff;
66  }
67 
68  const U8* getBuffAddr(void) const {
69  return m_buff;
70  }
71 
72  private:
73  // Should be the max of all the input ports serialized sizes...
74  U8 m_buff[SERIALIZATION_SIZE];
75 
76  };
77 
78  }
79 
80  // ----------------------------------------------------------------------
81  // Getters for numbers of input ports
82  // ----------------------------------------------------------------------
83 
86  {
87  FW_ASSERT(portNum < this->getNum_bufferSendIn_InputPorts(),static_cast<AssertArg>(portNum));
88  return &this->m_bufferSendIn_InputPort[portNum];
89  }
90 
93  {
94  FW_ASSERT(portNum < this->getNum_pingIn_InputPorts(),static_cast<AssertArg>(portNum));
95  return &this->m_pingIn_InputPort[portNum];
96  }
97 
98  // ----------------------------------------------------------------------
99  // Typed connectors for output ports
100  // ----------------------------------------------------------------------
101 
104  NATIVE_INT_TYPE portNum,
105  Fw::InputTimePort* port
106  )
107  {
108  FW_ASSERT(portNum < this->getNum_timeCaller_OutputPorts(),static_cast<AssertArg>(portNum));
109  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
110  }
111 
114  NATIVE_INT_TYPE portNum,
116  )
117  {
118  FW_ASSERT(portNum < this->getNum_bufferSendOut_OutputPorts(),static_cast<AssertArg>(portNum));
120  }
121 
124  NATIVE_INT_TYPE portNum,
125  Fw::InputTlmPort* port
126  )
127  {
128  FW_ASSERT(portNum < this->getNum_tlmOut_OutputPorts(),static_cast<AssertArg>(portNum));
130  }
131 
134  NATIVE_INT_TYPE portNum,
135  Fw::InputLogPort* port
136  )
137  {
138  FW_ASSERT(portNum < this->getNum_eventOut_OutputPorts(),static_cast<AssertArg>(portNum));
140  }
141 
144  NATIVE_INT_TYPE portNum,
145  Svc::InputPingPort* port
146  )
147  {
148  FW_ASSERT(portNum < this->getNum_pingOut_OutputPorts(),static_cast<AssertArg>(portNum));
150  }
151 
152 #if FW_ENABLE_TEXT_LOGGING == 1
153  void FileUplinkComponentBase ::
154  set_LogText_OutputPort(
155  NATIVE_INT_TYPE portNum,
157  )
158  {
159  FW_ASSERT(portNum < this->getNum_LogText_OutputPorts(),static_cast<AssertArg>(portNum));
160  this->m_LogText_OutputPort[portNum].addCallPort(port);
161  }
162 #endif
163 
164  // ----------------------------------------------------------------------
165  // Serialization connectors for output ports
166  // ----------------------------------------------------------------------
167 
168 #if FW_PORT_SERIALIZATION
169 
172  NATIVE_INT_TYPE portNum,
173  Fw::InputSerializePort *port
174  )
175  {
176  FW_ASSERT(portNum < this->getNum_timeCaller_OutputPorts(),static_cast<AssertArg>(portNum));
177  return this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
178  }
179 
182  NATIVE_INT_TYPE portNum,
183  Fw::InputSerializePort *port
184  )
185  {
186  FW_ASSERT(portNum < this->getNum_bufferSendOut_OutputPorts(),static_cast<AssertArg>(portNum));
187  return this->m_bufferSendOut_OutputPort[portNum].registerSerialPort(port);
188  }
189 
192  NATIVE_INT_TYPE portNum,
193  Fw::InputSerializePort *port
194  )
195  {
196  FW_ASSERT(portNum < this->getNum_tlmOut_OutputPorts(),static_cast<AssertArg>(portNum));
197  return this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
198  }
199 
202  NATIVE_INT_TYPE portNum,
203  Fw::InputSerializePort *port
204  )
205  {
206  FW_ASSERT(portNum < this->getNum_eventOut_OutputPorts(),static_cast<AssertArg>(portNum));
207  return this->m_eventOut_OutputPort[portNum].registerSerialPort(port);
208  }
209 
212  NATIVE_INT_TYPE portNum,
213  Fw::InputSerializePort *port
214  )
215  {
216  FW_ASSERT(portNum < this->getNum_pingOut_OutputPorts(),static_cast<AssertArg>(portNum));
217  return this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
218  }
219 
220 #if FW_ENABLE_TEXT_LOGGING == 1
221  void FileUplinkComponentBase ::
222  set_LogText_OutputPort(
223  NATIVE_INT_TYPE portNum,
224  Fw::InputSerializePort *port
225  )
226  {
227  FW_ASSERT(portNum < this->getNum_LogText_OutputPorts(),static_cast<AssertArg>(portNum));
228  return this->m_LogText_OutputPort[portNum].registerSerialPort(port);
229  }
230 #endif
231 
232 #endif
233 
234  // ----------------------------------------------------------------------
235  // Component construction, initialization, and destruction
236  // ----------------------------------------------------------------------
237 
238  FileUplinkComponentBase ::
239 #if FW_OBJECT_NAMES == 1
240  FileUplinkComponentBase(const char* compName) :
241  Fw::ActiveComponentBase(compName)
242 #else
243  FileUplinkComponentBase() :
244  Fw::ActiveComponentBase()
245 #endif
246  {
247 
248 
249  this->m_FileUplink_FileWriteErrorThrottle = 0;
250  this->m_FileUplink_InvalidReceiveModeThrottle = 0;
251  this->m_FileUplink_PacketOutOfBoundsThrottle = 0;
252  this->m_FileUplink_PacketOutOfOrderThrottle = 0;
253 
254  }
255 
257  init(
258  NATIVE_INT_TYPE queueDepth,
259  NATIVE_INT_TYPE instance
260  )
261  {
262 
263  // Initialize base class
265 
266  // Connect input port bufferSendIn
267  for (
268  NATIVE_INT_TYPE port = 0;
269  port < this->getNum_bufferSendIn_InputPorts();
270  port++
271  ) {
272 
273  this->m_bufferSendIn_InputPort[port].init();
274  this->m_bufferSendIn_InputPort[port].addCallComp(
275  this,
276  m_p_bufferSendIn_in
277  );
278  this->m_bufferSendIn_InputPort[port].setPortNum(port);
279 
280 #if FW_OBJECT_NAMES == 1
281  char portName[120];
282  (void) snprintf(
283  portName,
284  sizeof(portName),
285  "%s_bufferSendIn_InputPort[%d]",
286  this->m_objName,
287  port
288  );
289  this->m_bufferSendIn_InputPort[port].setObjName(portName);
290 #endif
291 
292  }
293 
294  // Connect input port pingIn
295  for (
296  NATIVE_INT_TYPE port = 0;
297  port < this->getNum_pingIn_InputPorts();
298  port++
299  ) {
300 
301  this->m_pingIn_InputPort[port].init();
302  this->m_pingIn_InputPort[port].addCallComp(
303  this,
305  );
306  this->m_pingIn_InputPort[port].setPortNum(port);
307 
308 #if FW_OBJECT_NAMES == 1
309  char portName[120];
310  (void) snprintf(
311  portName,
312  sizeof(portName),
313  "%s_pingIn_InputPort[%d]",
314  this->m_objName,
315  port
316  );
317  this->m_pingIn_InputPort[port].setObjName(portName);
318 #endif
319 
320  }
321 
322  // Initialize output port timeCaller
323  for (
324  NATIVE_INT_TYPE port = 0;
325  port < this->getNum_timeCaller_OutputPorts();
326  port++
327  ) {
328  this->m_timeCaller_OutputPort[port].init();
329 
330 #if FW_OBJECT_NAMES == 1
331  char portName[120];
332  (void) snprintf(
333  portName,
334  sizeof(portName),
335  "%s_timeCaller_OutputPort[%d]",
336  this->m_objName,
337  port
338  );
339  this->m_timeCaller_OutputPort[port].setObjName(portName);
340 #endif
341 
342  }
343 
344  // Initialize output port bufferSendOut
345  for (
346  NATIVE_INT_TYPE port = 0;
347  port < this->getNum_bufferSendOut_OutputPorts();
348  port++
349  ) {
350  this->m_bufferSendOut_OutputPort[port].init();
351 
352 #if FW_OBJECT_NAMES == 1
353  char portName[120];
354  (void) snprintf(
355  portName,
356  sizeof(portName),
357  "%s_bufferSendOut_OutputPort[%d]",
358  this->m_objName,
359  port
360  );
361  this->m_bufferSendOut_OutputPort[port].setObjName(portName);
362 #endif
363 
364  }
365 
366  // Initialize output port tlmOut
367  for (
368  NATIVE_INT_TYPE port = 0;
369  port < this->getNum_tlmOut_OutputPorts();
370  port++
371  ) {
372  this->m_tlmOut_OutputPort[port].init();
373 
374 #if FW_OBJECT_NAMES == 1
375  char portName[120];
376  (void) snprintf(
377  portName,
378  sizeof(portName),
379  "%s_tlmOut_OutputPort[%d]",
380  this->m_objName,
381  port
382  );
383  this->m_tlmOut_OutputPort[port].setObjName(portName);
384 #endif
385 
386  }
387 
388  // Initialize output port eventOut
389  for (
390  NATIVE_INT_TYPE port = 0;
391  port < this->getNum_eventOut_OutputPorts();
392  port++
393  ) {
394  this->m_eventOut_OutputPort[port].init();
395 
396 #if FW_OBJECT_NAMES == 1
397  char portName[120];
398  (void) snprintf(
399  portName,
400  sizeof(portName),
401  "%s_eventOut_OutputPort[%d]",
402  this->m_objName,
403  port
404  );
405  this->m_eventOut_OutputPort[port].setObjName(portName);
406 #endif
407 
408  }
409 
410  // Initialize output port pingOut
411  for (
412  NATIVE_INT_TYPE port = 0;
413  port < this->getNum_pingOut_OutputPorts();
414  port++
415  ) {
416  this->m_pingOut_OutputPort[port].init();
417 
418 #if FW_OBJECT_NAMES == 1
419  char portName[120];
420  (void) snprintf(
421  portName,
422  sizeof(portName),
423  "%s_pingOut_OutputPort[%d]",
424  this->m_objName,
425  port
426  );
427  this->m_pingOut_OutputPort[port].setObjName(portName);
428 #endif
429 
430  }
431 
432  // Initialize output port LogText
433 #if FW_ENABLE_TEXT_LOGGING == 1
434  for (
435  NATIVE_INT_TYPE port = 0;
436  port < this->getNum_LogText_OutputPorts();
437  port++
438  ) {
439  this->m_LogText_OutputPort[port].init();
440 
441 #if FW_OBJECT_NAMES == 1
442  char portName[120];
443  (void) snprintf(
444  portName,
445  sizeof(portName),
446  "%s_LogText_OutputPort[%d]",
447  this->m_objName,
448  port
449  );
450  this->m_LogText_OutputPort[port].setObjName(portName);
451 #endif
452 
453  }
454 #endif
455 
456  Os::Queue::QueueStatus qStat =
457  this->createQueue(
458  queueDepth,
459  ComponentIpcSerializableBuffer::SERIALIZATION_SIZE
460  );
461  FW_ASSERT(
462  Os::Queue::QUEUE_OK == qStat,
463  static_cast<AssertArg>(qStat)
464  );
465 
466  }
467 
470 
471  }
472 
473  // ----------------------------------------------------------------------
474  // Invocation functions for output ports
475  // ----------------------------------------------------------------------
476 
477  void FileUplinkComponentBase ::
478  bufferSendOut_out(
479  NATIVE_INT_TYPE portNum,
480  Fw::Buffer &fwBuffer
481  )
482  {
483  FW_ASSERT(portNum < this->getNum_bufferSendOut_OutputPorts(),static_cast<AssertArg>(portNum));
484  this->m_bufferSendOut_OutputPort[portNum].invoke(fwBuffer);
485  }
486 
489  NATIVE_INT_TYPE portNum,
490  U32 key
491  )
492  {
493  FW_ASSERT(portNum < this->getNum_pingOut_OutputPorts(),static_cast<AssertArg>(portNum));
494  this->m_pingOut_OutputPort[portNum].invoke(key);
495  }
496 
497  // ----------------------------------------------------------------------
498  // Getters for numbers of ports
499  // ----------------------------------------------------------------------
500 
501  NATIVE_INT_TYPE FileUplinkComponentBase ::
502  getNum_bufferSendIn_InputPorts(void)
503  {
505  this->m_bufferSendIn_InputPort
506  );
507  }
508 
509  NATIVE_INT_TYPE FileUplinkComponentBase ::
510  getNum_timeCaller_OutputPorts(void)
511  {
513  this->m_timeCaller_OutputPort
514  );
515  }
516 
519  {
522  );
523  }
524 
527  {
529  this->m_tlmOut_OutputPort
530  );
531  }
532 
535  {
538  );
539  }
540 
543  {
545  this->m_pingIn_InputPort
546  );
547  }
548 
551  {
554  );
555  }
556 
557 #if FW_ENABLE_TEXT_LOGGING == 1
558  NATIVE_INT_TYPE FileUplinkComponentBase ::
559  getNum_LogText_OutputPorts(void)
560  {
562  this->m_LogText_OutputPort
563  );
564  }
565 #endif
566 
567  // ----------------------------------------------------------------------
568  // Port connection status queries
569  // ----------------------------------------------------------------------
570 
571  bool FileUplinkComponentBase ::
572  isConnected_timeCaller_OutputPort(NATIVE_INT_TYPE portNum)
573  {
574  FW_ASSERT(
575  portNum < this->getNum_timeCaller_OutputPorts(),
576  static_cast<AssertArg>(portNum)
577  );
578  return this->m_timeCaller_OutputPort[portNum].isConnected();
579  }
580 
583  {
584  FW_ASSERT(
585  portNum < this->getNum_bufferSendOut_OutputPorts(),
586  static_cast<AssertArg>(portNum)
587  );
589  }
590 
593  {
594  FW_ASSERT(
595  portNum < this->getNum_tlmOut_OutputPorts(),
596  static_cast<AssertArg>(portNum)
597  );
598  return this->m_tlmOut_OutputPort[portNum].isConnected();
599  }
600 
603  {
604  FW_ASSERT(
605  portNum < this->getNum_eventOut_OutputPorts(),
606  static_cast<AssertArg>(portNum)
607  );
608  return this->m_eventOut_OutputPort[portNum].isConnected();
609  }
610 
613  {
614  FW_ASSERT(
615  portNum < this->getNum_pingOut_OutputPorts(),
616  static_cast<AssertArg>(portNum)
617  );
618  return this->m_pingOut_OutputPort[portNum].isConnected();
619  }
620 
621 #if FW_ENABLE_TEXT_LOGGING == 1
622  bool FileUplinkComponentBase ::
623  isConnected_LogText_OutputPort(NATIVE_INT_TYPE portNum)
624  {
625  FW_ASSERT(
626  portNum < this->getNum_LogText_OutputPorts(),
627  static_cast<AssertArg>(portNum)
628  );
629  return this->m_LogText_OutputPort[portNum].isConnected();
630  }
631 #endif
632 
633  // ----------------------------------------------------------------------
634  // Telemetry write functions
635  // ----------------------------------------------------------------------
636 
637  void FileUplinkComponentBase ::
638  tlmWrite_FileUplink_FilesReceived(U32 arg)
639  {
640 
641  if (this->m_tlmOut_OutputPort[0].isConnected()) {
642  Fw::Time _tlmTime;
643  if (this->m_timeCaller_OutputPort[0].isConnected()) {
644  this->m_timeCaller_OutputPort[0].invoke( _tlmTime);
645  }
646  Fw::TlmBuffer _tlmBuff;
647  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
648  FW_ASSERT(
649  _stat == Fw::FW_SERIALIZE_OK,
650  static_cast<AssertArg>(_stat)
651  );
652 
653  FwChanIdType _id;
654 
655  _id = this->getIdBase() + CHANNELID_FILEUPLINK_FILESRECEIVED;
656 
657  this->m_tlmOut_OutputPort[0].invoke(
658  _id,
659  _tlmTime,
660  _tlmBuff
661  );
662  }
663 
664  }
665 
668  {
669 
670  if (this->m_tlmOut_OutputPort[0].isConnected()) {
671  Fw::Time _tlmTime;
672  if (this->m_timeCaller_OutputPort[0].isConnected()) {
673  this->m_timeCaller_OutputPort[0].invoke( _tlmTime);
674  }
675  Fw::TlmBuffer _tlmBuff;
676  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
677  FW_ASSERT(
678  _stat == Fw::FW_SERIALIZE_OK,
679  static_cast<AssertArg>(_stat)
680  );
681 
682  FwChanIdType _id;
683 
685 
686  this->m_tlmOut_OutputPort[0].invoke(
687  _id,
688  _tlmTime,
689  _tlmBuff
690  );
691  }
692 
693  }
694 
697  {
698 
699  if (this->m_tlmOut_OutputPort[0].isConnected()) {
700  Fw::Time _tlmTime;
701  if (this->m_timeCaller_OutputPort[0].isConnected()) {
702  this->m_timeCaller_OutputPort[0].invoke( _tlmTime);
703  }
704  Fw::TlmBuffer _tlmBuff;
705  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
706  FW_ASSERT(
707  _stat == Fw::FW_SERIALIZE_OK,
708  static_cast<AssertArg>(_stat)
709  );
710 
711  FwChanIdType _id;
712 
714 
715  this->m_tlmOut_OutputPort[0].invoke(
716  _id,
717  _tlmTime,
718  _tlmBuff
719  );
720  }
721 
722  }
723 
724  // ----------------------------------------------------------------------
725  // Time
726  // ----------------------------------------------------------------------
727 
728  Fw::Time FileUplinkComponentBase ::
729  getTime(void)
730  {
731  if (this->m_timeCaller_OutputPort[0].isConnected()) {
732  Fw::Time _time;
733  this->m_timeCaller_OutputPort[0].invoke(_time);
734  return _time;
735  } else {
736  return Fw::Time(TB_NONE,0,0);
737  }
738  }
739 
740  // ----------------------------------------------------------------------
741  // Event handling functions
742  // ----------------------------------------------------------------------
743 
744  void FileUplinkComponentBase ::
745  log_WARNING_HI_FileUplink_BadChecksum(
746  Fw::LogStringArg& fileName, U32 computed, U32 read
747  )
748  {
749 
750 
751  // Get the time
752  Fw::Time _logTime;
753  if (this->m_timeCaller_OutputPort[0].isConnected()) {
754  this->m_timeCaller_OutputPort[0].invoke( _logTime);
755  }
756 
757  FwEventIdType _id = static_cast<FwEventIdType>(0);
758 
759  _id = this->getIdBase() + EVENTID_FILEUPLINK_BADCHECKSUM;
760 
761  // Emit the event on the log port
762  if (this->m_eventOut_OutputPort[0].isConnected()) {
763 
764  Fw::LogBuffer _logBuff;
766 
767 #if FW_AMPCS_COMPATIBLE
768  // Serialize the number of arguments
769  _status = _logBuff.serialize(static_cast<U8>(3));
770  FW_ASSERT(
771  _status == Fw::FW_SERIALIZE_OK,
772  static_cast<AssertArg>(_status)
773  );
774 #endif
775 
776  fileName.setMaxSerialize(40);
777  _status = _logBuff.serialize(fileName);
778  FW_ASSERT(
779  _status == Fw::FW_SERIALIZE_OK,
780  static_cast<AssertArg>(_status)
781  );
782 
783 #if FW_AMPCS_COMPATIBLE
784  // Serialize the argument size
785  _status = _logBuff.serialize(
786  static_cast<U8>(sizeof(computed))
787  );
788  FW_ASSERT(
789  _status == Fw::FW_SERIALIZE_OK,
790  static_cast<AssertArg>(_status)
791  );
792 #endif
793 
794  _status = _logBuff.serialize(computed);
795  FW_ASSERT(
796  _status == Fw::FW_SERIALIZE_OK,
797  static_cast<AssertArg>(_status)
798  );
799 
800 #if FW_AMPCS_COMPATIBLE
801  // Serialize the argument size
802  _status = _logBuff.serialize(
803  static_cast<U8>(sizeof(read))
804  );
805  FW_ASSERT(
806  _status == Fw::FW_SERIALIZE_OK,
807  static_cast<AssertArg>(_status)
808  );
809 #endif
810 
811  _status = _logBuff.serialize(read);
812  FW_ASSERT(
813  _status == Fw::FW_SERIALIZE_OK,
814  static_cast<AssertArg>(_status)
815  );
816 
817 
818  this->m_eventOut_OutputPort[0].invoke(
819  _id,
820  _logTime,Fw::LOG_WARNING_HI,
821  _logBuff
822  );
823 
824  }
825 
826  // Emit the event on the text log port
827 #if FW_ENABLE_TEXT_LOGGING
828  if (this->m_LogText_OutputPort[0].isConnected()) {
829 
830 #if FW_OBJECT_NAMES == 1
831  const char* _formatString =
832  "(%s) %s: Bad checksum value during receipt of file %s: computed 0x%08X, read 0x%08X";
833 #else
834  const char* _formatString =
835  "%s: Bad checksum value during receipt of file %s: computed 0x%08X, read 0x%08X";
836 #endif
837 
838  char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
839 
840  (void) snprintf(
841  _textBuffer,
843  _formatString,
844 #if FW_OBJECT_NAMES == 1
845  this->m_objName,
846 #endif
847  "FileUplink_BadChecksum "
848  , fileName.toChar()
849  , computed
850  , read
851  );
852 
853  // Null terminate
854  _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
855  Fw::TextLogString _logString = _textBuffer;
856  this->m_LogText_OutputPort[0].invoke(
857  _id,
858  _logTime,Fw::TEXT_LOG_WARNING_HI,
859  _logString
860  );
861 
862  }
863 #endif
864 
865  }
866 
867 
870  Fw::LogStringArg& fileName
871  )
872  {
873 
874 
875  // Get the time
876  Fw::Time _logTime;
877  if (this->m_timeCaller_OutputPort[0].isConnected()) {
878  this->m_timeCaller_OutputPort[0].invoke( _logTime);
879  }
880 
881  FwEventIdType _id = static_cast<FwEventIdType>(0);
882 
884 
885  // Emit the event on the log port
886  if (this->m_eventOut_OutputPort[0].isConnected()) {
887 
888  Fw::LogBuffer _logBuff;
890 
891 #if FW_AMPCS_COMPATIBLE
892  // Serialize the number of arguments
893  _status = _logBuff.serialize(static_cast<U8>(1));
894  FW_ASSERT(
895  _status == Fw::FW_SERIALIZE_OK,
896  static_cast<AssertArg>(_status)
897  );
898 #endif
899 
900  fileName.setMaxSerialize(40);
901  _status = _logBuff.serialize(fileName);
902  FW_ASSERT(
903  _status == Fw::FW_SERIALIZE_OK,
904  static_cast<AssertArg>(_status)
905  );
906 
907 
908  this->m_eventOut_OutputPort[0].invoke(
909  _id,
910  _logTime,Fw::LOG_WARNING_HI,
911  _logBuff
912  );
913 
914  }
915 
916  // Emit the event on the text log port
917 #if FW_ENABLE_TEXT_LOGGING
918  if (this->m_LogText_OutputPort[0].isConnected()) {
919 
920 #if FW_OBJECT_NAMES == 1
921  const char* _formatString =
922  "(%s) %s: Could not open file %s";
923 #else
924  const char* _formatString =
925  "%s: Could not open file %s";
926 #endif
927 
928  char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
929 
930  (void) snprintf(
931  _textBuffer,
933  _formatString,
934 #if FW_OBJECT_NAMES == 1
935  this->m_objName,
936 #endif
937  "FileUplink_FileOpenError "
938  , fileName.toChar()
939  );
940 
941  // Null terminate
942  _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
943  Fw::TextLogString _logString = _textBuffer;
944  this->m_LogText_OutputPort[0].invoke(
945  _id,
946  _logTime,Fw::TEXT_LOG_WARNING_HI,
947  _logString
948  );
949 
950  }
951 #endif
952 
953  }
954 
955 
958  Fw::LogStringArg& fileName
959  )
960  {
961 
962 
963  // Get the time
964  Fw::Time _logTime;
965  if (this->m_timeCaller_OutputPort[0].isConnected()) {
966  this->m_timeCaller_OutputPort[0].invoke( _logTime);
967  }
968 
969  FwEventIdType _id = static_cast<FwEventIdType>(0);
970 
972 
973  // Emit the event on the log port
974  if (this->m_eventOut_OutputPort[0].isConnected()) {
975 
976  Fw::LogBuffer _logBuff;
978 
979 #if FW_AMPCS_COMPATIBLE
980  // Serialize the number of arguments
981  _status = _logBuff.serialize(static_cast<U8>(1));
982  FW_ASSERT(
983  _status == Fw::FW_SERIALIZE_OK,
984  static_cast<AssertArg>(_status)
985  );
986 #endif
987 
988  fileName.setMaxSerialize(40);
989  _status = _logBuff.serialize(fileName);
990  FW_ASSERT(
991  _status == Fw::FW_SERIALIZE_OK,
992  static_cast<AssertArg>(_status)
993  );
994 
995 
996  this->m_eventOut_OutputPort[0].invoke(
997  _id,
998  _logTime,Fw::LOG_ACTIVITY_HI,
999  _logBuff
1000  );
1001 
1002  }
1003 
1004  // Emit the event on the text log port
1005 #if FW_ENABLE_TEXT_LOGGING
1006  if (this->m_LogText_OutputPort[0].isConnected()) {
1007 
1008 #if FW_OBJECT_NAMES == 1
1009  const char* _formatString =
1010  "(%s) %s: Received file %s";
1011 #else
1012  const char* _formatString =
1013  "%s: Received file %s";
1014 #endif
1015 
1016  char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
1017 
1018  (void) snprintf(
1019  _textBuffer,
1021  _formatString,
1022 #if FW_OBJECT_NAMES == 1
1023  this->m_objName,
1024 #endif
1025  "FileUplink_FileReceived "
1026  , fileName.toChar()
1027  );
1028 
1029  // Null terminate
1030  _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
1031  Fw::TextLogString _logString = _textBuffer;
1032  this->m_LogText_OutputPort[0].invoke(
1033  _id,
1034  _logTime,Fw::TEXT_LOG_ACTIVITY_HI,
1035  _logString
1036  );
1037 
1038  }
1039 #endif
1040 
1041  }
1042 
1043 
1046  Fw::LogStringArg& fileName
1047  )
1048  {
1049 
1050  // check throttle value
1051  if (this->m_FileUplink_FileWriteErrorThrottle >= EVENTID_FILEUPLINK_FILEWRITEERROR_THROTTLE) {
1052  return;
1053  } else {
1054  this->m_FileUplink_FileWriteErrorThrottle++;
1055  }
1056 
1057  // Get the time
1058  Fw::Time _logTime;
1059  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1060  this->m_timeCaller_OutputPort[0].invoke( _logTime);
1061  }
1062 
1063  FwEventIdType _id = static_cast<FwEventIdType>(0);
1064 
1066 
1067  // Emit the event on the log port
1068  if (this->m_eventOut_OutputPort[0].isConnected()) {
1069 
1070  Fw::LogBuffer _logBuff;
1072 
1073 #if FW_AMPCS_COMPATIBLE
1074  // Serialize the number of arguments
1075  _status = _logBuff.serialize(static_cast<U8>(1));
1076  FW_ASSERT(
1077  _status == Fw::FW_SERIALIZE_OK,
1078  static_cast<AssertArg>(_status)
1079  );
1080 #endif
1081 
1082  fileName.setMaxSerialize(40);
1083  _status = _logBuff.serialize(fileName);
1084  FW_ASSERT(
1085  _status == Fw::FW_SERIALIZE_OK,
1086  static_cast<AssertArg>(_status)
1087  );
1088 
1089 
1090  this->m_eventOut_OutputPort[0].invoke(
1091  _id,
1092  _logTime,Fw::LOG_WARNING_HI,
1093  _logBuff
1094  );
1095 
1096  }
1097 
1098  // Emit the event on the text log port
1099 #if FW_ENABLE_TEXT_LOGGING
1100  if (this->m_LogText_OutputPort[0].isConnected()) {
1101 
1102 #if FW_OBJECT_NAMES == 1
1103  const char* _formatString =
1104  "(%s) %s: Could not write to file %s";
1105 #else
1106  const char* _formatString =
1107  "%s: Could not write to file %s";
1108 #endif
1109 
1110  char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
1111 
1112  (void) snprintf(
1113  _textBuffer,
1115  _formatString,
1116 #if FW_OBJECT_NAMES == 1
1117  this->m_objName,
1118 #endif
1119  "FileUplink_FileWriteError "
1120  , fileName.toChar()
1121  );
1122 
1123  // Null terminate
1124  _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
1125  Fw::TextLogString _logString = _textBuffer;
1126  this->m_LogText_OutputPort[0].invoke(
1127  _id,
1128  _logTime,Fw::TEXT_LOG_WARNING_HI,
1129  _logString
1130  );
1131 
1132  }
1133 #endif
1134 
1135  }
1136 
1138  // reset throttle counter
1139  this->m_FileUplink_FileWriteErrorThrottle = 0;
1140  }
1141 
1144  U32 packetType, U32 mode
1145  )
1146  {
1147 
1148  // check throttle value
1150  return;
1151  } else {
1153  }
1154 
1155  // Get the time
1156  Fw::Time _logTime;
1157  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1158  this->m_timeCaller_OutputPort[0].invoke( _logTime);
1159  }
1160 
1161  FwEventIdType _id = static_cast<FwEventIdType>(0);
1162 
1164 
1165  // Emit the event on the log port
1166  if (this->m_eventOut_OutputPort[0].isConnected()) {
1167 
1168  Fw::LogBuffer _logBuff;
1170 
1171 #if FW_AMPCS_COMPATIBLE
1172  // Serialize the number of arguments
1173  _status = _logBuff.serialize(static_cast<U8>(2));
1174  FW_ASSERT(
1175  _status == Fw::FW_SERIALIZE_OK,
1176  static_cast<AssertArg>(_status)
1177  );
1178 #endif
1179 
1180 #if FW_AMPCS_COMPATIBLE
1181  // Serialize the argument size
1182  _status = _logBuff.serialize(
1183  static_cast<U8>(sizeof(packetType))
1184  );
1185  FW_ASSERT(
1186  _status == Fw::FW_SERIALIZE_OK,
1187  static_cast<AssertArg>(_status)
1188  );
1189 #endif
1190 
1191  _status = _logBuff.serialize(packetType);
1192  FW_ASSERT(
1193  _status == Fw::FW_SERIALIZE_OK,
1194  static_cast<AssertArg>(_status)
1195  );
1196 
1197 #if FW_AMPCS_COMPATIBLE
1198  // Serialize the argument size
1199  _status = _logBuff.serialize(
1200  static_cast<U8>(sizeof(mode))
1201  );
1202  FW_ASSERT(
1203  _status == Fw::FW_SERIALIZE_OK,
1204  static_cast<AssertArg>(_status)
1205  );
1206 #endif
1207 
1208  _status = _logBuff.serialize(mode);
1209  FW_ASSERT(
1210  _status == Fw::FW_SERIALIZE_OK,
1211  static_cast<AssertArg>(_status)
1212  );
1213 
1214 
1215  this->m_eventOut_OutputPort[0].invoke(
1216  _id,
1217  _logTime,Fw::LOG_WARNING_HI,
1218  _logBuff
1219  );
1220 
1221  }
1222 
1223  // Emit the event on the text log port
1224 #if FW_ENABLE_TEXT_LOGGING
1225  if (this->m_LogText_OutputPort[0].isConnected()) {
1226 
1227 #if FW_OBJECT_NAMES == 1
1228  const char* _formatString =
1229  "(%s) %s: Packet type %u received in mode %u";
1230 #else
1231  const char* _formatString =
1232  "%s: Packet type %u received in mode %u";
1233 #endif
1234 
1235  char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
1236 
1237  (void) snprintf(
1238  _textBuffer,
1240  _formatString,
1241 #if FW_OBJECT_NAMES == 1
1242  this->m_objName,
1243 #endif
1244  "FileUplink_InvalidReceiveMode "
1245  , packetType
1246  , mode
1247  );
1248 
1249  // Null terminate
1250  _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
1251  Fw::TextLogString _logString = _textBuffer;
1252  this->m_LogText_OutputPort[0].invoke(
1253  _id,
1254  _logTime,Fw::TEXT_LOG_WARNING_HI,
1255  _logString
1256  );
1257 
1258  }
1259 #endif
1260 
1261  }
1262 
1264  // reset throttle counter
1266  }
1267 
1270  U32 packetIndex, Fw::LogStringArg& fileName
1271  )
1272  {
1273 
1274  // check throttle value
1276  return;
1277  } else {
1279  }
1280 
1281  // Get the time
1282  Fw::Time _logTime;
1283  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1284  this->m_timeCaller_OutputPort[0].invoke( _logTime);
1285  }
1286 
1287  FwEventIdType _id = static_cast<FwEventIdType>(0);
1288 
1290 
1291  // Emit the event on the log port
1292  if (this->m_eventOut_OutputPort[0].isConnected()) {
1293 
1294  Fw::LogBuffer _logBuff;
1296 
1297 #if FW_AMPCS_COMPATIBLE
1298  // Serialize the number of arguments
1299  _status = _logBuff.serialize(static_cast<U8>(2));
1300  FW_ASSERT(
1301  _status == Fw::FW_SERIALIZE_OK,
1302  static_cast<AssertArg>(_status)
1303  );
1304 #endif
1305 
1306 #if FW_AMPCS_COMPATIBLE
1307  // Serialize the argument size
1308  _status = _logBuff.serialize(
1309  static_cast<U8>(sizeof(packetIndex))
1310  );
1311  FW_ASSERT(
1312  _status == Fw::FW_SERIALIZE_OK,
1313  static_cast<AssertArg>(_status)
1314  );
1315 #endif
1316 
1317  _status = _logBuff.serialize(packetIndex);
1318  FW_ASSERT(
1319  _status == Fw::FW_SERIALIZE_OK,
1320  static_cast<AssertArg>(_status)
1321  );
1322 
1323  fileName.setMaxSerialize(40);
1324  _status = _logBuff.serialize(fileName);
1325  FW_ASSERT(
1326  _status == Fw::FW_SERIALIZE_OK,
1327  static_cast<AssertArg>(_status)
1328  );
1329 
1330 
1331  this->m_eventOut_OutputPort[0].invoke(
1332  _id,
1333  _logTime,Fw::LOG_WARNING_HI,
1334  _logBuff
1335  );
1336 
1337  }
1338 
1339  // Emit the event on the text log port
1340 #if FW_ENABLE_TEXT_LOGGING
1341  if (this->m_LogText_OutputPort[0].isConnected()) {
1342 
1343 #if FW_OBJECT_NAMES == 1
1344  const char* _formatString =
1345  "(%s) %s: Packet %u out of bounds for file %s";
1346 #else
1347  const char* _formatString =
1348  "%s: Packet %u out of bounds for file %s";
1349 #endif
1350 
1351  char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
1352 
1353  (void) snprintf(
1354  _textBuffer,
1356  _formatString,
1357 #if FW_OBJECT_NAMES == 1
1358  this->m_objName,
1359 #endif
1360  "FileUplink_PacketOutOfBounds "
1361  , packetIndex
1362  , fileName.toChar()
1363  );
1364 
1365  // Null terminate
1366  _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
1367  Fw::TextLogString _logString = _textBuffer;
1368  this->m_LogText_OutputPort[0].invoke(
1369  _id,
1370  _logTime,Fw::TEXT_LOG_WARNING_HI,
1371  _logString
1372  );
1373 
1374  }
1375 #endif
1376 
1377  }
1378 
1380  // reset throttle counter
1382  }
1383 
1386  U32 packetIndex, U32 lastPacketIndex
1387  )
1388  {
1389 
1390  // check throttle value
1392  return;
1393  } else {
1395  }
1396 
1397  // Get the time
1398  Fw::Time _logTime;
1399  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1400  this->m_timeCaller_OutputPort[0].invoke( _logTime);
1401  }
1402 
1403  FwEventIdType _id = static_cast<FwEventIdType>(0);
1404 
1406 
1407  // Emit the event on the log port
1408  if (this->m_eventOut_OutputPort[0].isConnected()) {
1409 
1410  Fw::LogBuffer _logBuff;
1412 
1413 #if FW_AMPCS_COMPATIBLE
1414  // Serialize the number of arguments
1415  _status = _logBuff.serialize(static_cast<U8>(2));
1416  FW_ASSERT(
1417  _status == Fw::FW_SERIALIZE_OK,
1418  static_cast<AssertArg>(_status)
1419  );
1420 #endif
1421 
1422 #if FW_AMPCS_COMPATIBLE
1423  // Serialize the argument size
1424  _status = _logBuff.serialize(
1425  static_cast<U8>(sizeof(packetIndex))
1426  );
1427  FW_ASSERT(
1428  _status == Fw::FW_SERIALIZE_OK,
1429  static_cast<AssertArg>(_status)
1430  );
1431 #endif
1432 
1433  _status = _logBuff.serialize(packetIndex);
1434  FW_ASSERT(
1435  _status == Fw::FW_SERIALIZE_OK,
1436  static_cast<AssertArg>(_status)
1437  );
1438 
1439 #if FW_AMPCS_COMPATIBLE
1440  // Serialize the argument size
1441  _status = _logBuff.serialize(
1442  static_cast<U8>(sizeof(lastPacketIndex))
1443  );
1444  FW_ASSERT(
1445  _status == Fw::FW_SERIALIZE_OK,
1446  static_cast<AssertArg>(_status)
1447  );
1448 #endif
1449 
1450  _status = _logBuff.serialize(lastPacketIndex);
1451  FW_ASSERT(
1452  _status == Fw::FW_SERIALIZE_OK,
1453  static_cast<AssertArg>(_status)
1454  );
1455 
1456 
1457  this->m_eventOut_OutputPort[0].invoke(
1458  _id,
1459  _logTime,Fw::LOG_WARNING_HI,
1460  _logBuff
1461  );
1462 
1463  }
1464 
1465  // Emit the event on the text log port
1466 #if FW_ENABLE_TEXT_LOGGING
1467  if (this->m_LogText_OutputPort[0].isConnected()) {
1468 
1469 #if FW_OBJECT_NAMES == 1
1470  const char* _formatString =
1471  "(%s) %s: Received packet %u after packet %u";
1472 #else
1473  const char* _formatString =
1474  "%s: Received packet %u after packet %u";
1475 #endif
1476 
1477  char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
1478 
1479  (void) snprintf(
1480  _textBuffer,
1482  _formatString,
1483 #if FW_OBJECT_NAMES == 1
1484  this->m_objName,
1485 #endif
1486  "FileUplink_PacketOutOfOrder "
1487  , packetIndex
1488  , lastPacketIndex
1489  );
1490 
1491  // Null terminate
1492  _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
1493  Fw::TextLogString _logString = _textBuffer;
1494  this->m_LogText_OutputPort[0].invoke(
1495  _id,
1496  _logTime,Fw::TEXT_LOG_WARNING_HI,
1497  _logString
1498  );
1499 
1500  }
1501 #endif
1502 
1503  }
1504 
1506  // reset throttle counter
1508  }
1509 
1512  void
1513  )
1514  {
1515 
1516 
1517  // Get the time
1518  Fw::Time _logTime;
1519  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1520  this->m_timeCaller_OutputPort[0].invoke( _logTime);
1521  }
1522 
1523  FwEventIdType _id = static_cast<FwEventIdType>(0);
1524 
1526 
1527  // Emit the event on the log port
1528  if (this->m_eventOut_OutputPort[0].isConnected()) {
1529 
1530  Fw::LogBuffer _logBuff;
1531 #if FW_AMPCS_COMPATIBLE
1532  // for AMPCS, need to encode zero arguments
1534  _zero_status = _logBuff.serialize(static_cast<U8>(0));
1535  FW_ASSERT(
1536  _zero_status == Fw::FW_SERIALIZE_OK,
1537  static_cast<AssertArg>(_zero_status)
1538  );
1539 #endif
1540 
1541 
1542  this->m_eventOut_OutputPort[0].invoke(
1543  _id,
1544  _logTime,Fw::LOG_ACTIVITY_HI,
1545  _logBuff
1546  );
1547 
1548  }
1549 
1550  // Emit the event on the text log port
1551 #if FW_ENABLE_TEXT_LOGGING
1552  if (this->m_LogText_OutputPort[0].isConnected()) {
1553 
1554 #if FW_OBJECT_NAMES == 1
1555  const char* _formatString =
1556  "(%s) %s: Received CANCEL packet";
1557 #else
1558  const char* _formatString =
1559  "%s: Received CANCEL packet";
1560 #endif
1561 
1562  char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
1563 
1564  (void) snprintf(
1565  _textBuffer,
1567  _formatString,
1568 #if FW_OBJECT_NAMES == 1
1569  this->m_objName,
1570 #endif
1571  "FileUplink_UplinkCanceled "
1572  );
1573 
1574  // Null terminate
1575  _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
1576  Fw::TextLogString _logString = _textBuffer;
1577  this->m_LogText_OutputPort[0].invoke(
1578  _id,
1579  _logTime,Fw::TEXT_LOG_ACTIVITY_HI,
1580  _logString
1581  );
1582 
1583  }
1584 #endif
1585 
1586  }
1587 
1588 
1589  // ----------------------------------------------------------------------
1590  // Calls for invocations received on typed input ports
1591  // ----------------------------------------------------------------------
1592 
1593  void FileUplinkComponentBase ::
1594  m_p_bufferSendIn_in(
1595  Fw::PassiveComponentBase* callComp,
1596  NATIVE_INT_TYPE portNum,
1597  Fw::Buffer &fwBuffer
1598  )
1599  {
1600  FW_ASSERT(callComp);
1601  FileUplinkComponentBase* compPtr =
1602  (FileUplinkComponentBase*) callComp;
1603  compPtr->bufferSendIn_handlerBase(portNum, fwBuffer);
1604  }
1605 
1608  Fw::PassiveComponentBase* callComp,
1609  NATIVE_INT_TYPE portNum,
1610  U32 key
1611  )
1612  {
1613  FW_ASSERT(callComp);
1614  FileUplinkComponentBase* compPtr =
1615  (FileUplinkComponentBase*) callComp;
1616  compPtr->pingIn_handlerBase(portNum, key);
1617  }
1618 
1619  // ----------------------------------------------------------------------
1620  // Port handler base-class functions for typed input ports
1621  // ----------------------------------------------------------------------
1622 
1623  void FileUplinkComponentBase ::
1624  bufferSendIn_handlerBase(
1625  NATIVE_INT_TYPE portNum,
1626  Fw::Buffer &fwBuffer
1627  )
1628  {
1629 
1630  // Make sure port number is valid
1631  FW_ASSERT(portNum < this->getNum_bufferSendIn_InputPorts(),static_cast<AssertArg>(portNum));
1632 
1633  // Call pre-message hook
1634  bufferSendIn_preMsgHook(
1635  portNum,
1636  fwBuffer
1637  );
1638 
1639  ComponentIpcSerializableBuffer msg;
1641 
1642  _status = msg.serialize(
1643  static_cast<NATIVE_INT_TYPE>(BUFFERSENDIN_BUFFERSEND)
1644  );
1645  FW_ASSERT (
1646  _status == Fw::FW_SERIALIZE_OK,
1647  static_cast<AssertArg>(_status)
1648  );
1649 
1650  _status = msg.serialize(portNum);
1651  FW_ASSERT (
1652  _status == Fw::FW_SERIALIZE_OK,
1653  static_cast<AssertArg>(_status)
1654  );
1655 
1656  // Serialize argument fwBuffer
1657  _status = msg.serialize(fwBuffer);
1658  FW_ASSERT(
1659  _status == Fw::FW_SERIALIZE_OK,
1660  static_cast<AssertArg>(_status)
1661  );
1662 
1663 
1664  // send message
1665  Os::Queue::QueueBlocking _block =
1667  Os::Queue::QueueStatus qStatus =
1668  this->m_queue.send(msg, 0,_block);
1669  FW_ASSERT(
1670  qStatus == Os::Queue::QUEUE_OK,
1671  static_cast<AssertArg>(qStatus)
1672  );
1673 
1674  }
1675 
1678  NATIVE_INT_TYPE portNum,
1679  U32 key
1680  )
1681  {
1682 
1683  // Make sure port number is valid
1684  FW_ASSERT(portNum < this->getNum_pingIn_InputPorts(),static_cast<AssertArg>(portNum));
1685 
1686  // Call pre-message hook
1688  portNum,
1689  key
1690  );
1691 
1692  ComponentIpcSerializableBuffer msg;
1694 
1695  _status = msg.serialize(
1696  static_cast<NATIVE_INT_TYPE>(PINGIN_PING)
1697  );
1698  FW_ASSERT (
1699  _status == Fw::FW_SERIALIZE_OK,
1700  static_cast<AssertArg>(_status)
1701  );
1702 
1703  _status = msg.serialize(portNum);
1704  FW_ASSERT (
1705  _status == Fw::FW_SERIALIZE_OK,
1706  static_cast<AssertArg>(_status)
1707  );
1708 
1709  // Serialize argument key
1710  _status = msg.serialize(key);
1711  FW_ASSERT(
1712  _status == Fw::FW_SERIALIZE_OK,
1713  static_cast<AssertArg>(_status)
1714  );
1715 
1716 
1717  // send message
1718  Os::Queue::QueueBlocking _block =
1720  Os::Queue::QueueStatus qStatus =
1721  this->m_queue.send(msg, 0,_block);
1722  FW_ASSERT(
1723  qStatus == Os::Queue::QUEUE_OK,
1724  static_cast<AssertArg>(qStatus)
1725  );
1726 
1727  }
1728 
1729  // ----------------------------------------------------------------------
1730  // Pre-message hooks for async input ports
1731  // ----------------------------------------------------------------------
1732 
1733  void FileUplinkComponentBase ::
1734  bufferSendIn_preMsgHook(
1735  NATIVE_INT_TYPE portNum,
1736  Fw::Buffer &fwBuffer
1737  )
1738  {
1739  // Default: no-op
1740  }
1741 
1744  NATIVE_INT_TYPE portNum,
1745  U32 key
1746  )
1747  {
1748  // Default: no-op
1749  }
1750 
1751  // ----------------------------------------------------------------------
1752  // Message dispatch method for active and queued components. Called
1753  // by active component thread or implementation code for queued components
1754  // ----------------------------------------------------------------------
1755 
1757  doDispatch(void)
1758  {
1759  ComponentIpcSerializableBuffer msg;
1760  NATIVE_INT_TYPE priority;
1761 
1762  Os::Queue::QueueStatus msgStatus = this->m_queue.receive(msg,priority,Os::Queue::QUEUE_BLOCKING);
1763  FW_ASSERT(
1764  msgStatus == Os::Queue::QUEUE_OK,
1765  static_cast<AssertArg>(msgStatus)
1766  );
1767 
1768  // Reset to beginning of buffer
1769  msg.resetDeser();
1770 
1771  NATIVE_INT_TYPE desMsg;
1772  Fw::SerializeStatus deserStatus = msg.deserialize(desMsg);
1773  FW_ASSERT(
1774  deserStatus == Fw::FW_SERIALIZE_OK,
1775  static_cast<AssertArg>(deserStatus)
1776  );
1777 
1778  MsgTypeEnum msgType = static_cast<MsgTypeEnum>(desMsg);
1779 
1780  if (msgType == FILEUPLINK_COMPONENT_EXIT) {
1781  return MSG_DISPATCH_EXIT;
1782  }
1783 
1785  deserStatus = msg.deserialize(portNum);
1786  FW_ASSERT(
1787  deserStatus == Fw::FW_SERIALIZE_OK,
1788  static_cast<AssertArg>(deserStatus)
1789  );
1790 
1791  switch (msgType) {
1792 
1793  // Handle async input port bufferSendIn
1794  case BUFFERSENDIN_BUFFERSEND: {
1795 
1796  // Deserialize argument fwBuffer
1798  deserStatus = msg.deserialize(fwBuffer);
1799  FW_ASSERT(
1800  deserStatus == Fw::FW_SERIALIZE_OK,
1801  static_cast<AssertArg>(deserStatus)
1802  );
1803 
1804  // Call handler function
1805  this->bufferSendIn_handler(
1806  portNum,
1807  fwBuffer
1808  );
1809 
1810  break;
1811 
1812  }
1813 
1814  // Handle async input port pingIn
1815  case PINGIN_PING: {
1816 
1817  // Deserialize argument key
1818  U32 key;
1819  deserStatus = msg.deserialize(key);
1820  FW_ASSERT(
1821  deserStatus == Fw::FW_SERIALIZE_OK,
1822  static_cast<AssertArg>(deserStatus)
1823  );
1824 
1825  // Call handler function
1826  this->pingIn_handler(
1827  portNum,
1828  key
1829  );
1830 
1831  break;
1832 
1833  }
1834 
1835  default:
1836  return MSG_DISPATCH_ERROR;
1837 
1838  }
1839 
1840  return MSG_DISPATCH_OK;
1841 
1842  }
1843 
1844 } // end namespace Svc
Fw::TEXT_LOG_ACTIVITY_HI
@ TEXT_LOG_ACTIVITY_HI
Definition: LogTextPortAc.hpp:31
Fw::TextLogString
Definition: TextLogString.hpp:11
Fw::InputTimePort
Definition: TimePortAc.hpp:28
Svc::InputPingPort::SERIALIZED_SIZE
@ SERIALIZED_SIZE
serialized size of port arguments
Definition: PingPortAc.hpp:30
Fw::InputTlmPort
Definition: TlmPortAc.hpp:29
Fw::PassiveComponentBase::getIdBase
U32 getIdBase(void) const
Definition: PassiveComponentBase.cpp:40
Fw::Time
Definition: Time.hpp:10
Fw::QueuedComponentBase::doDispatch
virtual MsgDispatchStatus doDispatch(void)=0
method to dispatch a single message in the queue.
Fw::SerializeBufferBase
Definition: Serializable.hpp:43
Fw::SerializeStatus
SerializeStatus
forward declaration for string
Definition: Serializable.hpp:14
Fw::TlmBuffer
Definition: TlmBuffer.hpp:21
FwChanIdType
#define FwChanIdType
Type representation for a channel id.
Definition: FpConfig.hpp:66
Fw::PortBase::isConnected
bool isConnected(void)
Definition: PortBase.cpp:40
Fw::OutputLogPort::invoke
void invoke(FwEventIdType id, Fw::Time &timeTag, LogSeverity severity, LogBuffer &args)
Definition: LogPortAc.cpp:121
Fw::LOG_WARNING_HI
@ LOG_WARNING_HI
Definition: LogPortAc.hpp:28
FW_OBJECT_NAMES
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects)
Definition: FpConfig.hpp:91
Fw::SerializeBufferBase::serialize
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
Definition: Serializable.cpp:67
FW_NUM_ARRAY_ELEMENTS
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.hpp:103
Fw::LogStringArg
Definition: LogString.hpp:11
Fw::InputBufferSendPort::SERIALIZED_SIZE
@ SERIALIZED_SIZE
serialized size of port arguments
Definition: BufferSendPortAc.hpp:31
U8
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.hpp:76
Svc::InputPingPort::init
void init(void)
initialization function
Definition: PingPortAc.cpp:38
Fw::OutputBufferSendPort::init
void init(void)
Definition: BufferSendPortAc.cpp:89
Svc::OutputPingPort::init
void init(void)
Definition: PingPortAc.cpp:89
Os::Queue::QueueStatus
QueueStatus
Definition: Queue.hpp:27
Fw::QueuedComponentBase::m_queue
Os::Queue m_queue
queue object for active component
Definition: QueuedComponentBase.hpp:36
Fw::LogBuffer
Definition: LogBuffer.hpp:22
Svc::OutputPingPort::invoke
void invoke(U32 key)
Definition: PingPortAc.cpp:103
Fw::OutputBufferSendPort::addCallPort
void addCallPort(InputBufferSendPort *callPort)
Definition: BufferSendPortAc.cpp:93
Fw::Buffer
Definition: BufferSerializableAc.hpp:24
Fw::TEXT_LOG_WARNING_HI
@ TEXT_LOG_WARNING_HI
Definition: LogTextPortAc.hpp:28
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::LogStringArg::toChar
const char * toChar(void) const
Definition: LogString.cpp:38
Svc::OutputPingPort::addCallPort
void addCallPort(InputPingPort *callPort)
Definition: PingPortAc.cpp:93
EightyCharString.hpp
Fw::PassiveComponentBase
Definition: PassiveComponentBase.hpp:10
Fw::OutputLogPort::init
void init(void)
Definition: LogPortAc.cpp:107
Fw::ObjBase::init
void init(void)
Object initializer.
Definition: ObjBase.cpp:26
Os::Queue::QueueBlocking
QueueBlocking
Definition: Queue.hpp:40
Fw::QueuedComponentBase::MSG_DISPATCH_OK
@ MSG_DISPATCH_OK
Dispatch was normal.
Definition: QueuedComponentBase.hpp:26
BYTE
U8 BYTE
byte type
Definition: BasicTypes.hpp:77
Os::Queue::receive
QueueStatus receive(Fw::SerializeBufferBase &buffer, NATIVE_INT_TYPE &priority, QueueBlocking block)
receive a message
Definition: QueueCommon.cpp:22
Svc::InputPingPort
Definition: PingPortAc.hpp:27
Fw::OutputTlmPort::addCallPort
void addCallPort(InputTlmPort *callPort)
Definition: TlmPortAc.cpp:105
Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT
@ ACTIVE_COMPONENT_EXIT
message to exit active component task
Definition: ActiveComponentBase.hpp:27
Fw::OutputBufferSendPort::invoke
void invoke(Fw::Buffer &fwBuffer)
Definition: BufferSendPortAc.cpp:103
Fw::QueuedComponentBase::MsgDispatchStatus
MsgDispatchStatus
Definition: QueuedComponentBase.hpp:25
NATIVE_UINT_TYPE
unsigned int NATIVE_UINT_TYPE
native unsigned integer type declaration
Definition: BasicTypes.hpp:30
Fw::OutputTlmPort::invoke
void invoke(FwChanIdType id, Fw::Time &timeTag, TlmBuffer &val)
Definition: TlmPortAc.cpp:115
Fw::InputBufferSendPort
Definition: BufferSendPortAc.hpp:28
FW_ASSERT
#define FW_ASSERT(...)
Definition: Assert.hpp:9
Fw::QueuedComponentBase::MSG_DISPATCH_ERROR
@ MSG_DISPATCH_ERROR
Errors dispatching messages.
Definition: QueuedComponentBase.hpp:28
Fw::LOG_ACTIVITY_HI
@ LOG_ACTIVITY_HI
Definition: LogPortAc.hpp:31
Os::Queue::QUEUE_OK
@ QUEUE_OK
message sent/received okay
Definition: Queue.hpp:28
Fw::LogStringArg::setMaxSerialize
void setMaxSerialize(NATIVE_UINT_TYPE size)
Definition: LogString.cpp:106
Fw::OutputTlmPort::init
void init(void)
Definition: TlmPortAc.cpp:101
FpConfig.hpp
ISF configuration file.
Fw::InputPortBase::setPortNum
void setPortNum(NATIVE_INT_TYPE portNum)
Definition: InputPortBase.cpp:25
Fw::OutputLogPort::addCallPort
void addCallPort(InputLogPort *callPort)
Definition: LogPortAc.cpp:111
Fw::QueuedComponentBase::MSG_DISPATCH_EXIT
@ MSG_DISPATCH_EXIT
A message was sent requesting an exit of the loop.
Definition: QueuedComponentBase.hpp:29
Svc
Definition: ActiveLoggerComponentAc.cpp:22
Os::Queue::QUEUE_NONBLOCKING
@ QUEUE_NONBLOCKING
Queue receive always returns even if there is no message.
Definition: Queue.hpp:42
Fw::InputLogPort
Definition: LogPortAc.hpp:40
FwEventIdType
#define FwEventIdType
Type representation for a event id.
Definition: FpConfig.hpp:70
NATIVE_INT_TYPE
int NATIVE_INT_TYPE
native integer type declaration
Definition: BasicTypes.hpp:29
AssertArg
#define AssertArg
Definition: FpConfig.hpp:51
Fw::QueuedComponentBase::createQueue
Os::Queue::QueueStatus createQueue(NATIVE_INT_TYPE depth, NATIVE_INT_TYPE msgSize)
Definition: QueuedComponentBase.cpp:29
TB_NONE
@ TB_NONE
No time base has been established.
Definition: FpConfig.hpp:324
Fw
Definition: BufferGetPortAc.cpp:6
FW_LOG_TEXT_BUFFER_SIZE
#define FW_LOG_TEXT_BUFFER_SIZE
Max size of string for text log message.
Definition: FpConfig.hpp:291
Os::Queue::QUEUE_BLOCKING
@ QUEUE_BLOCKING
Queue receive blocks until a message arrives.
Definition: Queue.hpp:41
Fw::InputLogTextPort
Definition: LogTextPortAc.hpp:40
Svc::InputPingPort::addCallComp
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
call to register a component
Definition: PingPortAc.cpp:42