F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
SystemResourcesComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title SystemResourcesComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for SystemResources component base class
5 // ======================================================================
6 
7 #include "Fw/Types/Assert.hpp"
9 #if FW_ENABLE_TEXT_LOGGING
10 #include "Fw/Types/String.hpp"
11 #endif
13 
14 namespace Svc {
15 
16  // ----------------------------------------------------------------------
17  // Component initialization
18  // ----------------------------------------------------------------------
19 
22  {
23  // Initialize base class
25 
26 #if !FW_DIRECT_PORT_CALLS
27  // Connect input port CmdDisp
28  for (
29  FwIndexType port = 0;
30  port < static_cast<FwIndexType>(this->getNum_CmdDisp_InputPorts());
31  port++
32  ) {
33  this->m_CmdDisp_InputPort[port].init();
34  this->m_CmdDisp_InputPort[port].addCallComp(
35  this,
36  m_p_CmdDisp_in
37  );
38  this->m_CmdDisp_InputPort[port].setPortNum(port);
39 
40 #if FW_OBJECT_NAMES == 1
41  Fw::ObjectName portName;
42  portName.format(
43  "%s_CmdDisp_InputPort[%" PRI_FwIndexType "]",
44  this->m_objName.toChar(),
45  port
46  );
47  this->m_CmdDisp_InputPort[port].setObjName(portName.toChar());
48 #endif
49  }
50 #endif
51 
52 #if !FW_DIRECT_PORT_CALLS
53  // Connect input port run
54  for (
55  FwIndexType port = 0;
56  port < static_cast<FwIndexType>(this->getNum_run_InputPorts());
57  port++
58  ) {
59  this->m_run_InputPort[port].init();
60  this->m_run_InputPort[port].addCallComp(
61  this,
62  m_p_run_in
63  );
64  this->m_run_InputPort[port].setPortNum(port);
65 
66 #if FW_OBJECT_NAMES == 1
67  Fw::ObjectName portName;
68  portName.format(
69  "%s_run_InputPort[%" PRI_FwIndexType "]",
70  this->m_objName.toChar(),
71  port
72  );
73  this->m_run_InputPort[port].setObjName(portName.toChar());
74 #endif
75  }
76 #endif
77 
78 #if !FW_DIRECT_PORT_CALLS
79  // Connect output port CmdReg
80  for (
81  FwIndexType port = 0;
82  port < static_cast<FwIndexType>(this->getNum_CmdReg_OutputPorts());
83  port++
84  ) {
85  this->m_CmdReg_OutputPort[port].init();
86 
87 #if FW_OBJECT_NAMES == 1
88  Fw::ObjectName portName;
89  portName.format(
90  "%s_CmdReg_OutputPort[%" PRI_FwIndexType "]",
91  this->m_objName.toChar(),
92  port
93  );
94  this->m_CmdReg_OutputPort[port].setObjName(portName.toChar());
95 #endif
96  }
97 #endif
98 
99 #if !FW_DIRECT_PORT_CALLS
100  // Connect output port CmdStatus
101  for (
102  FwIndexType port = 0;
103  port < static_cast<FwIndexType>(this->getNum_CmdStatus_OutputPorts());
104  port++
105  ) {
106  this->m_CmdStatus_OutputPort[port].init();
107 
108 #if FW_OBJECT_NAMES == 1
109  Fw::ObjectName portName;
110  portName.format(
111  "%s_CmdStatus_OutputPort[%" PRI_FwIndexType "]",
112  this->m_objName.toChar(),
113  port
114  );
115  this->m_CmdStatus_OutputPort[port].setObjName(portName.toChar());
116 #endif
117  }
118 #endif
119 
120 #if !FW_DIRECT_PORT_CALLS
121  // Connect output port Log
122  for (
123  FwIndexType port = 0;
124  port < static_cast<FwIndexType>(this->getNum_Log_OutputPorts());
125  port++
126  ) {
127  this->m_Log_OutputPort[port].init();
128 
129 #if FW_OBJECT_NAMES == 1
130  Fw::ObjectName portName;
131  portName.format(
132  "%s_Log_OutputPort[%" PRI_FwIndexType "]",
133  this->m_objName.toChar(),
134  port
135  );
136  this->m_Log_OutputPort[port].setObjName(portName.toChar());
137 #endif
138  }
139 #endif
140 
141 #if !FW_DIRECT_PORT_CALLS && FW_ENABLE_TEXT_LOGGING
142  // Connect output port LogText
143  for (
144  FwIndexType port = 0;
145  port < static_cast<FwIndexType>(this->getNum_LogText_OutputPorts());
146  port++
147  ) {
148  this->m_LogText_OutputPort[port].init();
149 
150 #if FW_OBJECT_NAMES == 1
151  Fw::ObjectName portName;
152  portName.format(
153  "%s_LogText_OutputPort[%" PRI_FwIndexType "]",
154  this->m_objName.toChar(),
155  port
156  );
157  this->m_LogText_OutputPort[port].setObjName(portName.toChar());
158 #endif
159  }
160 #endif
161 
162 #if !FW_DIRECT_PORT_CALLS
163  // Connect output port Time
164  for (
165  FwIndexType port = 0;
166  port < static_cast<FwIndexType>(this->getNum_Time_OutputPorts());
167  port++
168  ) {
169  this->m_Time_OutputPort[port].init();
170 
171 #if FW_OBJECT_NAMES == 1
172  Fw::ObjectName portName;
173  portName.format(
174  "%s_Time_OutputPort[%" PRI_FwIndexType "]",
175  this->m_objName.toChar(),
176  port
177  );
178  this->m_Time_OutputPort[port].setObjName(portName.toChar());
179 #endif
180  }
181 #endif
182 
183 #if !FW_DIRECT_PORT_CALLS
184  // Connect output port Tlm
185  for (
186  FwIndexType port = 0;
187  port < static_cast<FwIndexType>(this->getNum_Tlm_OutputPorts());
188  port++
189  ) {
190  this->m_Tlm_OutputPort[port].init();
191 
192 #if FW_OBJECT_NAMES == 1
193  Fw::ObjectName portName;
194  portName.format(
195  "%s_Tlm_OutputPort[%" PRI_FwIndexType "]",
196  this->m_objName.toChar(),
197  port
198  );
199  this->m_Tlm_OutputPort[port].setObjName(portName.toChar());
200 #endif
201  }
202 #endif
203  }
204 
205 #if !FW_DIRECT_PORT_CALLS
206 
207  // ----------------------------------------------------------------------
208  // Getters for special input ports
209  // ----------------------------------------------------------------------
210 
213  {
214  FW_ASSERT(
215  (0 <= portNum) && (portNum < this->getNum_CmdDisp_InputPorts()),
216  static_cast<FwAssertArgType>(portNum)
217  );
218 
219  return &this->m_CmdDisp_InputPort[portNum];
220  }
221 
222 #endif
223 
224 #if !FW_DIRECT_PORT_CALLS
225 
226  // ----------------------------------------------------------------------
227  // Getters for typed input ports
228  // ----------------------------------------------------------------------
229 
232  {
233  FW_ASSERT(
234  (0 <= portNum) && (portNum < this->getNum_run_InputPorts()),
235  static_cast<FwAssertArgType>(portNum)
236  );
237 
238  return &this->m_run_InputPort[portNum];
239  }
240 
241 #endif
242 
243 #if !FW_DIRECT_PORT_CALLS
244 
245  // ----------------------------------------------------------------------
246  // Connect input ports to special output ports
247  // ----------------------------------------------------------------------
248 
251  FwIndexType portNum,
252  Fw::InputCmdRegPort* port
253  )
254  {
255  FW_ASSERT(
256  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
257  static_cast<FwAssertArgType>(portNum)
258  );
259 
260  this->m_CmdReg_OutputPort[portNum].addCallPort(port);
261  }
262 
265  FwIndexType portNum,
267  )
268  {
269  FW_ASSERT(
270  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
271  static_cast<FwAssertArgType>(portNum)
272  );
273 
274  this->m_CmdStatus_OutputPort[portNum].addCallPort(port);
275  }
276 
279  FwIndexType portNum,
280  Fw::InputLogPort* port
281  )
282  {
283  FW_ASSERT(
284  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
285  static_cast<FwAssertArgType>(portNum)
286  );
287 
288  this->m_Log_OutputPort[portNum].addCallPort(port);
289  }
290 
291 #if FW_ENABLE_TEXT_LOGGING == 1
292 
293  void SystemResourcesComponentBase ::
294  set_LogText_OutputPort(
295  FwIndexType portNum,
297  )
298  {
299  FW_ASSERT(
300  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
301  static_cast<FwAssertArgType>(portNum)
302  );
303 
304  this->m_LogText_OutputPort[portNum].addCallPort(port);
305  }
306 
307 #endif
308 
311  FwIndexType portNum,
312  Fw::InputTimePort* port
313  )
314  {
315  FW_ASSERT(
316  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
317  static_cast<FwAssertArgType>(portNum)
318  );
319 
320  this->m_Time_OutputPort[portNum].addCallPort(port);
321  }
322 
325  FwIndexType portNum,
326  Fw::InputTlmPort* port
327  )
328  {
329  FW_ASSERT(
330  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
331  static_cast<FwAssertArgType>(portNum)
332  );
333 
334  this->m_Tlm_OutputPort[portNum].addCallPort(port);
335  }
336 
337 #endif
338 
339 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
340 
341  // ----------------------------------------------------------------------
342  // Connect serial input ports to special output ports
343  // ----------------------------------------------------------------------
344 
347  FwIndexType portNum,
348  Fw::InputSerializePort* port
349  )
350  {
351  FW_ASSERT(
352  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
353  static_cast<FwAssertArgType>(portNum)
354  );
355 
356  this->m_CmdReg_OutputPort[portNum].registerSerialPort(port);
357  }
358 
361  FwIndexType portNum,
362  Fw::InputSerializePort* port
363  )
364  {
365  FW_ASSERT(
366  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
367  static_cast<FwAssertArgType>(portNum)
368  );
369 
370  this->m_CmdStatus_OutputPort[portNum].registerSerialPort(port);
371  }
372 
375  FwIndexType portNum,
376  Fw::InputSerializePort* port
377  )
378  {
379  FW_ASSERT(
380  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
381  static_cast<FwAssertArgType>(portNum)
382  );
383 
384  this->m_Log_OutputPort[portNum].registerSerialPort(port);
385  }
386 
387 #if FW_ENABLE_TEXT_LOGGING == 1
388 
389  void SystemResourcesComponentBase ::
390  set_LogText_OutputPort(
391  FwIndexType portNum,
392  Fw::InputSerializePort* port
393  )
394  {
395  FW_ASSERT(
396  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
397  static_cast<FwAssertArgType>(portNum)
398  );
399 
400  this->m_LogText_OutputPort[portNum].registerSerialPort(port);
401  }
402 
403 #endif
404 
407  FwIndexType portNum,
408  Fw::InputSerializePort* port
409  )
410  {
411  FW_ASSERT(
412  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
413  static_cast<FwAssertArgType>(portNum)
414  );
415 
416  this->m_Time_OutputPort[portNum].registerSerialPort(port);
417  }
418 
421  FwIndexType portNum,
422  Fw::InputSerializePort* port
423  )
424  {
425  FW_ASSERT(
426  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
427  static_cast<FwAssertArgType>(portNum)
428  );
429 
430  this->m_Tlm_OutputPort[portNum].registerSerialPort(port);
431  }
432 
433 #endif
434 
435  // ----------------------------------------------------------------------
436  // Command registration
437  // ----------------------------------------------------------------------
438 
441  {
443 
444  this->CmdReg_out(
445  0,
446  this->getIdBase() + OPCODE_ENABLE
447  );
448  }
449 
450  // ----------------------------------------------------------------------
451  // Component construction and destruction
452  // ----------------------------------------------------------------------
453 
455  SystemResourcesComponentBase(const char* compName) :
456  Fw::PassiveComponentBase(compName)
457  {
458 
459  }
460 
463  {
464 
465  }
466 
467 #if !FW_DIRECT_PORT_CALLS
468 
469  // ----------------------------------------------------------------------
470  // Connection status queries for special output ports
471  // ----------------------------------------------------------------------
472 
475  {
476  FW_ASSERT(
477  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
478  static_cast<FwAssertArgType>(portNum)
479  );
480 
481  return this->m_CmdReg_OutputPort[portNum].isConnected();
482  }
483 
486  {
487  FW_ASSERT(
488  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
489  static_cast<FwAssertArgType>(portNum)
490  );
491 
492  return this->m_CmdStatus_OutputPort[portNum].isConnected();
493  }
494 
497  {
498  FW_ASSERT(
499  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
500  static_cast<FwAssertArgType>(portNum)
501  );
502 
503  return this->m_Log_OutputPort[portNum].isConnected();
504  }
505 
506 #if FW_ENABLE_TEXT_LOGGING == 1
507 
508  bool SystemResourcesComponentBase ::
509  isConnected_LogText_OutputPort(FwIndexType portNum) const
510  {
511  FW_ASSERT(
512  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
513  static_cast<FwAssertArgType>(portNum)
514  );
515 
516  return this->m_LogText_OutputPort[portNum].isConnected();
517  }
518 
519 #endif
520 
523  {
524  FW_ASSERT(
525  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
526  static_cast<FwAssertArgType>(portNum)
527  );
528 
529  return this->m_Time_OutputPort[portNum].isConnected();
530  }
531 
534  {
535  FW_ASSERT(
536  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
537  static_cast<FwAssertArgType>(portNum)
538  );
539 
540  return this->m_Tlm_OutputPort[portNum].isConnected();
541  }
542 
543 #endif
544 
545  // ----------------------------------------------------------------------
546  // Port handler base-class functions for special input ports
547  //
548  // Call these functions directly to bypass the corresponding ports
549  // ----------------------------------------------------------------------
550 
553  FwIndexType portNum,
554  FwOpcodeType opCode,
555  U32 cmdSeq,
556  Fw::CmdArgBuffer& args
557  )
558  {
559 
560  const U32 idBase = this->getIdBase();
561  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
562 
563  // Select base class function based on opcode
564  switch (opCode - idBase) {
565  case OPCODE_ENABLE: {
566  this->ENABLE_cmdHandlerBase(
567  opCode,
568  cmdSeq,
569  args
570  );
571  break;
572  }
573  default:
574  // Unknown opcode: ignore it
575  break;
576  }
577  }
578 
579  // ----------------------------------------------------------------------
580  // Port handler base-class functions for typed input ports
581  //
582  // Call these functions directly to bypass the corresponding ports
583  // ----------------------------------------------------------------------
584 
587  FwIndexType portNum,
588  U32 context
589  )
590  {
591  // Make sure port number is valid
592  FW_ASSERT(
593  (0 <= portNum) && (portNum < this->getNum_run_InputPorts()),
594  static_cast<FwAssertArgType>(portNum)
595  );
596 
597  // Lock guard mutex before calling
598  this->lock();
599 
600  // Call handler function
601  this->run_handler(
602  portNum,
603  context
604  );
605 
606  // Unlock guard mutex
607  this->unLock();
608  }
609 
610  // ----------------------------------------------------------------------
611  // Command response
612  // ----------------------------------------------------------------------
613 
616  FwOpcodeType opCode,
617  U32 cmdSeq,
618  Fw::CmdResponse response
619  )
620  {
622  this->CmdStatus_out(0, opCode, cmdSeq, response);
623  }
624 
625  // ----------------------------------------------------------------------
626  // Command handler base-class functions
627  //
628  // Call these functions directly to bypass the command input port
629  // ----------------------------------------------------------------------
630 
633  FwOpcodeType opCode,
634  U32 cmdSeq,
635  Fw::CmdArgBuffer& args
636  )
637  {
638  // Deserialize the arguments
640 
641  // Reset the buffer
642  args.resetDeser();
643 
645  _status = args.deserializeTo(enable);
646  if (_status != Fw::FW_SERIALIZE_OK) {
647  if (this->isConnected_CmdStatus_OutputPort(0)) {
648  this->CmdStatus_out(
649  0,
650  opCode,
651  cmdSeq,
653  );
654  }
655  return;
656  }
657 
658 #if FW_CMD_CHECK_RESIDUAL
659  // Make sure there was no data left over.
660  // That means the argument buffer size was incorrect.
661  if (args.getDeserializeSizeLeft() != 0) {
662  if (this->isConnected_CmdStatus_OutputPort(0)) {
663  this->CmdStatus_out(
664  0,
665  opCode,
666  cmdSeq,
668  );
669  }
670  return;
671  }
672 #endif
673 
674  this->lock();
675 
676  this->ENABLE_cmdHandler(
677  opCode, cmdSeq,
678  enable
679  );
680 
681  this->unLock();
682  }
683 
684  // ----------------------------------------------------------------------
685  // Telemetry serialized write
686  // ----------------------------------------------------------------------
687 
690  FwChanIdType id,
691  Fw::TlmBuffer& _tlmBuff,
692  Fw::Time _tlmTime
693  ) const
694  {
695  if (this->isConnected_Tlm_OutputPort(0)) {
696  if (
697  this->isConnected_Time_OutputPort(0) &&
698  (_tlmTime == Fw::ZERO_TIME)
699  ) {
700  this->Time_out(0, _tlmTime);
701  }
702 
703  FwChanIdType _id;
704  _id = this->getIdBase() + id;
705 
706  this->Tlm_out(
707  0,
708  _id,
709  _tlmTime,
710  _tlmBuff
711  );
712  }
713  }
714 
715  // ----------------------------------------------------------------------
716  // Telemetry write functions
717  // ----------------------------------------------------------------------
718 
721  U64 arg,
722  Fw::Time _tlmTime
723  ) const
724  {
725  if (this->isConnected_Tlm_OutputPort(0)) {
726  Fw::TlmBuffer _tlmBuff;
727  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
728  FW_ASSERT(
729  _stat == Fw::FW_SERIALIZE_OK,
730  static_cast<FwAssertArgType>(_stat)
731  );
732 
733  this->tlmWrite(
735  _tlmBuff,
736  _tlmTime
737  );
738  }
739  }
740 
743  U64 arg,
744  Fw::Time _tlmTime
745  ) const
746  {
747  if (this->isConnected_Tlm_OutputPort(0)) {
748  Fw::TlmBuffer _tlmBuff;
749  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
750  FW_ASSERT(
751  _stat == Fw::FW_SERIALIZE_OK,
752  static_cast<FwAssertArgType>(_stat)
753  );
754 
755  this->tlmWrite(
757  _tlmBuff,
758  _tlmTime
759  );
760  }
761  }
762 
765  U64 arg,
766  Fw::Time _tlmTime
767  ) const
768  {
769  if (this->isConnected_Tlm_OutputPort(0)) {
770  Fw::TlmBuffer _tlmBuff;
771  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
772  FW_ASSERT(
773  _stat == Fw::FW_SERIALIZE_OK,
774  static_cast<FwAssertArgType>(_stat)
775  );
776 
777  this->tlmWrite(
779  _tlmBuff,
780  _tlmTime
781  );
782  }
783  }
784 
787  U64 arg,
788  Fw::Time _tlmTime
789  ) const
790  {
791  if (this->isConnected_Tlm_OutputPort(0)) {
792  Fw::TlmBuffer _tlmBuff;
793  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
794  FW_ASSERT(
795  _stat == Fw::FW_SERIALIZE_OK,
796  static_cast<FwAssertArgType>(_stat)
797  );
798 
799  this->tlmWrite(
801  _tlmBuff,
802  _tlmTime
803  );
804  }
805  }
806 
809  F32 arg,
810  Fw::Time _tlmTime
811  ) const
812  {
813  if (this->isConnected_Tlm_OutputPort(0)) {
814  Fw::TlmBuffer _tlmBuff;
815  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
816  FW_ASSERT(
817  _stat == Fw::FW_SERIALIZE_OK,
818  static_cast<FwAssertArgType>(_stat)
819  );
820 
821  this->tlmWrite(
823  _tlmBuff,
824  _tlmTime
825  );
826  }
827  }
828 
831  F32 arg,
832  Fw::Time _tlmTime
833  ) const
834  {
835  if (this->isConnected_Tlm_OutputPort(0)) {
836  Fw::TlmBuffer _tlmBuff;
837  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
838  FW_ASSERT(
839  _stat == Fw::FW_SERIALIZE_OK,
840  static_cast<FwAssertArgType>(_stat)
841  );
842 
843  this->tlmWrite(
845  _tlmBuff,
846  _tlmTime
847  );
848  }
849  }
850 
853  F32 arg,
854  Fw::Time _tlmTime
855  ) const
856  {
857  if (this->isConnected_Tlm_OutputPort(0)) {
858  Fw::TlmBuffer _tlmBuff;
859  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
860  FW_ASSERT(
861  _stat == Fw::FW_SERIALIZE_OK,
862  static_cast<FwAssertArgType>(_stat)
863  );
864 
865  this->tlmWrite(
867  _tlmBuff,
868  _tlmTime
869  );
870  }
871  }
872 
875  F32 arg,
876  Fw::Time _tlmTime
877  ) const
878  {
879  if (this->isConnected_Tlm_OutputPort(0)) {
880  Fw::TlmBuffer _tlmBuff;
881  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
882  FW_ASSERT(
883  _stat == Fw::FW_SERIALIZE_OK,
884  static_cast<FwAssertArgType>(_stat)
885  );
886 
887  this->tlmWrite(
889  _tlmBuff,
890  _tlmTime
891  );
892  }
893  }
894 
897  F32 arg,
898  Fw::Time _tlmTime
899  ) const
900  {
901  if (this->isConnected_Tlm_OutputPort(0)) {
902  Fw::TlmBuffer _tlmBuff;
903  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
904  FW_ASSERT(
905  _stat == Fw::FW_SERIALIZE_OK,
906  static_cast<FwAssertArgType>(_stat)
907  );
908 
909  this->tlmWrite(
911  _tlmBuff,
912  _tlmTime
913  );
914  }
915  }
916 
919  F32 arg,
920  Fw::Time _tlmTime
921  ) const
922  {
923  if (this->isConnected_Tlm_OutputPort(0)) {
924  Fw::TlmBuffer _tlmBuff;
925  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
926  FW_ASSERT(
927  _stat == Fw::FW_SERIALIZE_OK,
928  static_cast<FwAssertArgType>(_stat)
929  );
930 
931  this->tlmWrite(
933  _tlmBuff,
934  _tlmTime
935  );
936  }
937  }
938 
941  F32 arg,
942  Fw::Time _tlmTime
943  ) const
944  {
945  if (this->isConnected_Tlm_OutputPort(0)) {
946  Fw::TlmBuffer _tlmBuff;
947  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
948  FW_ASSERT(
949  _stat == Fw::FW_SERIALIZE_OK,
950  static_cast<FwAssertArgType>(_stat)
951  );
952 
953  this->tlmWrite(
955  _tlmBuff,
956  _tlmTime
957  );
958  }
959  }
960 
963  F32 arg,
964  Fw::Time _tlmTime
965  ) const
966  {
967  if (this->isConnected_Tlm_OutputPort(0)) {
968  Fw::TlmBuffer _tlmBuff;
969  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
970  FW_ASSERT(
971  _stat == Fw::FW_SERIALIZE_OK,
972  static_cast<FwAssertArgType>(_stat)
973  );
974 
975  this->tlmWrite(
977  _tlmBuff,
978  _tlmTime
979  );
980  }
981  }
982 
985  F32 arg,
986  Fw::Time _tlmTime
987  ) const
988  {
989  if (this->isConnected_Tlm_OutputPort(0)) {
990  Fw::TlmBuffer _tlmBuff;
991  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
992  FW_ASSERT(
993  _stat == Fw::FW_SERIALIZE_OK,
994  static_cast<FwAssertArgType>(_stat)
995  );
996 
997  this->tlmWrite(
999  _tlmBuff,
1000  _tlmTime
1001  );
1002  }
1003  }
1004 
1007  F32 arg,
1008  Fw::Time _tlmTime
1009  ) const
1010  {
1011  if (this->isConnected_Tlm_OutputPort(0)) {
1012  Fw::TlmBuffer _tlmBuff;
1013  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1014  FW_ASSERT(
1015  _stat == Fw::FW_SERIALIZE_OK,
1016  static_cast<FwAssertArgType>(_stat)
1017  );
1018 
1019  this->tlmWrite(
1021  _tlmBuff,
1022  _tlmTime
1023  );
1024  }
1025  }
1026 
1029  F32 arg,
1030  Fw::Time _tlmTime
1031  ) const
1032  {
1033  if (this->isConnected_Tlm_OutputPort(0)) {
1034  Fw::TlmBuffer _tlmBuff;
1035  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1036  FW_ASSERT(
1037  _stat == Fw::FW_SERIALIZE_OK,
1038  static_cast<FwAssertArgType>(_stat)
1039  );
1040 
1041  this->tlmWrite(
1043  _tlmBuff,
1044  _tlmTime
1045  );
1046  }
1047  }
1048 
1051  F32 arg,
1052  Fw::Time _tlmTime
1053  ) const
1054  {
1055  if (this->isConnected_Tlm_OutputPort(0)) {
1056  Fw::TlmBuffer _tlmBuff;
1057  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1058  FW_ASSERT(
1059  _stat == Fw::FW_SERIALIZE_OK,
1060  static_cast<FwAssertArgType>(_stat)
1061  );
1062 
1063  this->tlmWrite(
1065  _tlmBuff,
1066  _tlmTime
1067  );
1068  }
1069  }
1070 
1073  F32 arg,
1074  Fw::Time _tlmTime
1075  ) const
1076  {
1077  if (this->isConnected_Tlm_OutputPort(0)) {
1078  Fw::TlmBuffer _tlmBuff;
1079  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1080  FW_ASSERT(
1081  _stat == Fw::FW_SERIALIZE_OK,
1082  static_cast<FwAssertArgType>(_stat)
1083  );
1084 
1085  this->tlmWrite(
1087  _tlmBuff,
1088  _tlmTime
1089  );
1090  }
1091  }
1092 
1095  F32 arg,
1096  Fw::Time _tlmTime
1097  ) const
1098  {
1099  if (this->isConnected_Tlm_OutputPort(0)) {
1100  Fw::TlmBuffer _tlmBuff;
1101  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1102  FW_ASSERT(
1103  _stat == Fw::FW_SERIALIZE_OK,
1104  static_cast<FwAssertArgType>(_stat)
1105  );
1106 
1107  this->tlmWrite(
1109  _tlmBuff,
1110  _tlmTime
1111  );
1112  }
1113  }
1114 
1117  F32 arg,
1118  Fw::Time _tlmTime
1119  ) const
1120  {
1121  if (this->isConnected_Tlm_OutputPort(0)) {
1122  Fw::TlmBuffer _tlmBuff;
1123  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1124  FW_ASSERT(
1125  _stat == Fw::FW_SERIALIZE_OK,
1126  static_cast<FwAssertArgType>(_stat)
1127  );
1128 
1129  this->tlmWrite(
1131  _tlmBuff,
1132  _tlmTime
1133  );
1134  }
1135  }
1136 
1139  F32 arg,
1140  Fw::Time _tlmTime
1141  ) const
1142  {
1143  if (this->isConnected_Tlm_OutputPort(0)) {
1144  Fw::TlmBuffer _tlmBuff;
1145  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1146  FW_ASSERT(
1147  _stat == Fw::FW_SERIALIZE_OK,
1148  static_cast<FwAssertArgType>(_stat)
1149  );
1150 
1151  this->tlmWrite(
1153  _tlmBuff,
1154  _tlmTime
1155  );
1156  }
1157  }
1158 
1161  F32 arg,
1162  Fw::Time _tlmTime
1163  ) const
1164  {
1165  if (this->isConnected_Tlm_OutputPort(0)) {
1166  Fw::TlmBuffer _tlmBuff;
1167  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1168  FW_ASSERT(
1169  _stat == Fw::FW_SERIALIZE_OK,
1170  static_cast<FwAssertArgType>(_stat)
1171  );
1172 
1173  this->tlmWrite(
1175  _tlmBuff,
1176  _tlmTime
1177  );
1178  }
1179  }
1180 
1181  // ----------------------------------------------------------------------
1182  // Time
1183  // ----------------------------------------------------------------------
1184 
1186  getTime() const
1187  {
1188  if (this->isConnected_Time_OutputPort(0)) {
1189  Fw::Time _time;
1190  this->Time_out(0, _time);
1191  return _time;
1192  }
1193  else {
1194  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1195  }
1196  }
1197 
1198  // ----------------------------------------------------------------------
1199  // Mutex operations for guarded ports
1200  //
1201  // You can override these operations to provide more sophisticated
1202  // synchronization
1203  // ----------------------------------------------------------------------
1204 
1207  {
1208  this->m_guardedPortMutex.lock();
1209  }
1210 
1213  {
1214  this->m_guardedPortMutex.unLock();
1215  }
1216 
1217  // ----------------------------------------------------------------------
1218  // Calls for messages received on special input ports
1219  // ----------------------------------------------------------------------
1220 
1221  void SystemResourcesComponentBase ::
1222  m_p_CmdDisp_in(
1223  Fw::PassiveComponentBase* callComp,
1224  FwIndexType portNum,
1225  FwOpcodeType opCode,
1226  U32 cmdSeq,
1227  Fw::CmdArgBuffer& args
1228  )
1229  {
1230  FW_ASSERT(callComp);
1231  SystemResourcesComponentBase* compPtr = static_cast<SystemResourcesComponentBase*>(callComp);
1232  compPtr->CmdDisp_handlerBase(
1233  portNum,
1234  opCode,
1235  cmdSeq,
1236  args
1237  );
1238  }
1239 
1240  // ----------------------------------------------------------------------
1241  // Calls for messages received on typed input ports
1242  // ----------------------------------------------------------------------
1243 
1244  void SystemResourcesComponentBase ::
1245  m_p_run_in(
1246  Fw::PassiveComponentBase* callComp,
1247  FwIndexType portNum,
1248  U32 context
1249  )
1250  {
1251  FW_ASSERT(callComp);
1252  SystemResourcesComponentBase* compPtr = static_cast<SystemResourcesComponentBase*>(callComp);
1253  compPtr->run_handlerBase(
1254  portNum,
1255  context
1256  );
1257  }
1258 
1259 #if !FW_DIRECT_PORT_CALLS
1260 
1261  // ----------------------------------------------------------------------
1262  // Invocation functions for special output ports
1263  // ----------------------------------------------------------------------
1264 
1265  void SystemResourcesComponentBase ::
1266  CmdReg_out(
1267  FwIndexType portNum,
1268  FwOpcodeType opCode
1269  ) const
1270  {
1271  FW_ASSERT(
1272  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
1273  static_cast<FwAssertArgType>(portNum)
1274  );
1275 
1276  FW_ASSERT(
1277  this->m_CmdReg_OutputPort[portNum].isConnected(),
1278  static_cast<FwAssertArgType>(portNum)
1279  );
1280  this->m_CmdReg_OutputPort[portNum].invoke(
1281  opCode
1282  );
1283  }
1284 
1285  void SystemResourcesComponentBase ::
1286  CmdStatus_out(
1287  FwIndexType portNum,
1288  FwOpcodeType opCode,
1289  U32 cmdSeq,
1290  const Fw::CmdResponse& response
1291  ) const
1292  {
1293  FW_ASSERT(
1294  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
1295  static_cast<FwAssertArgType>(portNum)
1296  );
1297 
1298  FW_ASSERT(
1299  this->m_CmdStatus_OutputPort[portNum].isConnected(),
1300  static_cast<FwAssertArgType>(portNum)
1301  );
1302  this->m_CmdStatus_OutputPort[portNum].invoke(
1303  opCode,
1304  cmdSeq,
1305  response
1306  );
1307  }
1308 
1309  void SystemResourcesComponentBase ::
1310  Time_out(
1311  FwIndexType portNum,
1312  Fw::Time& time
1313  ) const
1314  {
1315  FW_ASSERT(
1316  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
1317  static_cast<FwAssertArgType>(portNum)
1318  );
1319 
1320  FW_ASSERT(
1321  this->m_Time_OutputPort[portNum].isConnected(),
1322  static_cast<FwAssertArgType>(portNum)
1323  );
1324  this->m_Time_OutputPort[portNum].invoke(
1325  time
1326  );
1327  }
1328 
1329  void SystemResourcesComponentBase ::
1330  Tlm_out(
1331  FwIndexType portNum,
1332  FwChanIdType id,
1333  Fw::Time& timeTag,
1334  Fw::TlmBuffer& val
1335  ) const
1336  {
1337  FW_ASSERT(
1338  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
1339  static_cast<FwAssertArgType>(portNum)
1340  );
1341 
1342  FW_ASSERT(
1343  this->m_Tlm_OutputPort[portNum].isConnected(),
1344  static_cast<FwAssertArgType>(portNum)
1345  );
1346  this->m_Tlm_OutputPort[portNum].invoke(
1347  id,
1348  timeTag,
1349  val
1350  );
1351  }
1352 
1353 #endif
1354 
1355 }
void set_CmdStatus_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to CmdStatus[portNum].
Serialization/Deserialization operation was successful.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:157
FwIdType FwOpcodeType
The type of a command opcode.
void tlmWrite_CPU_00(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
void tlmWrite_CPU(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
I32 FwEnumStoreType
static constexpr FwIndexType getNum_Time_OutputPorts()
virtual void ENABLE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::SystemResourceEnabled enable)=0
void init()
Initialization function.
Definition: SchedPortAc.cpp:73
static constexpr FwIndexType getNum_CmdStatus_OutputPorts()
void init()
Initialization function.
Definition: CmdPortAc.cpp:89
void tlmWrite_MEMORY_USED(U64 arg, Fw::Time _tlmTime=Fw::Time()) const
void tlmWrite_NON_VOLATILE_FREE(U64 arg, Fw::Time _tlmTime=Fw::Time()) const
bool isConnected_Time_OutputPort(FwIndexType portNum) const
void unLock()
unlock the mutex and assert success
Definition: Mutex.cpp:41
void tlmWrite_CPU_09(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
const Time ZERO_TIME
Definition: Time.cpp:5
void set_Tlm_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to Tlm[portNum].
void tlmWrite_CPU_02(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void init()
Initialization function.
Definition: TlmPortAc.cpp:171
Enum representing a command response.
No time base has been established (Required)
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
Fw::InputCmdPort * get_CmdDisp_InputPort(FwIndexType portNum)
bool isConnected_Log_OutputPort(FwIndexType portNum) const
void tlmWrite_CPU_10(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:177
void init()
Object initializer.
Definition: ObjBase.cpp:24
SerializeStatus
forward declaration for string
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:95
float F32
32-bit floating point
Definition: BasicTypes.h:83
SystemResourcesComponentBase(const char *compName="")
Construct SystemResourcesComponentBase object.
void invoke(FwOpcodeType opCode) const
Invoke a port connection.
void tlmWrite_CPU_13(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void tlmWrite_CPU_11(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void CmdDisp_handlerBase(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Handler base-class function for input port CmdDisp.
void init()
Initialization function.
Definition: TimePortAc.cpp:151
Svc::InputSchedPort * get_run_InputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_CmdDisp_InputPorts()
void invoke(Fw::Time &time) const
Invoke a port connection.
Definition: TimePortAc.cpp:170
Serializable::SizeType getDeserializeSizeLeft() const override
Get remaining deserialization buffer size.
const char * toChar() const
Convert to a C-style char*.
Definition: ObjectName.hpp:50
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port connection.
virtual void run_handler(FwIndexType portNum, U32 context)=0
Handler for input port run.
FwIdType FwChanIdType
The type of a telemetry channel identifier.
virtual void unLock()
Unlock the guarded mutex.
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
void resetDeser() override
Reset deserialization pointer to beginning of buffer.
bool isConnected_Tlm_OutputPort(FwIndexType portNum) const
void tlmWrite_CPU_14(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
static constexpr FwIndexType getNum_Tlm_OutputPorts()
A command to enable or disable system resource telemetry.
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) const
Invoke a port connection.
Definition: TlmPortAc.cpp:190
bool isConnected() const
Definition: PortBase.cpp:38
static constexpr FwIndexType getNum_run_InputPorts()
#define PRI_FwIndexType
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
void init()
Initialization function.
Definition: LogPortAc.cpp:180
void setPortNum(FwIndexType portNum)
Command failed to deserialize.
bool isConnected_CmdStatus_OutputPort(FwIndexType portNum) const
void tlmWrite_CPU_15(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: SchedPortAc.cpp:79
void tlmWrite_CPU_01(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
Auto-generated base for SystemResources component.
void tlmWrite_CPU_07(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
static constexpr FwIndexType getNum_CmdReg_OutputPorts()
PlatformIndexType FwIndexType
void tlmWrite_CPU_04(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:186
void init()
Initialization function.
void ENABLE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void tlmWrite_CPU_08(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
RateGroupDivider component implementation.
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
void regCommands()
Register commands with the Command Dispatcher.
SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG) override
Deserialize an 8-bit unsigned integer value.
virtual ~SystemResourcesComponentBase()
Destroy SystemResourcesComponentBase object.
void tlmWrite_CPU_06(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void set_CmdReg_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to CmdReg[portNum].
void tlmWrite_CPU_12(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
Implementation of malloc based allocator.
void tlmWrite_CPU_03(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void tlmWrite(FwChanIdType id, Fw::TlmBuffer &_tlmBuff, Fw::Time _tlmTime=Fw::Time()) const
void init()
Initialization function.
void run_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port run.
void tlmWrite_MEMORY_TOTAL(U64 arg, Fw::Time _tlmTime=Fw::Time()) const
bool isConnected_CmdReg_OutputPort(FwIndexType portNum) const
virtual void lock()
Lock the guarded mutex.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
static constexpr FwIndexType getNum_Log_OutputPorts()
void tlmWrite_NON_VOLATILE_TOTAL(U64 arg, Fw::Time _tlmTime=Fw::Time()) const
void tlmWrite_CPU_05(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
void lock()
lock the mutex and assert success
Definition: Mutex.cpp:34
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
#define U64(C)
Definition: sha.h:181