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