F´ Flight Software - C/C++ Documentation devel
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GroundInterfaceComponentAc.cpp
Go to the documentation of this file.
1// ======================================================================
2// \title GroundInterfaceComponentAc.cpp
3// \author Generated by fpp-to-cpp
4// \brief cpp file for GroundInterface component base class
5// ======================================================================
6
7#include <cstdio>
8
10#include "Fw/Types/Assert.hpp"
11#if FW_ENABLE_TEXT_LOGGING
12#include "Fw/Types/String.hpp"
13#endif
14
15namespace Svc {
16
17 // ----------------------------------------------------------------------
18 // Component initialization
19 // ----------------------------------------------------------------------
20
21 void GroundInterfaceComponentBase ::
22 init(NATIVE_INT_TYPE instance)
23 {
24 // Initialize base class
26
27 // Connect input port downlinkPort
28 for (
29 PlatformIntType port = 0;
30 port < static_cast<PlatformIntType>(this->getNum_downlinkPort_InputPorts());
31 port++
32 ) {
33 this->m_downlinkPort_InputPort[port].init();
34 this->m_downlinkPort_InputPort[port].addCallComp(
35 this,
36 m_p_downlinkPort_in
37 );
38 this->m_downlinkPort_InputPort[port].setPortNum(port);
39
40#if FW_OBJECT_NAMES == 1
41 char portName[120];
42 (void) snprintf(
43 portName,
44 sizeof(portName),
45 "%s_downlinkPort_InputPort[%" PRI_PlatformIntType "]",
46 this->m_objName,
47 port
48 );
49 this->m_downlinkPort_InputPort[port].setObjName(portName);
50#endif
51 }
52
53 // Connect input port fileDownlinkBufferSendIn
54 for (
55 PlatformIntType port = 0;
56 port < static_cast<PlatformIntType>(this->getNum_fileDownlinkBufferSendIn_InputPorts());
57 port++
58 ) {
59 this->m_fileDownlinkBufferSendIn_InputPort[port].init();
60 this->m_fileDownlinkBufferSendIn_InputPort[port].addCallComp(
61 this,
62 m_p_fileDownlinkBufferSendIn_in
63 );
64 this->m_fileDownlinkBufferSendIn_InputPort[port].setPortNum(port);
65
66#if FW_OBJECT_NAMES == 1
67 char portName[120];
68 (void) snprintf(
69 portName,
70 sizeof(portName),
71 "%s_fileDownlinkBufferSendIn_InputPort[%" PRI_PlatformIntType "]",
72 this->m_objName,
73 port
74 );
75 this->m_fileDownlinkBufferSendIn_InputPort[port].setObjName(portName);
76#endif
77 }
78
79 // Connect input port readCallback
80 for (
81 PlatformIntType port = 0;
82 port < static_cast<PlatformIntType>(this->getNum_readCallback_InputPorts());
83 port++
84 ) {
85 this->m_readCallback_InputPort[port].init();
86 this->m_readCallback_InputPort[port].addCallComp(
87 this,
88 m_p_readCallback_in
89 );
90 this->m_readCallback_InputPort[port].setPortNum(port);
91
92#if FW_OBJECT_NAMES == 1
93 char portName[120];
94 (void) snprintf(
95 portName,
96 sizeof(portName),
97 "%s_readCallback_InputPort[%" PRI_PlatformIntType "]",
98 this->m_objName,
99 port
100 );
101 this->m_readCallback_InputPort[port].setObjName(portName);
102#endif
103 }
104
105 // Connect input port schedIn
106 for (
107 PlatformIntType port = 0;
108 port < static_cast<PlatformIntType>(this->getNum_schedIn_InputPorts());
109 port++
110 ) {
111 this->m_schedIn_InputPort[port].init();
112 this->m_schedIn_InputPort[port].addCallComp(
113 this,
114 m_p_schedIn_in
115 );
116 this->m_schedIn_InputPort[port].setPortNum(port);
117
118#if FW_OBJECT_NAMES == 1
119 char portName[120];
120 (void) snprintf(
121 portName,
122 sizeof(portName),
123 "%s_schedIn_InputPort[%" PRI_PlatformIntType "]",
124 this->m_objName,
125 port
126 );
127 this->m_schedIn_InputPort[port].setObjName(portName);
128#endif
129 }
130
131 // Connect output port Log
132 for (
133 PlatformIntType port = 0;
134 port < static_cast<PlatformIntType>(this->getNum_Log_OutputPorts());
135 port++
136 ) {
137 this->m_Log_OutputPort[port].init();
138
139#if FW_OBJECT_NAMES == 1
140 char portName[120];
141 (void) snprintf(
142 portName,
143 sizeof(portName),
144 "%s_Log_OutputPort[%" PRI_PlatformIntType "]",
145 this->m_objName,
146 port
147 );
148 this->m_Log_OutputPort[port].setObjName(portName);
149#endif
150 }
151
152#if FW_ENABLE_TEXT_LOGGING == 1
153 // Connect output port LogText
154 for (
155 PlatformIntType port = 0;
156 port < static_cast<PlatformIntType>(this->getNum_LogText_OutputPorts());
157 port++
158 ) {
159 this->m_LogText_OutputPort[port].init();
160
161#if FW_OBJECT_NAMES == 1
162 char portName[120];
163 (void) snprintf(
164 portName,
165 sizeof(portName),
166 "%s_LogText_OutputPort[%" PRI_PlatformIntType "]",
167 this->m_objName,
168 port
169 );
170 this->m_LogText_OutputPort[port].setObjName(portName);
171#endif
172 }
173#endif
174
175 // Connect output port Time
176 for (
177 PlatformIntType port = 0;
178 port < static_cast<PlatformIntType>(this->getNum_Time_OutputPorts());
179 port++
180 ) {
181 this->m_Time_OutputPort[port].init();
182
183#if FW_OBJECT_NAMES == 1
184 char portName[120];
185 (void) snprintf(
186 portName,
187 sizeof(portName),
188 "%s_Time_OutputPort[%" PRI_PlatformIntType "]",
189 this->m_objName,
190 port
191 );
192 this->m_Time_OutputPort[port].setObjName(portName);
193#endif
194 }
195
196 // Connect output port fileDownlinkBufferSendOut
197 for (
198 PlatformIntType port = 0;
199 port < static_cast<PlatformIntType>(this->getNum_fileDownlinkBufferSendOut_OutputPorts());
200 port++
201 ) {
202 this->m_fileDownlinkBufferSendOut_OutputPort[port].init();
203
204#if FW_OBJECT_NAMES == 1
205 char portName[120];
206 (void) snprintf(
207 portName,
208 sizeof(portName),
209 "%s_fileDownlinkBufferSendOut_OutputPort[%" PRI_PlatformIntType "]",
210 this->m_objName,
211 port
212 );
213 this->m_fileDownlinkBufferSendOut_OutputPort[port].setObjName(portName);
214#endif
215 }
216
217 // Connect output port fileUplinkBufferGet
218 for (
219 PlatformIntType port = 0;
220 port < static_cast<PlatformIntType>(this->getNum_fileUplinkBufferGet_OutputPorts());
221 port++
222 ) {
223 this->m_fileUplinkBufferGet_OutputPort[port].init();
224
225#if FW_OBJECT_NAMES == 1
226 char portName[120];
227 (void) snprintf(
228 portName,
229 sizeof(portName),
230 "%s_fileUplinkBufferGet_OutputPort[%" PRI_PlatformIntType "]",
231 this->m_objName,
232 port
233 );
234 this->m_fileUplinkBufferGet_OutputPort[port].setObjName(portName);
235#endif
236 }
237
238 // Connect output port fileUplinkBufferSendOut
239 for (
240 PlatformIntType port = 0;
241 port < static_cast<PlatformIntType>(this->getNum_fileUplinkBufferSendOut_OutputPorts());
242 port++
243 ) {
244 this->m_fileUplinkBufferSendOut_OutputPort[port].init();
245
246#if FW_OBJECT_NAMES == 1
247 char portName[120];
248 (void) snprintf(
249 portName,
250 sizeof(portName),
251 "%s_fileUplinkBufferSendOut_OutputPort[%" PRI_PlatformIntType "]",
252 this->m_objName,
253 port
254 );
255 this->m_fileUplinkBufferSendOut_OutputPort[port].setObjName(portName);
256#endif
257 }
258
259 // Connect output port readPoll
260 for (
261 PlatformIntType port = 0;
262 port < static_cast<PlatformIntType>(this->getNum_readPoll_OutputPorts());
263 port++
264 ) {
265 this->m_readPoll_OutputPort[port].init();
266
267#if FW_OBJECT_NAMES == 1
268 char portName[120];
269 (void) snprintf(
270 portName,
271 sizeof(portName),
272 "%s_readPoll_OutputPort[%" PRI_PlatformIntType "]",
273 this->m_objName,
274 port
275 );
276 this->m_readPoll_OutputPort[port].setObjName(portName);
277#endif
278 }
279
280 // Connect output port uplinkPort
281 for (
282 PlatformIntType port = 0;
283 port < static_cast<PlatformIntType>(this->getNum_uplinkPort_OutputPorts());
284 port++
285 ) {
286 this->m_uplinkPort_OutputPort[port].init();
287
288#if FW_OBJECT_NAMES == 1
289 char portName[120];
290 (void) snprintf(
291 portName,
292 sizeof(portName),
293 "%s_uplinkPort_OutputPort[%" PRI_PlatformIntType "]",
294 this->m_objName,
295 port
296 );
297 this->m_uplinkPort_OutputPort[port].setObjName(portName);
298#endif
299 }
300
301 // Connect output port write
302 for (
303 PlatformIntType port = 0;
304 port < static_cast<PlatformIntType>(this->getNum_write_OutputPorts());
305 port++
306 ) {
307 this->m_write_OutputPort[port].init();
308
309#if FW_OBJECT_NAMES == 1
310 char portName[120];
311 (void) snprintf(
312 portName,
313 sizeof(portName),
314 "%s_write_OutputPort[%" PRI_PlatformIntType "]",
315 this->m_objName,
316 port
317 );
318 this->m_write_OutputPort[port].setObjName(portName);
319#endif
320 }
321 }
322
323 // ----------------------------------------------------------------------
324 // Getters for typed input ports
325 // ----------------------------------------------------------------------
326
327 Fw::InputComPort* GroundInterfaceComponentBase ::
328 get_downlinkPort_InputPort(NATIVE_INT_TYPE portNum)
329 {
330 FW_ASSERT(
331 portNum < this->getNum_downlinkPort_InputPorts(),
332 static_cast<FwAssertArgType>(portNum)
333 );
334
335 return &this->m_downlinkPort_InputPort[portNum];
336 }
337
338 Fw::InputBufferSendPort* GroundInterfaceComponentBase ::
339 get_fileDownlinkBufferSendIn_InputPort(NATIVE_INT_TYPE portNum)
340 {
341 FW_ASSERT(
342 portNum < this->getNum_fileDownlinkBufferSendIn_InputPorts(),
343 static_cast<FwAssertArgType>(portNum)
344 );
345
346 return &this->m_fileDownlinkBufferSendIn_InputPort[portNum];
347 }
348
349 Fw::InputBufferSendPort* GroundInterfaceComponentBase ::
350 get_readCallback_InputPort(NATIVE_INT_TYPE portNum)
351 {
352 FW_ASSERT(
353 portNum < this->getNum_readCallback_InputPorts(),
354 static_cast<FwAssertArgType>(portNum)
355 );
356
357 return &this->m_readCallback_InputPort[portNum];
358 }
359
360 Svc::InputSchedPort* GroundInterfaceComponentBase ::
361 get_schedIn_InputPort(NATIVE_INT_TYPE portNum)
362 {
363 FW_ASSERT(
364 portNum < this->getNum_schedIn_InputPorts(),
365 static_cast<FwAssertArgType>(portNum)
366 );
367
368 return &this->m_schedIn_InputPort[portNum];
369 }
370
371 // ----------------------------------------------------------------------
372 // Connect input ports to special output ports
373 // ----------------------------------------------------------------------
374
375 void GroundInterfaceComponentBase ::
376 set_Log_OutputPort(
377 NATIVE_INT_TYPE portNum,
378 Fw::InputLogPort* port
379 )
380 {
381 FW_ASSERT(
382 portNum < this->getNum_Log_OutputPorts(),
383 static_cast<FwAssertArgType>(portNum)
384 );
385
386 this->m_Log_OutputPort[portNum].addCallPort(port);
387 }
388
389#if FW_ENABLE_TEXT_LOGGING == 1
390
391 void GroundInterfaceComponentBase ::
392 set_LogText_OutputPort(
393 NATIVE_INT_TYPE portNum,
395 )
396 {
397 FW_ASSERT(
398 portNum < this->getNum_LogText_OutputPorts(),
399 static_cast<FwAssertArgType>(portNum)
400 );
401
402 this->m_LogText_OutputPort[portNum].addCallPort(port);
403 }
404
405#endif
406
407 void GroundInterfaceComponentBase ::
408 set_Time_OutputPort(
409 NATIVE_INT_TYPE portNum,
411 )
412 {
413 FW_ASSERT(
414 portNum < this->getNum_Time_OutputPorts(),
415 static_cast<FwAssertArgType>(portNum)
416 );
417
418 this->m_Time_OutputPort[portNum].addCallPort(port);
419 }
420
421 // ----------------------------------------------------------------------
422 // Connect typed input ports to typed output ports
423 // ----------------------------------------------------------------------
424
425 void GroundInterfaceComponentBase ::
426 set_fileDownlinkBufferSendOut_OutputPort(
427 NATIVE_INT_TYPE portNum,
429 )
430 {
431 FW_ASSERT(
432 portNum < this->getNum_fileDownlinkBufferSendOut_OutputPorts(),
433 static_cast<FwAssertArgType>(portNum)
434 );
435
436 this->m_fileDownlinkBufferSendOut_OutputPort[portNum].addCallPort(port);
437 }
438
439 void GroundInterfaceComponentBase ::
440 set_fileUplinkBufferGet_OutputPort(
441 NATIVE_INT_TYPE portNum,
443 )
444 {
445 FW_ASSERT(
446 portNum < this->getNum_fileUplinkBufferGet_OutputPorts(),
447 static_cast<FwAssertArgType>(portNum)
448 );
449
450 this->m_fileUplinkBufferGet_OutputPort[portNum].addCallPort(port);
451 }
452
453 void GroundInterfaceComponentBase ::
454 set_fileUplinkBufferSendOut_OutputPort(
455 NATIVE_INT_TYPE portNum,
457 )
458 {
459 FW_ASSERT(
460 portNum < this->getNum_fileUplinkBufferSendOut_OutputPorts(),
461 static_cast<FwAssertArgType>(portNum)
462 );
463
464 this->m_fileUplinkBufferSendOut_OutputPort[portNum].addCallPort(port);
465 }
466
467 void GroundInterfaceComponentBase ::
468 set_readPoll_OutputPort(
469 NATIVE_INT_TYPE portNum,
471 )
472 {
473 FW_ASSERT(
474 portNum < this->getNum_readPoll_OutputPorts(),
475 static_cast<FwAssertArgType>(portNum)
476 );
477
478 this->m_readPoll_OutputPort[portNum].addCallPort(port);
479 }
480
481 void GroundInterfaceComponentBase ::
482 set_uplinkPort_OutputPort(
483 NATIVE_INT_TYPE portNum,
484 Fw::InputComPort* port
485 )
486 {
487 FW_ASSERT(
488 portNum < this->getNum_uplinkPort_OutputPorts(),
489 static_cast<FwAssertArgType>(portNum)
490 );
491
492 this->m_uplinkPort_OutputPort[portNum].addCallPort(port);
493 }
494
495 void GroundInterfaceComponentBase ::
496 set_write_OutputPort(
497 NATIVE_INT_TYPE portNum,
499 )
500 {
501 FW_ASSERT(
502 portNum < this->getNum_write_OutputPorts(),
503 static_cast<FwAssertArgType>(portNum)
504 );
505
506 this->m_write_OutputPort[portNum].addCallPort(port);
507 }
508
509#if FW_PORT_SERIALIZATION
510
511 // ----------------------------------------------------------------------
512 // Connect serial input ports to special output ports
513 // ----------------------------------------------------------------------
514
515 void GroundInterfaceComponentBase ::
516 set_Log_OutputPort(
517 NATIVE_INT_TYPE 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 GroundInterfaceComponentBase ::
532 set_LogText_OutputPort(
533 NATIVE_INT_TYPE 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
547 void GroundInterfaceComponentBase ::
548 set_Time_OutputPort(
549 NATIVE_INT_TYPE 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
561#endif
562
563#if FW_PORT_SERIALIZATION
564
565 // ----------------------------------------------------------------------
566 // Connect serial input ports to typed output ports
567 // ----------------------------------------------------------------------
568
569 void GroundInterfaceComponentBase ::
570 set_fileDownlinkBufferSendOut_OutputPort(
571 NATIVE_INT_TYPE portNum,
572 Fw::InputSerializePort* port
573 )
574 {
575 FW_ASSERT(
576 portNum < this->getNum_fileDownlinkBufferSendOut_OutputPorts(),
577 static_cast<FwAssertArgType>(portNum)
578 );
579
580 this->m_fileDownlinkBufferSendOut_OutputPort[portNum].registerSerialPort(port);
581 }
582
583 void GroundInterfaceComponentBase ::
584 set_fileUplinkBufferSendOut_OutputPort(
585 NATIVE_INT_TYPE portNum,
586 Fw::InputSerializePort* port
587 )
588 {
589 FW_ASSERT(
590 portNum < this->getNum_fileUplinkBufferSendOut_OutputPorts(),
591 static_cast<FwAssertArgType>(portNum)
592 );
593
594 this->m_fileUplinkBufferSendOut_OutputPort[portNum].registerSerialPort(port);
595 }
596
597 void GroundInterfaceComponentBase ::
598 set_readPoll_OutputPort(
599 NATIVE_INT_TYPE portNum,
600 Fw::InputSerializePort* port
601 )
602 {
603 FW_ASSERT(
604 portNum < this->getNum_readPoll_OutputPorts(),
605 static_cast<FwAssertArgType>(portNum)
606 );
607
608 this->m_readPoll_OutputPort[portNum].registerSerialPort(port);
609 }
610
611 void GroundInterfaceComponentBase ::
612 set_uplinkPort_OutputPort(
613 NATIVE_INT_TYPE portNum,
614 Fw::InputSerializePort* port
615 )
616 {
617 FW_ASSERT(
618 portNum < this->getNum_uplinkPort_OutputPorts(),
619 static_cast<FwAssertArgType>(portNum)
620 );
621
622 this->m_uplinkPort_OutputPort[portNum].registerSerialPort(port);
623 }
624
625 void GroundInterfaceComponentBase ::
626 set_write_OutputPort(
627 NATIVE_INT_TYPE portNum,
628 Fw::InputSerializePort* port
629 )
630 {
631 FW_ASSERT(
632 portNum < this->getNum_write_OutputPorts(),
633 static_cast<FwAssertArgType>(portNum)
634 );
635
636 this->m_write_OutputPort[portNum].registerSerialPort(port);
637 }
638
639#endif
640
641 // ----------------------------------------------------------------------
642 // Component construction and destruction
643 // ----------------------------------------------------------------------
644
645 GroundInterfaceComponentBase ::
646 GroundInterfaceComponentBase(const char* compName) :
647 Fw::PassiveComponentBase(compName)
648 {
649
650 }
651
652 GroundInterfaceComponentBase ::
653 ~GroundInterfaceComponentBase()
654 {
655
656 }
657
658 // ----------------------------------------------------------------------
659 // Getters for numbers of typed input ports
660 // ----------------------------------------------------------------------
661
662 NATIVE_INT_TYPE GroundInterfaceComponentBase ::
663 getNum_downlinkPort_InputPorts() const
664 {
665 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_downlinkPort_InputPort));
666 }
667
668 NATIVE_INT_TYPE GroundInterfaceComponentBase ::
669 getNum_fileDownlinkBufferSendIn_InputPorts() const
670 {
671 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_fileDownlinkBufferSendIn_InputPort));
672 }
673
674 NATIVE_INT_TYPE GroundInterfaceComponentBase ::
675 getNum_readCallback_InputPorts() const
676 {
677 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_readCallback_InputPort));
678 }
679
680 NATIVE_INT_TYPE GroundInterfaceComponentBase ::
681 getNum_schedIn_InputPorts() const
682 {
683 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_schedIn_InputPort));
684 }
685
686 // ----------------------------------------------------------------------
687 // Getters for numbers of special output ports
688 // ----------------------------------------------------------------------
689
690 NATIVE_INT_TYPE GroundInterfaceComponentBase ::
691 getNum_Log_OutputPorts() const
692 {
693 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_Log_OutputPort));
694 }
695
696#if FW_ENABLE_TEXT_LOGGING == 1
697
698 NATIVE_INT_TYPE GroundInterfaceComponentBase ::
699 getNum_LogText_OutputPorts() const
700 {
701 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_LogText_OutputPort));
702 }
703
704#endif
705
706 NATIVE_INT_TYPE GroundInterfaceComponentBase ::
707 getNum_Time_OutputPorts() const
708 {
709 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_Time_OutputPort));
710 }
711
712 // ----------------------------------------------------------------------
713 // Getters for numbers of typed output ports
714 // ----------------------------------------------------------------------
715
716 NATIVE_INT_TYPE GroundInterfaceComponentBase ::
717 getNum_fileDownlinkBufferSendOut_OutputPorts() const
718 {
719 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_fileDownlinkBufferSendOut_OutputPort));
720 }
721
722 NATIVE_INT_TYPE GroundInterfaceComponentBase ::
723 getNum_fileUplinkBufferGet_OutputPorts() const
724 {
725 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_fileUplinkBufferGet_OutputPort));
726 }
727
728 NATIVE_INT_TYPE GroundInterfaceComponentBase ::
729 getNum_fileUplinkBufferSendOut_OutputPorts() const
730 {
731 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_fileUplinkBufferSendOut_OutputPort));
732 }
733
734 NATIVE_INT_TYPE GroundInterfaceComponentBase ::
735 getNum_readPoll_OutputPorts() const
736 {
737 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_readPoll_OutputPort));
738 }
739
740 NATIVE_INT_TYPE GroundInterfaceComponentBase ::
741 getNum_uplinkPort_OutputPorts() const
742 {
743 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_uplinkPort_OutputPort));
744 }
745
746 NATIVE_INT_TYPE GroundInterfaceComponentBase ::
747 getNum_write_OutputPorts() const
748 {
749 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_write_OutputPort));
750 }
751
752 // ----------------------------------------------------------------------
753 // Connection status queries for special output ports
754 // ----------------------------------------------------------------------
755
756 bool GroundInterfaceComponentBase ::
757 isConnected_Log_OutputPort(NATIVE_INT_TYPE portNum)
758 {
759 FW_ASSERT(
760 portNum < this->getNum_Log_OutputPorts(),
761 static_cast<FwAssertArgType>(portNum)
762 );
763
764 return this->m_Log_OutputPort[portNum].isConnected();
765 }
766
767#if FW_ENABLE_TEXT_LOGGING == 1
768
769 bool GroundInterfaceComponentBase ::
770 isConnected_LogText_OutputPort(NATIVE_INT_TYPE portNum)
771 {
772 FW_ASSERT(
773 portNum < this->getNum_LogText_OutputPorts(),
774 static_cast<FwAssertArgType>(portNum)
775 );
776
777 return this->m_LogText_OutputPort[portNum].isConnected();
778 }
779
780#endif
781
782 bool GroundInterfaceComponentBase ::
783 isConnected_Time_OutputPort(NATIVE_INT_TYPE portNum)
784 {
785 FW_ASSERT(
786 portNum < this->getNum_Time_OutputPorts(),
787 static_cast<FwAssertArgType>(portNum)
788 );
789
790 return this->m_Time_OutputPort[portNum].isConnected();
791 }
792
793 // ----------------------------------------------------------------------
794 // Connection status queries for typed output ports
795 // ----------------------------------------------------------------------
796
797 bool GroundInterfaceComponentBase ::
798 isConnected_fileDownlinkBufferSendOut_OutputPort(NATIVE_INT_TYPE portNum)
799 {
800 FW_ASSERT(
801 portNum < this->getNum_fileDownlinkBufferSendOut_OutputPorts(),
802 static_cast<FwAssertArgType>(portNum)
803 );
804
805 return this->m_fileDownlinkBufferSendOut_OutputPort[portNum].isConnected();
806 }
807
808 bool GroundInterfaceComponentBase ::
809 isConnected_fileUplinkBufferGet_OutputPort(NATIVE_INT_TYPE portNum)
810 {
811 FW_ASSERT(
812 portNum < this->getNum_fileUplinkBufferGet_OutputPorts(),
813 static_cast<FwAssertArgType>(portNum)
814 );
815
816 return this->m_fileUplinkBufferGet_OutputPort[portNum].isConnected();
817 }
818
819 bool GroundInterfaceComponentBase ::
820 isConnected_fileUplinkBufferSendOut_OutputPort(NATIVE_INT_TYPE portNum)
821 {
822 FW_ASSERT(
823 portNum < this->getNum_fileUplinkBufferSendOut_OutputPorts(),
824 static_cast<FwAssertArgType>(portNum)
825 );
826
827 return this->m_fileUplinkBufferSendOut_OutputPort[portNum].isConnected();
828 }
829
830 bool GroundInterfaceComponentBase ::
831 isConnected_readPoll_OutputPort(NATIVE_INT_TYPE portNum)
832 {
833 FW_ASSERT(
834 portNum < this->getNum_readPoll_OutputPorts(),
835 static_cast<FwAssertArgType>(portNum)
836 );
837
838 return this->m_readPoll_OutputPort[portNum].isConnected();
839 }
840
841 bool GroundInterfaceComponentBase ::
842 isConnected_uplinkPort_OutputPort(NATIVE_INT_TYPE portNum)
843 {
844 FW_ASSERT(
845 portNum < this->getNum_uplinkPort_OutputPorts(),
846 static_cast<FwAssertArgType>(portNum)
847 );
848
849 return this->m_uplinkPort_OutputPort[portNum].isConnected();
850 }
851
852 bool GroundInterfaceComponentBase ::
853 isConnected_write_OutputPort(NATIVE_INT_TYPE portNum)
854 {
855 FW_ASSERT(
856 portNum < this->getNum_write_OutputPorts(),
857 static_cast<FwAssertArgType>(portNum)
858 );
859
860 return this->m_write_OutputPort[portNum].isConnected();
861 }
862
863 // ----------------------------------------------------------------------
864 // Port handler base-class functions for typed input ports
865 //
866 // Call these functions directly to bypass the corresponding ports
867 // ----------------------------------------------------------------------
868
869 void GroundInterfaceComponentBase ::
870 downlinkPort_handlerBase(
871 NATIVE_INT_TYPE portNum,
872 Fw::ComBuffer& data,
873 U32 context
874 )
875 {
876 // Make sure port number is valid
877 FW_ASSERT(
878 portNum < this->getNum_downlinkPort_InputPorts(),
879 static_cast<FwAssertArgType>(portNum)
880 );
881
882 // Lock guard mutex before calling
883 this->lock();
884
885 // Down call to pure virtual handler method implemented in Impl class
886 this->downlinkPort_handler(
887 portNum,
888 data,
889 context
890 );
891
892 // Unlock guard mutex
893 this->unLock();
894 }
895
896 void GroundInterfaceComponentBase ::
897 fileDownlinkBufferSendIn_handlerBase(
898 NATIVE_INT_TYPE portNum,
899 Fw::Buffer& fwBuffer
900 )
901 {
902 // Make sure port number is valid
903 FW_ASSERT(
904 portNum < this->getNum_fileDownlinkBufferSendIn_InputPorts(),
905 static_cast<FwAssertArgType>(portNum)
906 );
907
908 // Lock guard mutex before calling
909 this->lock();
910
911 // Down call to pure virtual handler method implemented in Impl class
912 this->fileDownlinkBufferSendIn_handler(
913 portNum,
914 fwBuffer
915 );
916
917 // Unlock guard mutex
918 this->unLock();
919 }
920
921 void GroundInterfaceComponentBase ::
922 readCallback_handlerBase(
923 NATIVE_INT_TYPE portNum,
924 Fw::Buffer& fwBuffer
925 )
926 {
927 // Make sure port number is valid
928 FW_ASSERT(
929 portNum < this->getNum_readCallback_InputPorts(),
930 static_cast<FwAssertArgType>(portNum)
931 );
932
933 // Lock guard mutex before calling
934 this->lock();
935
936 // Down call to pure virtual handler method implemented in Impl class
937 this->readCallback_handler(
938 portNum,
939 fwBuffer
940 );
941
942 // Unlock guard mutex
943 this->unLock();
944 }
945
946 void GroundInterfaceComponentBase ::
947 schedIn_handlerBase(
948 NATIVE_INT_TYPE portNum,
949 NATIVE_UINT_TYPE context
950 )
951 {
952 // Make sure port number is valid
953 FW_ASSERT(
954 portNum < this->getNum_schedIn_InputPorts(),
955 static_cast<FwAssertArgType>(portNum)
956 );
957
958 // Lock guard mutex before calling
959 this->lock();
960
961 // Down call to pure virtual handler method implemented in Impl class
962 this->schedIn_handler(
963 portNum,
964 context
965 );
966
967 // Unlock guard mutex
968 this->unLock();
969 }
970
971 // ----------------------------------------------------------------------
972 // Invocation functions for typed output ports
973 // ----------------------------------------------------------------------
974
975 void GroundInterfaceComponentBase ::
976 fileDownlinkBufferSendOut_out(
977 NATIVE_INT_TYPE portNum,
978 Fw::Buffer& fwBuffer
979 )
980 {
981 FW_ASSERT(
982 portNum < this->getNum_fileDownlinkBufferSendOut_OutputPorts(),
983 static_cast<FwAssertArgType>(portNum)
984 );
985 this->m_fileDownlinkBufferSendOut_OutputPort[portNum].invoke(
986 fwBuffer
987 );
988 }
989
990 Fw::Buffer GroundInterfaceComponentBase ::
991 fileUplinkBufferGet_out(
992 NATIVE_INT_TYPE portNum,
993 U32 size
994 )
995 {
996 FW_ASSERT(
997 portNum < this->getNum_fileUplinkBufferGet_OutputPorts(),
998 static_cast<FwAssertArgType>(portNum)
999 );
1000 return this->m_fileUplinkBufferGet_OutputPort[portNum].invoke(
1001 size
1002 );
1003 }
1004
1005 void GroundInterfaceComponentBase ::
1006 fileUplinkBufferSendOut_out(
1007 NATIVE_INT_TYPE portNum,
1008 Fw::Buffer& fwBuffer
1009 )
1010 {
1011 FW_ASSERT(
1012 portNum < this->getNum_fileUplinkBufferSendOut_OutputPorts(),
1013 static_cast<FwAssertArgType>(portNum)
1014 );
1015 this->m_fileUplinkBufferSendOut_OutputPort[portNum].invoke(
1016 fwBuffer
1017 );
1018 }
1019
1020 void GroundInterfaceComponentBase ::
1021 readPoll_out(
1022 NATIVE_INT_TYPE portNum,
1023 Fw::Buffer& fwBuffer
1024 )
1025 {
1026 FW_ASSERT(
1027 portNum < this->getNum_readPoll_OutputPorts(),
1028 static_cast<FwAssertArgType>(portNum)
1029 );
1030 this->m_readPoll_OutputPort[portNum].invoke(
1031 fwBuffer
1032 );
1033 }
1034
1035 void GroundInterfaceComponentBase ::
1036 uplinkPort_out(
1037 NATIVE_INT_TYPE portNum,
1038 Fw::ComBuffer& data,
1039 U32 context
1040 )
1041 {
1042 FW_ASSERT(
1043 portNum < this->getNum_uplinkPort_OutputPorts(),
1044 static_cast<FwAssertArgType>(portNum)
1045 );
1046 this->m_uplinkPort_OutputPort[portNum].invoke(
1047 data,
1048 context
1049 );
1050 }
1051
1052 void GroundInterfaceComponentBase ::
1053 write_out(
1054 NATIVE_INT_TYPE portNum,
1055 Fw::Buffer& fwBuffer
1056 )
1057 {
1058 FW_ASSERT(
1059 portNum < this->getNum_write_OutputPorts(),
1060 static_cast<FwAssertArgType>(portNum)
1061 );
1062 this->m_write_OutputPort[portNum].invoke(
1063 fwBuffer
1064 );
1065 }
1066
1067 // ----------------------------------------------------------------------
1068 // Event logging functions
1069 // ----------------------------------------------------------------------
1070
1071 void GroundInterfaceComponentBase ::
1072 log_WARNING_HI_GroundInterfaceError()
1073 {
1074 // Get the time
1075 Fw::Time _logTime;
1076 if (this->m_Time_OutputPort[0].isConnected()) {
1077 this->m_Time_OutputPort[0].invoke(_logTime);
1078 }
1079
1080 FwEventIdType _id = static_cast<FwEventIdType>(0);
1081
1082 _id = this->getIdBase() + EVENTID_GROUNDINTERFACEERROR;
1083
1084 // Emit the event on the log port
1085 if (this->m_Log_OutputPort[0].isConnected()) {
1086 Fw::LogBuffer _logBuff;
1087
1088#if FW_AMPCS_COMPATIBLE
1090 // Serialize the number of arguments
1091 _status = _logBuff.serialize(static_cast<U8>(0));
1092 FW_ASSERT(
1093 _status == Fw::FW_SERIALIZE_OK,
1094 static_cast<FwAssertArgType>(_status)
1095 );
1096#endif
1097
1098 this->m_Log_OutputPort[0].invoke(
1099 _id,
1100 _logTime,
1102 _logBuff
1103 );
1104 }
1105
1106 // Emit the event on the text log port
1107#if FW_ENABLE_TEXT_LOGGING
1108 if (this->m_LogText_OutputPort[0].isConnected()) {
1109#if FW_OBJECT_NAMES == 1
1110 const char* _formatString =
1111 "(%s) %s: Ground interface encountered an error";
1112#else
1113 const char* _formatString =
1114 "%s: Ground interface encountered an error";
1115#endif
1116
1117 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
1118
1119 (void) snprintf(
1120 _textBuffer,
1122 _formatString,
1123#if FW_OBJECT_NAMES == 1
1124 this->m_objName,
1125#endif
1126 "GroundInterfaceError "
1127 );
1128
1129 // Null terminate
1130 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
1131 Fw::TextLogString _logString = _textBuffer;
1132 this->m_LogText_OutputPort[0].invoke(
1133 _id,
1134 _logTime,
1136 _logString
1137 );
1138 }
1139#endif
1140 }
1141
1142 // ----------------------------------------------------------------------
1143 // Time
1144 // ----------------------------------------------------------------------
1145
1146 Fw::Time GroundInterfaceComponentBase ::
1147 getTime()
1148 {
1149 if (this->m_Time_OutputPort[0].isConnected()) {
1150 Fw::Time _time;
1151 this->m_Time_OutputPort[0].invoke(_time);
1152 return _time;
1153 }
1154 else {
1155 return Fw::Time(TB_NONE, 0, 0);
1156 }
1157 }
1158
1159 // ----------------------------------------------------------------------
1160 // Mutex operations for guarded ports
1161 //
1162 // You can override these operations to provide more sophisticated
1163 // synchronization
1164 // ----------------------------------------------------------------------
1165
1166 void GroundInterfaceComponentBase ::
1167 lock()
1168 {
1169 this->m_guardedPortMutex.lock();
1170 }
1171
1172 void GroundInterfaceComponentBase ::
1173 unLock()
1174 {
1175 this->m_guardedPortMutex.unLock();
1176 }
1177
1178 // ----------------------------------------------------------------------
1179 // Calls for messages received on typed input ports
1180 // ----------------------------------------------------------------------
1181
1182 void GroundInterfaceComponentBase ::
1183 m_p_downlinkPort_in(
1184 Fw::PassiveComponentBase* callComp,
1185 NATIVE_INT_TYPE portNum,
1186 Fw::ComBuffer& data,
1187 U32 context
1188 )
1189 {
1190 FW_ASSERT(callComp);
1191 GroundInterfaceComponentBase* compPtr = static_cast<GroundInterfaceComponentBase*>(callComp);
1192 compPtr->downlinkPort_handlerBase(
1193 portNum,
1194 data,
1195 context
1196 );
1197 }
1198
1199 void GroundInterfaceComponentBase ::
1200 m_p_fileDownlinkBufferSendIn_in(
1201 Fw::PassiveComponentBase* callComp,
1202 NATIVE_INT_TYPE portNum,
1203 Fw::Buffer& fwBuffer
1204 )
1205 {
1206 FW_ASSERT(callComp);
1207 GroundInterfaceComponentBase* compPtr = static_cast<GroundInterfaceComponentBase*>(callComp);
1209 portNum,
1210 fwBuffer
1211 );
1212 }
1213
1214 void GroundInterfaceComponentBase ::
1215 m_p_readCallback_in(
1216 Fw::PassiveComponentBase* callComp,
1217 NATIVE_INT_TYPE portNum,
1218 Fw::Buffer& fwBuffer
1219 )
1220 {
1221 FW_ASSERT(callComp);
1222 GroundInterfaceComponentBase* compPtr = static_cast<GroundInterfaceComponentBase*>(callComp);
1223 compPtr->readCallback_handlerBase(
1224 portNum,
1225 fwBuffer
1226 );
1227 }
1228
1229 void GroundInterfaceComponentBase ::
1230 m_p_schedIn_in(
1231 Fw::PassiveComponentBase* callComp,
1232 NATIVE_INT_TYPE portNum,
1233 NATIVE_UINT_TYPE context
1234 )
1235 {
1236 FW_ASSERT(callComp);
1237 GroundInterfaceComponentBase* compPtr = static_cast<GroundInterfaceComponentBase*>(callComp);
1238 compPtr->schedIn_handlerBase(
1239 portNum,
1240 context
1241 );
1242 }
1243
1244}
#define FW_ASSERT(...)
Definition Assert.hpp:7
PlatformIntType NATIVE_INT_TYPE
Definition BasicTypes.h:51
uint8_t U8
8-bit unsigned integer
Definition BasicTypes.h:26
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition BasicTypes.h:66
PlatformUIntType NATIVE_UINT_TYPE
Definition BasicTypes.h:52
int PlatformIntType
DefaultTypes.hpp provides fallback defaults for the platform types.
#define PRI_PlatformIntType
@ TB_NONE
No time base has been established.
Definition FpConfig.h:39
PlatformAssertArgType FwAssertArgType
Definition FpConfig.h:21
U32 FwEventIdType
Definition FpConfig.h:62
#define FW_LOG_TEXT_BUFFER_SIZE
Max size of string for text log message.
Definition FpConfig.h:291
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects)
Definition FpConfig.h:82
Input BufferGet port.
Input BufferSend port.
@ WARNING_HI
A serious but recoverable event.
void init()
Object initializer.
Definition ObjBase.cpp:27
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
Auto-generated base for GroundInterface component.
void downlinkPort_handlerBase(NATIVE_INT_TYPE portNum, Fw::ComBuffer &data, U32 context)
Handler base-class function for input port downlinkPort.
void fileDownlinkBufferSendIn_handlerBase(NATIVE_INT_TYPE portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port fileDownlinkBufferSendIn.
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.