F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
HealthComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title HealthComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for Health component base class
5 // ======================================================================
6 
7 #include "Fw/Types/Assert.hpp"
9 #if FW_ENABLE_TEXT_LOGGING
10 #include "Fw/Types/String.hpp"
11 #endif
13 
14 namespace Svc {
15 
16  namespace {
17  enum MsgTypeEnum {
18  HEALTH_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
19  PINGRETURN_PING,
20  CMD_HLTH_ENABLE,
21  CMD_HLTH_PING_ENABLE,
22  CMD_HLTH_CHNG_PING,
23  };
24 
25  // Get the max size by constructing a union of the async input, command, and
26  // internal port serialization sizes
27  union BuffUnion {
28  BYTE PingReturnPortSize[Svc::PingPortBuffer::CAPACITY];
29  BYTE cmdPortSize[Fw::CmdPortBuffer::CAPACITY];
30  };
31 
32  // Define a message buffer class large enough to handle all the
33  // asynchronous inputs to the component
34  class ComponentIpcSerializableBuffer :
36  {
37 
38  public:
39 
40  enum {
41  // Offset into data in buffer: Size of message ID and port number
42  DATA_OFFSET = sizeof(FwEnumStoreType) + sizeof(FwIndexType),
43  // Max data size
44  MAX_DATA_SIZE = sizeof(BuffUnion),
45  // Max message size: Size of message id + size of port + max data size
46  SERIALIZATION_SIZE = DATA_OFFSET + MAX_DATA_SIZE
47  };
48 
49  Fw::Serializable::SizeType getCapacity() const {
50  return sizeof(m_buff);
51  }
52 
53  U8* getBuffAddr() {
54  return m_buff;
55  }
56 
57  const U8* getBuffAddr() const {
58  return m_buff;
59  }
60 
61  private:
62  // Should be the max of all the input ports serialized sizes...
63  U8 m_buff[SERIALIZATION_SIZE];
64 
65  };
66  }
67 
68  // ----------------------------------------------------------------------
69  // Component initialization
70  // ----------------------------------------------------------------------
71 
74  FwSizeType queueDepth,
75  FwEnumStoreType instance
76  )
77  {
78  // Initialize base class
80 
81 #if !FW_DIRECT_PORT_CALLS
82  // Connect input port CmdDisp
83  for (
84  FwIndexType port = 0;
85  port < static_cast<FwIndexType>(this->getNum_CmdDisp_InputPorts());
86  port++
87  ) {
88  this->m_CmdDisp_InputPort[port].init();
89  this->m_CmdDisp_InputPort[port].addCallComp(
90  this,
91  m_p_CmdDisp_in
92  );
93  this->m_CmdDisp_InputPort[port].setPortNum(port);
94 
95 #if FW_OBJECT_NAMES == 1
96  Fw::ObjectName portName;
97  portName.format(
98  "%s_CmdDisp_InputPort[%" PRI_FwIndexType "]",
99  this->m_objName.toChar(),
100  port
101  );
102  this->m_CmdDisp_InputPort[port].setObjName(portName.toChar());
103 #endif
104  }
105 #endif
106 
107 #if !FW_DIRECT_PORT_CALLS
108  // Connect input port PingReturn
109  for (
110  FwIndexType port = 0;
111  port < static_cast<FwIndexType>(this->getNum_PingReturn_InputPorts());
112  port++
113  ) {
114  this->m_PingReturn_InputPort[port].init();
115  this->m_PingReturn_InputPort[port].addCallComp(
116  this,
117  m_p_PingReturn_in
118  );
119  this->m_PingReturn_InputPort[port].setPortNum(port);
120 
121 #if FW_OBJECT_NAMES == 1
122  Fw::ObjectName portName;
123  portName.format(
124  "%s_PingReturn_InputPort[%" PRI_FwIndexType "]",
125  this->m_objName.toChar(),
126  port
127  );
128  this->m_PingReturn_InputPort[port].setObjName(portName.toChar());
129 #endif
130  }
131 #endif
132 
133 #if !FW_DIRECT_PORT_CALLS
134  // Connect input port Run
135  for (
136  FwIndexType port = 0;
137  port < static_cast<FwIndexType>(this->getNum_Run_InputPorts());
138  port++
139  ) {
140  this->m_Run_InputPort[port].init();
141  this->m_Run_InputPort[port].addCallComp(
142  this,
143  m_p_Run_in
144  );
145  this->m_Run_InputPort[port].setPortNum(port);
146 
147 #if FW_OBJECT_NAMES == 1
148  Fw::ObjectName portName;
149  portName.format(
150  "%s_Run_InputPort[%" PRI_FwIndexType "]",
151  this->m_objName.toChar(),
152  port
153  );
154  this->m_Run_InputPort[port].setObjName(portName.toChar());
155 #endif
156  }
157 #endif
158 
159 #if !FW_DIRECT_PORT_CALLS
160  // Connect output port CmdReg
161  for (
162  FwIndexType port = 0;
163  port < static_cast<FwIndexType>(this->getNum_CmdReg_OutputPorts());
164  port++
165  ) {
166  this->m_CmdReg_OutputPort[port].init();
167 
168 #if FW_OBJECT_NAMES == 1
169  Fw::ObjectName portName;
170  portName.format(
171  "%s_CmdReg_OutputPort[%" PRI_FwIndexType "]",
172  this->m_objName.toChar(),
173  port
174  );
175  this->m_CmdReg_OutputPort[port].setObjName(portName.toChar());
176 #endif
177  }
178 #endif
179 
180 #if !FW_DIRECT_PORT_CALLS
181  // Connect output port CmdStatus
182  for (
183  FwIndexType port = 0;
184  port < static_cast<FwIndexType>(this->getNum_CmdStatus_OutputPorts());
185  port++
186  ) {
187  this->m_CmdStatus_OutputPort[port].init();
188 
189 #if FW_OBJECT_NAMES == 1
190  Fw::ObjectName portName;
191  portName.format(
192  "%s_CmdStatus_OutputPort[%" PRI_FwIndexType "]",
193  this->m_objName.toChar(),
194  port
195  );
196  this->m_CmdStatus_OutputPort[port].setObjName(portName.toChar());
197 #endif
198  }
199 #endif
200 
201 #if !FW_DIRECT_PORT_CALLS
202  // Connect output port Log
203  for (
204  FwIndexType port = 0;
205  port < static_cast<FwIndexType>(this->getNum_Log_OutputPorts());
206  port++
207  ) {
208  this->m_Log_OutputPort[port].init();
209 
210 #if FW_OBJECT_NAMES == 1
211  Fw::ObjectName portName;
212  portName.format(
213  "%s_Log_OutputPort[%" PRI_FwIndexType "]",
214  this->m_objName.toChar(),
215  port
216  );
217  this->m_Log_OutputPort[port].setObjName(portName.toChar());
218 #endif
219  }
220 #endif
221 
222 #if !FW_DIRECT_PORT_CALLS && FW_ENABLE_TEXT_LOGGING
223  // Connect output port LogText
224  for (
225  FwIndexType port = 0;
226  port < static_cast<FwIndexType>(this->getNum_LogText_OutputPorts());
227  port++
228  ) {
229  this->m_LogText_OutputPort[port].init();
230 
231 #if FW_OBJECT_NAMES == 1
232  Fw::ObjectName portName;
233  portName.format(
234  "%s_LogText_OutputPort[%" PRI_FwIndexType "]",
235  this->m_objName.toChar(),
236  port
237  );
238  this->m_LogText_OutputPort[port].setObjName(portName.toChar());
239 #endif
240  }
241 #endif
242 
243 #if !FW_DIRECT_PORT_CALLS
244  // Connect output port Time
245  for (
246  FwIndexType port = 0;
247  port < static_cast<FwIndexType>(this->getNum_Time_OutputPorts());
248  port++
249  ) {
250  this->m_Time_OutputPort[port].init();
251 
252 #if FW_OBJECT_NAMES == 1
253  Fw::ObjectName portName;
254  portName.format(
255  "%s_Time_OutputPort[%" PRI_FwIndexType "]",
256  this->m_objName.toChar(),
257  port
258  );
259  this->m_Time_OutputPort[port].setObjName(portName.toChar());
260 #endif
261  }
262 #endif
263 
264 #if !FW_DIRECT_PORT_CALLS
265  // Connect output port Tlm
266  for (
267  FwIndexType port = 0;
268  port < static_cast<FwIndexType>(this->getNum_Tlm_OutputPorts());
269  port++
270  ) {
271  this->m_Tlm_OutputPort[port].init();
272 
273 #if FW_OBJECT_NAMES == 1
274  Fw::ObjectName portName;
275  portName.format(
276  "%s_Tlm_OutputPort[%" PRI_FwIndexType "]",
277  this->m_objName.toChar(),
278  port
279  );
280  this->m_Tlm_OutputPort[port].setObjName(portName.toChar());
281 #endif
282  }
283 #endif
284 
285 #if !FW_DIRECT_PORT_CALLS
286  // Connect output port PingSend
287  for (
288  FwIndexType port = 0;
289  port < static_cast<FwIndexType>(this->getNum_PingSend_OutputPorts());
290  port++
291  ) {
292  this->m_PingSend_OutputPort[port].init();
293 
294 #if FW_OBJECT_NAMES == 1
295  Fw::ObjectName portName;
296  portName.format(
297  "%s_PingSend_OutputPort[%" PRI_FwIndexType "]",
298  this->m_objName.toChar(),
299  port
300  );
301  this->m_PingSend_OutputPort[port].setObjName(portName.toChar());
302 #endif
303  }
304 #endif
305 
306 #if !FW_DIRECT_PORT_CALLS
307  // Connect output port WdogStroke
308  for (
309  FwIndexType port = 0;
310  port < static_cast<FwIndexType>(this->getNum_WdogStroke_OutputPorts());
311  port++
312  ) {
313  this->m_WdogStroke_OutputPort[port].init();
314 
315 #if FW_OBJECT_NAMES == 1
316  Fw::ObjectName portName;
317  portName.format(
318  "%s_WdogStroke_OutputPort[%" PRI_FwIndexType "]",
319  this->m_objName.toChar(),
320  port
321  );
322  this->m_WdogStroke_OutputPort[port].setObjName(portName.toChar());
323 #endif
324  }
325 #endif
326 
327  // Create the queue
328  Os::Queue::Status qStat = this->createQueue(
329  queueDepth,
330  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
331  );
332  FW_ASSERT(
333  Os::Queue::Status::OP_OK == qStat,
334  static_cast<FwAssertArgType>(qStat)
335  );
336  }
337 
338 #if !FW_DIRECT_PORT_CALLS
339 
340  // ----------------------------------------------------------------------
341  // Getters for special input ports
342  // ----------------------------------------------------------------------
343 
346  {
347  FW_ASSERT(
348  (0 <= portNum) && (portNum < this->getNum_CmdDisp_InputPorts()),
349  static_cast<FwAssertArgType>(portNum)
350  );
351 
352  return &this->m_CmdDisp_InputPort[portNum];
353  }
354 
355 #endif
356 
357 #if !FW_DIRECT_PORT_CALLS
358 
359  // ----------------------------------------------------------------------
360  // Getters for typed input ports
361  // ----------------------------------------------------------------------
362 
365  {
366  FW_ASSERT(
367  (0 <= portNum) && (portNum < this->getNum_PingReturn_InputPorts()),
368  static_cast<FwAssertArgType>(portNum)
369  );
370 
371  return &this->m_PingReturn_InputPort[portNum];
372  }
373 
376  {
377  FW_ASSERT(
378  (0 <= portNum) && (portNum < this->getNum_Run_InputPorts()),
379  static_cast<FwAssertArgType>(portNum)
380  );
381 
382  return &this->m_Run_InputPort[portNum];
383  }
384 
385 #endif
386 
387 #if !FW_DIRECT_PORT_CALLS
388 
389  // ----------------------------------------------------------------------
390  // Connect input ports to special output ports
391  // ----------------------------------------------------------------------
392 
395  FwIndexType portNum,
396  Fw::InputCmdRegPort* port
397  )
398  {
399  FW_ASSERT(
400  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
401  static_cast<FwAssertArgType>(portNum)
402  );
403 
404  this->m_CmdReg_OutputPort[portNum].addCallPort(port);
405  }
406 
409  FwIndexType portNum,
411  )
412  {
413  FW_ASSERT(
414  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
415  static_cast<FwAssertArgType>(portNum)
416  );
417 
418  this->m_CmdStatus_OutputPort[portNum].addCallPort(port);
419  }
420 
423  FwIndexType portNum,
424  Fw::InputLogPort* port
425  )
426  {
427  FW_ASSERT(
428  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
429  static_cast<FwAssertArgType>(portNum)
430  );
431 
432  this->m_Log_OutputPort[portNum].addCallPort(port);
433  }
434 
435 #if FW_ENABLE_TEXT_LOGGING == 1
436 
437  void HealthComponentBase ::
438  set_LogText_OutputPort(
439  FwIndexType portNum,
441  )
442  {
443  FW_ASSERT(
444  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
445  static_cast<FwAssertArgType>(portNum)
446  );
447 
448  this->m_LogText_OutputPort[portNum].addCallPort(port);
449  }
450 
451 #endif
452 
455  FwIndexType portNum,
456  Fw::InputTimePort* port
457  )
458  {
459  FW_ASSERT(
460  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
461  static_cast<FwAssertArgType>(portNum)
462  );
463 
464  this->m_Time_OutputPort[portNum].addCallPort(port);
465  }
466 
469  FwIndexType portNum,
470  Fw::InputTlmPort* port
471  )
472  {
473  FW_ASSERT(
474  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
475  static_cast<FwAssertArgType>(portNum)
476  );
477 
478  this->m_Tlm_OutputPort[portNum].addCallPort(port);
479  }
480 
481 #endif
482 
483 #if !FW_DIRECT_PORT_CALLS
484 
485  // ----------------------------------------------------------------------
486  // Connect typed input ports to typed output ports
487  // ----------------------------------------------------------------------
488 
491  FwIndexType portNum,
492  Svc::InputPingPort* port
493  )
494  {
495  FW_ASSERT(
496  (0 <= portNum) && (portNum < this->getNum_PingSend_OutputPorts()),
497  static_cast<FwAssertArgType>(portNum)
498  );
499 
500  this->m_PingSend_OutputPort[portNum].addCallPort(port);
501  }
502 
505  FwIndexType portNum,
507  )
508  {
509  FW_ASSERT(
510  (0 <= portNum) && (portNum < this->getNum_WdogStroke_OutputPorts()),
511  static_cast<FwAssertArgType>(portNum)
512  );
513 
514  this->m_WdogStroke_OutputPort[portNum].addCallPort(port);
515  }
516 
517 #endif
518 
519 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
520 
521  // ----------------------------------------------------------------------
522  // Connect serial input ports to special output ports
523  // ----------------------------------------------------------------------
524 
527  FwIndexType portNum,
528  Fw::InputSerializePort* port
529  )
530  {
531  FW_ASSERT(
532  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
533  static_cast<FwAssertArgType>(portNum)
534  );
535 
536  this->m_CmdReg_OutputPort[portNum].registerSerialPort(port);
537  }
538 
541  FwIndexType portNum,
542  Fw::InputSerializePort* port
543  )
544  {
545  FW_ASSERT(
546  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
547  static_cast<FwAssertArgType>(portNum)
548  );
549 
550  this->m_CmdStatus_OutputPort[portNum].registerSerialPort(port);
551  }
552 
555  FwIndexType portNum,
556  Fw::InputSerializePort* port
557  )
558  {
559  FW_ASSERT(
560  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
561  static_cast<FwAssertArgType>(portNum)
562  );
563 
564  this->m_Log_OutputPort[portNum].registerSerialPort(port);
565  }
566 
567 #if FW_ENABLE_TEXT_LOGGING == 1
568 
569  void HealthComponentBase ::
570  set_LogText_OutputPort(
571  FwIndexType portNum,
572  Fw::InputSerializePort* port
573  )
574  {
575  FW_ASSERT(
576  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
577  static_cast<FwAssertArgType>(portNum)
578  );
579 
580  this->m_LogText_OutputPort[portNum].registerSerialPort(port);
581  }
582 
583 #endif
584 
587  FwIndexType portNum,
588  Fw::InputSerializePort* port
589  )
590  {
591  FW_ASSERT(
592  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
593  static_cast<FwAssertArgType>(portNum)
594  );
595 
596  this->m_Time_OutputPort[portNum].registerSerialPort(port);
597  }
598 
601  FwIndexType portNum,
602  Fw::InputSerializePort* port
603  )
604  {
605  FW_ASSERT(
606  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
607  static_cast<FwAssertArgType>(portNum)
608  );
609 
610  this->m_Tlm_OutputPort[portNum].registerSerialPort(port);
611  }
612 
613 #endif
614 
615 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
616 
617  // ----------------------------------------------------------------------
618  // Connect serial input ports to typed output ports
619  // ----------------------------------------------------------------------
620 
623  FwIndexType portNum,
624  Fw::InputSerializePort* port
625  )
626  {
627  FW_ASSERT(
628  (0 <= portNum) && (portNum < this->getNum_PingSend_OutputPorts()),
629  static_cast<FwAssertArgType>(portNum)
630  );
631 
632  this->m_PingSend_OutputPort[portNum].registerSerialPort(port);
633  }
634 
637  FwIndexType portNum,
638  Fw::InputSerializePort* port
639  )
640  {
641  FW_ASSERT(
642  (0 <= portNum) && (portNum < this->getNum_WdogStroke_OutputPorts()),
643  static_cast<FwAssertArgType>(portNum)
644  );
645 
646  this->m_WdogStroke_OutputPort[portNum].registerSerialPort(port);
647  }
648 
649 #endif
650 
651  // ----------------------------------------------------------------------
652  // Command registration
653  // ----------------------------------------------------------------------
654 
657  {
659 
660  this->CmdReg_out(
661  0,
662  this->getIdBase() + OPCODE_HLTH_ENABLE
663  );
664 
665  this->CmdReg_out(
666  0,
668  );
669 
670  this->CmdReg_out(
671  0,
673  );
674  }
675 
676  // ----------------------------------------------------------------------
677  // Component construction and destruction
678  // ----------------------------------------------------------------------
679 
681  HealthComponentBase(const char* compName) :
682  Fw::QueuedComponentBase(compName)
683  {
684 
685  }
686 
689  {
690 
691  }
692 
693 #if !FW_DIRECT_PORT_CALLS
694 
695  // ----------------------------------------------------------------------
696  // Connection status queries for special output ports
697  // ----------------------------------------------------------------------
698 
701  {
702  FW_ASSERT(
703  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
704  static_cast<FwAssertArgType>(portNum)
705  );
706 
707  return this->m_CmdReg_OutputPort[portNum].isConnected();
708  }
709 
712  {
713  FW_ASSERT(
714  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
715  static_cast<FwAssertArgType>(portNum)
716  );
717 
718  return this->m_CmdStatus_OutputPort[portNum].isConnected();
719  }
720 
723  {
724  FW_ASSERT(
725  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
726  static_cast<FwAssertArgType>(portNum)
727  );
728 
729  return this->m_Log_OutputPort[portNum].isConnected();
730  }
731 
732 #if FW_ENABLE_TEXT_LOGGING == 1
733 
734  bool HealthComponentBase ::
735  isConnected_LogText_OutputPort(FwIndexType portNum) const
736  {
737  FW_ASSERT(
738  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
739  static_cast<FwAssertArgType>(portNum)
740  );
741 
742  return this->m_LogText_OutputPort[portNum].isConnected();
743  }
744 
745 #endif
746 
749  {
750  FW_ASSERT(
751  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
752  static_cast<FwAssertArgType>(portNum)
753  );
754 
755  return this->m_Time_OutputPort[portNum].isConnected();
756  }
757 
760  {
761  FW_ASSERT(
762  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
763  static_cast<FwAssertArgType>(portNum)
764  );
765 
766  return this->m_Tlm_OutputPort[portNum].isConnected();
767  }
768 
769 #endif
770 
771 #if !FW_DIRECT_PORT_CALLS
772 
773  // ----------------------------------------------------------------------
774  // Connection status queries for typed output ports
775  // ----------------------------------------------------------------------
776 
779  {
780  FW_ASSERT(
781  (0 <= portNum) && (portNum < this->getNum_PingSend_OutputPorts()),
782  static_cast<FwAssertArgType>(portNum)
783  );
784 
785  return this->m_PingSend_OutputPort[portNum].isConnected();
786  }
787 
790  {
791  FW_ASSERT(
792  (0 <= portNum) && (portNum < this->getNum_WdogStroke_OutputPorts()),
793  static_cast<FwAssertArgType>(portNum)
794  );
795 
796  return this->m_WdogStroke_OutputPort[portNum].isConnected();
797  }
798 
799 #endif
800 
801  // ----------------------------------------------------------------------
802  // Port handler base-class functions for special input ports
803  //
804  // Call these functions directly to bypass the corresponding ports
805  // ----------------------------------------------------------------------
806 
809  FwIndexType portNum,
810  FwOpcodeType opCode,
811  U32 cmdSeq,
812  Fw::CmdArgBuffer& args
813  )
814  {
815 
816  const U32 idBase = this->getIdBase();
817  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
818 
819  // Select base class function based on opcode
820  switch (opCode - idBase) {
821  case OPCODE_HLTH_ENABLE: {
823  opCode,
824  cmdSeq,
825  args
826  );
827  break;
828  }
829 
832  opCode,
833  cmdSeq,
834  args
835  );
836  break;
837  }
838 
839  case OPCODE_HLTH_CHNG_PING: {
841  opCode,
842  cmdSeq,
843  args
844  );
845  break;
846  }
847  default:
848  // Unknown opcode: ignore it
849  break;
850  }
851  }
852 
853  // ----------------------------------------------------------------------
854  // Port handler base-class functions for typed input ports
855  //
856  // Call these functions directly to bypass the corresponding ports
857  // ----------------------------------------------------------------------
858 
861  FwIndexType portNum,
862  U32 key
863  )
864  {
865  // Make sure port number is valid
866  FW_ASSERT(
867  (0 <= portNum) && (portNum < this->getNum_PingReturn_InputPorts()),
868  static_cast<FwAssertArgType>(portNum)
869  );
870 
871  // Call pre-message hook
873  portNum,
874  key
875  );
876  ComponentIpcSerializableBuffer msg;
878 
879  // Serialize message ID
880  _status = msg.serializeFrom(
881  static_cast<FwEnumStoreType>(PINGRETURN_PING)
882  );
883  FW_ASSERT(
884  _status == Fw::FW_SERIALIZE_OK,
885  static_cast<FwAssertArgType>(_status)
886  );
887 
888  // Serialize port number
889  _status = msg.serializeFrom(portNum);
890  FW_ASSERT(
891  _status == Fw::FW_SERIALIZE_OK,
892  static_cast<FwAssertArgType>(_status)
893  );
894 
895  // Serialize argument key
896  _status = msg.serializeFrom(key);
897  FW_ASSERT(
898  _status == Fw::FW_SERIALIZE_OK,
899  static_cast<FwAssertArgType>(_status)
900  );
901 
902  // Send message
904  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
905 
906  FW_ASSERT(
907  qStatus == Os::Queue::OP_OK,
908  static_cast<FwAssertArgType>(qStatus)
909  );
910  }
911 
914  FwIndexType portNum,
915  U32 context
916  )
917  {
918  // Make sure port number is valid
919  FW_ASSERT(
920  (0 <= portNum) && (portNum < this->getNum_Run_InputPorts()),
921  static_cast<FwAssertArgType>(portNum)
922  );
923 
924  // Call handler function
925  this->Run_handler(
926  portNum,
927  context
928  );
929  }
930 
931  // ----------------------------------------------------------------------
932  // Pre-message hooks for typed async input ports
933  //
934  // Each of these functions is invoked just before processing a message
935  // on the corresponding port. By default, they do nothing. You can
936  // override them to provide specific pre-message behavior.
937  // ----------------------------------------------------------------------
938 
941  FwIndexType portNum,
942  U32 key
943  )
944  {
945  // Default: no-op
946  }
947 
948 #if !FW_DIRECT_PORT_CALLS
949 
950  // ----------------------------------------------------------------------
951  // Invocation functions for typed output ports
952  // ----------------------------------------------------------------------
953 
956  FwIndexType portNum,
957  U32 key
958  ) const
959  {
960  FW_ASSERT(
961  (0 <= portNum) && (portNum < this->getNum_PingSend_OutputPorts()),
962  static_cast<FwAssertArgType>(portNum)
963  );
964 
965  FW_ASSERT(
966  this->m_PingSend_OutputPort[portNum].isConnected(),
967  static_cast<FwAssertArgType>(portNum)
968  );
969  this->m_PingSend_OutputPort[portNum].invoke(
970  key
971  );
972  }
973 
976  FwIndexType portNum,
977  U32 code
978  ) const
979  {
980  FW_ASSERT(
981  (0 <= portNum) && (portNum < this->getNum_WdogStroke_OutputPorts()),
982  static_cast<FwAssertArgType>(portNum)
983  );
984 
985  FW_ASSERT(
986  this->m_WdogStroke_OutputPort[portNum].isConnected(),
987  static_cast<FwAssertArgType>(portNum)
988  );
989  this->m_WdogStroke_OutputPort[portNum].invoke(
990  code
991  );
992  }
993 
994 #endif
995 
996  // ----------------------------------------------------------------------
997  // Command response
998  // ----------------------------------------------------------------------
999 
1002  FwOpcodeType opCode,
1003  U32 cmdSeq,
1004  Fw::CmdResponse response
1005  )
1006  {
1008  this->CmdStatus_out(0, opCode, cmdSeq, response);
1009  }
1010 
1011  // ----------------------------------------------------------------------
1012  // Command handler base-class functions
1013  //
1014  // Call these functions directly to bypass the command input port
1015  // ----------------------------------------------------------------------
1016 
1019  FwOpcodeType opCode,
1020  U32 cmdSeq,
1021  Fw::CmdArgBuffer& args
1022  )
1023  {
1024  // Call pre-message hook
1025  this->HLTH_ENABLE_preMsgHook(opCode,cmdSeq);
1026 
1027  // Defer deserializing arguments to the message dispatcher
1028  // to avoid deserializing and reserializing just for IPC
1029  ComponentIpcSerializableBuffer msg;
1031 
1032  // Serialize for IPC
1033  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_HLTH_ENABLE));
1034  FW_ASSERT (
1035  _status == Fw::FW_SERIALIZE_OK,
1036  static_cast<FwAssertArgType>(_status)
1037  );
1038 
1039  // Fake port number to make message dequeue work
1040  FwIndexType port = 0;
1041 
1042  _status = msg.serializeFrom(port);
1043  FW_ASSERT (
1044  _status == Fw::FW_SERIALIZE_OK,
1045  static_cast<FwAssertArgType>(_status)
1046  );
1047 
1048  _status = msg.serializeFrom(opCode);
1049  FW_ASSERT (
1050  _status == Fw::FW_SERIALIZE_OK,
1051  static_cast<FwAssertArgType>(_status)
1052  );
1053 
1054  _status = msg.serializeFrom(cmdSeq);
1055  FW_ASSERT (
1056  _status == Fw::FW_SERIALIZE_OK,
1057  static_cast<FwAssertArgType>(_status)
1058  );
1059 
1060  _status = msg.serializeFrom(args);
1061  FW_ASSERT (
1062  _status == Fw::FW_SERIALIZE_OK,
1063  static_cast<FwAssertArgType>(_status)
1064  );
1065 
1066  // Send message
1068  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1069 
1070  FW_ASSERT(
1071  qStatus == Os::Queue::OP_OK,
1072  static_cast<FwAssertArgType>(qStatus)
1073  );
1074  }
1075 
1078  FwOpcodeType opCode,
1079  U32 cmdSeq,
1080  Fw::CmdArgBuffer& args
1081  )
1082  {
1083  // Call pre-message hook
1084  this->HLTH_PING_ENABLE_preMsgHook(opCode,cmdSeq);
1085 
1086  // Defer deserializing arguments to the message dispatcher
1087  // to avoid deserializing and reserializing just for IPC
1088  ComponentIpcSerializableBuffer msg;
1090 
1091  // Serialize for IPC
1092  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_HLTH_PING_ENABLE));
1093  FW_ASSERT (
1094  _status == Fw::FW_SERIALIZE_OK,
1095  static_cast<FwAssertArgType>(_status)
1096  );
1097 
1098  // Fake port number to make message dequeue work
1099  FwIndexType port = 0;
1100 
1101  _status = msg.serializeFrom(port);
1102  FW_ASSERT (
1103  _status == Fw::FW_SERIALIZE_OK,
1104  static_cast<FwAssertArgType>(_status)
1105  );
1106 
1107  _status = msg.serializeFrom(opCode);
1108  FW_ASSERT (
1109  _status == Fw::FW_SERIALIZE_OK,
1110  static_cast<FwAssertArgType>(_status)
1111  );
1112 
1113  _status = msg.serializeFrom(cmdSeq);
1114  FW_ASSERT (
1115  _status == Fw::FW_SERIALIZE_OK,
1116  static_cast<FwAssertArgType>(_status)
1117  );
1118 
1119  _status = msg.serializeFrom(args);
1120  FW_ASSERT (
1121  _status == Fw::FW_SERIALIZE_OK,
1122  static_cast<FwAssertArgType>(_status)
1123  );
1124 
1125  // Send message
1127  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1128 
1129  FW_ASSERT(
1130  qStatus == Os::Queue::OP_OK,
1131  static_cast<FwAssertArgType>(qStatus)
1132  );
1133  }
1134 
1137  FwOpcodeType opCode,
1138  U32 cmdSeq,
1139  Fw::CmdArgBuffer& args
1140  )
1141  {
1142  // Call pre-message hook
1143  this->HLTH_CHNG_PING_preMsgHook(opCode,cmdSeq);
1144 
1145  // Defer deserializing arguments to the message dispatcher
1146  // to avoid deserializing and reserializing just for IPC
1147  ComponentIpcSerializableBuffer msg;
1149 
1150  // Serialize for IPC
1151  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_HLTH_CHNG_PING));
1152  FW_ASSERT (
1153  _status == Fw::FW_SERIALIZE_OK,
1154  static_cast<FwAssertArgType>(_status)
1155  );
1156 
1157  // Fake port number to make message dequeue work
1158  FwIndexType port = 0;
1159 
1160  _status = msg.serializeFrom(port);
1161  FW_ASSERT (
1162  _status == Fw::FW_SERIALIZE_OK,
1163  static_cast<FwAssertArgType>(_status)
1164  );
1165 
1166  _status = msg.serializeFrom(opCode);
1167  FW_ASSERT (
1168  _status == Fw::FW_SERIALIZE_OK,
1169  static_cast<FwAssertArgType>(_status)
1170  );
1171 
1172  _status = msg.serializeFrom(cmdSeq);
1173  FW_ASSERT (
1174  _status == Fw::FW_SERIALIZE_OK,
1175  static_cast<FwAssertArgType>(_status)
1176  );
1177 
1178  _status = msg.serializeFrom(args);
1179  FW_ASSERT (
1180  _status == Fw::FW_SERIALIZE_OK,
1181  static_cast<FwAssertArgType>(_status)
1182  );
1183 
1184  // Send message
1186  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1187 
1188  FW_ASSERT(
1189  qStatus == Os::Queue::OP_OK,
1190  static_cast<FwAssertArgType>(qStatus)
1191  );
1192  }
1193 
1194  // ----------------------------------------------------------------------
1195  // Pre-message hooks for async commands
1196  //
1197  // Each of these functions is invoked just before processing the
1198  // corresponding command. By default they do nothing. You can
1199  // override them to provide specific pre-command behavior.
1200  // ----------------------------------------------------------------------
1201 
1204  FwOpcodeType opCode,
1205  U32 cmdSeq
1206  )
1207  {
1208  // Defaults to no-op; can be overridden
1209  (void) opCode;
1210  (void) cmdSeq;
1211  }
1212 
1215  FwOpcodeType opCode,
1216  U32 cmdSeq
1217  )
1218  {
1219  // Defaults to no-op; can be overridden
1220  (void) opCode;
1221  (void) cmdSeq;
1222  }
1223 
1226  FwOpcodeType opCode,
1227  U32 cmdSeq
1228  )
1229  {
1230  // Defaults to no-op; can be overridden
1231  (void) opCode;
1232  (void) cmdSeq;
1233  }
1234 
1235  // ----------------------------------------------------------------------
1236  // Event logging functions
1237  // ----------------------------------------------------------------------
1238 
1241  {
1242  // Get the time
1243  Fw::Time _logTime;
1244  if (this->isConnected_Time_OutputPort(0)) {
1245  this->Time_out(0, _logTime);
1246  }
1247 
1248  const FwEventIdType _id = this->getIdBase() + EVENTID_HLTH_PING_WARN;
1249 
1250  // Emit the event on the log port
1251  if (this->isConnected_Log_OutputPort(0)) {
1252  Fw::LogBuffer _logBuff;
1254 
1255 #if FW_AMPCS_COMPATIBLE
1256  // Serialize the number of arguments
1257  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1258  FW_ASSERT(
1259  _status == Fw::FW_SERIALIZE_OK,
1260  static_cast<FwAssertArgType>(_status)
1261  );
1262 #endif
1263 
1264  _status = entry.serializeTo(
1265  _logBuff,
1266  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
1267  );
1268  FW_ASSERT(
1269  _status == Fw::FW_SERIALIZE_OK,
1270  static_cast<FwAssertArgType>(_status)
1271  );
1272 
1273  this->Log_out(
1274  0,
1275  _id,
1276  _logTime,
1278  _logBuff
1279  );
1280  }
1281 
1282  // Emit the event on the text log port
1283 #if FW_ENABLE_TEXT_LOGGING
1284  if (this->isConnected_LogText_OutputPort(0)) {
1285 #if FW_OBJECT_NAMES == 1
1286  const char* _formatString =
1287  "(%s) %s: Ping entry %s late warning";
1288 #else
1289  const char* _formatString =
1290  "%s: Ping entry %s late warning";
1291 #endif
1292 
1293  Fw::TextLogString _logString;
1294  _logString.format(
1295  _formatString,
1296 #if FW_OBJECT_NAMES == 1
1297  this->m_objName.toChar(),
1298 #endif
1299  "HLTH_PING_WARN ",
1300  entry.toChar()
1301  );
1302 
1303  this->LogText_out(
1304  0,
1305  _id,
1306  _logTime,
1308  _logString
1309  );
1310  }
1311 #endif
1312  }
1313 
1316  {
1317  // Get the time
1318  Fw::Time _logTime;
1319  if (this->isConnected_Time_OutputPort(0)) {
1320  this->Time_out(0, _logTime);
1321  }
1322 
1323  const FwEventIdType _id = this->getIdBase() + EVENTID_HLTH_PING_LATE;
1324 
1325  // Emit the event on the log port
1326  if (this->isConnected_Log_OutputPort(0)) {
1327  Fw::LogBuffer _logBuff;
1329 
1330 #if FW_AMPCS_COMPATIBLE
1331  // Serialize the number of arguments
1332  _status = _logBuff.serializeFrom(static_cast<U8>(1 + 1));
1333  FW_ASSERT(
1334  _status == Fw::FW_SERIALIZE_OK,
1335  static_cast<FwAssertArgType>(_status)
1336  );
1337 
1338  // For FATAL, add stack size of 4 and a dummy entry. No support for stacks yet.
1339  _status = _logBuff.serializeFrom(static_cast<U8>(4));
1340  FW_ASSERT(
1341  _status == Fw::FW_SERIALIZE_OK,
1342  static_cast<FwAssertArgType>(_status)
1343  );
1344 
1345  _status = _logBuff.serializeFrom(static_cast<U32>(0));
1346  FW_ASSERT(
1347  _status == Fw::FW_SERIALIZE_OK,
1348  static_cast<FwAssertArgType>(_status)
1349  );
1350 #endif
1351 
1352  _status = entry.serializeTo(
1353  _logBuff,
1354  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
1355  );
1356  FW_ASSERT(
1357  _status == Fw::FW_SERIALIZE_OK,
1358  static_cast<FwAssertArgType>(_status)
1359  );
1360 
1361  this->Log_out(
1362  0,
1363  _id,
1364  _logTime,
1366  _logBuff
1367  );
1368  }
1369 
1370  // Emit the event on the text log port
1371 #if FW_ENABLE_TEXT_LOGGING
1372  if (this->isConnected_LogText_OutputPort(0)) {
1373 #if FW_OBJECT_NAMES == 1
1374  const char* _formatString =
1375  "(%s) %s: Ping entry %s did not respond";
1376 #else
1377  const char* _formatString =
1378  "%s: Ping entry %s did not respond";
1379 #endif
1380 
1381  Fw::TextLogString _logString;
1382  _logString.format(
1383  _formatString,
1384 #if FW_OBJECT_NAMES == 1
1385  this->m_objName.toChar(),
1386 #endif
1387  "HLTH_PING_LATE ",
1388  entry.toChar()
1389  );
1390 
1391  this->LogText_out(
1392  0,
1393  _id,
1394  _logTime,
1396  _logString
1397  );
1398  }
1399 #endif
1400  }
1401 
1404  const Fw::StringBase& entry,
1405  U32 badKey
1406  ) const
1407  {
1408  // Get the time
1409  Fw::Time _logTime;
1410  if (this->isConnected_Time_OutputPort(0)) {
1411  this->Time_out(0, _logTime);
1412  }
1413 
1414  const FwEventIdType _id = this->getIdBase() + EVENTID_HLTH_PING_WRONG_KEY;
1415 
1416  // Emit the event on the log port
1417  if (this->isConnected_Log_OutputPort(0)) {
1418  Fw::LogBuffer _logBuff;
1420 
1421 #if FW_AMPCS_COMPATIBLE
1422  // Serialize the number of arguments
1423  _status = _logBuff.serializeFrom(static_cast<U8>(2 + 1));
1424  FW_ASSERT(
1425  _status == Fw::FW_SERIALIZE_OK,
1426  static_cast<FwAssertArgType>(_status)
1427  );
1428 
1429  // For FATAL, add stack size of 4 and a dummy entry. No support for stacks yet.
1430  _status = _logBuff.serializeFrom(static_cast<U8>(4));
1431  FW_ASSERT(
1432  _status == Fw::FW_SERIALIZE_OK,
1433  static_cast<FwAssertArgType>(_status)
1434  );
1435 
1436  _status = _logBuff.serializeFrom(static_cast<U32>(0));
1437  FW_ASSERT(
1438  _status == Fw::FW_SERIALIZE_OK,
1439  static_cast<FwAssertArgType>(_status)
1440  );
1441 #endif
1442 
1443  _status = entry.serializeTo(
1444  _logBuff,
1445  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
1446  );
1447  FW_ASSERT(
1448  _status == Fw::FW_SERIALIZE_OK,
1449  static_cast<FwAssertArgType>(_status)
1450  );
1451 
1452 #if FW_AMPCS_COMPATIBLE
1453  // Serialize the argument size
1454  _status = _logBuff.serializeFrom(
1455  static_cast<U8>(sizeof(U32))
1456  );
1457  FW_ASSERT(
1458  _status == Fw::FW_SERIALIZE_OK,
1459  static_cast<FwAssertArgType>(_status)
1460  );
1461 #endif
1462  _status = _logBuff.serializeFrom(badKey);
1463  FW_ASSERT(
1464  _status == Fw::FW_SERIALIZE_OK,
1465  static_cast<FwAssertArgType>(_status)
1466  );
1467 
1468  this->Log_out(
1469  0,
1470  _id,
1471  _logTime,
1473  _logBuff
1474  );
1475  }
1476 
1477  // Emit the event on the text log port
1478 #if FW_ENABLE_TEXT_LOGGING
1479  if (this->isConnected_LogText_OutputPort(0)) {
1480 #if FW_OBJECT_NAMES == 1
1481  const char* _formatString =
1482  "(%s) %s: Ping entry %s responded with wrong key 0x%" PRIx32 "";
1483 #else
1484  const char* _formatString =
1485  "%s: Ping entry %s responded with wrong key 0x%" PRIx32 "";
1486 #endif
1487 
1488  Fw::TextLogString _logString;
1489  _logString.format(
1490  _formatString,
1491 #if FW_OBJECT_NAMES == 1
1492  this->m_objName.toChar(),
1493 #endif
1494  "HLTH_PING_WRONG_KEY ",
1495  entry.toChar(),
1496  badKey
1497  );
1498 
1499  this->LogText_out(
1500  0,
1501  _id,
1502  _logTime,
1504  _logString
1505  );
1506  }
1507 #endif
1508  }
1509 
1512  {
1513  // Get the time
1514  Fw::Time _logTime;
1515  if (this->isConnected_Time_OutputPort(0)) {
1516  this->Time_out(0, _logTime);
1517  }
1518 
1519  const FwEventIdType _id = this->getIdBase() + EVENTID_HLTH_CHECK_ENABLE;
1520 
1521  // Emit the event on the log port
1522  if (this->isConnected_Log_OutputPort(0)) {
1523  Fw::LogBuffer _logBuff;
1525 
1526 #if FW_AMPCS_COMPATIBLE
1527  // Serialize the number of arguments
1528  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1529  FW_ASSERT(
1530  _status == Fw::FW_SERIALIZE_OK,
1531  static_cast<FwAssertArgType>(_status)
1532  );
1533 #endif
1534 
1535 #if FW_AMPCS_COMPATIBLE
1536  // Serialize the argument size
1537  _status = _logBuff.serializeFrom(
1538  static_cast<U8>(Fw::Enabled::SERIALIZED_SIZE)
1539  );
1540  FW_ASSERT(
1541  _status == Fw::FW_SERIALIZE_OK,
1542  static_cast<FwAssertArgType>(_status)
1543  );
1544 #endif
1545  _status = _logBuff.serializeFrom(enabled);
1546  FW_ASSERT(
1547  _status == Fw::FW_SERIALIZE_OK,
1548  static_cast<FwAssertArgType>(_status)
1549  );
1550 
1551  this->Log_out(
1552  0,
1553  _id,
1554  _logTime,
1556  _logBuff
1557  );
1558  }
1559 
1560  // Emit the event on the text log port
1561 #if FW_ENABLE_TEXT_LOGGING
1562  if (this->isConnected_LogText_OutputPort(0)) {
1563 #if FW_OBJECT_NAMES == 1
1564  const char* _formatString =
1565  "(%s) %s: Health checking set to %s";
1566 #else
1567  const char* _formatString =
1568  "%s: Health checking set to %s";
1569 #endif
1570 
1571  Fw::String enabledStr;
1572  enabled.toString(enabledStr);
1573 
1574  Fw::TextLogString _logString;
1575  _logString.format(
1576  _formatString,
1577 #if FW_OBJECT_NAMES == 1
1578  this->m_objName.toChar(),
1579 #endif
1580  "HLTH_CHECK_ENABLE ",
1581  enabledStr.toChar()
1582  );
1583 
1584  this->LogText_out(
1585  0,
1586  _id,
1587  _logTime,
1589  _logString
1590  );
1591  }
1592 #endif
1593  }
1594 
1597  Fw::Enabled enabled,
1598  const Fw::StringBase& entry
1599  ) const
1600  {
1601  // Get the time
1602  Fw::Time _logTime;
1603  if (this->isConnected_Time_OutputPort(0)) {
1604  this->Time_out(0, _logTime);
1605  }
1606 
1607  const FwEventIdType _id = this->getIdBase() + EVENTID_HLTH_CHECK_PING;
1608 
1609  // Emit the event on the log port
1610  if (this->isConnected_Log_OutputPort(0)) {
1611  Fw::LogBuffer _logBuff;
1613 
1614 #if FW_AMPCS_COMPATIBLE
1615  // Serialize the number of arguments
1616  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1617  FW_ASSERT(
1618  _status == Fw::FW_SERIALIZE_OK,
1619  static_cast<FwAssertArgType>(_status)
1620  );
1621 #endif
1622 
1623 #if FW_AMPCS_COMPATIBLE
1624  // Serialize the argument size
1625  _status = _logBuff.serializeFrom(
1626  static_cast<U8>(Fw::Enabled::SERIALIZED_SIZE)
1627  );
1628  FW_ASSERT(
1629  _status == Fw::FW_SERIALIZE_OK,
1630  static_cast<FwAssertArgType>(_status)
1631  );
1632 #endif
1633  _status = _logBuff.serializeFrom(enabled);
1634  FW_ASSERT(
1635  _status == Fw::FW_SERIALIZE_OK,
1636  static_cast<FwAssertArgType>(_status)
1637  );
1638 
1639  _status = entry.serializeTo(
1640  _logBuff,
1641  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
1642  );
1643  FW_ASSERT(
1644  _status == Fw::FW_SERIALIZE_OK,
1645  static_cast<FwAssertArgType>(_status)
1646  );
1647 
1648  this->Log_out(
1649  0,
1650  _id,
1651  _logTime,
1653  _logBuff
1654  );
1655  }
1656 
1657  // Emit the event on the text log port
1658 #if FW_ENABLE_TEXT_LOGGING
1659  if (this->isConnected_LogText_OutputPort(0)) {
1660 #if FW_OBJECT_NAMES == 1
1661  const char* _formatString =
1662  "(%s) %s: Health checking set to %s for %s";
1663 #else
1664  const char* _formatString =
1665  "%s: Health checking set to %s for %s";
1666 #endif
1667 
1668  Fw::String enabledStr;
1669  enabled.toString(enabledStr);
1670 
1671  Fw::TextLogString _logString;
1672  _logString.format(
1673  _formatString,
1674 #if FW_OBJECT_NAMES == 1
1675  this->m_objName.toChar(),
1676 #endif
1677  "HLTH_CHECK_PING ",
1678  enabledStr.toChar(),
1679  entry.toChar()
1680  );
1681 
1682  this->LogText_out(
1683  0,
1684  _id,
1685  _logTime,
1687  _logString
1688  );
1689  }
1690 #endif
1691  }
1692 
1695  {
1696  // Get the time
1697  Fw::Time _logTime;
1698  if (this->isConnected_Time_OutputPort(0)) {
1699  this->Time_out(0, _logTime);
1700  }
1701 
1703 
1704  // Emit the event on the log port
1705  if (this->isConnected_Log_OutputPort(0)) {
1706  Fw::LogBuffer _logBuff;
1708 
1709 #if FW_AMPCS_COMPATIBLE
1710  // Serialize the number of arguments
1711  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1712  FW_ASSERT(
1713  _status == Fw::FW_SERIALIZE_OK,
1714  static_cast<FwAssertArgType>(_status)
1715  );
1716 #endif
1717 
1718  _status = entry.serializeTo(
1719  _logBuff,
1720  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
1721  );
1722  FW_ASSERT(
1723  _status == Fw::FW_SERIALIZE_OK,
1724  static_cast<FwAssertArgType>(_status)
1725  );
1726 
1727  this->Log_out(
1728  0,
1729  _id,
1730  _logTime,
1732  _logBuff
1733  );
1734  }
1735 
1736  // Emit the event on the text log port
1737 #if FW_ENABLE_TEXT_LOGGING
1738  if (this->isConnected_LogText_OutputPort(0)) {
1739 #if FW_OBJECT_NAMES == 1
1740  const char* _formatString =
1741  "(%s) %s: Couldn't find entry %s";
1742 #else
1743  const char* _formatString =
1744  "%s: Couldn't find entry %s";
1745 #endif
1746 
1747  Fw::TextLogString _logString;
1748  _logString.format(
1749  _formatString,
1750 #if FW_OBJECT_NAMES == 1
1751  this->m_objName.toChar(),
1752 #endif
1753  "HLTH_CHECK_LOOKUP_ERROR ",
1754  entry.toChar()
1755  );
1756 
1757  this->LogText_out(
1758  0,
1759  _id,
1760  _logTime,
1762  _logString
1763  );
1764  }
1765 #endif
1766  }
1767 
1770  const Fw::StringBase& entry,
1771  U32 warn,
1772  U32 fatal
1773  ) const
1774  {
1775  // Get the time
1776  Fw::Time _logTime;
1777  if (this->isConnected_Time_OutputPort(0)) {
1778  this->Time_out(0, _logTime);
1779  }
1780 
1781  const FwEventIdType _id = this->getIdBase() + EVENTID_HLTH_PING_UPDATED;
1782 
1783  // Emit the event on the log port
1784  if (this->isConnected_Log_OutputPort(0)) {
1785  Fw::LogBuffer _logBuff;
1787 
1788 #if FW_AMPCS_COMPATIBLE
1789  // Serialize the number of arguments
1790  _status = _logBuff.serializeFrom(static_cast<U8>(3));
1791  FW_ASSERT(
1792  _status == Fw::FW_SERIALIZE_OK,
1793  static_cast<FwAssertArgType>(_status)
1794  );
1795 #endif
1796 
1797  _status = entry.serializeTo(
1798  _logBuff,
1799  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
1800  );
1801  FW_ASSERT(
1802  _status == Fw::FW_SERIALIZE_OK,
1803  static_cast<FwAssertArgType>(_status)
1804  );
1805 
1806 #if FW_AMPCS_COMPATIBLE
1807  // Serialize the argument size
1808  _status = _logBuff.serializeFrom(
1809  static_cast<U8>(sizeof(U32))
1810  );
1811  FW_ASSERT(
1812  _status == Fw::FW_SERIALIZE_OK,
1813  static_cast<FwAssertArgType>(_status)
1814  );
1815 #endif
1816  _status = _logBuff.serializeFrom(warn);
1817  FW_ASSERT(
1818  _status == Fw::FW_SERIALIZE_OK,
1819  static_cast<FwAssertArgType>(_status)
1820  );
1821 
1822 #if FW_AMPCS_COMPATIBLE
1823  // Serialize the argument size
1824  _status = _logBuff.serializeFrom(
1825  static_cast<U8>(sizeof(U32))
1826  );
1827  FW_ASSERT(
1828  _status == Fw::FW_SERIALIZE_OK,
1829  static_cast<FwAssertArgType>(_status)
1830  );
1831 #endif
1832  _status = _logBuff.serializeFrom(fatal);
1833  FW_ASSERT(
1834  _status == Fw::FW_SERIALIZE_OK,
1835  static_cast<FwAssertArgType>(_status)
1836  );
1837 
1838  this->Log_out(
1839  0,
1840  _id,
1841  _logTime,
1843  _logBuff
1844  );
1845  }
1846 
1847  // Emit the event on the text log port
1848 #if FW_ENABLE_TEXT_LOGGING
1849  if (this->isConnected_LogText_OutputPort(0)) {
1850 #if FW_OBJECT_NAMES == 1
1851  const char* _formatString =
1852  "(%s) %s: Health ping for %s changed to WARN %" PRIu32 " FATAL %" PRIu32 "";
1853 #else
1854  const char* _formatString =
1855  "%s: Health ping for %s changed to WARN %" PRIu32 " FATAL %" PRIu32 "";
1856 #endif
1857 
1858  Fw::TextLogString _logString;
1859  _logString.format(
1860  _formatString,
1861 #if FW_OBJECT_NAMES == 1
1862  this->m_objName.toChar(),
1863 #endif
1864  "HLTH_PING_UPDATED ",
1865  entry.toChar(),
1866  warn,
1867  fatal
1868  );
1869 
1870  this->LogText_out(
1871  0,
1872  _id,
1873  _logTime,
1875  _logString
1876  );
1877  }
1878 #endif
1879  }
1880 
1883  const Fw::StringBase& entry,
1884  U32 warn,
1885  U32 fatal
1886  ) const
1887  {
1888  // Get the time
1889  Fw::Time _logTime;
1890  if (this->isConnected_Time_OutputPort(0)) {
1891  this->Time_out(0, _logTime);
1892  }
1893 
1895 
1896  // Emit the event on the log port
1897  if (this->isConnected_Log_OutputPort(0)) {
1898  Fw::LogBuffer _logBuff;
1900 
1901 #if FW_AMPCS_COMPATIBLE
1902  // Serialize the number of arguments
1903  _status = _logBuff.serializeFrom(static_cast<U8>(3));
1904  FW_ASSERT(
1905  _status == Fw::FW_SERIALIZE_OK,
1906  static_cast<FwAssertArgType>(_status)
1907  );
1908 #endif
1909 
1910  _status = entry.serializeTo(
1911  _logBuff,
1912  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
1913  );
1914  FW_ASSERT(
1915  _status == Fw::FW_SERIALIZE_OK,
1916  static_cast<FwAssertArgType>(_status)
1917  );
1918 
1919 #if FW_AMPCS_COMPATIBLE
1920  // Serialize the argument size
1921  _status = _logBuff.serializeFrom(
1922  static_cast<U8>(sizeof(U32))
1923  );
1924  FW_ASSERT(
1925  _status == Fw::FW_SERIALIZE_OK,
1926  static_cast<FwAssertArgType>(_status)
1927  );
1928 #endif
1929  _status = _logBuff.serializeFrom(warn);
1930  FW_ASSERT(
1931  _status == Fw::FW_SERIALIZE_OK,
1932  static_cast<FwAssertArgType>(_status)
1933  );
1934 
1935 #if FW_AMPCS_COMPATIBLE
1936  // Serialize the argument size
1937  _status = _logBuff.serializeFrom(
1938  static_cast<U8>(sizeof(U32))
1939  );
1940  FW_ASSERT(
1941  _status == Fw::FW_SERIALIZE_OK,
1942  static_cast<FwAssertArgType>(_status)
1943  );
1944 #endif
1945  _status = _logBuff.serializeFrom(fatal);
1946  FW_ASSERT(
1947  _status == Fw::FW_SERIALIZE_OK,
1948  static_cast<FwAssertArgType>(_status)
1949  );
1950 
1951  this->Log_out(
1952  0,
1953  _id,
1954  _logTime,
1956  _logBuff
1957  );
1958  }
1959 
1960  // Emit the event on the text log port
1961 #if FW_ENABLE_TEXT_LOGGING
1962  if (this->isConnected_LogText_OutputPort(0)) {
1963 #if FW_OBJECT_NAMES == 1
1964  const char* _formatString =
1965  "(%s) %s: Health ping for %s invalid values: WARN %" PRIu32 " FATAL %" PRIu32 "";
1966 #else
1967  const char* _formatString =
1968  "%s: Health ping for %s invalid values: WARN %" PRIu32 " FATAL %" PRIu32 "";
1969 #endif
1970 
1971  Fw::TextLogString _logString;
1972  _logString.format(
1973  _formatString,
1974 #if FW_OBJECT_NAMES == 1
1975  this->m_objName.toChar(),
1976 #endif
1977  "HLTH_PING_INVALID_VALUES ",
1978  entry.toChar(),
1979  warn,
1980  fatal
1981  );
1982 
1983  this->LogText_out(
1984  0,
1985  _id,
1986  _logTime,
1988  _logString
1989  );
1990  }
1991 #endif
1992  }
1993 
1994  // ----------------------------------------------------------------------
1995  // Telemetry serialized write
1996  // ----------------------------------------------------------------------
1997 
2000  FwChanIdType id,
2001  Fw::TlmBuffer& _tlmBuff,
2002  Fw::Time _tlmTime
2003  ) const
2004  {
2005  if (this->isConnected_Tlm_OutputPort(0)) {
2006  if (
2007  this->isConnected_Time_OutputPort(0) &&
2008  (_tlmTime == Fw::ZERO_TIME)
2009  ) {
2010  this->Time_out(0, _tlmTime);
2011  }
2012 
2013  FwChanIdType _id;
2014  _id = this->getIdBase() + id;
2015 
2016  this->Tlm_out(
2017  0,
2018  _id,
2019  _tlmTime,
2020  _tlmBuff
2021  );
2022  }
2023  }
2024 
2025  // ----------------------------------------------------------------------
2026  // Telemetry write functions
2027  // ----------------------------------------------------------------------
2028 
2031  U32 arg,
2032  Fw::Time _tlmTime
2033  ) const
2034  {
2035  if (this->isConnected_Tlm_OutputPort(0)) {
2036  Fw::TlmBuffer _tlmBuff;
2037  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
2038  FW_ASSERT(
2039  _stat == Fw::FW_SERIALIZE_OK,
2040  static_cast<FwAssertArgType>(_stat)
2041  );
2042 
2043  this->tlmWrite(
2045  _tlmBuff,
2046  _tlmTime
2047  );
2048  }
2049  }
2050 
2051  // ----------------------------------------------------------------------
2052  // Time
2053  // ----------------------------------------------------------------------
2054 
2056  getTime() const
2057  {
2058  if (this->isConnected_Time_OutputPort(0)) {
2059  Fw::Time _time;
2060  this->Time_out(0, _time);
2061  return _time;
2062  }
2063  else {
2064  return Fw::Time(TimeBase::TB_NONE, 0, 0);
2065  }
2066  }
2067 
2068  // ----------------------------------------------------------------------
2069  // Message dispatch functions
2070  // ----------------------------------------------------------------------
2071 
2074  {
2075  ComponentIpcSerializableBuffer _msg;
2076  FwQueuePriorityType _priority = 0;
2077 
2078  Os::Queue::Status _msgStatus = this->m_queue.receive(
2079  _msg,
2081  _priority
2082  );
2083  if (Os::Queue::Status::EMPTY == _msgStatus) {
2085  }
2086  else {
2087  FW_ASSERT(
2088  _msgStatus == Os::Queue::OP_OK,
2089  static_cast<FwAssertArgType>(_msgStatus)
2090  );
2091  }
2092 
2093  // Reset to beginning of buffer
2094  _msg.resetDeser();
2095 
2096  FwEnumStoreType _desMsg = 0;
2097  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
2098  FW_ASSERT(
2099  _deserStatus == Fw::FW_SERIALIZE_OK,
2100  static_cast<FwAssertArgType>(_deserStatus)
2101  );
2102 
2103  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
2104 
2105  if (_msgType == HEALTH_COMPONENT_EXIT) {
2106  return MSG_DISPATCH_EXIT;
2107  }
2108 
2109  FwIndexType portNum = 0;
2110  _deserStatus = _msg.deserializeTo(portNum);
2111  FW_ASSERT(
2112  _deserStatus == Fw::FW_SERIALIZE_OK,
2113  static_cast<FwAssertArgType>(_deserStatus)
2114  );
2115 
2116  switch (_msgType) {
2117  // Handle async input port PingReturn
2118  case PINGRETURN_PING: {
2119  // Deserialize argument key
2120  U32 key;
2121  _deserStatus = _msg.deserializeTo(key);
2122  FW_ASSERT(
2123  _deserStatus == Fw::FW_SERIALIZE_OK,
2124  static_cast<FwAssertArgType>(_deserStatus)
2125  );
2126  // Call handler function
2127  this->PingReturn_handler(
2128  portNum,
2129  key
2130  );
2131 
2132  break;
2133  }
2134 
2135  // Handle command HLTH_ENABLE
2136  case CMD_HLTH_ENABLE: {
2137  // Deserialize opcode
2138  FwOpcodeType _opCode = 0;
2139  _deserStatus = _msg.deserializeTo(_opCode);
2140  FW_ASSERT (
2141  _deserStatus == Fw::FW_SERIALIZE_OK,
2142  static_cast<FwAssertArgType>(_deserStatus)
2143  );
2144 
2145  // Deserialize command sequence
2146  U32 _cmdSeq = 0;
2147  _deserStatus = _msg.deserializeTo(_cmdSeq);
2148  FW_ASSERT (
2149  _deserStatus == Fw::FW_SERIALIZE_OK,
2150  static_cast<FwAssertArgType>(_deserStatus)
2151  );
2152 
2153  // Deserialize command argument buffer
2154  Fw::CmdArgBuffer args;
2155  _deserStatus = _msg.deserializeTo(args);
2156  FW_ASSERT (
2157  _deserStatus == Fw::FW_SERIALIZE_OK,
2158  static_cast<FwAssertArgType>(_deserStatus)
2159  );
2160 
2161  // Reset buffer
2162  args.resetDeser();
2163 
2164  // Deserialize argument enable
2165  Fw::Enabled enable;
2166  _deserStatus = args.deserializeTo(enable);
2167  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2168  if (this->isConnected_CmdStatus_OutputPort(0)) {
2169  this->cmdResponse_out(
2170  _opCode,
2171  _cmdSeq,
2173  );
2174  }
2175  // Don't crash the task if bad arguments were passed from the ground
2176  break;
2177  }
2178 
2179  // Make sure there was no data left over.
2180  // That means the argument buffer size was incorrect.
2181 #if FW_CMD_CHECK_RESIDUAL
2182  if (args.getDeserializeSizeLeft() != 0) {
2183  if (this->isConnected_CmdStatus_OutputPort(0)) {
2184  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2185  }
2186  // Don't crash the task if bad arguments were passed from the ground
2187  break;
2188  }
2189 #endif
2190 
2191  // Call handler function
2192  this->HLTH_ENABLE_cmdHandler(
2193  _opCode, _cmdSeq,
2194  enable
2195  );
2196 
2197  break;
2198  }
2199 
2200  // Handle command HLTH_PING_ENABLE
2201  case CMD_HLTH_PING_ENABLE: {
2202  // Deserialize opcode
2203  FwOpcodeType _opCode = 0;
2204  _deserStatus = _msg.deserializeTo(_opCode);
2205  FW_ASSERT (
2206  _deserStatus == Fw::FW_SERIALIZE_OK,
2207  static_cast<FwAssertArgType>(_deserStatus)
2208  );
2209 
2210  // Deserialize command sequence
2211  U32 _cmdSeq = 0;
2212  _deserStatus = _msg.deserializeTo(_cmdSeq);
2213  FW_ASSERT (
2214  _deserStatus == Fw::FW_SERIALIZE_OK,
2215  static_cast<FwAssertArgType>(_deserStatus)
2216  );
2217 
2218  // Deserialize command argument buffer
2219  Fw::CmdArgBuffer args;
2220  _deserStatus = _msg.deserializeTo(args);
2221  FW_ASSERT (
2222  _deserStatus == Fw::FW_SERIALIZE_OK,
2223  static_cast<FwAssertArgType>(_deserStatus)
2224  );
2225 
2226  // Reset buffer
2227  args.resetDeser();
2228 
2229  // Deserialize argument entry
2230  Fw::CmdStringArg entry;
2231  _deserStatus = args.deserializeTo(entry);
2232  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2233  if (this->isConnected_CmdStatus_OutputPort(0)) {
2234  this->cmdResponse_out(
2235  _opCode,
2236  _cmdSeq,
2238  );
2239  }
2240  // Don't crash the task if bad arguments were passed from the ground
2241  break;
2242  }
2243 
2244  // Deserialize argument enable
2245  Fw::Enabled enable;
2246  _deserStatus = args.deserializeTo(enable);
2247  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2248  if (this->isConnected_CmdStatus_OutputPort(0)) {
2249  this->cmdResponse_out(
2250  _opCode,
2251  _cmdSeq,
2253  );
2254  }
2255  // Don't crash the task if bad arguments were passed from the ground
2256  break;
2257  }
2258 
2259  // Make sure there was no data left over.
2260  // That means the argument buffer size was incorrect.
2261 #if FW_CMD_CHECK_RESIDUAL
2262  if (args.getDeserializeSizeLeft() != 0) {
2263  if (this->isConnected_CmdStatus_OutputPort(0)) {
2264  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2265  }
2266  // Don't crash the task if bad arguments were passed from the ground
2267  break;
2268  }
2269 #endif
2270 
2271  // Call handler function
2273  _opCode, _cmdSeq,
2274  entry,
2275  enable
2276  );
2277 
2278  break;
2279  }
2280 
2281  // Handle command HLTH_CHNG_PING
2282  case CMD_HLTH_CHNG_PING: {
2283  // Deserialize opcode
2284  FwOpcodeType _opCode = 0;
2285  _deserStatus = _msg.deserializeTo(_opCode);
2286  FW_ASSERT (
2287  _deserStatus == Fw::FW_SERIALIZE_OK,
2288  static_cast<FwAssertArgType>(_deserStatus)
2289  );
2290 
2291  // Deserialize command sequence
2292  U32 _cmdSeq = 0;
2293  _deserStatus = _msg.deserializeTo(_cmdSeq);
2294  FW_ASSERT (
2295  _deserStatus == Fw::FW_SERIALIZE_OK,
2296  static_cast<FwAssertArgType>(_deserStatus)
2297  );
2298 
2299  // Deserialize command argument buffer
2300  Fw::CmdArgBuffer args;
2301  _deserStatus = _msg.deserializeTo(args);
2302  FW_ASSERT (
2303  _deserStatus == Fw::FW_SERIALIZE_OK,
2304  static_cast<FwAssertArgType>(_deserStatus)
2305  );
2306 
2307  // Reset buffer
2308  args.resetDeser();
2309 
2310  // Deserialize argument entry
2311  Fw::CmdStringArg entry;
2312  _deserStatus = args.deserializeTo(entry);
2313  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2314  if (this->isConnected_CmdStatus_OutputPort(0)) {
2315  this->cmdResponse_out(
2316  _opCode,
2317  _cmdSeq,
2319  );
2320  }
2321  // Don't crash the task if bad arguments were passed from the ground
2322  break;
2323  }
2324 
2325  // Deserialize argument warningValue
2326  U32 warningValue;
2327  _deserStatus = args.deserializeTo(warningValue);
2328  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2329  if (this->isConnected_CmdStatus_OutputPort(0)) {
2330  this->cmdResponse_out(
2331  _opCode,
2332  _cmdSeq,
2334  );
2335  }
2336  // Don't crash the task if bad arguments were passed from the ground
2337  break;
2338  }
2339 
2340  // Deserialize argument fatalValue
2341  U32 fatalValue;
2342  _deserStatus = args.deserializeTo(fatalValue);
2343  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2344  if (this->isConnected_CmdStatus_OutputPort(0)) {
2345  this->cmdResponse_out(
2346  _opCode,
2347  _cmdSeq,
2349  );
2350  }
2351  // Don't crash the task if bad arguments were passed from the ground
2352  break;
2353  }
2354 
2355  // Make sure there was no data left over.
2356  // That means the argument buffer size was incorrect.
2357 #if FW_CMD_CHECK_RESIDUAL
2358  if (args.getDeserializeSizeLeft() != 0) {
2359  if (this->isConnected_CmdStatus_OutputPort(0)) {
2360  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2361  }
2362  // Don't crash the task if bad arguments were passed from the ground
2363  break;
2364  }
2365 #endif
2366 
2367  // Call handler function
2369  _opCode, _cmdSeq,
2370  entry,
2371  warningValue,
2372  fatalValue
2373  );
2374 
2375  break;
2376  }
2377 
2378  default:
2379  return MSG_DISPATCH_ERROR;
2380  }
2381 
2382  return MSG_DISPATCH_OK;
2383  }
2384 
2385  // ----------------------------------------------------------------------
2386  // Helper functions for dispatching current messages
2387  // ----------------------------------------------------------------------
2388 
2391  {
2392  // Dispatch all current messages unless ERROR or EXIT occur
2393  const FwSizeType currentMessageCount = this->m_queue.getMessagesAvailable();
2394  MsgDispatchStatus messageStatus = MsgDispatchStatus::MSG_DISPATCH_EMPTY;
2395  for (FwSizeType i = 0; i < currentMessageCount; i++) {
2396  messageStatus = this->doDispatch();
2397  if (messageStatus != QueuedComponentBase::MSG_DISPATCH_OK) {
2398  break;
2399  }
2400  }
2401  return messageStatus;
2402  }
2403 
2404  // ----------------------------------------------------------------------
2405  // Calls for messages received on special input ports
2406  // ----------------------------------------------------------------------
2407 
2408  void HealthComponentBase ::
2409  m_p_CmdDisp_in(
2410  Fw::PassiveComponentBase* callComp,
2411  FwIndexType portNum,
2412  FwOpcodeType opCode,
2413  U32 cmdSeq,
2414  Fw::CmdArgBuffer& args
2415  )
2416  {
2417  FW_ASSERT(callComp);
2418  HealthComponentBase* compPtr = static_cast<HealthComponentBase*>(callComp);
2419  compPtr->CmdDisp_handlerBase(
2420  portNum,
2421  opCode,
2422  cmdSeq,
2423  args
2424  );
2425  }
2426 
2427  // ----------------------------------------------------------------------
2428  // Calls for messages received on typed input ports
2429  // ----------------------------------------------------------------------
2430 
2431  void HealthComponentBase ::
2432  m_p_PingReturn_in(
2433  Fw::PassiveComponentBase* callComp,
2434  FwIndexType portNum,
2435  U32 key
2436  )
2437  {
2438  FW_ASSERT(callComp);
2439  HealthComponentBase* compPtr = static_cast<HealthComponentBase*>(callComp);
2440  compPtr->PingReturn_handlerBase(
2441  portNum,
2442  key
2443  );
2444  }
2445 
2446  void HealthComponentBase ::
2447  m_p_Run_in(
2448  Fw::PassiveComponentBase* callComp,
2449  FwIndexType portNum,
2450  U32 context
2451  )
2452  {
2453  FW_ASSERT(callComp);
2454  HealthComponentBase* compPtr = static_cast<HealthComponentBase*>(callComp);
2455  compPtr->Run_handlerBase(
2456  portNum,
2457  context
2458  );
2459  }
2460 
2461 #if !FW_DIRECT_PORT_CALLS
2462 
2463  // ----------------------------------------------------------------------
2464  // Invocation functions for special output ports
2465  // ----------------------------------------------------------------------
2466 
2467  void HealthComponentBase ::
2468  CmdReg_out(
2469  FwIndexType portNum,
2470  FwOpcodeType opCode
2471  ) const
2472  {
2473  FW_ASSERT(
2474  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
2475  static_cast<FwAssertArgType>(portNum)
2476  );
2477 
2478  FW_ASSERT(
2479  this->m_CmdReg_OutputPort[portNum].isConnected(),
2480  static_cast<FwAssertArgType>(portNum)
2481  );
2482  this->m_CmdReg_OutputPort[portNum].invoke(
2483  opCode
2484  );
2485  }
2486 
2487  void HealthComponentBase ::
2488  CmdStatus_out(
2489  FwIndexType portNum,
2490  FwOpcodeType opCode,
2491  U32 cmdSeq,
2492  const Fw::CmdResponse& response
2493  ) const
2494  {
2495  FW_ASSERT(
2496  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
2497  static_cast<FwAssertArgType>(portNum)
2498  );
2499 
2500  FW_ASSERT(
2501  this->m_CmdStatus_OutputPort[portNum].isConnected(),
2502  static_cast<FwAssertArgType>(portNum)
2503  );
2504  this->m_CmdStatus_OutputPort[portNum].invoke(
2505  opCode,
2506  cmdSeq,
2507  response
2508  );
2509  }
2510 
2511  void HealthComponentBase ::
2512  Log_out(
2513  FwIndexType portNum,
2514  FwEventIdType id,
2515  Fw::Time& timeTag,
2516  const Fw::LogSeverity& severity,
2517  Fw::LogBuffer& args
2518  ) const
2519  {
2520  FW_ASSERT(
2521  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
2522  static_cast<FwAssertArgType>(portNum)
2523  );
2524 
2525  FW_ASSERT(
2526  this->m_Log_OutputPort[portNum].isConnected(),
2527  static_cast<FwAssertArgType>(portNum)
2528  );
2529  this->m_Log_OutputPort[portNum].invoke(
2530  id,
2531  timeTag,
2532  severity,
2533  args
2534  );
2535  }
2536 
2537 #if FW_ENABLE_TEXT_LOGGING
2538 
2539  void HealthComponentBase ::
2540  LogText_out(
2541  FwIndexType portNum,
2542  FwEventIdType id,
2543  Fw::Time& timeTag,
2544  const Fw::LogSeverity& severity,
2545  Fw::TextLogString& text
2546  ) const
2547  {
2548  FW_ASSERT(
2549  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
2550  static_cast<FwAssertArgType>(portNum)
2551  );
2552 
2553  FW_ASSERT(
2554  this->m_LogText_OutputPort[portNum].isConnected(),
2555  static_cast<FwAssertArgType>(portNum)
2556  );
2557  this->m_LogText_OutputPort[portNum].invoke(
2558  id,
2559  timeTag,
2560  severity,
2561  text
2562  );
2563  }
2564 
2565 #endif
2566 
2567  void HealthComponentBase ::
2568  Time_out(
2569  FwIndexType portNum,
2570  Fw::Time& time
2571  ) const
2572  {
2573  FW_ASSERT(
2574  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
2575  static_cast<FwAssertArgType>(portNum)
2576  );
2577 
2578  FW_ASSERT(
2579  this->m_Time_OutputPort[portNum].isConnected(),
2580  static_cast<FwAssertArgType>(portNum)
2581  );
2582  this->m_Time_OutputPort[portNum].invoke(
2583  time
2584  );
2585  }
2586 
2587  void HealthComponentBase ::
2588  Tlm_out(
2589  FwIndexType portNum,
2590  FwChanIdType id,
2591  Fw::Time& timeTag,
2592  Fw::TlmBuffer& val
2593  ) const
2594  {
2595  FW_ASSERT(
2596  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
2597  static_cast<FwAssertArgType>(portNum)
2598  );
2599 
2600  FW_ASSERT(
2601  this->m_Tlm_OutputPort[portNum].isConnected(),
2602  static_cast<FwAssertArgType>(portNum)
2603  );
2604  this->m_Tlm_OutputPort[portNum].invoke(
2605  id,
2606  timeTag,
2607  val
2608  );
2609  }
2610 
2611 #endif
2612 
2613 }
Serialization/Deserialization operation was successful.
virtual void HLTH_CHNG_PING_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg &entry, U32 warningValue, U32 fatalValue)=0
void regCommands()
Register commands with the Command Dispatcher.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:157
Auto-generated base for Health component.
static constexpr FwSizeType CAPACITY
Definition: CmdPortAc.hpp:36
void CmdDisp_handlerBase(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Handler base-class function for input port CmdDisp.
virtual void Run_handler(FwIndexType portNum, U32 context)=0
Handler for input port Run.
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
virtual ~HealthComponentBase()
Destroy HealthComponentBase object.
FwIdType FwOpcodeType
The type of a command opcode.
Operation succeeded.
Definition: Os.hpp:26
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
void tlmWrite_PingLateWarnings(U32 arg, Fw::Time _tlmTime=Fw::Time()) const
void log_FATAL_HLTH_PING_WRONG_KEY(const Fw::StringBase &entry, U32 badKey) const
PlatformSizeType FwSizeType
void set_CmdStatus_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to CmdStatus[portNum].
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
Definition: Queue.cpp:71
I32 FwEnumStoreType
Status
status returned from the queue send function
Definition: Queue.hpp:30
virtual MsgDispatchStatus doDispatch()
Called in the message loop to dispatch a message from the queue.
void init()
Initialization function.
Definition: SchedPortAc.cpp:73
const char * toChar() const
Convert to a C-style char*.
Definition: String.hpp:50
virtual void PingReturn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port PingReturn.
void init()
Initialization function.
Definition: CmdPortAc.cpp:89
void log_WARNING_LO_HLTH_CHECK_LOOKUP_ERROR(const Fw::StringBase &entry) const
static constexpr FwIndexType getNum_Tlm_OutputPorts()
void log_WARNING_HI_HLTH_PING_INVALID_VALUES(const Fw::StringBase &entry, U32 warn, U32 fatal) const
void invoke(U32 key) const
Invoke a port connection.
Definition: PingPortAc.cpp:170
void tlmWrite(FwChanIdType id, Fw::TlmBuffer &_tlmBuff, Fw::Time _tlmTime=Fw::Time()) const
virtual const CHAR * toChar() const =0
Convert to a C-style char*.
bool isConnected_Tlm_OutputPort(FwIndexType portNum) const
const Time ZERO_TIME
Definition: Time.cpp:5
bool isConnected_Log_OutputPort(FwIndexType portNum) const
void init()
Initialization function.
Definition: TlmPortAc.cpp:171
Enum representing a command response.
void PingSend_out(FwIndexType portNum, U32 key) const
Invoke output port PingSend.
No time base has been established (Required)
void addCallPort(InputWatchDogPort *callPort)
Register an input port.
void set_WdogStroke_OutputPort(FwIndexType portNum, Svc::InputWatchDogPort *port)
Connect port to WdogStroke[portNum].
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
static constexpr FwIndexType getNum_CmdStatus_OutputPorts()
virtual void HLTH_ENABLE_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command HLTH_ENABLE.
bool isConnected_WdogStroke_OutputPort(FwIndexType portNum) const
Os::Queue m_queue
queue object for active component
A command to enable or disable health checks.
void set_CmdReg_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to CmdReg[portNum].
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:177
void init()
Object initializer.
Definition: ObjBase.cpp:24
SerializeStatus
forward declaration for string
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:95
static constexpr FwIndexType getNum_Log_OutputPorts()
void WdogStroke_out(FwIndexType portNum, U32 code) const
Invoke output port WdogStroke.
FwIdType FwEventIdType
The type of an event identifier.
The size of the serial representation.
Svc::InputPingPort * get_PingReturn_InputPort(FwIndexType portNum)
void invoke(FwOpcodeType opCode) const
Invoke a port connection.
static constexpr FwIndexType getNum_Run_InputPorts()
static constexpr FwIndexType getNum_PingSend_OutputPorts()
void PingReturn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port PingReturn.
static constexpr FwSizeType CAPACITY
Definition: PingPortAc.hpp:34
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:40
void init()
Initialization function.
Definition: TimePortAc.cpp:151
static constexpr FwIndexType getNum_CmdDisp_InputPorts()
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
#define FW_MIN(a, b)
MIN macro (deprecated in C++, use std::min)
Definition: BasicTypes.h:94
A less serious but recoverable event.
void init()
Initialization function.
Definition: PingPortAc.cpp:151
bool isConnected_CmdStatus_OutputPort(FwIndexType portNum) const
void invoke(Fw::Time &time) const
Invoke a port connection.
Definition: TimePortAc.cpp:170
void log_ACTIVITY_HI_HLTH_CHECK_PING(Fw::Enabled enabled, const Fw::StringBase &entry) const
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
Serializable::SizeType getDeserializeSizeLeft() const override
Get remaining deserialization buffer size.
const char * toChar() const
Convert to a C-style char*.
Definition: ObjectName.hpp:50
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port connection.
FwIdType FwChanIdType
The type of a telemetry channel identifier.
FwSizeType SizeType
void addCallPort(InputPingPort *callPort)
Register an input port.
Definition: PingPortAc.cpp:157
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
Definition: Queue.cpp:54
void HLTH_PING_ENABLE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void resetDeser() override
Reset deserialization pointer to beginning of buffer.
A serious but recoverable event.
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) const
Invoke a port connection.
Definition: TlmPortAc.cpp:190
bool isConnected() const
Definition: PortBase.cpp:38
Enum representing event severity.
virtual void HLTH_ENABLE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Fw::Enabled enable)=0
void set_PingSend_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to PingSend[portNum].
#define PRI_FwIndexType
Enabled and disabled states.
bool isConnected_CmdReg_OutputPort(FwIndexType portNum) const
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
void init()
Initialization function.
Definition: LogPortAc.cpp:180
void setPortNum(FwIndexType portNum)
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:53
BlockingType
message type
Definition: Queue.hpp:46
FwSizeType getMessagesAvailable() const override
get number of messages available
Definition: Queue.cpp:89
static constexpr FwIndexType getNum_WdogStroke_OutputPorts()
bool isConnected_Time_OutputPort(FwIndexType portNum) const
Command failed to deserialize.
void log_FATAL_HLTH_PING_LATE(const Fw::StringBase &entry) const
PlatformQueuePriorityType FwQueuePriorityType
The type of queue priorities used.
Important informational events.
Fw::InputCmdPort * get_CmdDisp_InputPort(FwIndexType portNum)
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: SchedPortAc.cpp:79
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port connection.
Definition: LogPortAc.cpp:199
HealthComponentBase(const char *compName="")
Construct HealthComponentBase object.
void invoke(U32 code) const
Invoke a port connection.
virtual void HLTH_PING_ENABLE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg &entry, Fw::Enabled enable)=0
virtual void HLTH_CHNG_PING_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command HLTH_CHNG_PING.
bool isConnected_PingSend_OutputPort(FwIndexType portNum) const
static constexpr FwIndexType getNum_CmdReg_OutputPorts()
A message was sent requesting an exit of the loop.
void init()
Initialization function.
PlatformIndexType FwIndexType
virtual void PingReturn_handler(FwIndexType portNum, U32 key)=0
Handler for input port PingReturn.
A fatal non-recoverable event.
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:186
void set_Tlm_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to Tlm[portNum].
void init()
Initialization function.
Warn that a ping target is longer than the warning value.
void init()
Initialization function.
Definition: PingPortAc.cpp:73
RateGroupDivider component implementation.
message sent/received okay
Definition: Queue.hpp:31
SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG) override
Deserialize an 8-bit unsigned integer value.
U8 BYTE
byte type
Definition: BasicTypes.h:56
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: PingPortAc.cpp:79
Message will return with status when space is unavailable.
Definition: Queue.hpp:48
Implementation of malloc based allocator.
Svc::InputSchedPort * get_Run_InputPort(FwIndexType portNum)
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
static constexpr FwIndexType getNum_PingReturn_InputPorts()
void init()
Initialization function.
MsgDispatchStatus dispatchCurrentMessages()
Dispatch all current messages unless ERROR or EXIT occurs.
Declare FATAL since task is no longer responding.
void log_ACTIVITY_HI_HLTH_CHECK_ENABLE(Fw::Enabled enabled) const
Declare FATAL since task is no longer responding.
void HLTH_CHNG_PING_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
#define FW_ASSERT(...)
Definition: Assert.hpp:14
void log_WARNING_HI_HLTH_PING_WARN(const Fw::StringBase &entry) const
void HLTH_ENABLE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
virtual void HLTH_PING_ENABLE_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command HLTH_PING_ENABLE.
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
message to exit active component task
SerializeStatus serializeTo(SerialBufferBase &buffer, Endianness mode=Endianness::BIG) const override
Serialize the contents of this object to a buffer.
static constexpr FwIndexType getNum_Time_OutputPorts()
void Run_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port Run.
void log_ACTIVITY_HI_HLTH_PING_UPDATED(const Fw::StringBase &entry, U32 warn, U32 fatal) const