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