F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
BufferLoggerComponentAc.hpp
Go to the documentation of this file.
1// ======================================================================
2// \title BufferLoggerComponentAc.hpp
3// \author Generated by fpp-to-cpp
4// \brief hpp file for BufferLogger component base class
5// ======================================================================
6
7#ifndef Svc_BufferLoggerComponentAc_HPP
8#define Svc_BufferLoggerComponentAc_HPP
9
10#include "FpConfig.hpp"
12#include "Fw/Cmd/CmdPortAc.hpp"
15#include "Fw/Cmd/CmdString.hpp"
16#include "Fw/Com/ComPortAc.hpp"
18#include "Fw/Log/LogPortAc.hpp"
19#include "Fw/Log/LogString.hpp"
20#if FW_ENABLE_TEXT_LOGGING == 1
22#endif
26#include "Fw/Tlm/TlmPortAc.hpp"
27#include "Fw/Tlm/TlmString.hpp"
31
32namespace Svc {
33
38 {
39
40 // ----------------------------------------------------------------------
41 // Friend classes
42 // ----------------------------------------------------------------------
43
46
47 PROTECTED:
48
49 // ----------------------------------------------------------------------
50 // Constants
51 // ----------------------------------------------------------------------
52
54 enum {
56 };
57
59 enum {
64 };
65
67 enum {
74 };
75
77 enum {
80 };
81
83 enum {
88 };
89
91 enum {
99 };
100
102 enum {
104 };
105
106 public:
107
108 // ----------------------------------------------------------------------
109 // Component initialization
110 // ----------------------------------------------------------------------
111
113 void init(
114 FwSizeType queueDepth,
115 FwEnumStoreType instance = 0
116 );
117
118 public:
119
120 // ----------------------------------------------------------------------
121 // Getters for special input ports
122 // ----------------------------------------------------------------------
123
128 FwIndexType portNum
129 );
130
131 public:
132
133 // ----------------------------------------------------------------------
134 // Getters for typed input ports
135 // ----------------------------------------------------------------------
136
141 FwIndexType portNum
142 );
143
148 FwIndexType portNum
149 );
150
155 FwIndexType portNum
156 );
157
162 FwIndexType portNum
163 );
164
165 public:
166
167 // ----------------------------------------------------------------------
168 // Connect input ports to special output ports
169 // ----------------------------------------------------------------------
170
173 FwIndexType portNum,
175 );
176
179 FwIndexType portNum,
181 );
182
185 FwIndexType portNum,
186 Fw::InputLogPort* port
187 );
188
189#if FW_ENABLE_TEXT_LOGGING == 1
190
192 void set_eventOutText_OutputPort(
193 FwIndexType portNum,
195 );
196
197#endif
198
201 FwIndexType portNum,
202 Fw::InputTimePort* port
203 );
204
207 FwIndexType portNum,
208 Fw::InputTlmPort* port
209 );
210
211 public:
212
213 // ----------------------------------------------------------------------
214 // Connect typed input ports to typed output ports
215 // ----------------------------------------------------------------------
216
219 FwIndexType portNum,
221 );
222
225 FwIndexType portNum,
226 Svc::InputPingPort* port
227 );
228
229#if FW_PORT_SERIALIZATION
230
231 public:
232
233 // ----------------------------------------------------------------------
234 // Connect serial input ports to special output ports
235 // ----------------------------------------------------------------------
236
239 FwIndexType portNum,
240 Fw::InputSerializePort* port
241 );
242
245 FwIndexType portNum,
246 Fw::InputSerializePort* port
247 );
248
251 FwIndexType portNum,
252 Fw::InputSerializePort* port
253 );
254
255#if FW_ENABLE_TEXT_LOGGING == 1
256
258 void set_eventOutText_OutputPort(
259 FwIndexType portNum,
260 Fw::InputSerializePort* port
261 );
262
263#endif
264
267 FwIndexType portNum,
268 Fw::InputSerializePort* port
269 );
270
273 FwIndexType portNum,
274 Fw::InputSerializePort* port
275 );
276
277#endif
278
279#if FW_PORT_SERIALIZATION
280
281 public:
282
283 // ----------------------------------------------------------------------
284 // Connect serial input ports to typed output ports
285 // ----------------------------------------------------------------------
286
289 FwIndexType portNum,
290 Fw::InputSerializePort* port
291 );
292
295 FwIndexType portNum,
296 Fw::InputSerializePort* port
297 );
298
299#endif
300
301 public:
302
303 // ----------------------------------------------------------------------
304 // Command registration
305 // ----------------------------------------------------------------------
306
310 void regCommands();
311
312 PROTECTED:
313
314 // ----------------------------------------------------------------------
315 // Component construction and destruction
316 // ----------------------------------------------------------------------
317
320 const char* compName = ""
321 );
322
325
326 PROTECTED:
327
328 // ----------------------------------------------------------------------
329 // Getters for numbers of special input ports
330 // ----------------------------------------------------------------------
331
336
337 PROTECTED:
338
339 // ----------------------------------------------------------------------
340 // Getters for numbers of typed input ports
341 // ----------------------------------------------------------------------
342
347
352
357
362
363 PROTECTED:
364
365 // ----------------------------------------------------------------------
366 // Getters for numbers of special output ports
367 // ----------------------------------------------------------------------
368
373
378
383
384#if FW_ENABLE_TEXT_LOGGING == 1
385
389 FwIndexType getNum_eventOutText_OutputPorts() const;
390
391#endif
392
397
402
403 PROTECTED:
404
405 // ----------------------------------------------------------------------
406 // Getters for numbers of typed output ports
407 // ----------------------------------------------------------------------
408
413
418
419 PROTECTED:
420
421 // ----------------------------------------------------------------------
422 // Connection status queries for special output ports
423 // ----------------------------------------------------------------------
424
429 FwIndexType portNum
430 );
431
436 FwIndexType portNum
437 );
438
443 FwIndexType portNum
444 );
445
446#if FW_ENABLE_TEXT_LOGGING == 1
447
451 bool isConnected_eventOutText_OutputPort(
452 FwIndexType portNum
453 );
454
455#endif
456
461 FwIndexType portNum
462 );
463
468 FwIndexType portNum
469 );
470
471 PROTECTED:
472
473 // ----------------------------------------------------------------------
474 // Connection status queries for typed output ports
475 // ----------------------------------------------------------------------
476
481 FwIndexType portNum
482 );
483
488 FwIndexType portNum
489 );
490
491 PROTECTED:
492
493 // ----------------------------------------------------------------------
494 // Handlers to implement for typed input ports
495 // ----------------------------------------------------------------------
496
499 FwIndexType portNum,
500 Fw::Buffer& fwBuffer
501 ) = 0;
502
504 virtual void comIn_handler(
505 FwIndexType portNum,
506 Fw::ComBuffer& data,
507 U32 context
508 ) = 0;
509
511 virtual void pingIn_handler(
512 FwIndexType portNum,
513 U32 key
514 ) = 0;
515
517 virtual void schedIn_handler(
518 FwIndexType portNum,
519 U32 context
520 ) = 0;
521
522 PROTECTED:
523
524 // ----------------------------------------------------------------------
525 // Port handler base-class functions for typed input ports
526 //
527 // Call these functions directly to bypass the corresponding ports
528 // ----------------------------------------------------------------------
529
532 FwIndexType portNum,
533 Fw::Buffer& fwBuffer
534 );
535
538 FwIndexType portNum,
539 Fw::ComBuffer& data,
540 U32 context
541 );
542
545 FwIndexType portNum,
546 U32 key
547 );
548
551 FwIndexType portNum,
552 U32 context
553 );
554
555 PROTECTED:
556
557 // ----------------------------------------------------------------------
558 // Pre-message hooks for typed async input ports
559 //
560 // Each of these functions is invoked just before processing a message
561 // on the corresponding port. By default, they do nothing. You can
562 // override them to provide specific pre-message behavior.
563 // ----------------------------------------------------------------------
564
566 virtual void bufferSendIn_preMsgHook(
567 FwIndexType portNum,
568 Fw::Buffer& fwBuffer
569 );
570
572 virtual void comIn_preMsgHook(
573 FwIndexType portNum,
574 Fw::ComBuffer& data,
575 U32 context
576 );
577
579 virtual void pingIn_preMsgHook(
580 FwIndexType portNum,
581 U32 key
582 );
583
585 virtual void schedIn_preMsgHook(
586 FwIndexType portNum,
587 U32 context
588 );
589
590 PROTECTED:
591
592 // ----------------------------------------------------------------------
593 // Invocation functions for typed output ports
594 // ----------------------------------------------------------------------
595
598 FwIndexType portNum,
599 Fw::Buffer& fwBuffer
600 );
601
603 void pingOut_out(
604 FwIndexType portNum,
605 U32 key
606 );
607
608 PROTECTED:
609
610 // ----------------------------------------------------------------------
611 // Command response
612 // ----------------------------------------------------------------------
613
615 void cmdResponse_out(
616 FwOpcodeType opCode,
617 U32 cmdSeq,
618 Fw::CmdResponse response
619 );
620
621 PROTECTED:
622
623 // ----------------------------------------------------------------------
624 // Command handlers to implement
625 // ----------------------------------------------------------------------
626
631 FwOpcodeType opCode,
632 U32 cmdSeq,
633 const Fw::CmdStringArg& file
634 ) = 0;
635
640 FwOpcodeType opCode,
641 U32 cmdSeq
642 ) = 0;
643
648 FwOpcodeType opCode,
649 U32 cmdSeq,
651 ) = 0;
652
657 FwOpcodeType opCode,
658 U32 cmdSeq
659 ) = 0;
660
661 PROTECTED:
662
663 // ----------------------------------------------------------------------
664 // Command handler base-class functions
665 //
666 // Call these functions directly to bypass the command input port
667 // ----------------------------------------------------------------------
668
673 FwOpcodeType opCode,
674 U32 cmdSeq,
675 Fw::CmdArgBuffer& args
676 );
677
682 FwOpcodeType opCode,
683 U32 cmdSeq,
684 Fw::CmdArgBuffer& args
685 );
686
691 FwOpcodeType opCode,
692 U32 cmdSeq,
693 Fw::CmdArgBuffer& args
694 );
695
700 FwOpcodeType opCode,
701 U32 cmdSeq,
702 Fw::CmdArgBuffer& args
703 );
704
705 PROTECTED:
706
707 // ----------------------------------------------------------------------
708 // Pre-message hooks for async commands
709 //
710 // Each of these functions is invoked just before processing the
711 // corresponding command. By default they do nothing. You can
712 // override them to provide specific pre-command behavior.
713 // ----------------------------------------------------------------------
714
716 virtual void BL_OpenFile_preMsgHook(
717 FwOpcodeType opCode,
718 U32 cmdSeq
719 );
720
722 virtual void BL_CloseFile_preMsgHook(
723 FwOpcodeType opCode,
724 U32 cmdSeq
725 );
726
728 virtual void BL_SetLogging_preMsgHook(
729 FwOpcodeType opCode,
730 U32 cmdSeq
731 );
732
734 virtual void BL_FlushFile_preMsgHook(
735 FwOpcodeType opCode,
736 U32 cmdSeq
737 );
738
739 PROTECTED:
740
741 // ----------------------------------------------------------------------
742 // Event logging functions
743 // ----------------------------------------------------------------------
744
749 const Fw::StringBase& file
750 ) const;
751
756 U32 errornum,
757 const Fw::StringBase& file
758 ) const;
759
764 const Fw::StringBase& validationFile,
765 U32 status
766 ) const;
767
772 U32 errornum,
773 U32 bytesWritten,
774 U32 bytesToWrite,
775 const Fw::StringBase& file
776 ) const;
777
781 void log_ACTIVITY_LO_BL_Activated() const;
782
787
792
793 PROTECTED:
794
795 // ----------------------------------------------------------------------
796 // Telemetry write functions
797 // ----------------------------------------------------------------------
798
803 U32 arg,
804 Fw::Time _tlmTime = Fw::Time()
805 ) const;
806
807 PROTECTED:
808
809 // ----------------------------------------------------------------------
810 // Time
811 // ----------------------------------------------------------------------
812
817
818 PRIVATE:
819
820 // ----------------------------------------------------------------------
821 // Message dispatch functions
822 // ----------------------------------------------------------------------
823
825 virtual MsgDispatchStatus doDispatch();
826
827 PRIVATE:
828
829 // ----------------------------------------------------------------------
830 // Calls for messages received on special input ports
831 // ----------------------------------------------------------------------
832
834 static void m_p_cmdIn_in(
835 Fw::PassiveComponentBase* callComp,
836 FwIndexType portNum,
837 FwOpcodeType opCode,
838 U32 cmdSeq,
839 Fw::CmdArgBuffer& args
840 );
841
842 PRIVATE:
843
844 // ----------------------------------------------------------------------
845 // Calls for messages received on typed input ports
846 // ----------------------------------------------------------------------
847
849 static void m_p_bufferSendIn_in(
850 Fw::PassiveComponentBase* callComp,
851 FwIndexType portNum,
852 Fw::Buffer& fwBuffer
853 );
854
856 static void m_p_comIn_in(
857 Fw::PassiveComponentBase* callComp,
858 FwIndexType portNum,
859 Fw::ComBuffer& data,
860 U32 context
861 );
862
864 static void m_p_pingIn_in(
865 Fw::PassiveComponentBase* callComp,
866 FwIndexType portNum,
867 U32 key
868 );
869
871 static void m_p_schedIn_in(
872 Fw::PassiveComponentBase* callComp,
873 FwIndexType portNum,
874 U32 context
875 );
876
877 PRIVATE:
878
879 // ----------------------------------------------------------------------
880 // Special input ports
881 // ----------------------------------------------------------------------
882
884 Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS];
885
886 PRIVATE:
887
888 // ----------------------------------------------------------------------
889 // Typed input ports
890 // ----------------------------------------------------------------------
891
894
896 Fw::InputComPort m_comIn_InputPort[NUM_COMIN_INPUT_PORTS];
897
899 Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
900
902 Svc::InputSchedPort m_schedIn_InputPort[NUM_SCHEDIN_INPUT_PORTS];
903
904 PRIVATE:
905
906 // ----------------------------------------------------------------------
907 // Special output ports
908 // ----------------------------------------------------------------------
909
911 Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS];
912
915
917 Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS];
918
919#if FW_ENABLE_TEXT_LOGGING == 1
920
922 Fw::OutputLogTextPort m_eventOutText_OutputPort[NUM_EVENTOUTTEXT_OUTPUT_PORTS];
923
924#endif
925
927 Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
928
930 Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
931
932 PRIVATE:
933
934 // ----------------------------------------------------------------------
935 // Typed output ports
936 // ----------------------------------------------------------------------
937
940
942 Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
943
944 };
945
946}
947
948#endif
I32 FwEnumStoreType
Definition FpConfig.h:64
U32 FwOpcodeType
Definition FpConfig.h:91
PlatformSizeType FwSizeType
Definition FpConfig.h:35
PlatformIndexType FwIndexType
Definition FpConfig.h:25
C++-compatible configuration header for fprime configuration.
Enum representing a command response.
void init()
Object initializer.
Definition ObjBase.cpp:27
Auto-generated base for BufferLogger component.
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum)
Fw::InputBufferSendPort * get_bufferSendIn_InputPort(FwIndexType portNum)
friend class BufferLoggerComponentBaseFriend
Friend class for white-box testing.
Fw::InputComPort * get_comIn_InputPort(FwIndexType portNum)
bool isConnected_pingOut_OutputPort(FwIndexType portNum)
@ EVENTID_BL_ACTIVATED
Buffer logger was activated.
@ EVENTID_BL_LOGFILEWRITEERROR
The Buffer Logger encountered an error writing to a log file.
@ EVENTID_BL_LOGFILEVALIDATIONERROR
The Buffer Logger encountered an error writing a validation file.
@ EVENTID_BL_DEACTIVATED
Buffer logger was deactivated.
@ EVENTID_BL_LOGFILECLOSED
The Buffer Logger closed a log file.
@ EVENTID_BL_LOGFILEOPENERROR
The Buffer Logger encountered an error opening a log file.
@ EVENTID_BL_NOLOGFILEOPENINITERROR
No log file open command was received by BufferLogger.
void set_pingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
virtual void BL_OpenFile_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg &file)=0
virtual void BL_OpenFile_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command BL_OpenFile.
virtual void comIn_handler(FwIndexType portNum, Fw::ComBuffer &data, U32 context)=0
Handler for input port comIn.
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
bool isConnected_tlmOut_OutputPort(FwIndexType portNum)
@ OPCODE_BL_FLUSHFILE
Flushes the current open log file to disk; a no-op with fprime's unbuffered file I/O,...
@ OPCODE_BL_SETLOGGING
Sets the volatile logging state.
@ OPCODE_BL_OPENFILE
Open a new log file with specified name; also resets unique file counter to 0.
@ OPCODE_BL_CLOSEFILE
Close the currently open log file, if any.
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
void comIn_handlerBase(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Handler base-class function for input port comIn.
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
virtual void BL_SetLogging_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::BufferLogger_LogState state)=0
virtual void schedIn_preMsgHook(FwIndexType portNum, U32 context)
Pre-message hook for async input port schedIn.
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
virtual void BL_SetLogging_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command BL_SetLogging.
virtual void BL_FlushFile_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command BL_FlushFile.
void BL_FlushFile_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
virtual void BL_CloseFile_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command BL_CloseFile.
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
virtual ~BufferLoggerComponentBase()
Destroy BufferLoggerComponentBase object.
virtual void schedIn_handler(FwIndexType portNum, U32 context)=0
Handler for input port schedIn.
Svc::InputSchedPort * get_schedIn_InputPort(FwIndexType portNum)
virtual void BL_CloseFile_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
void log_WARNING_HI_BL_LogFileWriteError(U32 errornum, U32 bytesWritten, U32 bytesToWrite, const Fw::StringBase &file) const
void schedIn_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port schedIn.
virtual void bufferSendIn_preMsgHook(FwIndexType portNum, Fw::Buffer &fwBuffer)
Pre-message hook for async input port bufferSendIn.
void set_bufferSendOut_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferSendOut[portNum].
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
virtual void BL_FlushFile_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
FwIndexType getNum_cmdResponseOut_OutputPorts() const
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
void regCommands()
Register commands with the Command Dispatcher.
void set_eventOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to eventOut[portNum].
void bufferSendOut_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port bufferSendOut.
void tlmWrite_BufferLogger_NumLoggedBuffers(U32 arg, Fw::Time _tlmTime=Fw::Time()) const
void log_WARNING_HI_BL_LogFileOpenError(U32 errornum, const Fw::StringBase &file) const
void log_DIAGNOSTIC_BL_LogFileClosed(const Fw::StringBase &file) const
bool isConnected_bufferSendOut_OutputPort(FwIndexType portNum)
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
void BL_OpenFile_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum)
void bufferSendIn_handlerBase(FwIndexType portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port bufferSendIn.
@ CHANNELID_BUFFERLOGGER_NUMLOGGEDBUFFERS
Channel ID for BufferLogger_NumLoggedBuffers.
void BL_SetLogging_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void BL_CloseFile_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
virtual void comIn_preMsgHook(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Pre-message hook for async input port comIn.
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
void log_WARNING_HI_BL_LogFileValidationError(const Fw::StringBase &validationFile, U32 status) const
bool isConnected_eventOut_OutputPort(FwIndexType portNum)
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
virtual void bufferSendIn_handler(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Handler for input port bufferSendIn.