F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
ActiveLoggerComponentAc.cpp
Go to the documentation of this file.
1// ======================================================================
2// \title ActiveLoggerComponentAc.cpp
3// \author Generated by fpp-to-cpp
4// \brief cpp file for ActiveLogger component base class
5// ======================================================================
6
8#include "Fw/Types/Assert.hpp"
10#if FW_ENABLE_TEXT_LOGGING
11#include "Fw/Types/String.hpp"
12#endif
13
14namespace Svc {
15
16 namespace {
17 enum MsgTypeEnum {
18 ACTIVELOGGER_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
19 PINGIN_PING,
20 CMD_SET_ID_FILTER,
21 CMD_DUMP_FILTER_STATE,
22 INT_IF_LOQQUEUE,
23 };
24
25 // Get the max size by constructing a union of the async input, command, and
26 // internal port serialization sizes
27 union BuffUnion {
30 // Size of loqQueue argument list
31 BYTE loqQueueIntIfSize[
32 sizeof(FwEventIdType) +
36 ];
37 };
38
39 // Define a message buffer class large enough to handle all the
40 // asynchronous inputs to the component
41 class ComponentIpcSerializableBuffer :
43 {
44
45 public:
46
47 enum {
48 // Offset into data in buffer: Size of message ID and port number
49 DATA_OFFSET = sizeof(FwEnumStoreType) + sizeof(FwIndexType),
50 // Max data size
51 MAX_DATA_SIZE = sizeof(BuffUnion),
52 // Max message size: Size of message id + size of port + max data size
53 SERIALIZATION_SIZE = DATA_OFFSET + MAX_DATA_SIZE
54 };
55
56 Fw::Serializable::SizeType getBuffCapacity() const {
57 return sizeof(m_buff);
58 }
59
60 U8* getBuffAddr() {
61 return m_buff;
62 }
63
64 const U8* getBuffAddr() const {
65 return m_buff;
66 }
67
68 private:
69 // Should be the max of all the input ports serialized sizes...
70 U8 m_buff[SERIALIZATION_SIZE];
71
72 };
73 }
74
75 // ----------------------------------------------------------------------
76 // Component initialization
77 // ----------------------------------------------------------------------
78
79 void ActiveLoggerComponentBase ::
80 init(
81 FwSizeType queueDepth,
82 FwEnumStoreType instance
83 )
84 {
85 // Initialize base class
87
88 // Connect input port CmdDisp
89 for (
90 FwIndexType port = 0;
91 port < static_cast<FwIndexType>(this->getNum_CmdDisp_InputPorts());
92 port++
93 ) {
94 this->m_CmdDisp_InputPort[port].init();
95 this->m_CmdDisp_InputPort[port].addCallComp(
96 this,
97 m_p_CmdDisp_in
98 );
99 this->m_CmdDisp_InputPort[port].setPortNum(port);
100
101#if FW_OBJECT_NAMES == 1
102 Fw::ObjectName portName;
103 portName.format(
104 "%s_CmdDisp_InputPort[%" PRI_PlatformIntType "]",
105 this->m_objName.toChar(),
106 port
107 );
108 this->m_CmdDisp_InputPort[port].setObjName(portName.toChar());
109#endif
110 }
111
112 // Connect input port LogRecv
113 for (
114 FwIndexType port = 0;
115 port < static_cast<FwIndexType>(this->getNum_LogRecv_InputPorts());
116 port++
117 ) {
118 this->m_LogRecv_InputPort[port].init();
119 this->m_LogRecv_InputPort[port].addCallComp(
120 this,
121 m_p_LogRecv_in
122 );
123 this->m_LogRecv_InputPort[port].setPortNum(port);
124
125#if FW_OBJECT_NAMES == 1
126 Fw::ObjectName portName;
127 portName.format(
128 "%s_LogRecv_InputPort[%" PRI_PlatformIntType "]",
129 this->m_objName.toChar(),
130 port
131 );
132 this->m_LogRecv_InputPort[port].setObjName(portName.toChar());
133#endif
134 }
135
136 // Connect input port pingIn
137 for (
138 FwIndexType port = 0;
139 port < static_cast<FwIndexType>(this->getNum_pingIn_InputPorts());
140 port++
141 ) {
142 this->m_pingIn_InputPort[port].init();
143 this->m_pingIn_InputPort[port].addCallComp(
144 this,
145 m_p_pingIn_in
146 );
147 this->m_pingIn_InputPort[port].setPortNum(port);
148
149#if FW_OBJECT_NAMES == 1
150 Fw::ObjectName portName;
151 portName.format(
152 "%s_pingIn_InputPort[%" PRI_PlatformIntType "]",
153 this->m_objName.toChar(),
154 port
155 );
156 this->m_pingIn_InputPort[port].setObjName(portName.toChar());
157#endif
158 }
159
160 // Connect output port CmdReg
161 for (
162 FwIndexType port = 0;
163 port < static_cast<FwIndexType>(this->getNum_CmdReg_OutputPorts());
164 port++
165 ) {
166 this->m_CmdReg_OutputPort[port].init();
167
168#if FW_OBJECT_NAMES == 1
169 Fw::ObjectName portName;
170 portName.format(
171 "%s_CmdReg_OutputPort[%" PRI_PlatformIntType "]",
172 this->m_objName.toChar(),
173 port
174 );
175 this->m_CmdReg_OutputPort[port].setObjName(portName.toChar());
176#endif
177 }
178
179 // Connect output port CmdStatus
180 for (
181 FwIndexType port = 0;
182 port < static_cast<FwIndexType>(this->getNum_CmdStatus_OutputPorts());
183 port++
184 ) {
185 this->m_CmdStatus_OutputPort[port].init();
186
187#if FW_OBJECT_NAMES == 1
188 Fw::ObjectName portName;
189 portName.format(
190 "%s_CmdStatus_OutputPort[%" PRI_PlatformIntType "]",
191 this->m_objName.toChar(),
192 port
193 );
194 this->m_CmdStatus_OutputPort[port].setObjName(portName.toChar());
195#endif
196 }
197
198 // Connect output port Log
199 for (
200 FwIndexType port = 0;
201 port < static_cast<FwIndexType>(this->getNum_Log_OutputPorts());
202 port++
203 ) {
204 this->m_Log_OutputPort[port].init();
205
206#if FW_OBJECT_NAMES == 1
207 Fw::ObjectName portName;
208 portName.format(
209 "%s_Log_OutputPort[%" PRI_PlatformIntType "]",
210 this->m_objName.toChar(),
211 port
212 );
213 this->m_Log_OutputPort[port].setObjName(portName.toChar());
214#endif
215 }
216
217#if FW_ENABLE_TEXT_LOGGING == 1
218 // Connect output port LogText
219 for (
220 FwIndexType port = 0;
221 port < static_cast<FwIndexType>(this->getNum_LogText_OutputPorts());
222 port++
223 ) {
224 this->m_LogText_OutputPort[port].init();
225
226#if FW_OBJECT_NAMES == 1
227 Fw::ObjectName portName;
228 portName.format(
229 "%s_LogText_OutputPort[%" PRI_PlatformIntType "]",
230 this->m_objName.toChar(),
231 port
232 );
233 this->m_LogText_OutputPort[port].setObjName(portName.toChar());
234#endif
235 }
236#endif
237
238 // Connect output port Time
239 for (
240 FwIndexType port = 0;
241 port < static_cast<FwIndexType>(this->getNum_Time_OutputPorts());
242 port++
243 ) {
244 this->m_Time_OutputPort[port].init();
245
246#if FW_OBJECT_NAMES == 1
247 Fw::ObjectName portName;
248 portName.format(
249 "%s_Time_OutputPort[%" PRI_PlatformIntType "]",
250 this->m_objName.toChar(),
251 port
252 );
253 this->m_Time_OutputPort[port].setObjName(portName.toChar());
254#endif
255 }
256
257 // Connect output port FatalAnnounce
258 for (
259 FwIndexType port = 0;
260 port < static_cast<FwIndexType>(this->getNum_FatalAnnounce_OutputPorts());
261 port++
262 ) {
263 this->m_FatalAnnounce_OutputPort[port].init();
264
265#if FW_OBJECT_NAMES == 1
266 Fw::ObjectName portName;
267 portName.format(
268 "%s_FatalAnnounce_OutputPort[%" PRI_PlatformIntType "]",
269 this->m_objName.toChar(),
270 port
271 );
272 this->m_FatalAnnounce_OutputPort[port].setObjName(portName.toChar());
273#endif
274 }
275
276 // Connect output port PktSend
277 for (
278 FwIndexType port = 0;
279 port < static_cast<FwIndexType>(this->getNum_PktSend_OutputPorts());
280 port++
281 ) {
282 this->m_PktSend_OutputPort[port].init();
283
284#if FW_OBJECT_NAMES == 1
285 Fw::ObjectName portName;
286 portName.format(
287 "%s_PktSend_OutputPort[%" PRI_PlatformIntType "]",
288 this->m_objName.toChar(),
289 port
290 );
291 this->m_PktSend_OutputPort[port].setObjName(portName.toChar());
292#endif
293 }
294
295 // Connect output port pingOut
296 for (
297 FwIndexType port = 0;
298 port < static_cast<FwIndexType>(this->getNum_pingOut_OutputPorts());
299 port++
300 ) {
301 this->m_pingOut_OutputPort[port].init();
302
303#if FW_OBJECT_NAMES == 1
304 Fw::ObjectName portName;
305 portName.format(
306 "%s_pingOut_OutputPort[%" PRI_PlatformIntType "]",
307 this->m_objName.toChar(),
308 port
309 );
310 this->m_pingOut_OutputPort[port].setObjName(portName.toChar());
311#endif
312 }
313
314 // Create the queue
315 Os::Queue::Status qStat = this->createQueue(
316 queueDepth,
317 static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
318 );
319 FW_ASSERT(
321 static_cast<FwAssertArgType>(qStat)
322 );
323 }
324
325 // ----------------------------------------------------------------------
326 // Getters for special input ports
327 // ----------------------------------------------------------------------
328
329 Fw::InputCmdPort* ActiveLoggerComponentBase ::
330 get_CmdDisp_InputPort(FwIndexType portNum)
331 {
332 FW_ASSERT(
333 portNum < this->getNum_CmdDisp_InputPorts(),
334 static_cast<FwAssertArgType>(portNum)
335 );
336
337 return &this->m_CmdDisp_InputPort[portNum];
338 }
339
340 // ----------------------------------------------------------------------
341 // Getters for typed input ports
342 // ----------------------------------------------------------------------
343
344 Fw::InputLogPort* ActiveLoggerComponentBase ::
345 get_LogRecv_InputPort(FwIndexType portNum)
346 {
347 FW_ASSERT(
348 portNum < this->getNum_LogRecv_InputPorts(),
349 static_cast<FwAssertArgType>(portNum)
350 );
351
352 return &this->m_LogRecv_InputPort[portNum];
353 }
354
355 Svc::InputPingPort* ActiveLoggerComponentBase ::
356 get_pingIn_InputPort(FwIndexType portNum)
357 {
358 FW_ASSERT(
359 portNum < this->getNum_pingIn_InputPorts(),
360 static_cast<FwAssertArgType>(portNum)
361 );
362
363 return &this->m_pingIn_InputPort[portNum];
364 }
365
366 // ----------------------------------------------------------------------
367 // Connect input ports to special output ports
368 // ----------------------------------------------------------------------
369
370 void ActiveLoggerComponentBase ::
371 set_CmdReg_OutputPort(
372 FwIndexType portNum,
374 )
375 {
376 FW_ASSERT(
377 portNum < this->getNum_CmdReg_OutputPorts(),
378 static_cast<FwAssertArgType>(portNum)
379 );
380
381 this->m_CmdReg_OutputPort[portNum].addCallPort(port);
382 }
383
384 void ActiveLoggerComponentBase ::
385 set_CmdStatus_OutputPort(
386 FwIndexType portNum,
388 )
389 {
390 FW_ASSERT(
391 portNum < this->getNum_CmdStatus_OutputPorts(),
392 static_cast<FwAssertArgType>(portNum)
393 );
394
395 this->m_CmdStatus_OutputPort[portNum].addCallPort(port);
396 }
397
398 void ActiveLoggerComponentBase ::
399 set_Log_OutputPort(
400 FwIndexType portNum,
401 Fw::InputLogPort* port
402 )
403 {
404 FW_ASSERT(
405 portNum < this->getNum_Log_OutputPorts(),
406 static_cast<FwAssertArgType>(portNum)
407 );
408
409 this->m_Log_OutputPort[portNum].addCallPort(port);
410 }
411
412#if FW_ENABLE_TEXT_LOGGING == 1
413
414 void ActiveLoggerComponentBase ::
415 set_LogText_OutputPort(
416 FwIndexType portNum,
418 )
419 {
420 FW_ASSERT(
421 portNum < this->getNum_LogText_OutputPorts(),
422 static_cast<FwAssertArgType>(portNum)
423 );
424
425 this->m_LogText_OutputPort[portNum].addCallPort(port);
426 }
427
428#endif
429
430 void ActiveLoggerComponentBase ::
431 set_Time_OutputPort(
432 FwIndexType portNum,
434 )
435 {
436 FW_ASSERT(
437 portNum < this->getNum_Time_OutputPorts(),
438 static_cast<FwAssertArgType>(portNum)
439 );
440
441 this->m_Time_OutputPort[portNum].addCallPort(port);
442 }
443
444 // ----------------------------------------------------------------------
445 // Connect typed input ports to typed output ports
446 // ----------------------------------------------------------------------
447
448 void ActiveLoggerComponentBase ::
449 set_FatalAnnounce_OutputPort(
450 FwIndexType portNum,
452 )
453 {
454 FW_ASSERT(
455 portNum < this->getNum_FatalAnnounce_OutputPorts(),
456 static_cast<FwAssertArgType>(portNum)
457 );
458
459 this->m_FatalAnnounce_OutputPort[portNum].addCallPort(port);
460 }
461
462 void ActiveLoggerComponentBase ::
463 set_PktSend_OutputPort(
464 FwIndexType portNum,
465 Fw::InputComPort* port
466 )
467 {
468 FW_ASSERT(
469 portNum < this->getNum_PktSend_OutputPorts(),
470 static_cast<FwAssertArgType>(portNum)
471 );
472
473 this->m_PktSend_OutputPort[portNum].addCallPort(port);
474 }
475
476 void ActiveLoggerComponentBase ::
477 set_pingOut_OutputPort(
478 FwIndexType portNum,
480 )
481 {
482 FW_ASSERT(
483 portNum < this->getNum_pingOut_OutputPorts(),
484 static_cast<FwAssertArgType>(portNum)
485 );
486
487 this->m_pingOut_OutputPort[portNum].addCallPort(port);
488 }
489
490#if FW_PORT_SERIALIZATION
491
492 // ----------------------------------------------------------------------
493 // Connect serial input ports to special output ports
494 // ----------------------------------------------------------------------
495
496 void ActiveLoggerComponentBase ::
497 set_CmdReg_OutputPort(
498 FwIndexType portNum,
499 Fw::InputSerializePort* port
500 )
501 {
502 FW_ASSERT(
503 portNum < this->getNum_CmdReg_OutputPorts(),
504 static_cast<FwAssertArgType>(portNum)
505 );
506
507 this->m_CmdReg_OutputPort[portNum].registerSerialPort(port);
508 }
509
510 void ActiveLoggerComponentBase ::
511 set_CmdStatus_OutputPort(
512 FwIndexType portNum,
513 Fw::InputSerializePort* port
514 )
515 {
516 FW_ASSERT(
517 portNum < this->getNum_CmdStatus_OutputPorts(),
518 static_cast<FwAssertArgType>(portNum)
519 );
520
521 this->m_CmdStatus_OutputPort[portNum].registerSerialPort(port);
522 }
523
524 void ActiveLoggerComponentBase ::
525 set_Log_OutputPort(
526 FwIndexType portNum,
527 Fw::InputSerializePort* port
528 )
529 {
530 FW_ASSERT(
531 portNum < this->getNum_Log_OutputPorts(),
532 static_cast<FwAssertArgType>(portNum)
533 );
534
535 this->m_Log_OutputPort[portNum].registerSerialPort(port);
536 }
537
538#if FW_ENABLE_TEXT_LOGGING == 1
539
540 void ActiveLoggerComponentBase ::
541 set_LogText_OutputPort(
542 FwIndexType portNum,
543 Fw::InputSerializePort* port
544 )
545 {
546 FW_ASSERT(
547 portNum < this->getNum_LogText_OutputPorts(),
548 static_cast<FwAssertArgType>(portNum)
549 );
550
551 this->m_LogText_OutputPort[portNum].registerSerialPort(port);
552 }
553
554#endif
555
556 void ActiveLoggerComponentBase ::
557 set_Time_OutputPort(
558 FwIndexType portNum,
559 Fw::InputSerializePort* port
560 )
561 {
562 FW_ASSERT(
563 portNum < this->getNum_Time_OutputPorts(),
564 static_cast<FwAssertArgType>(portNum)
565 );
566
567 this->m_Time_OutputPort[portNum].registerSerialPort(port);
568 }
569
570#endif
571
572#if FW_PORT_SERIALIZATION
573
574 // ----------------------------------------------------------------------
575 // Connect serial input ports to typed output ports
576 // ----------------------------------------------------------------------
577
578 void ActiveLoggerComponentBase ::
579 set_FatalAnnounce_OutputPort(
580 FwIndexType portNum,
581 Fw::InputSerializePort* port
582 )
583 {
584 FW_ASSERT(
585 portNum < this->getNum_FatalAnnounce_OutputPorts(),
586 static_cast<FwAssertArgType>(portNum)
587 );
588
589 this->m_FatalAnnounce_OutputPort[portNum].registerSerialPort(port);
590 }
591
592 void ActiveLoggerComponentBase ::
593 set_PktSend_OutputPort(
594 FwIndexType portNum,
595 Fw::InputSerializePort* port
596 )
597 {
598 FW_ASSERT(
599 portNum < this->getNum_PktSend_OutputPorts(),
600 static_cast<FwAssertArgType>(portNum)
601 );
602
603 this->m_PktSend_OutputPort[portNum].registerSerialPort(port);
604 }
605
606 void ActiveLoggerComponentBase ::
607 set_pingOut_OutputPort(
608 FwIndexType portNum,
609 Fw::InputSerializePort* port
610 )
611 {
612 FW_ASSERT(
613 portNum < this->getNum_pingOut_OutputPorts(),
614 static_cast<FwAssertArgType>(portNum)
615 );
616
617 this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
618 }
619
620#endif
621
622 // ----------------------------------------------------------------------
623 // Command registration
624 // ----------------------------------------------------------------------
625
626 void ActiveLoggerComponentBase ::
627 regCommands()
628 {
629 FW_ASSERT(this->m_CmdReg_OutputPort[0].isConnected());
630
631 this->m_CmdReg_OutputPort[0].invoke(
632 this->getIdBase() + OPCODE_SET_EVENT_FILTER
633 );
634
635 this->m_CmdReg_OutputPort[0].invoke(
636 this->getIdBase() + OPCODE_SET_ID_FILTER
637 );
638
639 this->m_CmdReg_OutputPort[0].invoke(
640 this->getIdBase() + OPCODE_DUMP_FILTER_STATE
641 );
642 }
643
644 // ----------------------------------------------------------------------
645 // Component construction and destruction
646 // ----------------------------------------------------------------------
647
648 ActiveLoggerComponentBase ::
649 ActiveLoggerComponentBase(const char* compName) :
650 Fw::ActiveComponentBase(compName)
651 {
652
653 }
654
655 ActiveLoggerComponentBase ::
656 ~ActiveLoggerComponentBase()
657 {
658
659 }
660
661 // ----------------------------------------------------------------------
662 // Getters for numbers of special input ports
663 // ----------------------------------------------------------------------
664
665 FwIndexType ActiveLoggerComponentBase ::
666 getNum_CmdDisp_InputPorts() const
667 {
668 return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_CmdDisp_InputPort));
669 }
670
671 // ----------------------------------------------------------------------
672 // Getters for numbers of typed input ports
673 // ----------------------------------------------------------------------
674
675 FwIndexType ActiveLoggerComponentBase ::
676 getNum_LogRecv_InputPorts() const
677 {
678 return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_LogRecv_InputPort));
679 }
680
681 FwIndexType ActiveLoggerComponentBase ::
682 getNum_pingIn_InputPorts() const
683 {
684 return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_pingIn_InputPort));
685 }
686
687 // ----------------------------------------------------------------------
688 // Getters for numbers of special output ports
689 // ----------------------------------------------------------------------
690
691 FwIndexType ActiveLoggerComponentBase ::
692 getNum_CmdReg_OutputPorts() const
693 {
694 return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_CmdReg_OutputPort));
695 }
696
697 FwIndexType ActiveLoggerComponentBase ::
698 getNum_CmdStatus_OutputPorts() const
699 {
700 return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_CmdStatus_OutputPort));
701 }
702
703 FwIndexType ActiveLoggerComponentBase ::
704 getNum_Log_OutputPorts() const
705 {
706 return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_Log_OutputPort));
707 }
708
709#if FW_ENABLE_TEXT_LOGGING == 1
710
711 FwIndexType ActiveLoggerComponentBase ::
712 getNum_LogText_OutputPorts() const
713 {
714 return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_LogText_OutputPort));
715 }
716
717#endif
718
719 FwIndexType ActiveLoggerComponentBase ::
720 getNum_Time_OutputPorts() const
721 {
722 return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_Time_OutputPort));
723 }
724
725 // ----------------------------------------------------------------------
726 // Getters for numbers of typed output ports
727 // ----------------------------------------------------------------------
728
729 FwIndexType ActiveLoggerComponentBase ::
730 getNum_FatalAnnounce_OutputPorts() const
731 {
732 return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_FatalAnnounce_OutputPort));
733 }
734
735 FwIndexType ActiveLoggerComponentBase ::
736 getNum_PktSend_OutputPorts() const
737 {
738 return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_PktSend_OutputPort));
739 }
740
741 FwIndexType ActiveLoggerComponentBase ::
742 getNum_pingOut_OutputPorts() const
743 {
744 return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_pingOut_OutputPort));
745 }
746
747 // ----------------------------------------------------------------------
748 // Connection status queries for special output ports
749 // ----------------------------------------------------------------------
750
751 bool ActiveLoggerComponentBase ::
752 isConnected_CmdReg_OutputPort(FwIndexType portNum)
753 {
754 FW_ASSERT(
755 portNum < this->getNum_CmdReg_OutputPorts(),
756 static_cast<FwAssertArgType>(portNum)
757 );
758
759 return this->m_CmdReg_OutputPort[portNum].isConnected();
760 }
761
762 bool ActiveLoggerComponentBase ::
763 isConnected_CmdStatus_OutputPort(FwIndexType portNum)
764 {
765 FW_ASSERT(
766 portNum < this->getNum_CmdStatus_OutputPorts(),
767 static_cast<FwAssertArgType>(portNum)
768 );
769
770 return this->m_CmdStatus_OutputPort[portNum].isConnected();
771 }
772
773 bool ActiveLoggerComponentBase ::
774 isConnected_Log_OutputPort(FwIndexType portNum)
775 {
776 FW_ASSERT(
777 portNum < this->getNum_Log_OutputPorts(),
778 static_cast<FwAssertArgType>(portNum)
779 );
780
781 return this->m_Log_OutputPort[portNum].isConnected();
782 }
783
784#if FW_ENABLE_TEXT_LOGGING == 1
785
786 bool ActiveLoggerComponentBase ::
787 isConnected_LogText_OutputPort(FwIndexType portNum)
788 {
789 FW_ASSERT(
790 portNum < this->getNum_LogText_OutputPorts(),
791 static_cast<FwAssertArgType>(portNum)
792 );
793
794 return this->m_LogText_OutputPort[portNum].isConnected();
795 }
796
797#endif
798
799 bool ActiveLoggerComponentBase ::
800 isConnected_Time_OutputPort(FwIndexType portNum)
801 {
802 FW_ASSERT(
803 portNum < this->getNum_Time_OutputPorts(),
804 static_cast<FwAssertArgType>(portNum)
805 );
806
807 return this->m_Time_OutputPort[portNum].isConnected();
808 }
809
810 // ----------------------------------------------------------------------
811 // Connection status queries for typed output ports
812 // ----------------------------------------------------------------------
813
814 bool ActiveLoggerComponentBase ::
815 isConnected_FatalAnnounce_OutputPort(FwIndexType portNum)
816 {
817 FW_ASSERT(
818 portNum < this->getNum_FatalAnnounce_OutputPorts(),
819 static_cast<FwAssertArgType>(portNum)
820 );
821
822 return this->m_FatalAnnounce_OutputPort[portNum].isConnected();
823 }
824
825 bool ActiveLoggerComponentBase ::
826 isConnected_PktSend_OutputPort(FwIndexType portNum)
827 {
828 FW_ASSERT(
829 portNum < this->getNum_PktSend_OutputPorts(),
830 static_cast<FwAssertArgType>(portNum)
831 );
832
833 return this->m_PktSend_OutputPort[portNum].isConnected();
834 }
835
836 bool ActiveLoggerComponentBase ::
837 isConnected_pingOut_OutputPort(FwIndexType portNum)
838 {
839 FW_ASSERT(
840 portNum < this->getNum_pingOut_OutputPorts(),
841 static_cast<FwAssertArgType>(portNum)
842 );
843
844 return this->m_pingOut_OutputPort[portNum].isConnected();
845 }
846
847 // ----------------------------------------------------------------------
848 // Port handler base-class functions for typed input ports
849 //
850 // Call these functions directly to bypass the corresponding ports
851 // ----------------------------------------------------------------------
852
853 void ActiveLoggerComponentBase ::
854 LogRecv_handlerBase(
855 FwIndexType portNum,
856 FwEventIdType id,
857 Fw::Time& timeTag,
858 const Fw::LogSeverity& severity,
859 Fw::LogBuffer& args
860 )
861 {
862 // Make sure port number is valid
863 FW_ASSERT(
864 portNum < this->getNum_LogRecv_InputPorts(),
865 static_cast<FwAssertArgType>(portNum)
866 );
867
868 // Call handler function
869 this->LogRecv_handler(
870 portNum,
871 id,
872 timeTag,
873 severity,
874 args
875 );
876 }
877
878 void ActiveLoggerComponentBase ::
879 pingIn_handlerBase(
880 FwIndexType portNum,
881 U32 key
882 )
883 {
884 // Make sure port number is valid
885 FW_ASSERT(
886 portNum < this->getNum_pingIn_InputPorts(),
887 static_cast<FwAssertArgType>(portNum)
888 );
889
890 // Call pre-message hook
891 pingIn_preMsgHook(
892 portNum,
893 key
894 );
895 ComponentIpcSerializableBuffer msg;
897
898 // Serialize message ID
899 _status = msg.serialize(
900 static_cast<FwEnumStoreType>(PINGIN_PING)
901 );
902 FW_ASSERT(
903 _status == Fw::FW_SERIALIZE_OK,
904 static_cast<FwAssertArgType>(_status)
905 );
906
907 // Serialize port number
908 _status = msg.serialize(portNum);
909 FW_ASSERT(
910 _status == Fw::FW_SERIALIZE_OK,
911 static_cast<FwAssertArgType>(_status)
912 );
913
914 // Serialize argument key
915 _status = msg.serialize(key);
916 FW_ASSERT(
917 _status == Fw::FW_SERIALIZE_OK,
918 static_cast<FwAssertArgType>(_status)
919 );
920
921 // Send message
923 Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
924
925 FW_ASSERT(
926 qStatus == Os::Queue::OP_OK,
927 static_cast<FwAssertArgType>(qStatus)
928 );
929 }
930
931 // ----------------------------------------------------------------------
932 // Pre-message hooks for typed async input ports
933 //
934 // Each of these functions is invoked just before processing a message
935 // on the corresponding port. By default, they do nothing. You can
936 // override them to provide specific pre-message behavior.
937 // ----------------------------------------------------------------------
938
939 void ActiveLoggerComponentBase ::
940 pingIn_preMsgHook(
941 FwIndexType portNum,
942 U32 key
943 )
944 {
945 // Default: no-op
946 }
947
948 // ----------------------------------------------------------------------
949 // Invocation functions for typed output ports
950 // ----------------------------------------------------------------------
951
952 void ActiveLoggerComponentBase ::
953 FatalAnnounce_out(
954 FwIndexType portNum,
956 )
957 {
958 FW_ASSERT(
959 portNum < this->getNum_FatalAnnounce_OutputPorts(),
960 static_cast<FwAssertArgType>(portNum)
961 );
962 this->m_FatalAnnounce_OutputPort[portNum].invoke(
963 Id
964 );
965 }
966
967 void ActiveLoggerComponentBase ::
968 PktSend_out(
969 FwIndexType portNum,
970 Fw::ComBuffer& data,
971 U32 context
972 )
973 {
974 FW_ASSERT(
975 portNum < this->getNum_PktSend_OutputPorts(),
976 static_cast<FwAssertArgType>(portNum)
977 );
978 this->m_PktSend_OutputPort[portNum].invoke(
979 data,
980 context
981 );
982 }
983
984 void ActiveLoggerComponentBase ::
985 pingOut_out(
986 FwIndexType portNum,
987 U32 key
988 )
989 {
990 FW_ASSERT(
991 portNum < this->getNum_pingOut_OutputPorts(),
992 static_cast<FwAssertArgType>(portNum)
993 );
994 this->m_pingOut_OutputPort[portNum].invoke(
995 key
996 );
997 }
998
999 // ----------------------------------------------------------------------
1000 // Internal interface base-class functions
1001 // ----------------------------------------------------------------------
1002
1003 void ActiveLoggerComponentBase ::
1004 loqQueue_internalInterfaceInvoke(
1005 FwEventIdType id,
1006 const Fw::Time& timeTag,
1007 const Fw::LogSeverity& severity,
1008 const Fw::LogBuffer& args
1009 )
1010 {
1011 ComponentIpcSerializableBuffer msg;
1013
1014 // Serialize the message ID
1015 _status = msg.serialize(static_cast<FwEnumStoreType>(INT_IF_LOQQUEUE));
1016 FW_ASSERT (
1017 _status == Fw::FW_SERIALIZE_OK,
1018 static_cast<FwAssertArgType>(_status)
1019 );
1020
1021 // Fake port number to make message dequeue work
1022 _status = msg.serialize(static_cast<FwIndexType>(0));
1023 FW_ASSERT (
1024 _status == Fw::FW_SERIALIZE_OK,
1025 static_cast<FwAssertArgType>(_status)
1026 );
1027
1028 _status = msg.serialize(id);
1029 FW_ASSERT(
1030 _status == Fw::FW_SERIALIZE_OK,
1031 static_cast<FwAssertArgType>(_status)
1032 );
1033
1034 _status = msg.serialize(timeTag);
1035 FW_ASSERT(
1036 _status == Fw::FW_SERIALIZE_OK,
1037 static_cast<FwAssertArgType>(_status)
1038 );
1039
1040 _status = msg.serialize(severity);
1041 FW_ASSERT(
1042 _status == Fw::FW_SERIALIZE_OK,
1043 static_cast<FwAssertArgType>(_status)
1044 );
1045
1046 _status = msg.serialize(args);
1047 FW_ASSERT(
1048 _status == Fw::FW_SERIALIZE_OK,
1049 static_cast<FwAssertArgType>(_status)
1050 );
1051
1052 // Send message
1054 Os::Queue::Status qStatus = this->m_queue.send(msg, 1, _block);
1055
1056 if (qStatus == Os::Queue::Status::FULL) {
1057 this->incNumMsgDropped();
1058 return;
1059 }
1060
1061 FW_ASSERT(
1062 qStatus == Os::Queue::OP_OK,
1063 static_cast<FwAssertArgType>(qStatus)
1064 );
1065 }
1066
1067 // ----------------------------------------------------------------------
1068 // Command response
1069 // ----------------------------------------------------------------------
1070
1071 void ActiveLoggerComponentBase ::
1072 cmdResponse_out(
1073 FwOpcodeType opCode,
1074 U32 cmdSeq,
1075 Fw::CmdResponse response
1076 )
1077 {
1078 FW_ASSERT(this->m_CmdStatus_OutputPort[0].isConnected());
1079 this->m_CmdStatus_OutputPort[0].invoke(opCode, cmdSeq, response);
1080 }
1081
1082 // ----------------------------------------------------------------------
1083 // Command handler base-class functions
1084 //
1085 // Call these functions directly to bypass the command input port
1086 // ----------------------------------------------------------------------
1087
1088 void ActiveLoggerComponentBase ::
1089 SET_EVENT_FILTER_cmdHandlerBase(
1090 FwOpcodeType opCode,
1091 U32 cmdSeq,
1092 Fw::CmdArgBuffer& args
1093 )
1094 {
1095 // Deserialize the arguments
1097
1098 // Reset the buffer
1099 args.resetDeser();
1100
1102 _status = args.deserialize(filterLevel);
1103 if (_status != Fw::FW_SERIALIZE_OK) {
1104 if (this->m_CmdStatus_OutputPort[0].isConnected()) {
1105 this->m_CmdStatus_OutputPort[0].invoke(
1106 opCode,
1107 cmdSeq,
1109 );
1110 }
1111 return;
1112 }
1113
1114 Svc::ActiveLogger_Enabled filterEnabled;
1115 _status = args.deserialize(filterEnabled);
1116 if (_status != Fw::FW_SERIALIZE_OK) {
1117 if (this->m_CmdStatus_OutputPort[0].isConnected()) {
1118 this->m_CmdStatus_OutputPort[0].invoke(
1119 opCode,
1120 cmdSeq,
1122 );
1123 }
1124 return;
1125 }
1126
1127#if FW_CMD_CHECK_RESIDUAL
1128 // Make sure there was no data left over.
1129 // That means the argument buffer size was incorrect.
1130 if (args.getBuffLeft() != 0) {
1131 if (this->m_CmdStatus_OutputPort[0].isConnected()) {
1132 this->m_CmdStatus_OutputPort[0].invoke(
1133 opCode,
1134 cmdSeq,
1136 );
1137 }
1138 return;
1139 }
1140#endif
1141
1142 this->SET_EVENT_FILTER_cmdHandler(
1143 opCode, cmdSeq,
1144 filterLevel,
1145 filterEnabled
1146 );
1147 }
1148
1149 void ActiveLoggerComponentBase ::
1150 SET_ID_FILTER_cmdHandlerBase(
1151 FwOpcodeType opCode,
1152 U32 cmdSeq,
1153 Fw::CmdArgBuffer& args
1154 )
1155 {
1156 // Call pre-message hook
1157 this->SET_ID_FILTER_preMsgHook(opCode,cmdSeq);
1158
1159 // Defer deserializing arguments to the message dispatcher
1160 // to avoid deserializing and reserializing just for IPC
1161 ComponentIpcSerializableBuffer msg;
1163
1164 // Serialize for IPC
1165 _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_SET_ID_FILTER));
1166 FW_ASSERT (
1167 _status == Fw::FW_SERIALIZE_OK,
1168 static_cast<FwAssertArgType>(_status)
1169 );
1170
1171 // Fake port number to make message dequeue work
1172 FwIndexType port = 0;
1173
1174 _status = msg.serialize(port);
1175 FW_ASSERT (
1176 _status == Fw::FW_SERIALIZE_OK,
1177 static_cast<FwAssertArgType>(_status)
1178 );
1179
1180 _status = msg.serialize(opCode);
1181 FW_ASSERT (
1182 _status == Fw::FW_SERIALIZE_OK,
1183 static_cast<FwAssertArgType>(_status)
1184 );
1185
1186 _status = msg.serialize(cmdSeq);
1187 FW_ASSERT (
1188 _status == Fw::FW_SERIALIZE_OK,
1189 static_cast<FwAssertArgType>(_status)
1190 );
1191
1192 _status = msg.serialize(args);
1193 FW_ASSERT (
1194 _status == Fw::FW_SERIALIZE_OK,
1195 static_cast<FwAssertArgType>(_status)
1196 );
1197
1198 // Send message
1200 Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1201
1202 FW_ASSERT(
1203 qStatus == Os::Queue::OP_OK,
1204 static_cast<FwAssertArgType>(qStatus)
1205 );
1206 }
1207
1208 void ActiveLoggerComponentBase ::
1209 DUMP_FILTER_STATE_cmdHandlerBase(
1210 FwOpcodeType opCode,
1211 U32 cmdSeq,
1212 Fw::CmdArgBuffer& args
1213 )
1214 {
1215 // Call pre-message hook
1216 this->DUMP_FILTER_STATE_preMsgHook(opCode,cmdSeq);
1217
1218 // Defer deserializing arguments to the message dispatcher
1219 // to avoid deserializing and reserializing just for IPC
1220 ComponentIpcSerializableBuffer msg;
1222
1223 // Serialize for IPC
1224 _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_DUMP_FILTER_STATE));
1225 FW_ASSERT (
1226 _status == Fw::FW_SERIALIZE_OK,
1227 static_cast<FwAssertArgType>(_status)
1228 );
1229
1230 // Fake port number to make message dequeue work
1231 FwIndexType port = 0;
1232
1233 _status = msg.serialize(port);
1234 FW_ASSERT (
1235 _status == Fw::FW_SERIALIZE_OK,
1236 static_cast<FwAssertArgType>(_status)
1237 );
1238
1239 _status = msg.serialize(opCode);
1240 FW_ASSERT (
1241 _status == Fw::FW_SERIALIZE_OK,
1242 static_cast<FwAssertArgType>(_status)
1243 );
1244
1245 _status = msg.serialize(cmdSeq);
1246 FW_ASSERT (
1247 _status == Fw::FW_SERIALIZE_OK,
1248 static_cast<FwAssertArgType>(_status)
1249 );
1250
1251 _status = msg.serialize(args);
1252 FW_ASSERT (
1253 _status == Fw::FW_SERIALIZE_OK,
1254 static_cast<FwAssertArgType>(_status)
1255 );
1256
1257 // Send message
1259 Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1260
1261 FW_ASSERT(
1262 qStatus == Os::Queue::OP_OK,
1263 static_cast<FwAssertArgType>(qStatus)
1264 );
1265 }
1266
1267 // ----------------------------------------------------------------------
1268 // Pre-message hooks for async commands
1269 //
1270 // Each of these functions is invoked just before processing the
1271 // corresponding command. By default they do nothing. You can
1272 // override them to provide specific pre-command behavior.
1273 // ----------------------------------------------------------------------
1274
1275 void ActiveLoggerComponentBase ::
1276 SET_ID_FILTER_preMsgHook(
1277 FwOpcodeType opCode,
1278 U32 cmdSeq
1279 )
1280 {
1281 // Defaults to no-op; can be overridden
1282 (void) opCode;
1283 (void) cmdSeq;
1284 }
1285
1286 void ActiveLoggerComponentBase ::
1287 DUMP_FILTER_STATE_preMsgHook(
1288 FwOpcodeType opCode,
1289 U32 cmdSeq
1290 )
1291 {
1292 // Defaults to no-op; can be overridden
1293 (void) opCode;
1294 (void) cmdSeq;
1295 }
1296
1297 // ----------------------------------------------------------------------
1298 // Event logging functions
1299 // ----------------------------------------------------------------------
1300
1301 void ActiveLoggerComponentBase ::
1302 log_ACTIVITY_LO_SEVERITY_FILTER_STATE(
1304 bool enabled
1305 ) const
1306 {
1307 // Get the time
1308 Fw::Time _logTime;
1309 if (this->m_Time_OutputPort[0].isConnected()) {
1310 this->m_Time_OutputPort[0].invoke(_logTime);
1311 }
1312
1313 FwEventIdType _id = static_cast<FwEventIdType>(0);
1314
1315 _id = this->getIdBase() + EVENTID_SEVERITY_FILTER_STATE;
1316
1317 // Emit the event on the log port
1318 if (this->m_Log_OutputPort[0].isConnected()) {
1319 Fw::LogBuffer _logBuff;
1321
1322#if FW_AMPCS_COMPATIBLE
1323 // Serialize the number of arguments
1324 _status = _logBuff.serialize(static_cast<U8>(2));
1325 FW_ASSERT(
1326 _status == Fw::FW_SERIALIZE_OK,
1327 static_cast<FwAssertArgType>(_status)
1328 );
1329#endif
1330
1331#if FW_AMPCS_COMPATIBLE
1332 // Serialize the argument size
1333 _status = _logBuff.serialize(
1335 );
1336 FW_ASSERT(
1337 _status == Fw::FW_SERIALIZE_OK,
1338 static_cast<FwAssertArgType>(_status)
1339 );
1340#endif
1341 _status = _logBuff.serialize(severity);
1342 FW_ASSERT(
1343 _status == Fw::FW_SERIALIZE_OK,
1344 static_cast<FwAssertArgType>(_status)
1345 );
1346
1347#if FW_AMPCS_COMPATIBLE
1348 // Serialize the argument size
1349 _status = _logBuff.serialize(
1350 static_cast<U8>(sizeof(U8))
1351 );
1352 FW_ASSERT(
1353 _status == Fw::FW_SERIALIZE_OK,
1354 static_cast<FwAssertArgType>(_status)
1355 );
1356#endif
1357 _status = _logBuff.serialize(enabled);
1358 FW_ASSERT(
1359 _status == Fw::FW_SERIALIZE_OK,
1360 static_cast<FwAssertArgType>(_status)
1361 );
1362
1363 this->m_Log_OutputPort[0].invoke(
1364 _id,
1365 _logTime,
1367 _logBuff
1368 );
1369 }
1370
1371 // Emit the event on the text log port
1372#if FW_ENABLE_TEXT_LOGGING
1373 if (this->m_LogText_OutputPort[0].isConnected()) {
1374#if FW_OBJECT_NAMES == 1
1375 const char* _formatString =
1376 "(%s) %s: %s filter state. %d";
1377#else
1378 const char* _formatString =
1379 "%s: %s filter state. %d";
1380#endif
1381
1382 Fw::String severityStr;
1383 severity.toString(severityStr);
1384
1385 Fw::TextLogString _logString;
1386 _logString.format(
1387 _formatString,
1388#if FW_OBJECT_NAMES == 1
1389 this->m_objName.toChar(),
1390#endif
1391 "SEVERITY_FILTER_STATE ",
1392 severityStr.toChar(),
1393 enabled
1394 );
1395
1396 this->m_LogText_OutputPort[0].invoke(
1397 _id,
1398 _logTime,
1400 _logString
1401 );
1402 }
1403#endif
1404 }
1405
1406 void ActiveLoggerComponentBase ::
1407 log_ACTIVITY_HI_ID_FILTER_ENABLED(U32 ID) const
1408 {
1409 // Get the time
1410 Fw::Time _logTime;
1411 if (this->m_Time_OutputPort[0].isConnected()) {
1412 this->m_Time_OutputPort[0].invoke(_logTime);
1413 }
1414
1415 FwEventIdType _id = static_cast<FwEventIdType>(0);
1416
1417 _id = this->getIdBase() + EVENTID_ID_FILTER_ENABLED;
1418
1419 // Emit the event on the log port
1420 if (this->m_Log_OutputPort[0].isConnected()) {
1421 Fw::LogBuffer _logBuff;
1423
1424#if FW_AMPCS_COMPATIBLE
1425 // Serialize the number of arguments
1426 _status = _logBuff.serialize(static_cast<U8>(1));
1427 FW_ASSERT(
1428 _status == Fw::FW_SERIALIZE_OK,
1429 static_cast<FwAssertArgType>(_status)
1430 );
1431#endif
1432
1433#if FW_AMPCS_COMPATIBLE
1434 // Serialize the argument size
1435 _status = _logBuff.serialize(
1436 static_cast<U8>(sizeof(U32))
1437 );
1438 FW_ASSERT(
1439 _status == Fw::FW_SERIALIZE_OK,
1440 static_cast<FwAssertArgType>(_status)
1441 );
1442#endif
1443 _status = _logBuff.serialize(ID);
1444 FW_ASSERT(
1445 _status == Fw::FW_SERIALIZE_OK,
1446 static_cast<FwAssertArgType>(_status)
1447 );
1448
1449 this->m_Log_OutputPort[0].invoke(
1450 _id,
1451 _logTime,
1453 _logBuff
1454 );
1455 }
1456
1457 // Emit the event on the text log port
1458#if FW_ENABLE_TEXT_LOGGING
1459 if (this->m_LogText_OutputPort[0].isConnected()) {
1460#if FW_OBJECT_NAMES == 1
1461 const char* _formatString =
1462 "(%s) %s: ID %" PRIu32 " is filtered.";
1463#else
1464 const char* _formatString =
1465 "%s: ID %" PRIu32 " is filtered.";
1466#endif
1467
1468 Fw::TextLogString _logString;
1469 _logString.format(
1470 _formatString,
1471#if FW_OBJECT_NAMES == 1
1472 this->m_objName.toChar(),
1473#endif
1474 "ID_FILTER_ENABLED ",
1475 ID
1476 );
1477
1478 this->m_LogText_OutputPort[0].invoke(
1479 _id,
1480 _logTime,
1482 _logString
1483 );
1484 }
1485#endif
1486 }
1487
1488 void ActiveLoggerComponentBase ::
1489 log_WARNING_LO_ID_FILTER_LIST_FULL(U32 ID) const
1490 {
1491 // Get the time
1492 Fw::Time _logTime;
1493 if (this->m_Time_OutputPort[0].isConnected()) {
1494 this->m_Time_OutputPort[0].invoke(_logTime);
1495 }
1496
1497 FwEventIdType _id = static_cast<FwEventIdType>(0);
1498
1499 _id = this->getIdBase() + EVENTID_ID_FILTER_LIST_FULL;
1500
1501 // Emit the event on the log port
1502 if (this->m_Log_OutputPort[0].isConnected()) {
1503 Fw::LogBuffer _logBuff;
1505
1506#if FW_AMPCS_COMPATIBLE
1507 // Serialize the number of arguments
1508 _status = _logBuff.serialize(static_cast<U8>(1));
1509 FW_ASSERT(
1510 _status == Fw::FW_SERIALIZE_OK,
1511 static_cast<FwAssertArgType>(_status)
1512 );
1513#endif
1514
1515#if FW_AMPCS_COMPATIBLE
1516 // Serialize the argument size
1517 _status = _logBuff.serialize(
1518 static_cast<U8>(sizeof(U32))
1519 );
1520 FW_ASSERT(
1521 _status == Fw::FW_SERIALIZE_OK,
1522 static_cast<FwAssertArgType>(_status)
1523 );
1524#endif
1525 _status = _logBuff.serialize(ID);
1526 FW_ASSERT(
1527 _status == Fw::FW_SERIALIZE_OK,
1528 static_cast<FwAssertArgType>(_status)
1529 );
1530
1531 this->m_Log_OutputPort[0].invoke(
1532 _id,
1533 _logTime,
1535 _logBuff
1536 );
1537 }
1538
1539 // Emit the event on the text log port
1540#if FW_ENABLE_TEXT_LOGGING
1541 if (this->m_LogText_OutputPort[0].isConnected()) {
1542#if FW_OBJECT_NAMES == 1
1543 const char* _formatString =
1544 "(%s) %s: ID filter list is full. Cannot filter %" PRIu32 " .";
1545#else
1546 const char* _formatString =
1547 "%s: ID filter list is full. Cannot filter %" PRIu32 " .";
1548#endif
1549
1550 Fw::TextLogString _logString;
1551 _logString.format(
1552 _formatString,
1553#if FW_OBJECT_NAMES == 1
1554 this->m_objName.toChar(),
1555#endif
1556 "ID_FILTER_LIST_FULL ",
1557 ID
1558 );
1559
1560 this->m_LogText_OutputPort[0].invoke(
1561 _id,
1562 _logTime,
1564 _logString
1565 );
1566 }
1567#endif
1568 }
1569
1570 void ActiveLoggerComponentBase ::
1571 log_ACTIVITY_HI_ID_FILTER_REMOVED(U32 ID) const
1572 {
1573 // Get the time
1574 Fw::Time _logTime;
1575 if (this->m_Time_OutputPort[0].isConnected()) {
1576 this->m_Time_OutputPort[0].invoke(_logTime);
1577 }
1578
1579 FwEventIdType _id = static_cast<FwEventIdType>(0);
1580
1581 _id = this->getIdBase() + EVENTID_ID_FILTER_REMOVED;
1582
1583 // Emit the event on the log port
1584 if (this->m_Log_OutputPort[0].isConnected()) {
1585 Fw::LogBuffer _logBuff;
1587
1588#if FW_AMPCS_COMPATIBLE
1589 // Serialize the number of arguments
1590 _status = _logBuff.serialize(static_cast<U8>(1));
1591 FW_ASSERT(
1592 _status == Fw::FW_SERIALIZE_OK,
1593 static_cast<FwAssertArgType>(_status)
1594 );
1595#endif
1596
1597#if FW_AMPCS_COMPATIBLE
1598 // Serialize the argument size
1599 _status = _logBuff.serialize(
1600 static_cast<U8>(sizeof(U32))
1601 );
1602 FW_ASSERT(
1603 _status == Fw::FW_SERIALIZE_OK,
1604 static_cast<FwAssertArgType>(_status)
1605 );
1606#endif
1607 _status = _logBuff.serialize(ID);
1608 FW_ASSERT(
1609 _status == Fw::FW_SERIALIZE_OK,
1610 static_cast<FwAssertArgType>(_status)
1611 );
1612
1613 this->m_Log_OutputPort[0].invoke(
1614 _id,
1615 _logTime,
1617 _logBuff
1618 );
1619 }
1620
1621 // Emit the event on the text log port
1622#if FW_ENABLE_TEXT_LOGGING
1623 if (this->m_LogText_OutputPort[0].isConnected()) {
1624#if FW_OBJECT_NAMES == 1
1625 const char* _formatString =
1626 "(%s) %s: ID filter ID %" PRIu32 " removed.";
1627#else
1628 const char* _formatString =
1629 "%s: ID filter ID %" PRIu32 " removed.";
1630#endif
1631
1632 Fw::TextLogString _logString;
1633 _logString.format(
1634 _formatString,
1635#if FW_OBJECT_NAMES == 1
1636 this->m_objName.toChar(),
1637#endif
1638 "ID_FILTER_REMOVED ",
1639 ID
1640 );
1641
1642 this->m_LogText_OutputPort[0].invoke(
1643 _id,
1644 _logTime,
1646 _logString
1647 );
1648 }
1649#endif
1650 }
1651
1652 void ActiveLoggerComponentBase ::
1653 log_WARNING_LO_ID_FILTER_NOT_FOUND(U32 ID) const
1654 {
1655 // Get the time
1656 Fw::Time _logTime;
1657 if (this->m_Time_OutputPort[0].isConnected()) {
1658 this->m_Time_OutputPort[0].invoke(_logTime);
1659 }
1660
1661 FwEventIdType _id = static_cast<FwEventIdType>(0);
1662
1663 _id = this->getIdBase() + EVENTID_ID_FILTER_NOT_FOUND;
1664
1665 // Emit the event on the log port
1666 if (this->m_Log_OutputPort[0].isConnected()) {
1667 Fw::LogBuffer _logBuff;
1669
1670#if FW_AMPCS_COMPATIBLE
1671 // Serialize the number of arguments
1672 _status = _logBuff.serialize(static_cast<U8>(1));
1673 FW_ASSERT(
1674 _status == Fw::FW_SERIALIZE_OK,
1675 static_cast<FwAssertArgType>(_status)
1676 );
1677#endif
1678
1679#if FW_AMPCS_COMPATIBLE
1680 // Serialize the argument size
1681 _status = _logBuff.serialize(
1682 static_cast<U8>(sizeof(U32))
1683 );
1684 FW_ASSERT(
1685 _status == Fw::FW_SERIALIZE_OK,
1686 static_cast<FwAssertArgType>(_status)
1687 );
1688#endif
1689 _status = _logBuff.serialize(ID);
1690 FW_ASSERT(
1691 _status == Fw::FW_SERIALIZE_OK,
1692 static_cast<FwAssertArgType>(_status)
1693 );
1694
1695 this->m_Log_OutputPort[0].invoke(
1696 _id,
1697 _logTime,
1699 _logBuff
1700 );
1701 }
1702
1703 // Emit the event on the text log port
1704#if FW_ENABLE_TEXT_LOGGING
1705 if (this->m_LogText_OutputPort[0].isConnected()) {
1706#if FW_OBJECT_NAMES == 1
1707 const char* _formatString =
1708 "(%s) %s: ID filter ID %" PRIu32 " not found.";
1709#else
1710 const char* _formatString =
1711 "%s: ID filter ID %" PRIu32 " not found.";
1712#endif
1713
1714 Fw::TextLogString _logString;
1715 _logString.format(
1716 _formatString,
1717#if FW_OBJECT_NAMES == 1
1718 this->m_objName.toChar(),
1719#endif
1720 "ID_FILTER_NOT_FOUND ",
1721 ID
1722 );
1723
1724 this->m_LogText_OutputPort[0].invoke(
1725 _id,
1726 _logTime,
1728 _logString
1729 );
1730 }
1731#endif
1732 }
1733
1734 // ----------------------------------------------------------------------
1735 // Time
1736 // ----------------------------------------------------------------------
1737
1738 Fw::Time ActiveLoggerComponentBase ::
1739 getTime()
1740 {
1741 if (this->m_Time_OutputPort[0].isConnected()) {
1742 Fw::Time _time;
1743 this->m_Time_OutputPort[0].invoke(_time);
1744 return _time;
1745 }
1746 else {
1747 return Fw::Time(TB_NONE, 0, 0);
1748 }
1749 }
1750
1751 // ----------------------------------------------------------------------
1752 // Message dispatch functions
1753 // ----------------------------------------------------------------------
1754
1755 Fw::QueuedComponentBase::MsgDispatchStatus ActiveLoggerComponentBase ::
1756 doDispatch()
1757 {
1758 ComponentIpcSerializableBuffer msg;
1759 FwQueuePriorityType priority = 0;
1760
1761 Os::Queue::Status msgStatus = this->m_queue.receive(
1762 msg,
1764 priority
1765 );
1766 FW_ASSERT(
1767 msgStatus == Os::Queue::OP_OK,
1768 static_cast<FwAssertArgType>(msgStatus)
1769 );
1770
1771 // Reset to beginning of buffer
1772 msg.resetDeser();
1773
1774 FwEnumStoreType desMsg = 0;
1775 Fw::SerializeStatus deserStatus = msg.deserialize(desMsg);
1776 FW_ASSERT(
1777 deserStatus == Fw::FW_SERIALIZE_OK,
1778 static_cast<FwAssertArgType>(deserStatus)
1779 );
1780
1781 MsgTypeEnum msgType = static_cast<MsgTypeEnum>(desMsg);
1782
1783 if (msgType == ACTIVELOGGER_COMPONENT_EXIT) {
1784 return MSG_DISPATCH_EXIT;
1785 }
1786
1787 FwIndexType portNum = 0;
1788 deserStatus = msg.deserialize(portNum);
1789 FW_ASSERT(
1790 deserStatus == Fw::FW_SERIALIZE_OK,
1791 static_cast<FwAssertArgType>(deserStatus)
1792 );
1793
1794 switch (msgType) {
1795 // Handle async input port pingIn
1796 case PINGIN_PING: {
1797 // Deserialize argument key
1798 U32 key;
1799 deserStatus = msg.deserialize(key);
1800 FW_ASSERT(
1801 deserStatus == Fw::FW_SERIALIZE_OK,
1802 static_cast<FwAssertArgType>(deserStatus)
1803 );
1804 // Call handler function
1805 this->pingIn_handler(
1806 portNum,
1807 key
1808 );
1809
1810 break;
1811 }
1812
1813 // Handle command SET_ID_FILTER
1814 case CMD_SET_ID_FILTER: {
1815 // Deserialize opcode
1816 FwOpcodeType opCode = 0;
1817 deserStatus = msg.deserialize(opCode);
1818 FW_ASSERT (
1819 deserStatus == Fw::FW_SERIALIZE_OK,
1820 static_cast<FwAssertArgType>(deserStatus)
1821 );
1822
1823 // Deserialize command sequence
1824 U32 cmdSeq = 0;
1825 deserStatus = msg.deserialize(cmdSeq);
1826 FW_ASSERT (
1827 deserStatus == Fw::FW_SERIALIZE_OK,
1828 static_cast<FwAssertArgType>(deserStatus)
1829 );
1830
1831 // Deserialize command argument buffer
1832 Fw::CmdArgBuffer args;
1833 deserStatus = msg.deserialize(args);
1834 FW_ASSERT (
1835 deserStatus == Fw::FW_SERIALIZE_OK,
1836 static_cast<FwAssertArgType>(deserStatus)
1837 );
1838
1839 // Reset buffer
1840 args.resetDeser();
1841
1842 // Deserialize argument ID
1843 U32 ID;
1844 deserStatus = args.deserialize(ID);
1845 if (deserStatus != Fw::FW_SERIALIZE_OK) {
1846 if (this->m_CmdStatus_OutputPort[0].isConnected()) {
1847 this->cmdResponse_out(
1848 opCode,
1849 cmdSeq,
1851 );
1852 }
1853 // Don't crash the task if bad arguments were passed from the ground
1854 break;
1855 }
1856
1857 // Deserialize argument idFilterEnabled
1858 Svc::ActiveLogger_Enabled idFilterEnabled;
1859 deserStatus = args.deserialize(idFilterEnabled);
1860 if (deserStatus != Fw::FW_SERIALIZE_OK) {
1861 if (this->m_CmdStatus_OutputPort[0].isConnected()) {
1862 this->cmdResponse_out(
1863 opCode,
1864 cmdSeq,
1866 );
1867 }
1868 // Don't crash the task if bad arguments were passed from the ground
1869 break;
1870 }
1871
1872 // Make sure there was no data left over.
1873 // That means the argument buffer size was incorrect.
1874#if FW_CMD_CHECK_RESIDUAL
1875 if (args.getBuffLeft() != 0) {
1876 if (this->m_CmdStatus_OutputPort[0].isConnected()) {
1877 this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
1878 }
1879 // Don't crash the task if bad arguments were passed from the ground
1880 break;
1881 }
1882#endif
1883
1884 // Call handler function
1885 this->SET_ID_FILTER_cmdHandler(
1886 opCode, cmdSeq,
1887 ID,
1888 idFilterEnabled
1889 );
1890
1891 break;
1892 }
1893
1894 // Handle command DUMP_FILTER_STATE
1895 case CMD_DUMP_FILTER_STATE: {
1896 // Deserialize opcode
1897 FwOpcodeType opCode = 0;
1898 deserStatus = msg.deserialize(opCode);
1899 FW_ASSERT (
1900 deserStatus == Fw::FW_SERIALIZE_OK,
1901 static_cast<FwAssertArgType>(deserStatus)
1902 );
1903
1904 // Deserialize command sequence
1905 U32 cmdSeq = 0;
1906 deserStatus = msg.deserialize(cmdSeq);
1907 FW_ASSERT (
1908 deserStatus == Fw::FW_SERIALIZE_OK,
1909 static_cast<FwAssertArgType>(deserStatus)
1910 );
1911
1912 // Deserialize command argument buffer
1913 Fw::CmdArgBuffer args;
1914 deserStatus = msg.deserialize(args);
1915 FW_ASSERT (
1916 deserStatus == Fw::FW_SERIALIZE_OK,
1917 static_cast<FwAssertArgType>(deserStatus)
1918 );
1919
1920 // Reset buffer
1921 args.resetDeser();
1922
1923 // Make sure there was no data left over.
1924 // That means the argument buffer size was incorrect.
1925#if FW_CMD_CHECK_RESIDUAL
1926 if (args.getBuffLeft() != 0) {
1927 if (this->m_CmdStatus_OutputPort[0].isConnected()) {
1928 this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
1929 }
1930 // Don't crash the task if bad arguments were passed from the ground
1931 break;
1932 }
1933#endif
1934
1935 // Call handler function
1936 this->DUMP_FILTER_STATE_cmdHandler(opCode, cmdSeq);
1937
1938 break;
1939 }
1940
1941 // Handle internal interface loqQueue
1942 case INT_IF_LOQQUEUE: {
1943 FwEventIdType id;
1944 deserStatus = msg.deserialize(id);
1945
1946 // Internal interface should always deserialize
1947 FW_ASSERT(
1948 Fw::FW_SERIALIZE_OK == deserStatus,
1949 static_cast<FwAssertArgType>(deserStatus)
1950 );
1951
1952 Fw::Time timeTag;
1953 deserStatus = msg.deserialize(timeTag);
1954
1955 // Internal interface should always deserialize
1956 FW_ASSERT(
1957 Fw::FW_SERIALIZE_OK == deserStatus,
1958 static_cast<FwAssertArgType>(deserStatus)
1959 );
1960
1961 Fw::LogSeverity severity;
1962 deserStatus = msg.deserialize(severity);
1963
1964 // Internal interface should always deserialize
1965 FW_ASSERT(
1966 Fw::FW_SERIALIZE_OK == deserStatus,
1967 static_cast<FwAssertArgType>(deserStatus)
1968 );
1969
1970 Fw::LogBuffer args;
1971 deserStatus = msg.deserialize(args);
1972
1973 // Internal interface should always deserialize
1974 FW_ASSERT(
1975 Fw::FW_SERIALIZE_OK == deserStatus,
1976 static_cast<FwAssertArgType>(deserStatus)
1977 );
1978
1979 // Make sure there was no data left over.
1980 // That means the buffer size was incorrect.
1981 FW_ASSERT(
1982 msg.getBuffLeft() == 0,
1983 static_cast<FwAssertArgType>(msg.getBuffLeft())
1984 );
1985
1986 // Call handler function
1987 this->loqQueue_internalInterfaceHandler(
1988 id,
1989 timeTag,
1990 severity,
1991 args
1992 );
1993
1994 break;
1995 }
1996
1997 default:
1998 return MSG_DISPATCH_ERROR;
1999 }
2000
2001 return MSG_DISPATCH_OK;
2002 }
2003
2004 // ----------------------------------------------------------------------
2005 // Calls for messages received on special input ports
2006 // ----------------------------------------------------------------------
2007
2008 void ActiveLoggerComponentBase ::
2009 m_p_CmdDisp_in(
2010 Fw::PassiveComponentBase* callComp,
2011 FwIndexType portNum,
2012 FwOpcodeType opCode,
2013 U32 cmdSeq,
2014 Fw::CmdArgBuffer& args
2015 )
2016 {
2017 FW_ASSERT(callComp);
2018 ActiveLoggerComponentBase* compPtr = static_cast<ActiveLoggerComponentBase*>(callComp);
2019
2020 const U32 idBase = callComp->getIdBase();
2021 FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
2022
2023 // Select base class function based on opcode
2024 switch (opCode - idBase) {
2025 case OPCODE_SET_EVENT_FILTER: {
2026 compPtr->SET_EVENT_FILTER_cmdHandlerBase(
2027 opCode,
2028 cmdSeq,
2029 args
2030 );
2031 break;
2032 }
2033
2034 case OPCODE_SET_ID_FILTER: {
2035 compPtr->SET_ID_FILTER_cmdHandlerBase(
2036 opCode,
2037 cmdSeq,
2038 args
2039 );
2040 break;
2041 }
2042
2043 case OPCODE_DUMP_FILTER_STATE: {
2044 compPtr->DUMP_FILTER_STATE_cmdHandlerBase(
2045 opCode,
2046 cmdSeq,
2047 args
2048 );
2049 break;
2050 }
2051 }
2052 }
2053
2054 // ----------------------------------------------------------------------
2055 // Calls for messages received on typed input ports
2056 // ----------------------------------------------------------------------
2057
2058 void ActiveLoggerComponentBase ::
2059 m_p_LogRecv_in(
2060 Fw::PassiveComponentBase* callComp,
2061 FwIndexType portNum,
2062 FwEventIdType id,
2063 Fw::Time& timeTag,
2064 const Fw::LogSeverity& severity,
2065 Fw::LogBuffer& args
2066 )
2067 {
2068 FW_ASSERT(callComp);
2069 ActiveLoggerComponentBase* compPtr = static_cast<ActiveLoggerComponentBase*>(callComp);
2070 compPtr->LogRecv_handlerBase(
2071 portNum,
2072 id,
2073 timeTag,
2074 severity,
2075 args
2076 );
2077 }
2078
2079 void ActiveLoggerComponentBase ::
2080 m_p_pingIn_in(
2081 Fw::PassiveComponentBase* callComp,
2082 FwIndexType portNum,
2083 U32 key
2084 )
2085 {
2086 FW_ASSERT(callComp);
2087 ActiveLoggerComponentBase* compPtr = static_cast<ActiveLoggerComponentBase*>(callComp);
2088 compPtr->pingIn_handlerBase(
2089 portNum,
2090 key
2091 );
2092 }
2093
2094}
#define FW_ASSERT(...)
Definition Assert.hpp:14
U8 BYTE
byte type
Definition BasicTypes.h:31
uint8_t U8
8-bit unsigned integer
Definition BasicTypes.h:30
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition BasicTypes.h:70
#define PRI_PlatformIntType
@ TB_NONE
No time base has been established.
Definition FpConfig.h:70
I32 FwEnumStoreType
Definition FpConfig.h:64
PlatformAssertArgType FwAssertArgType
Definition FpConfig.h:39
U32 FwEventIdType
Definition FpConfig.h:103
U32 FwOpcodeType
Definition FpConfig.h:91
PlatformSizeType FwSizeType
Definition FpConfig.h:35
PlatformQueuePriorityType FwQueuePriorityType
Definition FpConfig.h:55
PlatformIndexType FwIndexType
Definition FpConfig.h:25
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects)/*#en...
Definition FpConfig.h:148
@ ACTIVE_COMPONENT_EXIT
message to exit active component task
Enum representing a command response.
@ FORMAT_ERROR
Command failed to deserialize.
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
Definition CmdPortAc.hpp:37
Enum representing event severity.
@ SERIALIZED_SIZE
The size of the serial representation.
@ ACTIVITY_HI
Important informational events.
@ WARNING_LO
A less serious but recoverable event.
@ ACTIVITY_LO
Less important informational events.
void init()
Object initializer.
Definition ObjBase.cpp:27
const char * toChar() const
NATIVE_UINT_TYPE SizeType
void resetDeser()
reset deserialization to beginning
Serializable::SizeType getBuffLeft() const
returns how much deserialization buffer is left
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
void format(const CHAR *formatString,...)
write formatted string to buffer
const char * toChar() const
Definition String.hpp:50
@ SERIALIZED_SIZE
Definition Time.hpp:13
BlockingType
message type
Definition Queue.hpp:44
@ BLOCKING
Message will block until space is available.
Definition Queue.hpp:45
@ NONBLOCKING
Message will return with status when space is unavailable.
Definition Queue.hpp:46
Status
status returned from the queue send function
Definition Queue.hpp:30
@ FULL
queue was full when attempting to send a message
Definition Queue.hpp:39
@ OP_OK
message sent/received okay
Definition Queue.hpp:31
@ SERIALIZED_SIZE
The size of the serial representation.
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.