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