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::InputPingPort::SERIALIZED_SIZE];
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  // Connect input port CmdDisp
82  for (
83  FwIndexType port = 0;
84  port < static_cast<FwIndexType>(this->getNum_CmdDisp_InputPorts());
85  port++
86  ) {
87  this->m_CmdDisp_InputPort[port].init();
88  this->m_CmdDisp_InputPort[port].addCallComp(
89  this,
90  m_p_CmdDisp_in
91  );
92  this->m_CmdDisp_InputPort[port].setPortNum(port);
93 
94 #if FW_OBJECT_NAMES == 1
95  Fw::ObjectName portName;
96  portName.format(
97  "%s_CmdDisp_InputPort[%" PRI_FwIndexType "]",
98  this->m_objName.toChar(),
99  port
100  );
101  this->m_CmdDisp_InputPort[port].setObjName(portName.toChar());
102 #endif
103  }
104 
105  // Connect input port PingReturn
106  for (
107  FwIndexType port = 0;
108  port < static_cast<FwIndexType>(this->getNum_PingReturn_InputPorts());
109  port++
110  ) {
111  this->m_PingReturn_InputPort[port].init();
112  this->m_PingReturn_InputPort[port].addCallComp(
113  this,
114  m_p_PingReturn_in
115  );
116  this->m_PingReturn_InputPort[port].setPortNum(port);
117 
118 #if FW_OBJECT_NAMES == 1
119  Fw::ObjectName portName;
120  portName.format(
121  "%s_PingReturn_InputPort[%" PRI_FwIndexType "]",
122  this->m_objName.toChar(),
123  port
124  );
125  this->m_PingReturn_InputPort[port].setObjName(portName.toChar());
126 #endif
127  }
128 
129  // Connect input port Run
130  for (
131  FwIndexType port = 0;
132  port < static_cast<FwIndexType>(this->getNum_Run_InputPorts());
133  port++
134  ) {
135  this->m_Run_InputPort[port].init();
136  this->m_Run_InputPort[port].addCallComp(
137  this,
138  m_p_Run_in
139  );
140  this->m_Run_InputPort[port].setPortNum(port);
141 
142 #if FW_OBJECT_NAMES == 1
143  Fw::ObjectName portName;
144  portName.format(
145  "%s_Run_InputPort[%" PRI_FwIndexType "]",
146  this->m_objName.toChar(),
147  port
148  );
149  this->m_Run_InputPort[port].setObjName(portName.toChar());
150 #endif
151  }
152 
153  // Connect output port CmdReg
154  for (
155  FwIndexType port = 0;
156  port < static_cast<FwIndexType>(this->getNum_CmdReg_OutputPorts());
157  port++
158  ) {
159  this->m_CmdReg_OutputPort[port].init();
160 
161 #if FW_OBJECT_NAMES == 1
162  Fw::ObjectName portName;
163  portName.format(
164  "%s_CmdReg_OutputPort[%" PRI_FwIndexType "]",
165  this->m_objName.toChar(),
166  port
167  );
168  this->m_CmdReg_OutputPort[port].setObjName(portName.toChar());
169 #endif
170  }
171 
172  // Connect output port CmdStatus
173  for (
174  FwIndexType port = 0;
175  port < static_cast<FwIndexType>(this->getNum_CmdStatus_OutputPorts());
176  port++
177  ) {
178  this->m_CmdStatus_OutputPort[port].init();
179 
180 #if FW_OBJECT_NAMES == 1
181  Fw::ObjectName portName;
182  portName.format(
183  "%s_CmdStatus_OutputPort[%" PRI_FwIndexType "]",
184  this->m_objName.toChar(),
185  port
186  );
187  this->m_CmdStatus_OutputPort[port].setObjName(portName.toChar());
188 #endif
189  }
190 
191  // Connect output port Log
192  for (
193  FwIndexType port = 0;
194  port < static_cast<FwIndexType>(this->getNum_Log_OutputPorts());
195  port++
196  ) {
197  this->m_Log_OutputPort[port].init();
198 
199 #if FW_OBJECT_NAMES == 1
200  Fw::ObjectName portName;
201  portName.format(
202  "%s_Log_OutputPort[%" PRI_FwIndexType "]",
203  this->m_objName.toChar(),
204  port
205  );
206  this->m_Log_OutputPort[port].setObjName(portName.toChar());
207 #endif
208  }
209 
210 #if FW_ENABLE_TEXT_LOGGING == 1
211  // Connect output port LogText
212  for (
213  FwIndexType port = 0;
214  port < static_cast<FwIndexType>(this->getNum_LogText_OutputPorts());
215  port++
216  ) {
217  this->m_LogText_OutputPort[port].init();
218 
219 #if FW_OBJECT_NAMES == 1
220  Fw::ObjectName portName;
221  portName.format(
222  "%s_LogText_OutputPort[%" PRI_FwIndexType "]",
223  this->m_objName.toChar(),
224  port
225  );
226  this->m_LogText_OutputPort[port].setObjName(portName.toChar());
227 #endif
228  }
229 #endif
230 
231  // Connect output port Time
232  for (
233  FwIndexType port = 0;
234  port < static_cast<FwIndexType>(this->getNum_Time_OutputPorts());
235  port++
236  ) {
237  this->m_Time_OutputPort[port].init();
238 
239 #if FW_OBJECT_NAMES == 1
240  Fw::ObjectName portName;
241  portName.format(
242  "%s_Time_OutputPort[%" PRI_FwIndexType "]",
243  this->m_objName.toChar(),
244  port
245  );
246  this->m_Time_OutputPort[port].setObjName(portName.toChar());
247 #endif
248  }
249 
250  // Connect output port Tlm
251  for (
252  FwIndexType port = 0;
253  port < static_cast<FwIndexType>(this->getNum_Tlm_OutputPorts());
254  port++
255  ) {
256  this->m_Tlm_OutputPort[port].init();
257 
258 #if FW_OBJECT_NAMES == 1
259  Fw::ObjectName portName;
260  portName.format(
261  "%s_Tlm_OutputPort[%" PRI_FwIndexType "]",
262  this->m_objName.toChar(),
263  port
264  );
265  this->m_Tlm_OutputPort[port].setObjName(portName.toChar());
266 #endif
267  }
268 
269  // Connect output port PingSend
270  for (
271  FwIndexType port = 0;
272  port < static_cast<FwIndexType>(this->getNum_PingSend_OutputPorts());
273  port++
274  ) {
275  this->m_PingSend_OutputPort[port].init();
276 
277 #if FW_OBJECT_NAMES == 1
278  Fw::ObjectName portName;
279  portName.format(
280  "%s_PingSend_OutputPort[%" PRI_FwIndexType "]",
281  this->m_objName.toChar(),
282  port
283  );
284  this->m_PingSend_OutputPort[port].setObjName(portName.toChar());
285 #endif
286  }
287 
288  // Connect output port WdogStroke
289  for (
290  FwIndexType port = 0;
291  port < static_cast<FwIndexType>(this->getNum_WdogStroke_OutputPorts());
292  port++
293  ) {
294  this->m_WdogStroke_OutputPort[port].init();
295 
296 #if FW_OBJECT_NAMES == 1
297  Fw::ObjectName portName;
298  portName.format(
299  "%s_WdogStroke_OutputPort[%" PRI_FwIndexType "]",
300  this->m_objName.toChar(),
301  port
302  );
303  this->m_WdogStroke_OutputPort[port].setObjName(portName.toChar());
304 #endif
305  }
306 
307  // Create the queue
308  Os::Queue::Status qStat = this->createQueue(
309  queueDepth,
310  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
311  );
312  FW_ASSERT(
313  Os::Queue::Status::OP_OK == qStat,
314  static_cast<FwAssertArgType>(qStat)
315  );
316  }
317 
318  // ----------------------------------------------------------------------
319  // Getters for special input ports
320  // ----------------------------------------------------------------------
321 
324  {
325  FW_ASSERT(
326  (0 <= portNum) && (portNum < this->getNum_CmdDisp_InputPorts()),
327  static_cast<FwAssertArgType>(portNum)
328  );
329 
330  return &this->m_CmdDisp_InputPort[portNum];
331  }
332 
333  // ----------------------------------------------------------------------
334  // Getters for typed input ports
335  // ----------------------------------------------------------------------
336 
339  {
340  FW_ASSERT(
341  (0 <= portNum) && (portNum < this->getNum_PingReturn_InputPorts()),
342  static_cast<FwAssertArgType>(portNum)
343  );
344 
345  return &this->m_PingReturn_InputPort[portNum];
346  }
347 
350  {
351  FW_ASSERT(
352  (0 <= portNum) && (portNum < this->getNum_Run_InputPorts()),
353  static_cast<FwAssertArgType>(portNum)
354  );
355 
356  return &this->m_Run_InputPort[portNum];
357  }
358 
359  // ----------------------------------------------------------------------
360  // Connect input ports to special output ports
361  // ----------------------------------------------------------------------
362 
365  FwIndexType portNum,
366  Fw::InputCmdRegPort* port
367  )
368  {
369  FW_ASSERT(
370  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
371  static_cast<FwAssertArgType>(portNum)
372  );
373 
374  this->m_CmdReg_OutputPort[portNum].addCallPort(port);
375  }
376 
379  FwIndexType portNum,
381  )
382  {
383  FW_ASSERT(
384  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
385  static_cast<FwAssertArgType>(portNum)
386  );
387 
388  this->m_CmdStatus_OutputPort[portNum].addCallPort(port);
389  }
390 
393  FwIndexType portNum,
394  Fw::InputLogPort* port
395  )
396  {
397  FW_ASSERT(
398  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
399  static_cast<FwAssertArgType>(portNum)
400  );
401 
402  this->m_Log_OutputPort[portNum].addCallPort(port);
403  }
404 
405 #if FW_ENABLE_TEXT_LOGGING == 1
406 
407  void HealthComponentBase ::
408  set_LogText_OutputPort(
409  FwIndexType portNum,
411  )
412  {
413  FW_ASSERT(
414  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
415  static_cast<FwAssertArgType>(portNum)
416  );
417 
418  this->m_LogText_OutputPort[portNum].addCallPort(port);
419  }
420 
421 #endif
422 
425  FwIndexType portNum,
426  Fw::InputTimePort* port
427  )
428  {
429  FW_ASSERT(
430  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
431  static_cast<FwAssertArgType>(portNum)
432  );
433 
434  this->m_Time_OutputPort[portNum].addCallPort(port);
435  }
436 
439  FwIndexType portNum,
440  Fw::InputTlmPort* port
441  )
442  {
443  FW_ASSERT(
444  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
445  static_cast<FwAssertArgType>(portNum)
446  );
447 
448  this->m_Tlm_OutputPort[portNum].addCallPort(port);
449  }
450 
451  // ----------------------------------------------------------------------
452  // Connect typed input ports to typed output ports
453  // ----------------------------------------------------------------------
454 
457  FwIndexType portNum,
458  Svc::InputPingPort* port
459  )
460  {
461  FW_ASSERT(
462  (0 <= portNum) && (portNum < this->getNum_PingSend_OutputPorts()),
463  static_cast<FwAssertArgType>(portNum)
464  );
465 
466  this->m_PingSend_OutputPort[portNum].addCallPort(port);
467  }
468 
471  FwIndexType portNum,
473  )
474  {
475  FW_ASSERT(
476  (0 <= portNum) && (portNum < this->getNum_WdogStroke_OutputPorts()),
477  static_cast<FwAssertArgType>(portNum)
478  );
479 
480  this->m_WdogStroke_OutputPort[portNum].addCallPort(port);
481  }
482 
483 #if FW_PORT_SERIALIZATION
484 
485  // ----------------------------------------------------------------------
486  // Connect serial input ports to special output ports
487  // ----------------------------------------------------------------------
488 
491  FwIndexType portNum,
492  Fw::InputSerializePort* port
493  )
494  {
495  FW_ASSERT(
496  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
497  static_cast<FwAssertArgType>(portNum)
498  );
499 
500  this->m_CmdReg_OutputPort[portNum].registerSerialPort(port);
501  }
502 
505  FwIndexType portNum,
506  Fw::InputSerializePort* port
507  )
508  {
509  FW_ASSERT(
510  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
511  static_cast<FwAssertArgType>(portNum)
512  );
513 
514  this->m_CmdStatus_OutputPort[portNum].registerSerialPort(port);
515  }
516 
519  FwIndexType portNum,
520  Fw::InputSerializePort* port
521  )
522  {
523  FW_ASSERT(
524  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
525  static_cast<FwAssertArgType>(portNum)
526  );
527 
528  this->m_Log_OutputPort[portNum].registerSerialPort(port);
529  }
530 
531 #if FW_ENABLE_TEXT_LOGGING == 1
532 
533  void HealthComponentBase ::
534  set_LogText_OutputPort(
535  FwIndexType portNum,
536  Fw::InputSerializePort* port
537  )
538  {
539  FW_ASSERT(
540  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
541  static_cast<FwAssertArgType>(portNum)
542  );
543 
544  this->m_LogText_OutputPort[portNum].registerSerialPort(port);
545  }
546 
547 #endif
548 
551  FwIndexType portNum,
552  Fw::InputSerializePort* port
553  )
554  {
555  FW_ASSERT(
556  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
557  static_cast<FwAssertArgType>(portNum)
558  );
559 
560  this->m_Time_OutputPort[portNum].registerSerialPort(port);
561  }
562 
565  FwIndexType portNum,
566  Fw::InputSerializePort* port
567  )
568  {
569  FW_ASSERT(
570  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
571  static_cast<FwAssertArgType>(portNum)
572  );
573 
574  this->m_Tlm_OutputPort[portNum].registerSerialPort(port);
575  }
576 
577 #endif
578 
579 #if FW_PORT_SERIALIZATION
580 
581  // ----------------------------------------------------------------------
582  // Connect serial input ports to typed output ports
583  // ----------------------------------------------------------------------
584 
587  FwIndexType portNum,
588  Fw::InputSerializePort* port
589  )
590  {
591  FW_ASSERT(
592  (0 <= portNum) && (portNum < this->getNum_PingSend_OutputPorts()),
593  static_cast<FwAssertArgType>(portNum)
594  );
595 
596  this->m_PingSend_OutputPort[portNum].registerSerialPort(port);
597  }
598 
601  FwIndexType portNum,
602  Fw::InputSerializePort* port
603  )
604  {
605  FW_ASSERT(
606  (0 <= portNum) && (portNum < this->getNum_WdogStroke_OutputPorts()),
607  static_cast<FwAssertArgType>(portNum)
608  );
609 
610  this->m_WdogStroke_OutputPort[portNum].registerSerialPort(port);
611  }
612 
613 #endif
614 
615  // ----------------------------------------------------------------------
616  // Command registration
617  // ----------------------------------------------------------------------
618 
621  {
622  FW_ASSERT(this->m_CmdReg_OutputPort[0].isConnected());
623 
624  this->m_CmdReg_OutputPort[0].invoke(
625  this->getIdBase() + OPCODE_HLTH_ENABLE
626  );
627 
628  this->m_CmdReg_OutputPort[0].invoke(
630  );
631 
632  this->m_CmdReg_OutputPort[0].invoke(
634  );
635  }
636 
637  // ----------------------------------------------------------------------
638  // Component construction and destruction
639  // ----------------------------------------------------------------------
640 
642  HealthComponentBase(const char* compName) :
643  Fw::QueuedComponentBase(compName)
644  {
645 
646  }
647 
650  {
651 
652  }
653 
654  // ----------------------------------------------------------------------
655  // Connection status queries for special output ports
656  // ----------------------------------------------------------------------
657 
660  {
661  FW_ASSERT(
662  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
663  static_cast<FwAssertArgType>(portNum)
664  );
665 
666  return this->m_CmdReg_OutputPort[portNum].isConnected();
667  }
668 
671  {
672  FW_ASSERT(
673  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
674  static_cast<FwAssertArgType>(portNum)
675  );
676 
677  return this->m_CmdStatus_OutputPort[portNum].isConnected();
678  }
679 
682  {
683  FW_ASSERT(
684  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
685  static_cast<FwAssertArgType>(portNum)
686  );
687 
688  return this->m_Log_OutputPort[portNum].isConnected();
689  }
690 
691 #if FW_ENABLE_TEXT_LOGGING == 1
692 
693  bool HealthComponentBase ::
694  isConnected_LogText_OutputPort(FwIndexType portNum)
695  {
696  FW_ASSERT(
697  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
698  static_cast<FwAssertArgType>(portNum)
699  );
700 
701  return this->m_LogText_OutputPort[portNum].isConnected();
702  }
703 
704 #endif
705 
708  {
709  FW_ASSERT(
710  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
711  static_cast<FwAssertArgType>(portNum)
712  );
713 
714  return this->m_Time_OutputPort[portNum].isConnected();
715  }
716 
719  {
720  FW_ASSERT(
721  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
722  static_cast<FwAssertArgType>(portNum)
723  );
724 
725  return this->m_Tlm_OutputPort[portNum].isConnected();
726  }
727 
728  // ----------------------------------------------------------------------
729  // Connection status queries for typed output ports
730  // ----------------------------------------------------------------------
731 
734  {
735  FW_ASSERT(
736  (0 <= portNum) && (portNum < this->getNum_PingSend_OutputPorts()),
737  static_cast<FwAssertArgType>(portNum)
738  );
739 
740  return this->m_PingSend_OutputPort[portNum].isConnected();
741  }
742 
745  {
746  FW_ASSERT(
747  (0 <= portNum) && (portNum < this->getNum_WdogStroke_OutputPorts()),
748  static_cast<FwAssertArgType>(portNum)
749  );
750 
751  return this->m_WdogStroke_OutputPort[portNum].isConnected();
752  }
753 
754  // ----------------------------------------------------------------------
755  // Port handler base-class functions for typed input ports
756  //
757  // Call these functions directly to bypass the corresponding ports
758  // ----------------------------------------------------------------------
759 
762  FwIndexType portNum,
763  U32 key
764  )
765  {
766  // Make sure port number is valid
767  FW_ASSERT(
768  (0 <= portNum) && (portNum < this->getNum_PingReturn_InputPorts()),
769  static_cast<FwAssertArgType>(portNum)
770  );
771 
772  // Call pre-message hook
774  portNum,
775  key
776  );
777  ComponentIpcSerializableBuffer msg;
779 
780  // Serialize message ID
781  _status = msg.serializeFrom(
782  static_cast<FwEnumStoreType>(PINGRETURN_PING)
783  );
784  FW_ASSERT(
785  _status == Fw::FW_SERIALIZE_OK,
786  static_cast<FwAssertArgType>(_status)
787  );
788 
789  // Serialize port number
790  _status = msg.serializeFrom(portNum);
791  FW_ASSERT(
792  _status == Fw::FW_SERIALIZE_OK,
793  static_cast<FwAssertArgType>(_status)
794  );
795 
796  // Serialize argument key
797  _status = msg.serializeFrom(key);
798  FW_ASSERT(
799  _status == Fw::FW_SERIALIZE_OK,
800  static_cast<FwAssertArgType>(_status)
801  );
802 
803  // Send message
805  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
806 
807  FW_ASSERT(
808  qStatus == Os::Queue::OP_OK,
809  static_cast<FwAssertArgType>(qStatus)
810  );
811  }
812 
815  FwIndexType portNum,
816  U32 context
817  )
818  {
819  // Make sure port number is valid
820  FW_ASSERT(
821  (0 <= portNum) && (portNum < this->getNum_Run_InputPorts()),
822  static_cast<FwAssertArgType>(portNum)
823  );
824 
825  // Call handler function
826  this->Run_handler(
827  portNum,
828  context
829  );
830  }
831 
832  // ----------------------------------------------------------------------
833  // Pre-message hooks for typed async input ports
834  //
835  // Each of these functions is invoked just before processing a message
836  // on the corresponding port. By default, they do nothing. You can
837  // override them to provide specific pre-message behavior.
838  // ----------------------------------------------------------------------
839 
842  FwIndexType portNum,
843  U32 key
844  )
845  {
846  // Default: no-op
847  }
848 
849  // ----------------------------------------------------------------------
850  // Invocation functions for typed output ports
851  // ----------------------------------------------------------------------
852 
855  FwIndexType portNum,
856  U32 key
857  )
858  {
859  FW_ASSERT(
860  (0 <= portNum) && (portNum < this->getNum_PingSend_OutputPorts()),
861  static_cast<FwAssertArgType>(portNum)
862  );
863 
864  FW_ASSERT(
865  this->m_PingSend_OutputPort[portNum].isConnected(),
866  static_cast<FwAssertArgType>(portNum)
867  );
868  this->m_PingSend_OutputPort[portNum].invoke(
869  key
870  );
871  }
872 
875  FwIndexType portNum,
876  U32 code
877  )
878  {
879  FW_ASSERT(
880  (0 <= portNum) && (portNum < this->getNum_WdogStroke_OutputPorts()),
881  static_cast<FwAssertArgType>(portNum)
882  );
883 
884  FW_ASSERT(
885  this->m_WdogStroke_OutputPort[portNum].isConnected(),
886  static_cast<FwAssertArgType>(portNum)
887  );
888  this->m_WdogStroke_OutputPort[portNum].invoke(
889  code
890  );
891  }
892 
893  // ----------------------------------------------------------------------
894  // Command response
895  // ----------------------------------------------------------------------
896 
899  FwOpcodeType opCode,
900  U32 cmdSeq,
901  Fw::CmdResponse response
902  )
903  {
904  FW_ASSERT(this->m_CmdStatus_OutputPort[0].isConnected());
905  this->m_CmdStatus_OutputPort[0].invoke(opCode, cmdSeq, response);
906  }
907 
908  // ----------------------------------------------------------------------
909  // Command handler base-class functions
910  //
911  // Call these functions directly to bypass the command input port
912  // ----------------------------------------------------------------------
913 
916  FwOpcodeType opCode,
917  U32 cmdSeq,
918  Fw::CmdArgBuffer& args
919  )
920  {
921  // Call pre-message hook
922  this->HLTH_ENABLE_preMsgHook(opCode,cmdSeq);
923 
924  // Defer deserializing arguments to the message dispatcher
925  // to avoid deserializing and reserializing just for IPC
926  ComponentIpcSerializableBuffer msg;
928 
929  // Serialize for IPC
930  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_HLTH_ENABLE));
931  FW_ASSERT (
932  _status == Fw::FW_SERIALIZE_OK,
933  static_cast<FwAssertArgType>(_status)
934  );
935 
936  // Fake port number to make message dequeue work
937  FwIndexType port = 0;
938 
939  _status = msg.serializeFrom(port);
940  FW_ASSERT (
941  _status == Fw::FW_SERIALIZE_OK,
942  static_cast<FwAssertArgType>(_status)
943  );
944 
945  _status = msg.serializeFrom(opCode);
946  FW_ASSERT (
947  _status == Fw::FW_SERIALIZE_OK,
948  static_cast<FwAssertArgType>(_status)
949  );
950 
951  _status = msg.serializeFrom(cmdSeq);
952  FW_ASSERT (
953  _status == Fw::FW_SERIALIZE_OK,
954  static_cast<FwAssertArgType>(_status)
955  );
956 
957  _status = msg.serializeFrom(args);
958  FW_ASSERT (
959  _status == Fw::FW_SERIALIZE_OK,
960  static_cast<FwAssertArgType>(_status)
961  );
962 
963  // Send message
965  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
966 
967  FW_ASSERT(
968  qStatus == Os::Queue::OP_OK,
969  static_cast<FwAssertArgType>(qStatus)
970  );
971  }
972 
975  FwOpcodeType opCode,
976  U32 cmdSeq,
977  Fw::CmdArgBuffer& args
978  )
979  {
980  // Call pre-message hook
981  this->HLTH_PING_ENABLE_preMsgHook(opCode,cmdSeq);
982 
983  // Defer deserializing arguments to the message dispatcher
984  // to avoid deserializing and reserializing just for IPC
985  ComponentIpcSerializableBuffer msg;
987 
988  // Serialize for IPC
989  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_HLTH_PING_ENABLE));
990  FW_ASSERT (
991  _status == Fw::FW_SERIALIZE_OK,
992  static_cast<FwAssertArgType>(_status)
993  );
994 
995  // Fake port number to make message dequeue work
996  FwIndexType port = 0;
997 
998  _status = msg.serializeFrom(port);
999  FW_ASSERT (
1000  _status == Fw::FW_SERIALIZE_OK,
1001  static_cast<FwAssertArgType>(_status)
1002  );
1003 
1004  _status = msg.serializeFrom(opCode);
1005  FW_ASSERT (
1006  _status == Fw::FW_SERIALIZE_OK,
1007  static_cast<FwAssertArgType>(_status)
1008  );
1009 
1010  _status = msg.serializeFrom(cmdSeq);
1011  FW_ASSERT (
1012  _status == Fw::FW_SERIALIZE_OK,
1013  static_cast<FwAssertArgType>(_status)
1014  );
1015 
1016  _status = msg.serializeFrom(args);
1017  FW_ASSERT (
1018  _status == Fw::FW_SERIALIZE_OK,
1019  static_cast<FwAssertArgType>(_status)
1020  );
1021 
1022  // Send message
1024  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1025 
1026  FW_ASSERT(
1027  qStatus == Os::Queue::OP_OK,
1028  static_cast<FwAssertArgType>(qStatus)
1029  );
1030  }
1031 
1034  FwOpcodeType opCode,
1035  U32 cmdSeq,
1036  Fw::CmdArgBuffer& args
1037  )
1038  {
1039  // Call pre-message hook
1040  this->HLTH_CHNG_PING_preMsgHook(opCode,cmdSeq);
1041 
1042  // Defer deserializing arguments to the message dispatcher
1043  // to avoid deserializing and reserializing just for IPC
1044  ComponentIpcSerializableBuffer msg;
1046 
1047  // Serialize for IPC
1048  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_HLTH_CHNG_PING));
1049  FW_ASSERT (
1050  _status == Fw::FW_SERIALIZE_OK,
1051  static_cast<FwAssertArgType>(_status)
1052  );
1053 
1054  // Fake port number to make message dequeue work
1055  FwIndexType port = 0;
1056 
1057  _status = msg.serializeFrom(port);
1058  FW_ASSERT (
1059  _status == Fw::FW_SERIALIZE_OK,
1060  static_cast<FwAssertArgType>(_status)
1061  );
1062 
1063  _status = msg.serializeFrom(opCode);
1064  FW_ASSERT (
1065  _status == Fw::FW_SERIALIZE_OK,
1066  static_cast<FwAssertArgType>(_status)
1067  );
1068 
1069  _status = msg.serializeFrom(cmdSeq);
1070  FW_ASSERT (
1071  _status == Fw::FW_SERIALIZE_OK,
1072  static_cast<FwAssertArgType>(_status)
1073  );
1074 
1075  _status = msg.serializeFrom(args);
1076  FW_ASSERT (
1077  _status == Fw::FW_SERIALIZE_OK,
1078  static_cast<FwAssertArgType>(_status)
1079  );
1080 
1081  // Send message
1083  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1084 
1085  FW_ASSERT(
1086  qStatus == Os::Queue::OP_OK,
1087  static_cast<FwAssertArgType>(qStatus)
1088  );
1089  }
1090 
1091  // ----------------------------------------------------------------------
1092  // Pre-message hooks for async commands
1093  //
1094  // Each of these functions is invoked just before processing the
1095  // corresponding command. By default they do nothing. You can
1096  // override them to provide specific pre-command behavior.
1097  // ----------------------------------------------------------------------
1098 
1101  FwOpcodeType opCode,
1102  U32 cmdSeq
1103  )
1104  {
1105  // Defaults to no-op; can be overridden
1106  (void) opCode;
1107  (void) cmdSeq;
1108  }
1109 
1112  FwOpcodeType opCode,
1113  U32 cmdSeq
1114  )
1115  {
1116  // Defaults to no-op; can be overridden
1117  (void) opCode;
1118  (void) cmdSeq;
1119  }
1120 
1123  FwOpcodeType opCode,
1124  U32 cmdSeq
1125  )
1126  {
1127  // Defaults to no-op; can be overridden
1128  (void) opCode;
1129  (void) cmdSeq;
1130  }
1131 
1132  // ----------------------------------------------------------------------
1133  // Event logging functions
1134  // ----------------------------------------------------------------------
1135 
1138  {
1139  // Get the time
1140  Fw::Time _logTime;
1141  if (this->m_Time_OutputPort[0].isConnected()) {
1142  this->m_Time_OutputPort[0].invoke(_logTime);
1143  }
1144 
1145  FwEventIdType _id = static_cast<FwEventIdType>(0);
1146 
1147  _id = this->getIdBase() + EVENTID_HLTH_PING_WARN;
1148 
1149  // Emit the event on the log port
1150  if (this->m_Log_OutputPort[0].isConnected()) {
1151  Fw::LogBuffer _logBuff;
1153 
1154 #if FW_AMPCS_COMPATIBLE
1155  // Serialize the number of arguments
1156  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1157  FW_ASSERT(
1158  _status == Fw::FW_SERIALIZE_OK,
1159  static_cast<FwAssertArgType>(_status)
1160  );
1161 #endif
1162 
1163  _status = entry.serializeTo(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1164  FW_ASSERT(
1165  _status == Fw::FW_SERIALIZE_OK,
1166  static_cast<FwAssertArgType>(_status)
1167  );
1168 
1169  this->m_Log_OutputPort[0].invoke(
1170  _id,
1171  _logTime,
1173  _logBuff
1174  );
1175  }
1176 
1177  // Emit the event on the text log port
1178 #if FW_ENABLE_TEXT_LOGGING
1179  if (this->m_LogText_OutputPort[0].isConnected()) {
1180 #if FW_OBJECT_NAMES == 1
1181  const char* _formatString =
1182  "(%s) %s: Ping entry %s late warning";
1183 #else
1184  const char* _formatString =
1185  "%s: Ping entry %s late warning";
1186 #endif
1187 
1188  Fw::TextLogString _logString;
1189  _logString.format(
1190  _formatString,
1191 #if FW_OBJECT_NAMES == 1
1192  this->m_objName.toChar(),
1193 #endif
1194  "HLTH_PING_WARN ",
1195  entry.toChar()
1196  );
1197 
1198  this->m_LogText_OutputPort[0].invoke(
1199  _id,
1200  _logTime,
1202  _logString
1203  );
1204  }
1205 #endif
1206  }
1207 
1210  {
1211  // Get the time
1212  Fw::Time _logTime;
1213  if (this->m_Time_OutputPort[0].isConnected()) {
1214  this->m_Time_OutputPort[0].invoke(_logTime);
1215  }
1216 
1217  FwEventIdType _id = static_cast<FwEventIdType>(0);
1218 
1219  _id = this->getIdBase() + EVENTID_HLTH_PING_LATE;
1220 
1221  // Emit the event on the log port
1222  if (this->m_Log_OutputPort[0].isConnected()) {
1223  Fw::LogBuffer _logBuff;
1225 
1226 #if FW_AMPCS_COMPATIBLE
1227  // Serialize the number of arguments
1228  _status = _logBuff.serializeFrom(static_cast<U8>(1 + 1));
1229  FW_ASSERT(
1230  _status == Fw::FW_SERIALIZE_OK,
1231  static_cast<FwAssertArgType>(_status)
1232  );
1233 
1234  // For FATAL, add stack size of 4 and a dummy entry. No support for stacks yet.
1235  _status = _logBuff.serializeFrom(static_cast<U8>(4));
1236  FW_ASSERT(
1237  _status == Fw::FW_SERIALIZE_OK,
1238  static_cast<FwAssertArgType>(_status)
1239  );
1240 
1241  _status = _logBuff.serializeFrom(static_cast<U32>(0));
1242  FW_ASSERT(
1243  _status == Fw::FW_SERIALIZE_OK,
1244  static_cast<FwAssertArgType>(_status)
1245  );
1246 #endif
1247 
1248  _status = entry.serializeTo(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1249  FW_ASSERT(
1250  _status == Fw::FW_SERIALIZE_OK,
1251  static_cast<FwAssertArgType>(_status)
1252  );
1253 
1254  this->m_Log_OutputPort[0].invoke(
1255  _id,
1256  _logTime,
1258  _logBuff
1259  );
1260  }
1261 
1262  // Emit the event on the text log port
1263 #if FW_ENABLE_TEXT_LOGGING
1264  if (this->m_LogText_OutputPort[0].isConnected()) {
1265 #if FW_OBJECT_NAMES == 1
1266  const char* _formatString =
1267  "(%s) %s: Ping entry %s did not respond";
1268 #else
1269  const char* _formatString =
1270  "%s: Ping entry %s did not respond";
1271 #endif
1272 
1273  Fw::TextLogString _logString;
1274  _logString.format(
1275  _formatString,
1276 #if FW_OBJECT_NAMES == 1
1277  this->m_objName.toChar(),
1278 #endif
1279  "HLTH_PING_LATE ",
1280  entry.toChar()
1281  );
1282 
1283  this->m_LogText_OutputPort[0].invoke(
1284  _id,
1285  _logTime,
1287  _logString
1288  );
1289  }
1290 #endif
1291  }
1292 
1295  const Fw::StringBase& entry,
1296  U32 badKey
1297  ) const
1298  {
1299  // Get the time
1300  Fw::Time _logTime;
1301  if (this->m_Time_OutputPort[0].isConnected()) {
1302  this->m_Time_OutputPort[0].invoke(_logTime);
1303  }
1304 
1305  FwEventIdType _id = static_cast<FwEventIdType>(0);
1306 
1307  _id = this->getIdBase() + EVENTID_HLTH_PING_WRONG_KEY;
1308 
1309  // Emit the event on the log port
1310  if (this->m_Log_OutputPort[0].isConnected()) {
1311  Fw::LogBuffer _logBuff;
1313 
1314 #if FW_AMPCS_COMPATIBLE
1315  // Serialize the number of arguments
1316  _status = _logBuff.serializeFrom(static_cast<U8>(2 + 1));
1317  FW_ASSERT(
1318  _status == Fw::FW_SERIALIZE_OK,
1319  static_cast<FwAssertArgType>(_status)
1320  );
1321 
1322  // For FATAL, add stack size of 4 and a dummy entry. No support for stacks yet.
1323  _status = _logBuff.serializeFrom(static_cast<U8>(4));
1324  FW_ASSERT(
1325  _status == Fw::FW_SERIALIZE_OK,
1326  static_cast<FwAssertArgType>(_status)
1327  );
1328 
1329  _status = _logBuff.serializeFrom(static_cast<U32>(0));
1330  FW_ASSERT(
1331  _status == Fw::FW_SERIALIZE_OK,
1332  static_cast<FwAssertArgType>(_status)
1333  );
1334 #endif
1335 
1336  _status = entry.serializeTo(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1337  FW_ASSERT(
1338  _status == Fw::FW_SERIALIZE_OK,
1339  static_cast<FwAssertArgType>(_status)
1340  );
1341 
1342 #if FW_AMPCS_COMPATIBLE
1343  // Serialize the argument size
1344  _status = _logBuff.serializeFrom(
1345  static_cast<U8>(sizeof(U32))
1346  );
1347  FW_ASSERT(
1348  _status == Fw::FW_SERIALIZE_OK,
1349  static_cast<FwAssertArgType>(_status)
1350  );
1351 #endif
1352  _status = _logBuff.serializeFrom(badKey);
1353  FW_ASSERT(
1354  _status == Fw::FW_SERIALIZE_OK,
1355  static_cast<FwAssertArgType>(_status)
1356  );
1357 
1358  this->m_Log_OutputPort[0].invoke(
1359  _id,
1360  _logTime,
1362  _logBuff
1363  );
1364  }
1365 
1366  // Emit the event on the text log port
1367 #if FW_ENABLE_TEXT_LOGGING
1368  if (this->m_LogText_OutputPort[0].isConnected()) {
1369 #if FW_OBJECT_NAMES == 1
1370  const char* _formatString =
1371  "(%s) %s: Ping entry %s responded with wrong key 0x%" PRIx32 "";
1372 #else
1373  const char* _formatString =
1374  "%s: Ping entry %s responded with wrong key 0x%" PRIx32 "";
1375 #endif
1376 
1377  Fw::TextLogString _logString;
1378  _logString.format(
1379  _formatString,
1380 #if FW_OBJECT_NAMES == 1
1381  this->m_objName.toChar(),
1382 #endif
1383  "HLTH_PING_WRONG_KEY ",
1384  entry.toChar(),
1385  badKey
1386  );
1387 
1388  this->m_LogText_OutputPort[0].invoke(
1389  _id,
1390  _logTime,
1392  _logString
1393  );
1394  }
1395 #endif
1396  }
1397 
1400  {
1401  // Get the time
1402  Fw::Time _logTime;
1403  if (this->m_Time_OutputPort[0].isConnected()) {
1404  this->m_Time_OutputPort[0].invoke(_logTime);
1405  }
1406 
1407  FwEventIdType _id = static_cast<FwEventIdType>(0);
1408 
1409  _id = this->getIdBase() + EVENTID_HLTH_CHECK_ENABLE;
1410 
1411  // Emit the event on the log port
1412  if (this->m_Log_OutputPort[0].isConnected()) {
1413  Fw::LogBuffer _logBuff;
1415 
1416 #if FW_AMPCS_COMPATIBLE
1417  // Serialize the number of arguments
1418  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1419  FW_ASSERT(
1420  _status == Fw::FW_SERIALIZE_OK,
1421  static_cast<FwAssertArgType>(_status)
1422  );
1423 #endif
1424 
1425 #if FW_AMPCS_COMPATIBLE
1426  // Serialize the argument size
1427  _status = _logBuff.serializeFrom(
1428  static_cast<U8>(Fw::Enabled::SERIALIZED_SIZE)
1429  );
1430  FW_ASSERT(
1431  _status == Fw::FW_SERIALIZE_OK,
1432  static_cast<FwAssertArgType>(_status)
1433  );
1434 #endif
1435  _status = _logBuff.serializeFrom(enabled);
1436  FW_ASSERT(
1437  _status == Fw::FW_SERIALIZE_OK,
1438  static_cast<FwAssertArgType>(_status)
1439  );
1440 
1441  this->m_Log_OutputPort[0].invoke(
1442  _id,
1443  _logTime,
1445  _logBuff
1446  );
1447  }
1448 
1449  // Emit the event on the text log port
1450 #if FW_ENABLE_TEXT_LOGGING
1451  if (this->m_LogText_OutputPort[0].isConnected()) {
1452 #if FW_OBJECT_NAMES == 1
1453  const char* _formatString =
1454  "(%s) %s: Health checking set to %s";
1455 #else
1456  const char* _formatString =
1457  "%s: Health checking set to %s";
1458 #endif
1459 
1460  Fw::String enabledStr;
1461  enabled.toString(enabledStr);
1462 
1463  Fw::TextLogString _logString;
1464  _logString.format(
1465  _formatString,
1466 #if FW_OBJECT_NAMES == 1
1467  this->m_objName.toChar(),
1468 #endif
1469  "HLTH_CHECK_ENABLE ",
1470  enabledStr.toChar()
1471  );
1472 
1473  this->m_LogText_OutputPort[0].invoke(
1474  _id,
1475  _logTime,
1477  _logString
1478  );
1479  }
1480 #endif
1481  }
1482 
1485  Fw::Enabled enabled,
1486  const Fw::StringBase& entry
1487  ) const
1488  {
1489  // Get the time
1490  Fw::Time _logTime;
1491  if (this->m_Time_OutputPort[0].isConnected()) {
1492  this->m_Time_OutputPort[0].invoke(_logTime);
1493  }
1494 
1495  FwEventIdType _id = static_cast<FwEventIdType>(0);
1496 
1497  _id = this->getIdBase() + EVENTID_HLTH_CHECK_PING;
1498 
1499  // Emit the event on the log port
1500  if (this->m_Log_OutputPort[0].isConnected()) {
1501  Fw::LogBuffer _logBuff;
1503 
1504 #if FW_AMPCS_COMPATIBLE
1505  // Serialize the number of arguments
1506  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1507  FW_ASSERT(
1508  _status == Fw::FW_SERIALIZE_OK,
1509  static_cast<FwAssertArgType>(_status)
1510  );
1511 #endif
1512 
1513 #if FW_AMPCS_COMPATIBLE
1514  // Serialize the argument size
1515  _status = _logBuff.serializeFrom(
1516  static_cast<U8>(Fw::Enabled::SERIALIZED_SIZE)
1517  );
1518  FW_ASSERT(
1519  _status == Fw::FW_SERIALIZE_OK,
1520  static_cast<FwAssertArgType>(_status)
1521  );
1522 #endif
1523  _status = _logBuff.serializeFrom(enabled);
1524  FW_ASSERT(
1525  _status == Fw::FW_SERIALIZE_OK,
1526  static_cast<FwAssertArgType>(_status)
1527  );
1528 
1529  _status = entry.serializeTo(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1530  FW_ASSERT(
1531  _status == Fw::FW_SERIALIZE_OK,
1532  static_cast<FwAssertArgType>(_status)
1533  );
1534 
1535  this->m_Log_OutputPort[0].invoke(
1536  _id,
1537  _logTime,
1539  _logBuff
1540  );
1541  }
1542 
1543  // Emit the event on the text log port
1544 #if FW_ENABLE_TEXT_LOGGING
1545  if (this->m_LogText_OutputPort[0].isConnected()) {
1546 #if FW_OBJECT_NAMES == 1
1547  const char* _formatString =
1548  "(%s) %s: Health checking set to %s for %s";
1549 #else
1550  const char* _formatString =
1551  "%s: Health checking set to %s for %s";
1552 #endif
1553 
1554  Fw::String enabledStr;
1555  enabled.toString(enabledStr);
1556 
1557  Fw::TextLogString _logString;
1558  _logString.format(
1559  _formatString,
1560 #if FW_OBJECT_NAMES == 1
1561  this->m_objName.toChar(),
1562 #endif
1563  "HLTH_CHECK_PING ",
1564  enabledStr.toChar(),
1565  entry.toChar()
1566  );
1567 
1568  this->m_LogText_OutputPort[0].invoke(
1569  _id,
1570  _logTime,
1572  _logString
1573  );
1574  }
1575 #endif
1576  }
1577 
1580  {
1581  // Get the time
1582  Fw::Time _logTime;
1583  if (this->m_Time_OutputPort[0].isConnected()) {
1584  this->m_Time_OutputPort[0].invoke(_logTime);
1585  }
1586 
1587  FwEventIdType _id = static_cast<FwEventIdType>(0);
1588 
1590 
1591  // Emit the event on the log port
1592  if (this->m_Log_OutputPort[0].isConnected()) {
1593  Fw::LogBuffer _logBuff;
1595 
1596 #if FW_AMPCS_COMPATIBLE
1597  // Serialize the number of arguments
1598  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1599  FW_ASSERT(
1600  _status == Fw::FW_SERIALIZE_OK,
1601  static_cast<FwAssertArgType>(_status)
1602  );
1603 #endif
1604 
1605  _status = entry.serializeTo(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1606  FW_ASSERT(
1607  _status == Fw::FW_SERIALIZE_OK,
1608  static_cast<FwAssertArgType>(_status)
1609  );
1610 
1611  this->m_Log_OutputPort[0].invoke(
1612  _id,
1613  _logTime,
1615  _logBuff
1616  );
1617  }
1618 
1619  // Emit the event on the text log port
1620 #if FW_ENABLE_TEXT_LOGGING
1621  if (this->m_LogText_OutputPort[0].isConnected()) {
1622 #if FW_OBJECT_NAMES == 1
1623  const char* _formatString =
1624  "(%s) %s: Couldn't find entry %s";
1625 #else
1626  const char* _formatString =
1627  "%s: Couldn't find entry %s";
1628 #endif
1629 
1630  Fw::TextLogString _logString;
1631  _logString.format(
1632  _formatString,
1633 #if FW_OBJECT_NAMES == 1
1634  this->m_objName.toChar(),
1635 #endif
1636  "HLTH_CHECK_LOOKUP_ERROR ",
1637  entry.toChar()
1638  );
1639 
1640  this->m_LogText_OutputPort[0].invoke(
1641  _id,
1642  _logTime,
1644  _logString
1645  );
1646  }
1647 #endif
1648  }
1649 
1652  const Fw::StringBase& entry,
1653  U32 warn,
1654  U32 fatal
1655  ) const
1656  {
1657  // Get the time
1658  Fw::Time _logTime;
1659  if (this->m_Time_OutputPort[0].isConnected()) {
1660  this->m_Time_OutputPort[0].invoke(_logTime);
1661  }
1662 
1663  FwEventIdType _id = static_cast<FwEventIdType>(0);
1664 
1665  _id = this->getIdBase() + EVENTID_HLTH_PING_UPDATED;
1666 
1667  // Emit the event on the log port
1668  if (this->m_Log_OutputPort[0].isConnected()) {
1669  Fw::LogBuffer _logBuff;
1671 
1672 #if FW_AMPCS_COMPATIBLE
1673  // Serialize the number of arguments
1674  _status = _logBuff.serializeFrom(static_cast<U8>(3));
1675  FW_ASSERT(
1676  _status == Fw::FW_SERIALIZE_OK,
1677  static_cast<FwAssertArgType>(_status)
1678  );
1679 #endif
1680 
1681  _status = entry.serializeTo(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1682  FW_ASSERT(
1683  _status == Fw::FW_SERIALIZE_OK,
1684  static_cast<FwAssertArgType>(_status)
1685  );
1686 
1687 #if FW_AMPCS_COMPATIBLE
1688  // Serialize the argument size
1689  _status = _logBuff.serializeFrom(
1690  static_cast<U8>(sizeof(U32))
1691  );
1692  FW_ASSERT(
1693  _status == Fw::FW_SERIALIZE_OK,
1694  static_cast<FwAssertArgType>(_status)
1695  );
1696 #endif
1697  _status = _logBuff.serializeFrom(warn);
1698  FW_ASSERT(
1699  _status == Fw::FW_SERIALIZE_OK,
1700  static_cast<FwAssertArgType>(_status)
1701  );
1702 
1703 #if FW_AMPCS_COMPATIBLE
1704  // Serialize the argument size
1705  _status = _logBuff.serializeFrom(
1706  static_cast<U8>(sizeof(U32))
1707  );
1708  FW_ASSERT(
1709  _status == Fw::FW_SERIALIZE_OK,
1710  static_cast<FwAssertArgType>(_status)
1711  );
1712 #endif
1713  _status = _logBuff.serializeFrom(fatal);
1714  FW_ASSERT(
1715  _status == Fw::FW_SERIALIZE_OK,
1716  static_cast<FwAssertArgType>(_status)
1717  );
1718 
1719  this->m_Log_OutputPort[0].invoke(
1720  _id,
1721  _logTime,
1723  _logBuff
1724  );
1725  }
1726 
1727  // Emit the event on the text log port
1728 #if FW_ENABLE_TEXT_LOGGING
1729  if (this->m_LogText_OutputPort[0].isConnected()) {
1730 #if FW_OBJECT_NAMES == 1
1731  const char* _formatString =
1732  "(%s) %s: Health ping for %s changed to WARN %" PRIu32 " FATAL %" PRIu32 "";
1733 #else
1734  const char* _formatString =
1735  "%s: Health ping for %s changed to WARN %" PRIu32 " FATAL %" PRIu32 "";
1736 #endif
1737 
1738  Fw::TextLogString _logString;
1739  _logString.format(
1740  _formatString,
1741 #if FW_OBJECT_NAMES == 1
1742  this->m_objName.toChar(),
1743 #endif
1744  "HLTH_PING_UPDATED ",
1745  entry.toChar(),
1746  warn,
1747  fatal
1748  );
1749 
1750  this->m_LogText_OutputPort[0].invoke(
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->m_Time_OutputPort[0].isConnected()) {
1770  this->m_Time_OutputPort[0].invoke(_logTime);
1771  }
1772 
1773  FwEventIdType _id = static_cast<FwEventIdType>(0);
1774 
1776 
1777  // Emit the event on the log port
1778  if (this->m_Log_OutputPort[0].isConnected()) {
1779  Fw::LogBuffer _logBuff;
1781 
1782 #if FW_AMPCS_COMPATIBLE
1783  // Serialize the number of arguments
1784  _status = _logBuff.serializeFrom(static_cast<U8>(3));
1785  FW_ASSERT(
1786  _status == Fw::FW_SERIALIZE_OK,
1787  static_cast<FwAssertArgType>(_status)
1788  );
1789 #endif
1790 
1791  _status = entry.serializeTo(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1792  FW_ASSERT(
1793  _status == Fw::FW_SERIALIZE_OK,
1794  static_cast<FwAssertArgType>(_status)
1795  );
1796 
1797 #if FW_AMPCS_COMPATIBLE
1798  // Serialize the argument size
1799  _status = _logBuff.serializeFrom(
1800  static_cast<U8>(sizeof(U32))
1801  );
1802  FW_ASSERT(
1803  _status == Fw::FW_SERIALIZE_OK,
1804  static_cast<FwAssertArgType>(_status)
1805  );
1806 #endif
1807  _status = _logBuff.serializeFrom(warn);
1808  FW_ASSERT(
1809  _status == Fw::FW_SERIALIZE_OK,
1810  static_cast<FwAssertArgType>(_status)
1811  );
1812 
1813 #if FW_AMPCS_COMPATIBLE
1814  // Serialize the argument size
1815  _status = _logBuff.serializeFrom(
1816  static_cast<U8>(sizeof(U32))
1817  );
1818  FW_ASSERT(
1819  _status == Fw::FW_SERIALIZE_OK,
1820  static_cast<FwAssertArgType>(_status)
1821  );
1822 #endif
1823  _status = _logBuff.serializeFrom(fatal);
1824  FW_ASSERT(
1825  _status == Fw::FW_SERIALIZE_OK,
1826  static_cast<FwAssertArgType>(_status)
1827  );
1828 
1829  this->m_Log_OutputPort[0].invoke(
1830  _id,
1831  _logTime,
1833  _logBuff
1834  );
1835  }
1836 
1837  // Emit the event on the text log port
1838 #if FW_ENABLE_TEXT_LOGGING
1839  if (this->m_LogText_OutputPort[0].isConnected()) {
1840 #if FW_OBJECT_NAMES == 1
1841  const char* _formatString =
1842  "(%s) %s: Health ping for %s invalid values: WARN %" PRIu32 " FATAL %" PRIu32 "";
1843 #else
1844  const char* _formatString =
1845  "%s: Health ping for %s invalid values: WARN %" PRIu32 " FATAL %" PRIu32 "";
1846 #endif
1847 
1848  Fw::TextLogString _logString;
1849  _logString.format(
1850  _formatString,
1851 #if FW_OBJECT_NAMES == 1
1852  this->m_objName.toChar(),
1853 #endif
1854  "HLTH_PING_INVALID_VALUES ",
1855  entry.toChar(),
1856  warn,
1857  fatal
1858  );
1859 
1860  this->m_LogText_OutputPort[0].invoke(
1861  _id,
1862  _logTime,
1864  _logString
1865  );
1866  }
1867 #endif
1868  }
1869 
1870  // ----------------------------------------------------------------------
1871  // Telemetry write functions
1872  // ----------------------------------------------------------------------
1873 
1876  U32 arg,
1877  Fw::Time _tlmTime
1878  ) const
1879  {
1880  if (this->m_Tlm_OutputPort[0].isConnected()) {
1881  if (
1882  this->m_Time_OutputPort[0].isConnected() &&
1883  (_tlmTime == Fw::ZERO_TIME)
1884  ) {
1885  this->m_Time_OutputPort[0].invoke(_tlmTime);
1886  }
1887 
1888  Fw::TlmBuffer _tlmBuff;
1889  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1890  FW_ASSERT(
1891  _stat == Fw::FW_SERIALIZE_OK,
1892  static_cast<FwAssertArgType>(_stat)
1893  );
1894 
1895  FwChanIdType _id;
1896 
1897  _id = this->getIdBase() + CHANNELID_PINGLATEWARNINGS;
1898 
1899  this->m_Tlm_OutputPort[0].invoke(
1900  _id,
1901  _tlmTime,
1902  _tlmBuff
1903  );
1904  }
1905  }
1906 
1907  // ----------------------------------------------------------------------
1908  // Time
1909  // ----------------------------------------------------------------------
1910 
1912  getTime() const
1913  {
1914  if (this->m_Time_OutputPort[0].isConnected()) {
1915  Fw::Time _time;
1916  this->m_Time_OutputPort[0].invoke(_time);
1917  return _time;
1918  }
1919  else {
1920  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1921  }
1922  }
1923 
1924  // ----------------------------------------------------------------------
1925  // Message dispatch functions
1926  // ----------------------------------------------------------------------
1927 
1930  {
1931  ComponentIpcSerializableBuffer _msg;
1932  FwQueuePriorityType _priority = 0;
1933 
1934  Os::Queue::Status _msgStatus = this->m_queue.receive(
1935  _msg,
1937  _priority
1938  );
1939  if (Os::Queue::Status::EMPTY == _msgStatus) {
1941  }
1942  else {
1943  FW_ASSERT(
1944  _msgStatus == Os::Queue::OP_OK,
1945  static_cast<FwAssertArgType>(_msgStatus)
1946  );
1947  }
1948 
1949  // Reset to beginning of buffer
1950  _msg.resetDeser();
1951 
1952  FwEnumStoreType _desMsg = 0;
1953  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
1954  FW_ASSERT(
1955  _deserStatus == Fw::FW_SERIALIZE_OK,
1956  static_cast<FwAssertArgType>(_deserStatus)
1957  );
1958 
1959  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
1960 
1961  if (_msgType == HEALTH_COMPONENT_EXIT) {
1962  return MSG_DISPATCH_EXIT;
1963  }
1964 
1965  FwIndexType portNum = 0;
1966  _deserStatus = _msg.deserializeTo(portNum);
1967  FW_ASSERT(
1968  _deserStatus == Fw::FW_SERIALIZE_OK,
1969  static_cast<FwAssertArgType>(_deserStatus)
1970  );
1971 
1972  switch (_msgType) {
1973  // Handle async input port PingReturn
1974  case PINGRETURN_PING: {
1975  // Deserialize argument key
1976  U32 key;
1977  _deserStatus = _msg.deserializeTo(key);
1978  FW_ASSERT(
1979  _deserStatus == Fw::FW_SERIALIZE_OK,
1980  static_cast<FwAssertArgType>(_deserStatus)
1981  );
1982  // Call handler function
1983  this->PingReturn_handler(
1984  portNum,
1985  key
1986  );
1987 
1988  break;
1989  }
1990 
1991  // Handle command HLTH_ENABLE
1992  case CMD_HLTH_ENABLE: {
1993  // Deserialize opcode
1994  FwOpcodeType _opCode = 0;
1995  _deserStatus = _msg.deserializeTo(_opCode);
1996  FW_ASSERT (
1997  _deserStatus == Fw::FW_SERIALIZE_OK,
1998  static_cast<FwAssertArgType>(_deserStatus)
1999  );
2000 
2001  // Deserialize command sequence
2002  U32 _cmdSeq = 0;
2003  _deserStatus = _msg.deserializeTo(_cmdSeq);
2004  FW_ASSERT (
2005  _deserStatus == Fw::FW_SERIALIZE_OK,
2006  static_cast<FwAssertArgType>(_deserStatus)
2007  );
2008 
2009  // Deserialize command argument buffer
2010  Fw::CmdArgBuffer args;
2011  _deserStatus = _msg.deserializeTo(args);
2012  FW_ASSERT (
2013  _deserStatus == Fw::FW_SERIALIZE_OK,
2014  static_cast<FwAssertArgType>(_deserStatus)
2015  );
2016 
2017  // Reset buffer
2018  args.resetDeser();
2019 
2020  // Deserialize argument enable
2021  Fw::Enabled enable;
2022  _deserStatus = args.deserializeTo(enable);
2023  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2024  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2025  this->cmdResponse_out(
2026  _opCode,
2027  _cmdSeq,
2029  );
2030  }
2031  // Don't crash the task if bad arguments were passed from the ground
2032  break;
2033  }
2034 
2035  // Make sure there was no data left over.
2036  // That means the argument buffer size was incorrect.
2037 #if FW_CMD_CHECK_RESIDUAL
2038  if (args.getDeserializeSizeLeft() != 0) {
2039  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2040  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2041  }
2042  // Don't crash the task if bad arguments were passed from the ground
2043  break;
2044  }
2045 #endif
2046 
2047  // Call handler function
2048  this->HLTH_ENABLE_cmdHandler(
2049  _opCode, _cmdSeq,
2050  enable
2051  );
2052 
2053  break;
2054  }
2055 
2056  // Handle command HLTH_PING_ENABLE
2057  case CMD_HLTH_PING_ENABLE: {
2058  // Deserialize opcode
2059  FwOpcodeType _opCode = 0;
2060  _deserStatus = _msg.deserializeTo(_opCode);
2061  FW_ASSERT (
2062  _deserStatus == Fw::FW_SERIALIZE_OK,
2063  static_cast<FwAssertArgType>(_deserStatus)
2064  );
2065 
2066  // Deserialize command sequence
2067  U32 _cmdSeq = 0;
2068  _deserStatus = _msg.deserializeTo(_cmdSeq);
2069  FW_ASSERT (
2070  _deserStatus == Fw::FW_SERIALIZE_OK,
2071  static_cast<FwAssertArgType>(_deserStatus)
2072  );
2073 
2074  // Deserialize command argument buffer
2075  Fw::CmdArgBuffer args;
2076  _deserStatus = _msg.deserializeTo(args);
2077  FW_ASSERT (
2078  _deserStatus == Fw::FW_SERIALIZE_OK,
2079  static_cast<FwAssertArgType>(_deserStatus)
2080  );
2081 
2082  // Reset buffer
2083  args.resetDeser();
2084 
2085  // Deserialize argument entry
2086  Fw::CmdStringArg entry;
2087  _deserStatus = args.deserializeTo(entry);
2088  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2089  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2090  this->cmdResponse_out(
2091  _opCode,
2092  _cmdSeq,
2094  );
2095  }
2096  // Don't crash the task if bad arguments were passed from the ground
2097  break;
2098  }
2099 
2100  // Deserialize argument enable
2101  Fw::Enabled enable;
2102  _deserStatus = args.deserializeTo(enable);
2103  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2104  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2105  this->cmdResponse_out(
2106  _opCode,
2107  _cmdSeq,
2109  );
2110  }
2111  // Don't crash the task if bad arguments were passed from the ground
2112  break;
2113  }
2114 
2115  // Make sure there was no data left over.
2116  // That means the argument buffer size was incorrect.
2117 #if FW_CMD_CHECK_RESIDUAL
2118  if (args.getDeserializeSizeLeft() != 0) {
2119  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2120  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2121  }
2122  // Don't crash the task if bad arguments were passed from the ground
2123  break;
2124  }
2125 #endif
2126 
2127  // Call handler function
2129  _opCode, _cmdSeq,
2130  entry,
2131  enable
2132  );
2133 
2134  break;
2135  }
2136 
2137  // Handle command HLTH_CHNG_PING
2138  case CMD_HLTH_CHNG_PING: {
2139  // Deserialize opcode
2140  FwOpcodeType _opCode = 0;
2141  _deserStatus = _msg.deserializeTo(_opCode);
2142  FW_ASSERT (
2143  _deserStatus == Fw::FW_SERIALIZE_OK,
2144  static_cast<FwAssertArgType>(_deserStatus)
2145  );
2146 
2147  // Deserialize command sequence
2148  U32 _cmdSeq = 0;
2149  _deserStatus = _msg.deserializeTo(_cmdSeq);
2150  FW_ASSERT (
2151  _deserStatus == Fw::FW_SERIALIZE_OK,
2152  static_cast<FwAssertArgType>(_deserStatus)
2153  );
2154 
2155  // Deserialize command argument buffer
2156  Fw::CmdArgBuffer args;
2157  _deserStatus = _msg.deserializeTo(args);
2158  FW_ASSERT (
2159  _deserStatus == Fw::FW_SERIALIZE_OK,
2160  static_cast<FwAssertArgType>(_deserStatus)
2161  );
2162 
2163  // Reset buffer
2164  args.resetDeser();
2165 
2166  // Deserialize argument entry
2167  Fw::CmdStringArg entry;
2168  _deserStatus = args.deserializeTo(entry);
2169  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2170  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2171  this->cmdResponse_out(
2172  _opCode,
2173  _cmdSeq,
2175  );
2176  }
2177  // Don't crash the task if bad arguments were passed from the ground
2178  break;
2179  }
2180 
2181  // Deserialize argument warningValue
2182  U32 warningValue;
2183  _deserStatus = args.deserializeTo(warningValue);
2184  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2185  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2186  this->cmdResponse_out(
2187  _opCode,
2188  _cmdSeq,
2190  );
2191  }
2192  // Don't crash the task if bad arguments were passed from the ground
2193  break;
2194  }
2195 
2196  // Deserialize argument fatalValue
2197  U32 fatalValue;
2198  _deserStatus = args.deserializeTo(fatalValue);
2199  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2200  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2201  this->cmdResponse_out(
2202  _opCode,
2203  _cmdSeq,
2205  );
2206  }
2207  // Don't crash the task if bad arguments were passed from the ground
2208  break;
2209  }
2210 
2211  // Make sure there was no data left over.
2212  // That means the argument buffer size was incorrect.
2213 #if FW_CMD_CHECK_RESIDUAL
2214  if (args.getDeserializeSizeLeft() != 0) {
2215  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2216  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2217  }
2218  // Don't crash the task if bad arguments were passed from the ground
2219  break;
2220  }
2221 #endif
2222 
2223  // Call handler function
2225  _opCode, _cmdSeq,
2226  entry,
2227  warningValue,
2228  fatalValue
2229  );
2230 
2231  break;
2232  }
2233 
2234  default:
2235  return MSG_DISPATCH_ERROR;
2236  }
2237 
2238  return MSG_DISPATCH_OK;
2239  }
2240 
2241  // ----------------------------------------------------------------------
2242  // Helper functions for dispatching current messages
2243  // ----------------------------------------------------------------------
2244 
2247  {
2248  // Dispatch all current messages unless ERROR or EXIT occur
2249  const FwSizeType currentMessageCount = this->m_queue.getMessagesAvailable();
2250  MsgDispatchStatus messageStatus = MsgDispatchStatus::MSG_DISPATCH_EMPTY;
2251  for (FwSizeType i = 0; i < currentMessageCount; i++) {
2252  messageStatus = this->doDispatch();
2253  if (messageStatus != QueuedComponentBase::MSG_DISPATCH_OK) {
2254  break;
2255  }
2256  }
2257  return messageStatus;
2258  }
2259 
2260  // ----------------------------------------------------------------------
2261  // Calls for messages received on special input ports
2262  // ----------------------------------------------------------------------
2263 
2264  void HealthComponentBase ::
2265  m_p_CmdDisp_in(
2266  Fw::PassiveComponentBase* callComp,
2267  FwIndexType portNum,
2268  FwOpcodeType opCode,
2269  U32 cmdSeq,
2270  Fw::CmdArgBuffer& args
2271  )
2272  {
2273  FW_ASSERT(callComp);
2274  HealthComponentBase* compPtr = static_cast<HealthComponentBase*>(callComp);
2275 
2276  const U32 idBase = callComp->getIdBase();
2277  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
2278 
2279  // Select base class function based on opcode
2280  switch (opCode - idBase) {
2281  case OPCODE_HLTH_ENABLE: {
2282  compPtr->HLTH_ENABLE_cmdHandlerBase(
2283  opCode,
2284  cmdSeq,
2285  args
2286  );
2287  break;
2288  }
2289 
2290  case OPCODE_HLTH_PING_ENABLE: {
2292  opCode,
2293  cmdSeq,
2294  args
2295  );
2296  break;
2297  }
2298 
2299  case OPCODE_HLTH_CHNG_PING: {
2301  opCode,
2302  cmdSeq,
2303  args
2304  );
2305  break;
2306  }
2307  }
2308  }
2309 
2310  // ----------------------------------------------------------------------
2311  // Calls for messages received on typed input ports
2312  // ----------------------------------------------------------------------
2313 
2314  void HealthComponentBase ::
2315  m_p_PingReturn_in(
2316  Fw::PassiveComponentBase* callComp,
2317  FwIndexType portNum,
2318  U32 key
2319  )
2320  {
2321  FW_ASSERT(callComp);
2322  HealthComponentBase* compPtr = static_cast<HealthComponentBase*>(callComp);
2323  compPtr->PingReturn_handlerBase(
2324  portNum,
2325  key
2326  );
2327  }
2328 
2329  void HealthComponentBase ::
2330  m_p_Run_in(
2331  Fw::PassiveComponentBase* callComp,
2332  FwIndexType portNum,
2333  U32 context
2334  )
2335  {
2336  FW_ASSERT(callComp);
2337  HealthComponentBase* compPtr = static_cast<HealthComponentBase*>(callComp);
2338  compPtr->Run_handlerBase(
2339  portNum,
2340  context
2341  );
2342  }
2343 
2344 }
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:134
Auto-generated base for Health component.
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:63
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:56
The size of the serial representations of the port arguments.
Definition: PingPortAc.hpp:36
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:56
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 interface.
Definition: PingPortAc.cpp:147
virtual const CHAR * toChar() const =0
Convert to a C-style char*.
bool isConnected_Log_OutputPort(FwIndexType portNum)
const Time ZERO_TIME
Definition: Time.cpp:5
bool isConnected_CmdReg_OutputPort(FwIndexType portNum)
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
Enum representing a command response.
bool isConnected_CmdStatus_OutputPort(FwIndexType portNum)
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.
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:150
void init()
Object initializer.
Definition: ObjBase.cpp:24
Declare FATAL since task is no longer responding.
SerializeStatus
forward declaration for string
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:62
static constexpr FwIndexType getNum_Log_OutputPorts()
FwIdType FwEventIdType
The type of an event identifier.
Svc::InputPingPort * get_PingReturn_InputPort(FwIndexType portNum)
void invoke(FwOpcodeType opCode) const
Invoke a port interface.
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.
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:26
void init()
Initialization function.
Definition: TimePortAc.cpp:128
static constexpr FwIndexType getNum_CmdDisp_InputPorts()
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
#define FW_MIN(a, b)
MIN macro.
Definition: BasicTypes.h:92
A less serious but recoverable event.
void init()
Initialization function.
Definition: PingPortAc.cpp:128
The size of the serial representation.
void invoke(Fw::Time &time) const
Invoke a port interface.
Definition: TimePortAc.cpp:147
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 interface.
FwIdType FwChanIdType
The type of a telemetry channel identifier.
FwSizeType SizeType
void addCallPort(InputPingPort *callPort)
Register an input port.
Definition: PingPortAc.cpp:134
bool isConnected_Time_OutputPort(FwIndexType portNum)
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
Definition: Queue.cpp:46
void WdogStroke_out(FwIndexType portNum, U32 code)
Invoke output port WdogStroke.
void HLTH_PING_ENABLE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void resetDeser() override
Reset deserialization pointer to beginning of buffer.
The size of the serial representations of the port arguments.
Definition: CmdPortAc.hpp:38
Warn that a ping target is longer than the warning value.
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 interface.
Definition: TlmPortAc.cpp:163
bool isConnected() const
Definition: PortBase.cpp:38
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
A command to enable or disable health checks.
Enabled and disabled states.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
void init()
Initialization function.
Definition: LogPortAc.cpp:151
bool isConnected_WdogStroke_OutputPort(FwIndexType portNum)
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:81
bool isConnected_PingSend_OutputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_WdogStroke_OutputPorts()
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)
bool isConnected_Tlm_OutputPort(FwIndexType portNum)
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: SchedPortAc.cpp:62
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port interface.
Definition: LogPortAc.cpp:170
HealthComponentBase(const char *compName="")
Construct HealthComponentBase object.
void invoke(U32 code) const
Invoke a port interface.
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.
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:157
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:56
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
message to exit active component task
Report a particular entry on or off.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: PingPortAc.cpp:62
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.
void log_ACTIVITY_HI_HLTH_CHECK_ENABLE(Fw::Enabled enabled) const
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.
static constexpr FwIndexType getNum_Time_OutputPorts()
void Run_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port Run.
void PingSend_out(FwIndexType portNum, U32 key)
Invoke output port PingSend.
void log_ACTIVITY_HI_HLTH_PING_UPDATED(const Fw::StringBase &entry, U32 warn, U32 fatal) const