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 
8 #include "Fw/Types/Assert.hpp"
10 #if FW_ENABLE_TEXT_LOGGING
11 #include "Fw/Types/String.hpp"
12 #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 getBuffCapacity() 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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  // Getters for numbers of special input ports
656  // ----------------------------------------------------------------------
657 
660  {
661  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_CmdDisp_InputPort));
662  }
663 
664  // ----------------------------------------------------------------------
665  // Getters for numbers of typed input ports
666  // ----------------------------------------------------------------------
667 
670  {
671  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_PingReturn_InputPort));
672  }
673 
676  {
677  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_Run_InputPort));
678  }
679 
680  // ----------------------------------------------------------------------
681  // Getters for numbers of special output ports
682  // ----------------------------------------------------------------------
683 
686  {
687  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_CmdReg_OutputPort));
688  }
689 
692  {
693  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_CmdStatus_OutputPort));
694  }
695 
698  {
699  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_Log_OutputPort));
700  }
701 
702 #if FW_ENABLE_TEXT_LOGGING == 1
703 
704  FwIndexType HealthComponentBase ::
705  getNum_LogText_OutputPorts() const
706  {
707  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_LogText_OutputPort));
708  }
709 
710 #endif
711 
714  {
715  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_Time_OutputPort));
716  }
717 
720  {
721  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_Tlm_OutputPort));
722  }
723 
724  // ----------------------------------------------------------------------
725  // Getters for numbers of typed output ports
726  // ----------------------------------------------------------------------
727 
730  {
731  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_PingSend_OutputPort));
732  }
733 
736  {
737  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_WdogStroke_OutputPort));
738  }
739 
740  // ----------------------------------------------------------------------
741  // Connection status queries for special output ports
742  // ----------------------------------------------------------------------
743 
746  {
747  FW_ASSERT(
748  portNum < this->getNum_CmdReg_OutputPorts(),
749  static_cast<FwAssertArgType>(portNum)
750  );
751 
752  return this->m_CmdReg_OutputPort[portNum].isConnected();
753  }
754 
757  {
758  FW_ASSERT(
759  portNum < this->getNum_CmdStatus_OutputPorts(),
760  static_cast<FwAssertArgType>(portNum)
761  );
762 
763  return this->m_CmdStatus_OutputPort[portNum].isConnected();
764  }
765 
768  {
769  FW_ASSERT(
770  portNum < this->getNum_Log_OutputPorts(),
771  static_cast<FwAssertArgType>(portNum)
772  );
773 
774  return this->m_Log_OutputPort[portNum].isConnected();
775  }
776 
777 #if FW_ENABLE_TEXT_LOGGING == 1
778 
779  bool HealthComponentBase ::
780  isConnected_LogText_OutputPort(FwIndexType portNum)
781  {
782  FW_ASSERT(
783  portNum < this->getNum_LogText_OutputPorts(),
784  static_cast<FwAssertArgType>(portNum)
785  );
786 
787  return this->m_LogText_OutputPort[portNum].isConnected();
788  }
789 
790 #endif
791 
794  {
795  FW_ASSERT(
796  portNum < this->getNum_Time_OutputPorts(),
797  static_cast<FwAssertArgType>(portNum)
798  );
799 
800  return this->m_Time_OutputPort[portNum].isConnected();
801  }
802 
805  {
806  FW_ASSERT(
807  portNum < this->getNum_Tlm_OutputPorts(),
808  static_cast<FwAssertArgType>(portNum)
809  );
810 
811  return this->m_Tlm_OutputPort[portNum].isConnected();
812  }
813 
814  // ----------------------------------------------------------------------
815  // Connection status queries for typed output ports
816  // ----------------------------------------------------------------------
817 
820  {
821  FW_ASSERT(
822  portNum < this->getNum_PingSend_OutputPorts(),
823  static_cast<FwAssertArgType>(portNum)
824  );
825 
826  return this->m_PingSend_OutputPort[portNum].isConnected();
827  }
828 
831  {
832  FW_ASSERT(
833  portNum < this->getNum_WdogStroke_OutputPorts(),
834  static_cast<FwAssertArgType>(portNum)
835  );
836 
837  return this->m_WdogStroke_OutputPort[portNum].isConnected();
838  }
839 
840  // ----------------------------------------------------------------------
841  // Port handler base-class functions for typed input ports
842  //
843  // Call these functions directly to bypass the corresponding ports
844  // ----------------------------------------------------------------------
845 
848  FwIndexType portNum,
849  U32 key
850  )
851  {
852  // Make sure port number is valid
853  FW_ASSERT(
854  portNum < this->getNum_PingReturn_InputPorts(),
855  static_cast<FwAssertArgType>(portNum)
856  );
857 
858  // Call pre-message hook
860  portNum,
861  key
862  );
863  ComponentIpcSerializableBuffer msg;
865 
866  // Serialize message ID
867  _status = msg.serialize(
868  static_cast<FwEnumStoreType>(PINGRETURN_PING)
869  );
870  FW_ASSERT(
871  _status == Fw::FW_SERIALIZE_OK,
872  static_cast<FwAssertArgType>(_status)
873  );
874 
875  // Serialize port number
876  _status = msg.serialize(portNum);
877  FW_ASSERT(
878  _status == Fw::FW_SERIALIZE_OK,
879  static_cast<FwAssertArgType>(_status)
880  );
881 
882  // Serialize argument key
883  _status = msg.serialize(key);
884  FW_ASSERT(
885  _status == Fw::FW_SERIALIZE_OK,
886  static_cast<FwAssertArgType>(_status)
887  );
888 
889  // Send message
891  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
892 
893  FW_ASSERT(
894  qStatus == Os::Queue::OP_OK,
895  static_cast<FwAssertArgType>(qStatus)
896  );
897  }
898 
901  FwIndexType portNum,
902  U32 context
903  )
904  {
905  // Make sure port number is valid
906  FW_ASSERT(
907  portNum < this->getNum_Run_InputPorts(),
908  static_cast<FwAssertArgType>(portNum)
909  );
910 
911  // Call handler function
912  this->Run_handler(
913  portNum,
914  context
915  );
916  }
917 
918  // ----------------------------------------------------------------------
919  // Pre-message hooks for typed async input ports
920  //
921  // Each of these functions is invoked just before processing a message
922  // on the corresponding port. By default, they do nothing. You can
923  // override them to provide specific pre-message behavior.
924  // ----------------------------------------------------------------------
925 
928  FwIndexType portNum,
929  U32 key
930  )
931  {
932  // Default: no-op
933  }
934 
935  // ----------------------------------------------------------------------
936  // Invocation functions for typed output ports
937  // ----------------------------------------------------------------------
938 
941  FwIndexType portNum,
942  U32 key
943  )
944  {
945  FW_ASSERT(
946  portNum < this->getNum_PingSend_OutputPorts(),
947  static_cast<FwAssertArgType>(portNum)
948  );
949  this->m_PingSend_OutputPort[portNum].invoke(
950  key
951  );
952  }
953 
956  FwIndexType portNum,
957  U32 code
958  )
959  {
960  FW_ASSERT(
961  portNum < this->getNum_WdogStroke_OutputPorts(),
962  static_cast<FwAssertArgType>(portNum)
963  );
964  this->m_WdogStroke_OutputPort[portNum].invoke(
965  code
966  );
967  }
968 
969  // ----------------------------------------------------------------------
970  // Command response
971  // ----------------------------------------------------------------------
972 
975  FwOpcodeType opCode,
976  U32 cmdSeq,
977  Fw::CmdResponse response
978  )
979  {
980  FW_ASSERT(this->m_CmdStatus_OutputPort[0].isConnected());
981  this->m_CmdStatus_OutputPort[0].invoke(opCode, cmdSeq, response);
982  }
983 
984  // ----------------------------------------------------------------------
985  // Command handler base-class functions
986  //
987  // Call these functions directly to bypass the command input port
988  // ----------------------------------------------------------------------
989 
992  FwOpcodeType opCode,
993  U32 cmdSeq,
994  Fw::CmdArgBuffer& args
995  )
996  {
997  // Call pre-message hook
998  this->HLTH_ENABLE_preMsgHook(opCode,cmdSeq);
999 
1000  // Defer deserializing arguments to the message dispatcher
1001  // to avoid deserializing and reserializing just for IPC
1002  ComponentIpcSerializableBuffer msg;
1004 
1005  // Serialize for IPC
1006  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_HLTH_ENABLE));
1007  FW_ASSERT (
1008  _status == Fw::FW_SERIALIZE_OK,
1009  static_cast<FwAssertArgType>(_status)
1010  );
1011 
1012  // Fake port number to make message dequeue work
1013  FwIndexType port = 0;
1014 
1015  _status = msg.serialize(port);
1016  FW_ASSERT (
1017  _status == Fw::FW_SERIALIZE_OK,
1018  static_cast<FwAssertArgType>(_status)
1019  );
1020 
1021  _status = msg.serialize(opCode);
1022  FW_ASSERT (
1023  _status == Fw::FW_SERIALIZE_OK,
1024  static_cast<FwAssertArgType>(_status)
1025  );
1026 
1027  _status = msg.serialize(cmdSeq);
1028  FW_ASSERT (
1029  _status == Fw::FW_SERIALIZE_OK,
1030  static_cast<FwAssertArgType>(_status)
1031  );
1032 
1033  _status = msg.serialize(args);
1034  FW_ASSERT (
1035  _status == Fw::FW_SERIALIZE_OK,
1036  static_cast<FwAssertArgType>(_status)
1037  );
1038 
1039  // Send message
1041  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1042 
1043  FW_ASSERT(
1044  qStatus == Os::Queue::OP_OK,
1045  static_cast<FwAssertArgType>(qStatus)
1046  );
1047  }
1048 
1051  FwOpcodeType opCode,
1052  U32 cmdSeq,
1053  Fw::CmdArgBuffer& args
1054  )
1055  {
1056  // Call pre-message hook
1057  this->HLTH_PING_ENABLE_preMsgHook(opCode,cmdSeq);
1058 
1059  // Defer deserializing arguments to the message dispatcher
1060  // to avoid deserializing and reserializing just for IPC
1061  ComponentIpcSerializableBuffer msg;
1063 
1064  // Serialize for IPC
1065  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_HLTH_PING_ENABLE));
1066  FW_ASSERT (
1067  _status == Fw::FW_SERIALIZE_OK,
1068  static_cast<FwAssertArgType>(_status)
1069  );
1070 
1071  // Fake port number to make message dequeue work
1072  FwIndexType port = 0;
1073 
1074  _status = msg.serialize(port);
1075  FW_ASSERT (
1076  _status == Fw::FW_SERIALIZE_OK,
1077  static_cast<FwAssertArgType>(_status)
1078  );
1079 
1080  _status = msg.serialize(opCode);
1081  FW_ASSERT (
1082  _status == Fw::FW_SERIALIZE_OK,
1083  static_cast<FwAssertArgType>(_status)
1084  );
1085 
1086  _status = msg.serialize(cmdSeq);
1087  FW_ASSERT (
1088  _status == Fw::FW_SERIALIZE_OK,
1089  static_cast<FwAssertArgType>(_status)
1090  );
1091 
1092  _status = msg.serialize(args);
1093  FW_ASSERT (
1094  _status == Fw::FW_SERIALIZE_OK,
1095  static_cast<FwAssertArgType>(_status)
1096  );
1097 
1098  // Send message
1100  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1101 
1102  FW_ASSERT(
1103  qStatus == Os::Queue::OP_OK,
1104  static_cast<FwAssertArgType>(qStatus)
1105  );
1106  }
1107 
1110  FwOpcodeType opCode,
1111  U32 cmdSeq,
1112  Fw::CmdArgBuffer& args
1113  )
1114  {
1115  // Call pre-message hook
1116  this->HLTH_CHNG_PING_preMsgHook(opCode,cmdSeq);
1117 
1118  // Defer deserializing arguments to the message dispatcher
1119  // to avoid deserializing and reserializing just for IPC
1120  ComponentIpcSerializableBuffer msg;
1122 
1123  // Serialize for IPC
1124  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_HLTH_CHNG_PING));
1125  FW_ASSERT (
1126  _status == Fw::FW_SERIALIZE_OK,
1127  static_cast<FwAssertArgType>(_status)
1128  );
1129 
1130  // Fake port number to make message dequeue work
1131  FwIndexType port = 0;
1132 
1133  _status = msg.serialize(port);
1134  FW_ASSERT (
1135  _status == Fw::FW_SERIALIZE_OK,
1136  static_cast<FwAssertArgType>(_status)
1137  );
1138 
1139  _status = msg.serialize(opCode);
1140  FW_ASSERT (
1141  _status == Fw::FW_SERIALIZE_OK,
1142  static_cast<FwAssertArgType>(_status)
1143  );
1144 
1145  _status = msg.serialize(cmdSeq);
1146  FW_ASSERT (
1147  _status == Fw::FW_SERIALIZE_OK,
1148  static_cast<FwAssertArgType>(_status)
1149  );
1150 
1151  _status = msg.serialize(args);
1152  FW_ASSERT (
1153  _status == Fw::FW_SERIALIZE_OK,
1154  static_cast<FwAssertArgType>(_status)
1155  );
1156 
1157  // Send message
1159  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1160 
1161  FW_ASSERT(
1162  qStatus == Os::Queue::OP_OK,
1163  static_cast<FwAssertArgType>(qStatus)
1164  );
1165  }
1166 
1167  // ----------------------------------------------------------------------
1168  // Pre-message hooks for async commands
1169  //
1170  // Each of these functions is invoked just before processing the
1171  // corresponding command. By default they do nothing. You can
1172  // override them to provide specific pre-command behavior.
1173  // ----------------------------------------------------------------------
1174 
1177  FwOpcodeType opCode,
1178  U32 cmdSeq
1179  )
1180  {
1181  // Defaults to no-op; can be overridden
1182  (void) opCode;
1183  (void) cmdSeq;
1184  }
1185 
1188  FwOpcodeType opCode,
1189  U32 cmdSeq
1190  )
1191  {
1192  // Defaults to no-op; can be overridden
1193  (void) opCode;
1194  (void) cmdSeq;
1195  }
1196 
1199  FwOpcodeType opCode,
1200  U32 cmdSeq
1201  )
1202  {
1203  // Defaults to no-op; can be overridden
1204  (void) opCode;
1205  (void) cmdSeq;
1206  }
1207 
1208  // ----------------------------------------------------------------------
1209  // Event logging functions
1210  // ----------------------------------------------------------------------
1211 
1214  {
1215  // Get the time
1216  Fw::Time _logTime;
1217  if (this->m_Time_OutputPort[0].isConnected()) {
1218  this->m_Time_OutputPort[0].invoke(_logTime);
1219  }
1220 
1221  FwEventIdType _id = static_cast<FwEventIdType>(0);
1222 
1223  _id = this->getIdBase() + EVENTID_HLTH_PING_WARN;
1224 
1225  // Emit the event on the log port
1226  if (this->m_Log_OutputPort[0].isConnected()) {
1227  Fw::LogBuffer _logBuff;
1229 
1230 #if FW_AMPCS_COMPATIBLE
1231  // Serialize the number of arguments
1232  _status = _logBuff.serialize(static_cast<U8>(1));
1233  FW_ASSERT(
1234  _status == Fw::FW_SERIALIZE_OK,
1235  static_cast<FwAssertArgType>(_status)
1236  );
1237 #endif
1238 
1239  _status = entry.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1240  FW_ASSERT(
1241  _status == Fw::FW_SERIALIZE_OK,
1242  static_cast<FwAssertArgType>(_status)
1243  );
1244 
1245  this->m_Log_OutputPort[0].invoke(
1246  _id,
1247  _logTime,
1249  _logBuff
1250  );
1251  }
1252 
1253  // Emit the event on the text log port
1254 #if FW_ENABLE_TEXT_LOGGING
1255  if (this->m_LogText_OutputPort[0].isConnected()) {
1256 #if FW_OBJECT_NAMES == 1
1257  const char* _formatString =
1258  "(%s) %s: Ping entry %s late warning";
1259 #else
1260  const char* _formatString =
1261  "%s: Ping entry %s late warning";
1262 #endif
1263 
1264  Fw::TextLogString _logString;
1265  _logString.format(
1266  _formatString,
1267 #if FW_OBJECT_NAMES == 1
1268  this->m_objName.toChar(),
1269 #endif
1270  "HLTH_PING_WARN ",
1271  entry.toChar()
1272  );
1273 
1274  this->m_LogText_OutputPort[0].invoke(
1275  _id,
1276  _logTime,
1278  _logString
1279  );
1280  }
1281 #endif
1282  }
1283 
1286  {
1287  // Get the time
1288  Fw::Time _logTime;
1289  if (this->m_Time_OutputPort[0].isConnected()) {
1290  this->m_Time_OutputPort[0].invoke(_logTime);
1291  }
1292 
1293  FwEventIdType _id = static_cast<FwEventIdType>(0);
1294 
1295  _id = this->getIdBase() + EVENTID_HLTH_PING_LATE;
1296 
1297  // Emit the event on the log port
1298  if (this->m_Log_OutputPort[0].isConnected()) {
1299  Fw::LogBuffer _logBuff;
1301 
1302 #if FW_AMPCS_COMPATIBLE
1303  // Serialize the number of arguments
1304  _status = _logBuff.serialize(static_cast<U8>(1 + 1));
1305  FW_ASSERT(
1306  _status == Fw::FW_SERIALIZE_OK,
1307  static_cast<FwAssertArgType>(_status)
1308  );
1309 
1310  // For FATAL, add stack size of 4 and a dummy entry. No support for stacks yet.
1311  _status = _logBuff.serialize(static_cast<U8>(4));
1312  FW_ASSERT(
1313  _status == Fw::FW_SERIALIZE_OK,
1314  static_cast<FwAssertArgType>(_status)
1315  );
1316 
1317  _status = _logBuff.serialize(static_cast<U32>(0));
1318  FW_ASSERT(
1319  _status == Fw::FW_SERIALIZE_OK,
1320  static_cast<FwAssertArgType>(_status)
1321  );
1322 #endif
1323 
1324  _status = entry.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1325  FW_ASSERT(
1326  _status == Fw::FW_SERIALIZE_OK,
1327  static_cast<FwAssertArgType>(_status)
1328  );
1329 
1330  this->m_Log_OutputPort[0].invoke(
1331  _id,
1332  _logTime,
1334  _logBuff
1335  );
1336  }
1337 
1338  // Emit the event on the text log port
1339 #if FW_ENABLE_TEXT_LOGGING
1340  if (this->m_LogText_OutputPort[0].isConnected()) {
1341 #if FW_OBJECT_NAMES == 1
1342  const char* _formatString =
1343  "(%s) %s: Ping entry %s did not respond";
1344 #else
1345  const char* _formatString =
1346  "%s: Ping entry %s did not respond";
1347 #endif
1348 
1349  Fw::TextLogString _logString;
1350  _logString.format(
1351  _formatString,
1352 #if FW_OBJECT_NAMES == 1
1353  this->m_objName.toChar(),
1354 #endif
1355  "HLTH_PING_LATE ",
1356  entry.toChar()
1357  );
1358 
1359  this->m_LogText_OutputPort[0].invoke(
1360  _id,
1361  _logTime,
1363  _logString
1364  );
1365  }
1366 #endif
1367  }
1368 
1371  const Fw::StringBase& entry,
1372  U32 badKey
1373  ) const
1374  {
1375  // Get the time
1376  Fw::Time _logTime;
1377  if (this->m_Time_OutputPort[0].isConnected()) {
1378  this->m_Time_OutputPort[0].invoke(_logTime);
1379  }
1380 
1381  FwEventIdType _id = static_cast<FwEventIdType>(0);
1382 
1383  _id = this->getIdBase() + EVENTID_HLTH_PING_WRONG_KEY;
1384 
1385  // Emit the event on the log port
1386  if (this->m_Log_OutputPort[0].isConnected()) {
1387  Fw::LogBuffer _logBuff;
1389 
1390 #if FW_AMPCS_COMPATIBLE
1391  // Serialize the number of arguments
1392  _status = _logBuff.serialize(static_cast<U8>(2 + 1));
1393  FW_ASSERT(
1394  _status == Fw::FW_SERIALIZE_OK,
1395  static_cast<FwAssertArgType>(_status)
1396  );
1397 
1398  // For FATAL, add stack size of 4 and a dummy entry. No support for stacks yet.
1399  _status = _logBuff.serialize(static_cast<U8>(4));
1400  FW_ASSERT(
1401  _status == Fw::FW_SERIALIZE_OK,
1402  static_cast<FwAssertArgType>(_status)
1403  );
1404 
1405  _status = _logBuff.serialize(static_cast<U32>(0));
1406  FW_ASSERT(
1407  _status == Fw::FW_SERIALIZE_OK,
1408  static_cast<FwAssertArgType>(_status)
1409  );
1410 #endif
1411 
1412  _status = entry.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1413  FW_ASSERT(
1414  _status == Fw::FW_SERIALIZE_OK,
1415  static_cast<FwAssertArgType>(_status)
1416  );
1417 
1418 #if FW_AMPCS_COMPATIBLE
1419  // Serialize the argument size
1420  _status = _logBuff.serialize(
1421  static_cast<U8>(sizeof(U32))
1422  );
1423  FW_ASSERT(
1424  _status == Fw::FW_SERIALIZE_OK,
1425  static_cast<FwAssertArgType>(_status)
1426  );
1427 #endif
1428  _status = _logBuff.serialize(badKey);
1429  FW_ASSERT(
1430  _status == Fw::FW_SERIALIZE_OK,
1431  static_cast<FwAssertArgType>(_status)
1432  );
1433 
1434  this->m_Log_OutputPort[0].invoke(
1435  _id,
1436  _logTime,
1438  _logBuff
1439  );
1440  }
1441 
1442  // Emit the event on the text log port
1443 #if FW_ENABLE_TEXT_LOGGING
1444  if (this->m_LogText_OutputPort[0].isConnected()) {
1445 #if FW_OBJECT_NAMES == 1
1446  const char* _formatString =
1447  "(%s) %s: Ping entry %s responded with wrong key 0x%" PRIx32 "";
1448 #else
1449  const char* _formatString =
1450  "%s: Ping entry %s responded with wrong key 0x%" PRIx32 "";
1451 #endif
1452 
1453  Fw::TextLogString _logString;
1454  _logString.format(
1455  _formatString,
1456 #if FW_OBJECT_NAMES == 1
1457  this->m_objName.toChar(),
1458 #endif
1459  "HLTH_PING_WRONG_KEY ",
1460  entry.toChar(),
1461  badKey
1462  );
1463 
1464  this->m_LogText_OutputPort[0].invoke(
1465  _id,
1466  _logTime,
1468  _logString
1469  );
1470  }
1471 #endif
1472  }
1473 
1476  {
1477  // Get the time
1478  Fw::Time _logTime;
1479  if (this->m_Time_OutputPort[0].isConnected()) {
1480  this->m_Time_OutputPort[0].invoke(_logTime);
1481  }
1482 
1483  FwEventIdType _id = static_cast<FwEventIdType>(0);
1484 
1485  _id = this->getIdBase() + EVENTID_HLTH_CHECK_ENABLE;
1486 
1487  // Emit the event on the log port
1488  if (this->m_Log_OutputPort[0].isConnected()) {
1489  Fw::LogBuffer _logBuff;
1491 
1492 #if FW_AMPCS_COMPATIBLE
1493  // Serialize the number of arguments
1494  _status = _logBuff.serialize(static_cast<U8>(1));
1495  FW_ASSERT(
1496  _status == Fw::FW_SERIALIZE_OK,
1497  static_cast<FwAssertArgType>(_status)
1498  );
1499 #endif
1500 
1501 #if FW_AMPCS_COMPATIBLE
1502  // Serialize the argument size
1503  _status = _logBuff.serialize(
1504  static_cast<U8>(Fw::Enabled::SERIALIZED_SIZE)
1505  );
1506  FW_ASSERT(
1507  _status == Fw::FW_SERIALIZE_OK,
1508  static_cast<FwAssertArgType>(_status)
1509  );
1510 #endif
1511  _status = _logBuff.serialize(enabled);
1512  FW_ASSERT(
1513  _status == Fw::FW_SERIALIZE_OK,
1514  static_cast<FwAssertArgType>(_status)
1515  );
1516 
1517  this->m_Log_OutputPort[0].invoke(
1518  _id,
1519  _logTime,
1521  _logBuff
1522  );
1523  }
1524 
1525  // Emit the event on the text log port
1526 #if FW_ENABLE_TEXT_LOGGING
1527  if (this->m_LogText_OutputPort[0].isConnected()) {
1528 #if FW_OBJECT_NAMES == 1
1529  const char* _formatString =
1530  "(%s) %s: Health checking set to %s";
1531 #else
1532  const char* _formatString =
1533  "%s: Health checking set to %s";
1534 #endif
1535 
1536  Fw::String enabledStr;
1537  enabled.toString(enabledStr);
1538 
1539  Fw::TextLogString _logString;
1540  _logString.format(
1541  _formatString,
1542 #if FW_OBJECT_NAMES == 1
1543  this->m_objName.toChar(),
1544 #endif
1545  "HLTH_CHECK_ENABLE ",
1546  enabledStr.toChar()
1547  );
1548 
1549  this->m_LogText_OutputPort[0].invoke(
1550  _id,
1551  _logTime,
1553  _logString
1554  );
1555  }
1556 #endif
1557  }
1558 
1561  Fw::Enabled enabled,
1562  const Fw::StringBase& entry
1563  ) const
1564  {
1565  // Get the time
1566  Fw::Time _logTime;
1567  if (this->m_Time_OutputPort[0].isConnected()) {
1568  this->m_Time_OutputPort[0].invoke(_logTime);
1569  }
1570 
1571  FwEventIdType _id = static_cast<FwEventIdType>(0);
1572 
1573  _id = this->getIdBase() + EVENTID_HLTH_CHECK_PING;
1574 
1575  // Emit the event on the log port
1576  if (this->m_Log_OutputPort[0].isConnected()) {
1577  Fw::LogBuffer _logBuff;
1579 
1580 #if FW_AMPCS_COMPATIBLE
1581  // Serialize the number of arguments
1582  _status = _logBuff.serialize(static_cast<U8>(2));
1583  FW_ASSERT(
1584  _status == Fw::FW_SERIALIZE_OK,
1585  static_cast<FwAssertArgType>(_status)
1586  );
1587 #endif
1588 
1589 #if FW_AMPCS_COMPATIBLE
1590  // Serialize the argument size
1591  _status = _logBuff.serialize(
1592  static_cast<U8>(Fw::Enabled::SERIALIZED_SIZE)
1593  );
1594  FW_ASSERT(
1595  _status == Fw::FW_SERIALIZE_OK,
1596  static_cast<FwAssertArgType>(_status)
1597  );
1598 #endif
1599  _status = _logBuff.serialize(enabled);
1600  FW_ASSERT(
1601  _status == Fw::FW_SERIALIZE_OK,
1602  static_cast<FwAssertArgType>(_status)
1603  );
1604 
1605  _status = entry.serialize(_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: Health checking set to %s for %s";
1625 #else
1626  const char* _formatString =
1627  "%s: Health checking set to %s for %s";
1628 #endif
1629 
1630  Fw::String enabledStr;
1631  enabled.toString(enabledStr);
1632 
1633  Fw::TextLogString _logString;
1634  _logString.format(
1635  _formatString,
1636 #if FW_OBJECT_NAMES == 1
1637  this->m_objName.toChar(),
1638 #endif
1639  "HLTH_CHECK_PING ",
1640  enabledStr.toChar(),
1641  entry.toChar()
1642  );
1643 
1644  this->m_LogText_OutputPort[0].invoke(
1645  _id,
1646  _logTime,
1648  _logString
1649  );
1650  }
1651 #endif
1652  }
1653 
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 
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.serialize(static_cast<U8>(1));
1675  FW_ASSERT(
1676  _status == Fw::FW_SERIALIZE_OK,
1677  static_cast<FwAssertArgType>(_status)
1678  );
1679 #endif
1680 
1681  _status = entry.serialize(_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  this->m_Log_OutputPort[0].invoke(
1688  _id,
1689  _logTime,
1691  _logBuff
1692  );
1693  }
1694 
1695  // Emit the event on the text log port
1696 #if FW_ENABLE_TEXT_LOGGING
1697  if (this->m_LogText_OutputPort[0].isConnected()) {
1698 #if FW_OBJECT_NAMES == 1
1699  const char* _formatString =
1700  "(%s) %s: Couldn't find entry %s";
1701 #else
1702  const char* _formatString =
1703  "%s: Couldn't find entry %s";
1704 #endif
1705 
1706  Fw::TextLogString _logString;
1707  _logString.format(
1708  _formatString,
1709 #if FW_OBJECT_NAMES == 1
1710  this->m_objName.toChar(),
1711 #endif
1712  "HLTH_CHECK_LOOKUP_ERROR ",
1713  entry.toChar()
1714  );
1715 
1716  this->m_LogText_OutputPort[0].invoke(
1717  _id,
1718  _logTime,
1720  _logString
1721  );
1722  }
1723 #endif
1724  }
1725 
1728  const Fw::StringBase& entry,
1729  U32 warn,
1730  U32 fatal
1731  ) const
1732  {
1733  // Get the time
1734  Fw::Time _logTime;
1735  if (this->m_Time_OutputPort[0].isConnected()) {
1736  this->m_Time_OutputPort[0].invoke(_logTime);
1737  }
1738 
1739  FwEventIdType _id = static_cast<FwEventIdType>(0);
1740 
1741  _id = this->getIdBase() + EVENTID_HLTH_PING_UPDATED;
1742 
1743  // Emit the event on the log port
1744  if (this->m_Log_OutputPort[0].isConnected()) {
1745  Fw::LogBuffer _logBuff;
1747 
1748 #if FW_AMPCS_COMPATIBLE
1749  // Serialize the number of arguments
1750  _status = _logBuff.serialize(static_cast<U8>(3));
1751  FW_ASSERT(
1752  _status == Fw::FW_SERIALIZE_OK,
1753  static_cast<FwAssertArgType>(_status)
1754  );
1755 #endif
1756 
1757  _status = entry.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1758  FW_ASSERT(
1759  _status == Fw::FW_SERIALIZE_OK,
1760  static_cast<FwAssertArgType>(_status)
1761  );
1762 
1763 #if FW_AMPCS_COMPATIBLE
1764  // Serialize the argument size
1765  _status = _logBuff.serialize(
1766  static_cast<U8>(sizeof(U32))
1767  );
1768  FW_ASSERT(
1769  _status == Fw::FW_SERIALIZE_OK,
1770  static_cast<FwAssertArgType>(_status)
1771  );
1772 #endif
1773  _status = _logBuff.serialize(warn);
1774  FW_ASSERT(
1775  _status == Fw::FW_SERIALIZE_OK,
1776  static_cast<FwAssertArgType>(_status)
1777  );
1778 
1779 #if FW_AMPCS_COMPATIBLE
1780  // Serialize the argument size
1781  _status = _logBuff.serialize(
1782  static_cast<U8>(sizeof(U32))
1783  );
1784  FW_ASSERT(
1785  _status == Fw::FW_SERIALIZE_OK,
1786  static_cast<FwAssertArgType>(_status)
1787  );
1788 #endif
1789  _status = _logBuff.serialize(fatal);
1790  FW_ASSERT(
1791  _status == Fw::FW_SERIALIZE_OK,
1792  static_cast<FwAssertArgType>(_status)
1793  );
1794 
1795  this->m_Log_OutputPort[0].invoke(
1796  _id,
1797  _logTime,
1799  _logBuff
1800  );
1801  }
1802 
1803  // Emit the event on the text log port
1804 #if FW_ENABLE_TEXT_LOGGING
1805  if (this->m_LogText_OutputPort[0].isConnected()) {
1806 #if FW_OBJECT_NAMES == 1
1807  const char* _formatString =
1808  "(%s) %s: Health ping for %s changed to WARN %" PRIu32 " FATAL %" PRIu32 "";
1809 #else
1810  const char* _formatString =
1811  "%s: Health ping for %s changed to WARN %" PRIu32 " FATAL %" PRIu32 "";
1812 #endif
1813 
1814  Fw::TextLogString _logString;
1815  _logString.format(
1816  _formatString,
1817 #if FW_OBJECT_NAMES == 1
1818  this->m_objName.toChar(),
1819 #endif
1820  "HLTH_PING_UPDATED ",
1821  entry.toChar(),
1822  warn,
1823  fatal
1824  );
1825 
1826  this->m_LogText_OutputPort[0].invoke(
1827  _id,
1828  _logTime,
1830  _logString
1831  );
1832  }
1833 #endif
1834  }
1835 
1838  const Fw::StringBase& entry,
1839  U32 warn,
1840  U32 fatal
1841  ) const
1842  {
1843  // Get the time
1844  Fw::Time _logTime;
1845  if (this->m_Time_OutputPort[0].isConnected()) {
1846  this->m_Time_OutputPort[0].invoke(_logTime);
1847  }
1848 
1849  FwEventIdType _id = static_cast<FwEventIdType>(0);
1850 
1852 
1853  // Emit the event on the log port
1854  if (this->m_Log_OutputPort[0].isConnected()) {
1855  Fw::LogBuffer _logBuff;
1857 
1858 #if FW_AMPCS_COMPATIBLE
1859  // Serialize the number of arguments
1860  _status = _logBuff.serialize(static_cast<U8>(3));
1861  FW_ASSERT(
1862  _status == Fw::FW_SERIALIZE_OK,
1863  static_cast<FwAssertArgType>(_status)
1864  );
1865 #endif
1866 
1867  _status = entry.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1868  FW_ASSERT(
1869  _status == Fw::FW_SERIALIZE_OK,
1870  static_cast<FwAssertArgType>(_status)
1871  );
1872 
1873 #if FW_AMPCS_COMPATIBLE
1874  // Serialize the argument size
1875  _status = _logBuff.serialize(
1876  static_cast<U8>(sizeof(U32))
1877  );
1878  FW_ASSERT(
1879  _status == Fw::FW_SERIALIZE_OK,
1880  static_cast<FwAssertArgType>(_status)
1881  );
1882 #endif
1883  _status = _logBuff.serialize(warn);
1884  FW_ASSERT(
1885  _status == Fw::FW_SERIALIZE_OK,
1886  static_cast<FwAssertArgType>(_status)
1887  );
1888 
1889 #if FW_AMPCS_COMPATIBLE
1890  // Serialize the argument size
1891  _status = _logBuff.serialize(
1892  static_cast<U8>(sizeof(U32))
1893  );
1894  FW_ASSERT(
1895  _status == Fw::FW_SERIALIZE_OK,
1896  static_cast<FwAssertArgType>(_status)
1897  );
1898 #endif
1899  _status = _logBuff.serialize(fatal);
1900  FW_ASSERT(
1901  _status == Fw::FW_SERIALIZE_OK,
1902  static_cast<FwAssertArgType>(_status)
1903  );
1904 
1905  this->m_Log_OutputPort[0].invoke(
1906  _id,
1907  _logTime,
1909  _logBuff
1910  );
1911  }
1912 
1913  // Emit the event on the text log port
1914 #if FW_ENABLE_TEXT_LOGGING
1915  if (this->m_LogText_OutputPort[0].isConnected()) {
1916 #if FW_OBJECT_NAMES == 1
1917  const char* _formatString =
1918  "(%s) %s: Health ping for %s invalid values: WARN %" PRIu32 " FATAL %" PRIu32 "";
1919 #else
1920  const char* _formatString =
1921  "%s: Health ping for %s invalid values: WARN %" PRIu32 " FATAL %" PRIu32 "";
1922 #endif
1923 
1924  Fw::TextLogString _logString;
1925  _logString.format(
1926  _formatString,
1927 #if FW_OBJECT_NAMES == 1
1928  this->m_objName.toChar(),
1929 #endif
1930  "HLTH_PING_INVALID_VALUES ",
1931  entry.toChar(),
1932  warn,
1933  fatal
1934  );
1935 
1936  this->m_LogText_OutputPort[0].invoke(
1937  _id,
1938  _logTime,
1940  _logString
1941  );
1942  }
1943 #endif
1944  }
1945 
1946  // ----------------------------------------------------------------------
1947  // Telemetry write functions
1948  // ----------------------------------------------------------------------
1949 
1952  U32 arg,
1953  Fw::Time _tlmTime
1954  ) const
1955  {
1956  if (this->m_Tlm_OutputPort[0].isConnected()) {
1957  if (
1958  this->m_Time_OutputPort[0].isConnected() &&
1959  (_tlmTime == Fw::ZERO_TIME)
1960  ) {
1961  this->m_Time_OutputPort[0].invoke(_tlmTime);
1962  }
1963 
1964  Fw::TlmBuffer _tlmBuff;
1965  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1966  FW_ASSERT(
1967  _stat == Fw::FW_SERIALIZE_OK,
1968  static_cast<FwAssertArgType>(_stat)
1969  );
1970 
1971  FwChanIdType _id;
1972 
1973  _id = this->getIdBase() + CHANNELID_PINGLATEWARNINGS;
1974 
1975  this->m_Tlm_OutputPort[0].invoke(
1976  _id,
1977  _tlmTime,
1978  _tlmBuff
1979  );
1980  }
1981  }
1982 
1983  // ----------------------------------------------------------------------
1984  // Time
1985  // ----------------------------------------------------------------------
1986 
1989  {
1990  if (this->m_Time_OutputPort[0].isConnected()) {
1991  Fw::Time _time;
1992  this->m_Time_OutputPort[0].invoke(_time);
1993  return _time;
1994  }
1995  else {
1996  return Fw::Time(TB_NONE, 0, 0);
1997  }
1998  }
1999 
2000  // ----------------------------------------------------------------------
2001  // Message dispatch functions
2002  // ----------------------------------------------------------------------
2003 
2006  {
2007  ComponentIpcSerializableBuffer msg;
2008  FwQueuePriorityType priority = 0;
2009 
2010  Os::Queue::Status msgStatus = this->m_queue.receive(
2011  msg,
2013  priority
2014  );
2015  if (Os::Queue::Status::EMPTY == msgStatus) {
2017  }
2018  else {
2019  FW_ASSERT(
2020  msgStatus == Os::Queue::OP_OK,
2021  static_cast<FwAssertArgType>(msgStatus)
2022  );
2023  }
2024 
2025  // Reset to beginning of buffer
2026  msg.resetDeser();
2027 
2028  FwEnumStoreType desMsg = 0;
2029  Fw::SerializeStatus deserStatus = msg.deserialize(desMsg);
2030  FW_ASSERT(
2031  deserStatus == Fw::FW_SERIALIZE_OK,
2032  static_cast<FwAssertArgType>(deserStatus)
2033  );
2034 
2035  MsgTypeEnum msgType = static_cast<MsgTypeEnum>(desMsg);
2036 
2037  if (msgType == HEALTH_COMPONENT_EXIT) {
2038  return MSG_DISPATCH_EXIT;
2039  }
2040 
2041  FwIndexType portNum = 0;
2042  deserStatus = msg.deserialize(portNum);
2043  FW_ASSERT(
2044  deserStatus == Fw::FW_SERIALIZE_OK,
2045  static_cast<FwAssertArgType>(deserStatus)
2046  );
2047 
2048  switch (msgType) {
2049  // Handle async input port PingReturn
2050  case PINGRETURN_PING: {
2051  // Deserialize argument key
2052  U32 key;
2053  deserStatus = msg.deserialize(key);
2054  FW_ASSERT(
2055  deserStatus == Fw::FW_SERIALIZE_OK,
2056  static_cast<FwAssertArgType>(deserStatus)
2057  );
2058  // Call handler function
2059  this->PingReturn_handler(
2060  portNum,
2061  key
2062  );
2063 
2064  break;
2065  }
2066 
2067  // Handle command HLTH_ENABLE
2068  case CMD_HLTH_ENABLE: {
2069  // Deserialize opcode
2070  FwOpcodeType opCode = 0;
2071  deserStatus = msg.deserialize(opCode);
2072  FW_ASSERT (
2073  deserStatus == Fw::FW_SERIALIZE_OK,
2074  static_cast<FwAssertArgType>(deserStatus)
2075  );
2076 
2077  // Deserialize command sequence
2078  U32 cmdSeq = 0;
2079  deserStatus = msg.deserialize(cmdSeq);
2080  FW_ASSERT (
2081  deserStatus == Fw::FW_SERIALIZE_OK,
2082  static_cast<FwAssertArgType>(deserStatus)
2083  );
2084 
2085  // Deserialize command argument buffer
2086  Fw::CmdArgBuffer args;
2087  deserStatus = msg.deserialize(args);
2088  FW_ASSERT (
2089  deserStatus == Fw::FW_SERIALIZE_OK,
2090  static_cast<FwAssertArgType>(deserStatus)
2091  );
2092 
2093  // Reset buffer
2094  args.resetDeser();
2095 
2096  // Deserialize argument enable
2097  Fw::Enabled enable;
2098  deserStatus = args.deserialize(enable);
2099  if (deserStatus != Fw::FW_SERIALIZE_OK) {
2100  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2101  this->cmdResponse_out(
2102  opCode,
2103  cmdSeq,
2105  );
2106  }
2107  // Don't crash the task if bad arguments were passed from the ground
2108  break;
2109  }
2110 
2111  // Make sure there was no data left over.
2112  // That means the argument buffer size was incorrect.
2113 #if FW_CMD_CHECK_RESIDUAL
2114  if (args.getBuffLeft() != 0) {
2115  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2116  this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2117  }
2118  // Don't crash the task if bad arguments were passed from the ground
2119  break;
2120  }
2121 #endif
2122 
2123  // Call handler function
2124  this->HLTH_ENABLE_cmdHandler(
2125  opCode, cmdSeq,
2126  enable
2127  );
2128 
2129  break;
2130  }
2131 
2132  // Handle command HLTH_PING_ENABLE
2133  case CMD_HLTH_PING_ENABLE: {
2134  // Deserialize opcode
2135  FwOpcodeType opCode = 0;
2136  deserStatus = msg.deserialize(opCode);
2137  FW_ASSERT (
2138  deserStatus == Fw::FW_SERIALIZE_OK,
2139  static_cast<FwAssertArgType>(deserStatus)
2140  );
2141 
2142  // Deserialize command sequence
2143  U32 cmdSeq = 0;
2144  deserStatus = msg.deserialize(cmdSeq);
2145  FW_ASSERT (
2146  deserStatus == Fw::FW_SERIALIZE_OK,
2147  static_cast<FwAssertArgType>(deserStatus)
2148  );
2149 
2150  // Deserialize command argument buffer
2151  Fw::CmdArgBuffer args;
2152  deserStatus = msg.deserialize(args);
2153  FW_ASSERT (
2154  deserStatus == Fw::FW_SERIALIZE_OK,
2155  static_cast<FwAssertArgType>(deserStatus)
2156  );
2157 
2158  // Reset buffer
2159  args.resetDeser();
2160 
2161  // Deserialize argument entry
2162  Fw::CmdStringArg entry;
2163  deserStatus = args.deserialize(entry);
2164  if (deserStatus != Fw::FW_SERIALIZE_OK) {
2165  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2166  this->cmdResponse_out(
2167  opCode,
2168  cmdSeq,
2170  );
2171  }
2172  // Don't crash the task if bad arguments were passed from the ground
2173  break;
2174  }
2175 
2176  // Deserialize argument enable
2177  Fw::Enabled enable;
2178  deserStatus = args.deserialize(enable);
2179  if (deserStatus != Fw::FW_SERIALIZE_OK) {
2180  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2181  this->cmdResponse_out(
2182  opCode,
2183  cmdSeq,
2185  );
2186  }
2187  // Don't crash the task if bad arguments were passed from the ground
2188  break;
2189  }
2190 
2191  // Make sure there was no data left over.
2192  // That means the argument buffer size was incorrect.
2193 #if FW_CMD_CHECK_RESIDUAL
2194  if (args.getBuffLeft() != 0) {
2195  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2196  this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2197  }
2198  // Don't crash the task if bad arguments were passed from the ground
2199  break;
2200  }
2201 #endif
2202 
2203  // Call handler function
2205  opCode, cmdSeq,
2206  entry,
2207  enable
2208  );
2209 
2210  break;
2211  }
2212 
2213  // Handle command HLTH_CHNG_PING
2214  case CMD_HLTH_CHNG_PING: {
2215  // Deserialize opcode
2216  FwOpcodeType opCode = 0;
2217  deserStatus = msg.deserialize(opCode);
2218  FW_ASSERT (
2219  deserStatus == Fw::FW_SERIALIZE_OK,
2220  static_cast<FwAssertArgType>(deserStatus)
2221  );
2222 
2223  // Deserialize command sequence
2224  U32 cmdSeq = 0;
2225  deserStatus = msg.deserialize(cmdSeq);
2226  FW_ASSERT (
2227  deserStatus == Fw::FW_SERIALIZE_OK,
2228  static_cast<FwAssertArgType>(deserStatus)
2229  );
2230 
2231  // Deserialize command argument buffer
2232  Fw::CmdArgBuffer args;
2233  deserStatus = msg.deserialize(args);
2234  FW_ASSERT (
2235  deserStatus == Fw::FW_SERIALIZE_OK,
2236  static_cast<FwAssertArgType>(deserStatus)
2237  );
2238 
2239  // Reset buffer
2240  args.resetDeser();
2241 
2242  // Deserialize argument entry
2243  Fw::CmdStringArg entry;
2244  deserStatus = args.deserialize(entry);
2245  if (deserStatus != Fw::FW_SERIALIZE_OK) {
2246  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2247  this->cmdResponse_out(
2248  opCode,
2249  cmdSeq,
2251  );
2252  }
2253  // Don't crash the task if bad arguments were passed from the ground
2254  break;
2255  }
2256 
2257  // Deserialize argument warningValue
2258  U32 warningValue;
2259  deserStatus = args.deserialize(warningValue);
2260  if (deserStatus != Fw::FW_SERIALIZE_OK) {
2261  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2262  this->cmdResponse_out(
2263  opCode,
2264  cmdSeq,
2266  );
2267  }
2268  // Don't crash the task if bad arguments were passed from the ground
2269  break;
2270  }
2271 
2272  // Deserialize argument fatalValue
2273  U32 fatalValue;
2274  deserStatus = args.deserialize(fatalValue);
2275  if (deserStatus != Fw::FW_SERIALIZE_OK) {
2276  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2277  this->cmdResponse_out(
2278  opCode,
2279  cmdSeq,
2281  );
2282  }
2283  // Don't crash the task if bad arguments were passed from the ground
2284  break;
2285  }
2286 
2287  // Make sure there was no data left over.
2288  // That means the argument buffer size was incorrect.
2289 #if FW_CMD_CHECK_RESIDUAL
2290  if (args.getBuffLeft() != 0) {
2291  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2292  this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2293  }
2294  // Don't crash the task if bad arguments were passed from the ground
2295  break;
2296  }
2297 #endif
2298 
2299  // Call handler function
2301  opCode, cmdSeq,
2302  entry,
2303  warningValue,
2304  fatalValue
2305  );
2306 
2307  break;
2308  }
2309 
2310  default:
2311  return MSG_DISPATCH_ERROR;
2312  }
2313 
2314  return MSG_DISPATCH_OK;
2315  }
2316 
2317  // ----------------------------------------------------------------------
2318  // Calls for messages received on special input ports
2319  // ----------------------------------------------------------------------
2320 
2321  void HealthComponentBase ::
2322  m_p_CmdDisp_in(
2323  Fw::PassiveComponentBase* callComp,
2324  FwIndexType portNum,
2325  FwOpcodeType opCode,
2326  U32 cmdSeq,
2327  Fw::CmdArgBuffer& args
2328  )
2329  {
2330  FW_ASSERT(callComp);
2331  HealthComponentBase* compPtr = static_cast<HealthComponentBase*>(callComp);
2332 
2333  const U32 idBase = callComp->getIdBase();
2334  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
2335 
2336  // Select base class function based on opcode
2337  switch (opCode - idBase) {
2338  case OPCODE_HLTH_ENABLE: {
2339  compPtr->HLTH_ENABLE_cmdHandlerBase(
2340  opCode,
2341  cmdSeq,
2342  args
2343  );
2344  break;
2345  }
2346 
2347  case OPCODE_HLTH_PING_ENABLE: {
2349  opCode,
2350  cmdSeq,
2351  args
2352  );
2353  break;
2354  }
2355 
2356  case OPCODE_HLTH_CHNG_PING: {
2358  opCode,
2359  cmdSeq,
2360  args
2361  );
2362  break;
2363  }
2364  }
2365  }
2366 
2367  // ----------------------------------------------------------------------
2368  // Calls for messages received on typed input ports
2369  // ----------------------------------------------------------------------
2370 
2371  void HealthComponentBase ::
2372  m_p_PingReturn_in(
2373  Fw::PassiveComponentBase* callComp,
2374  FwIndexType portNum,
2375  U32 key
2376  )
2377  {
2378  FW_ASSERT(callComp);
2379  HealthComponentBase* compPtr = static_cast<HealthComponentBase*>(callComp);
2380  compPtr->PingReturn_handlerBase(
2381  portNum,
2382  key
2383  );
2384  }
2385 
2386  void HealthComponentBase ::
2387  m_p_Run_in(
2388  Fw::PassiveComponentBase* callComp,
2389  FwIndexType portNum,
2390  U32 context
2391  )
2392  {
2393  FW_ASSERT(callComp);
2394  HealthComponentBase* compPtr = static_cast<HealthComponentBase*>(callComp);
2395  compPtr->Run_handlerBase(
2396  portNum,
2397  context
2398  );
2399  }
2400 
2401 }
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.
Definition: Time.hpp:9
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.
Operation succeeded.
Definition: Os.hpp:26
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
void set_CmdStatus_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to CmdStatus[portNum].
NATIVE_UINT_TYPE SizeType
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.
FwIndexType getNum_PingSend_OutputPorts() const
FwIndexType getNum_Time_OutputPorts() const
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
void init()
Initialization function.
Definition: SchedPortAc.cpp:56
const char * toChar() const
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
PlatformSizeType FwSizeType
Definition: FpConfig.h:35
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
bool isConnected_Log_OutputPort(FwIndexType portNum)
const Time ZERO_TIME
Definition: Time.cpp:5
bool isConnected_CmdReg_OutputPort(FwIndexType portNum)
I32 FwEnumStoreType
Definition: FpConfig.h:64
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
Enum representing a command response.
bool isConnected_CmdStatus_OutputPort(FwIndexType portNum)
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.
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
Warn that a ping target is longer than the warning value.
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:26
The size of the serial representations of the port arguments.
Definition: CmdPortAc.hpp:37
SerializeStatus
forward declaration for string
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:62
FwIndexType getNum_Log_OutputPorts() const
FwIndexType getNum_WdogStroke_OutputPorts() const
Svc::InputPingPort * get_PingReturn_InputPort(FwIndexType portNum)
void invoke(FwOpcodeType opCode) const
Invoke a port interface.
void PingReturn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port PingReturn.
Serializable::SizeType getBuffLeft() const
returns how much deserialization buffer is left
void init()
Initialization function.
Definition: TimePortAc.cpp:128
void setPortNum(NATIVE_INT_TYPE portNum)
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
#define FW_MIN(a, b)
MIN macro.
Definition: BasicTypes.h:72
A less serious but recoverable event.
void init()
Initialization function.
Definition: PingPortAc.cpp:128
FwIndexType getNum_CmdReg_OutputPorts() const
FwIndexType getNum_PingReturn_InputPorts() const
FwIndexType getNum_CmdStatus_OutputPorts() const
The size of the serial representations of the port arguments.
Definition: PingPortAc.hpp:36
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].
U32 FwOpcodeType
Definition: FpConfig.h:91
const char * toChar() const
Definition: ObjectName.hpp:50
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port interface.
No time base has been established.
Definition: FpConfig.h:70
void addCallPort(InputPingPort *callPort)
Register an input port.
Definition: PingPortAc.cpp:134
Declare FATAL since task is no longer responding.
bool isConnected_Time_OutputPort(FwIndexType portNum)
void WdogStroke_out(FwIndexType portNum, U32 code)
Invoke output port WdogStroke.
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
void HLTH_PING_ENABLE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Report a particular entry on or off.
void resetDeser()
reset deserialization to beginning
FwIndexType getNum_Run_InputPorts() const
A serious but recoverable event.
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:42
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].
Enabled and disabled states.
U32 FwEventIdType
Definition: FpConfig.h:103
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
void init()
Initialization function.
Definition: LogPortAc.cpp:151
bool isConnected_WdogStroke_OutputPort(FwIndexType portNum)
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:30
The size of the serial representation.
BlockingType
message type
Definition: Queue.hpp:45
#define PRI_PlatformIntType
bool isConnected_PingSend_OutputPort(FwIndexType portNum)
A command to enable or disable health checks.
Command failed to deserialize.
void log_FATAL_HLTH_PING_LATE(const Fw::StringBase &entry) const
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.
PlatformQueuePriorityType FwQueuePriorityType
Definition: FpConfig.h:55
virtual void HLTH_PING_ENABLE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg &entry, Fw::Enabled enable)=0
message to exit active component task
virtual void HLTH_CHNG_PING_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command HLTH_CHNG_PING.
A message was sent requesting an exit of the loop.
void init()
Initialization function.
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
virtual void PingReturn_handler(FwIndexType portNum, U32 key)=0
Handler for input port PingReturn.
A fatal non-recoverable event.
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.h:70
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
message sent/received okay
Definition: Queue.hpp:31
U8 BYTE
byte type
Definition: BasicTypes.h:31
virtual SerializeStatus serialize(SerializeBufferBase &buffer) const
serialization function
Definition: StringBase.cpp:142
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:47
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
FwIndexType getNum_Tlm_OutputPorts() const
Svc::InputSchedPort * get_Run_InputPort(FwIndexType portNum)
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
void init()
Initialization function.
void log_ACTIVITY_HI_HLTH_CHECK_ENABLE(Fw::Enabled enabled) const
FwIndexType getNum_CmdDisp_InputPorts() const
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:148
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)
#define FW_LOG_STRING_MAX_SIZE
Max size of log string parameter type.
Definition: FpConfig.h:319
virtual const CHAR * toChar() const =0
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.
U32 FwChanIdType
Definition: FpConfig.h:95
Declare FATAL since task is no longer responding.
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