F´ Flight Software - C/C++ Documentation NASA-v1.6.0
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PrmDbComponentAc.hpp
Go to the documentation of this file.
1// ======================================================================
2// \title PrmDbComponentAc.hpp
3// \author Generated by fpp-to-cpp
4// \brief hpp file for PrmDb component base class
5// ======================================================================
6
7#ifndef Svc_PrmDbComponentAc_HPP
8#define Svc_PrmDbComponentAc_HPP
9
10#include "FpConfig.hpp"
11#include "Fw/Cmd/CmdPortAc.hpp"
14#include "Fw/Cmd/CmdString.hpp"
16#include "Fw/Log/LogPortAc.hpp"
17#include "Fw/Log/LogString.hpp"
18#if FW_ENABLE_TEXT_LOGGING == 1
20#endif
26#include "Os/Mutex.hpp"
30
31namespace Svc {
32
39 {
40
41 // ----------------------------------------------------------------------
42 // Friend classes
43 // ----------------------------------------------------------------------
44
47
48 PROTECTED:
49
50 // ----------------------------------------------------------------------
51 // Constants
52 // ----------------------------------------------------------------------
53
55 enum {
57 };
58
60 enum {
64 };
65
67 enum {
73 };
74
76 enum {
78 };
79
81 enum {
83 };
84
86 enum {
95 };
96
98 enum {
100 };
101
102 public:
103
104 // ----------------------------------------------------------------------
105 // Component initialization
106 // ----------------------------------------------------------------------
107
109 void init(
110 NATIVE_INT_TYPE queueDepth,
111 NATIVE_INT_TYPE instance = 0
112 );
113
114 public:
115
116 // ----------------------------------------------------------------------
117 // Getters for special input ports
118 // ----------------------------------------------------------------------
119
124 NATIVE_INT_TYPE portNum
125 );
126
127 public:
128
129 // ----------------------------------------------------------------------
130 // Getters for typed input ports
131 // ----------------------------------------------------------------------
132
137 NATIVE_INT_TYPE portNum
138 );
139
144 NATIVE_INT_TYPE portNum
145 );
146
151 NATIVE_INT_TYPE portNum
152 );
153
154 public:
155
156 // ----------------------------------------------------------------------
157 // Connect special input ports to special output ports
158 // ----------------------------------------------------------------------
159
162 NATIVE_INT_TYPE portNum,
164 );
165
168 NATIVE_INT_TYPE portNum,
170 );
171
174 NATIVE_INT_TYPE portNum,
175 Fw::InputLogPort* port
176 );
177
178#if FW_ENABLE_TEXT_LOGGING == 1
179
181 void set_LogText_OutputPort(
182 NATIVE_INT_TYPE portNum,
184 );
185
186#endif
187
190 NATIVE_INT_TYPE portNum,
191 Fw::InputTimePort* port
192 );
193
194 public:
195
196 // ----------------------------------------------------------------------
197 // Connect typed input ports to typed output ports
198 // ----------------------------------------------------------------------
199
202 NATIVE_INT_TYPE portNum,
203 Svc::InputPingPort* port
204 );
205
206#if FW_PORT_SERIALIZATION
207
208 public:
209
210 // ----------------------------------------------------------------------
211 // Connect serial input ports to special output ports
212 // ----------------------------------------------------------------------
213
216 NATIVE_INT_TYPE portNum,
217 Fw::InputSerializePort* port
218 );
219
222 NATIVE_INT_TYPE portNum,
223 Fw::InputSerializePort* port
224 );
225
228 NATIVE_INT_TYPE portNum,
229 Fw::InputSerializePort* port
230 );
231
232#if FW_ENABLE_TEXT_LOGGING == 1
233
235 void set_LogText_OutputPort(
236 NATIVE_INT_TYPE portNum,
237 Fw::InputSerializePort* port
238 );
239
240#endif
241
244 NATIVE_INT_TYPE portNum,
245 Fw::InputSerializePort* port
246 );
247
248#endif
249
250#if FW_PORT_SERIALIZATION
251
252 public:
253
254 // ----------------------------------------------------------------------
255 // Connect serial input ports to typed output ports
256 // ----------------------------------------------------------------------
257
260 NATIVE_INT_TYPE portNum,
261 Fw::InputSerializePort* port
262 );
263
264#endif
265
266 public:
267
268 // ----------------------------------------------------------------------
269 // Command registration
270 // ----------------------------------------------------------------------
271
275 void regCommands();
276
277 PROTECTED:
278
279 // ----------------------------------------------------------------------
280 // Component construction and destruction
281 // ----------------------------------------------------------------------
282
285 const char* compName = ""
286 );
287
289 virtual ~PrmDbComponentBase();
290
291 PROTECTED:
292
293 // ----------------------------------------------------------------------
294 // Getters for numbers of special input ports
295 // ----------------------------------------------------------------------
296
301
302 PROTECTED:
303
304 // ----------------------------------------------------------------------
305 // Getters for numbers of typed input ports
306 // ----------------------------------------------------------------------
307
312
317
322
323 PROTECTED:
324
325 // ----------------------------------------------------------------------
326 // Getters for numbers of special output ports
327 // ----------------------------------------------------------------------
328
333
338
343
344#if FW_ENABLE_TEXT_LOGGING == 1
345
349 NATIVE_INT_TYPE getNum_LogText_OutputPorts();
350
351#endif
352
357
358 PROTECTED:
359
360 // ----------------------------------------------------------------------
361 // Getters for numbers of typed output ports
362 // ----------------------------------------------------------------------
363
368
369 PROTECTED:
370
371 // ----------------------------------------------------------------------
372 // Connection status queries for special output ports
373 // ----------------------------------------------------------------------
374
379 NATIVE_INT_TYPE portNum
380 );
381
386 NATIVE_INT_TYPE portNum
387 );
388
393 NATIVE_INT_TYPE portNum
394 );
395
396#if FW_ENABLE_TEXT_LOGGING == 1
397
401 bool isConnected_LogText_OutputPort(
402 NATIVE_INT_TYPE portNum
403 );
404
405#endif
406
411 NATIVE_INT_TYPE portNum
412 );
413
414 PROTECTED:
415
416 // ----------------------------------------------------------------------
417 // Connection status queries for typed output ports
418 // ----------------------------------------------------------------------
419
424 NATIVE_INT_TYPE portNum
425 );
426
427 PROTECTED:
428
429 // ----------------------------------------------------------------------
430 // Handlers to implement for typed input ports
431 // ----------------------------------------------------------------------
432
435 NATIVE_INT_TYPE portNum,
436 FwPrmIdType id,
437 Fw::ParamBuffer& val
438 ) = 0;
439
441 virtual void pingIn_handler(
442 NATIVE_INT_TYPE portNum,
443 U32 key
444 ) = 0;
445
447 virtual void setPrm_handler(
448 NATIVE_INT_TYPE portNum,
449 FwPrmIdType id,
450 Fw::ParamBuffer& val
451 ) = 0;
452
453 PROTECTED:
454
455 // ----------------------------------------------------------------------
456 // Port handler base-class functions for typed input ports
457 //
458 // Call these functions directly to bypass the corresponding ports
459 // ----------------------------------------------------------------------
460
463 NATIVE_INT_TYPE portNum,
464 FwPrmIdType id,
465 Fw::ParamBuffer& val
466 );
467
470 NATIVE_INT_TYPE portNum,
471 U32 key
472 );
473
476 NATIVE_INT_TYPE portNum,
477 FwPrmIdType id,
478 Fw::ParamBuffer& val
479 );
480
481 PROTECTED:
482
483 // ----------------------------------------------------------------------
484 // Pre-message hooks for typed async input ports
485 //
486 // Each of these functions is invoked just before processing a message
487 // on the corresponding port. By default, they do nothing. You can
488 // override them to provide specific pre-message behavior.
489 // ----------------------------------------------------------------------
490
492 virtual void pingIn_preMsgHook(
493 NATIVE_INT_TYPE portNum,
494 U32 key
495 );
496
498 virtual void setPrm_preMsgHook(
499 NATIVE_INT_TYPE portNum,
500 FwPrmIdType id,
501 Fw::ParamBuffer& val
502 );
503
504 PROTECTED:
505
506 // ----------------------------------------------------------------------
507 // Invocation functions for typed output ports
508 // ----------------------------------------------------------------------
509
511 void pingOut_out(
512 NATIVE_INT_TYPE portNum,
513 U32 key
514 );
515
516 PROTECTED:
517
518 // ----------------------------------------------------------------------
519 // Command response
520 // ----------------------------------------------------------------------
521
523 void cmdResponse_out(
524 FwOpcodeType opCode,
525 U32 cmdSeq,
526 Fw::CmdResponse response
527 );
528
529 PROTECTED:
530
531 // ----------------------------------------------------------------------
532 // Command handlers to implement
533 // ----------------------------------------------------------------------
534
539 FwOpcodeType opCode,
540 U32 cmdSeq
541 ) = 0;
542
543 PROTECTED:
544
545 // ----------------------------------------------------------------------
546 // Command handler base-class functions
547 //
548 // Call these functions directly to bypass the command input port
549 // ----------------------------------------------------------------------
550
555 FwOpcodeType opCode,
556 U32 cmdSeq,
557 Fw::CmdArgBuffer& args
558 );
559
560 PROTECTED:
561
562 // ----------------------------------------------------------------------
563 // Pre-message hooks for async commands
564 //
565 // Each of these functions is invoked just before processing the
566 // corresponding command. By default they do nothing. You can
567 // override them to provide specific pre-command behavior.
568 // ----------------------------------------------------------------------
569
571 virtual void PRM_SAVE_FILE_preMsgHook(
572 FwOpcodeType opCode,
573 U32 cmdSeq
574 );
575
576 PROTECTED:
577
578 // ----------------------------------------------------------------------
579 // Event logging functions
580 // ----------------------------------------------------------------------
581
586 U32 Id
587 );
588
593 U32 Id
594 );
595
600 U32 Id
601 );
602
607 U32 Id
608 );
609
615 I32 record,
616 I32 error
617 );
618
623 U32 records
624 );
625
631 I32 record,
632 I32 error
633 );
634
639 U32 records
640 );
641
642 PROTECTED:
643
644 // ----------------------------------------------------------------------
645 // Event throttle reset functions
646 // ----------------------------------------------------------------------
647
650
651 PROTECTED:
652
653 // ----------------------------------------------------------------------
654 // Time
655 // ----------------------------------------------------------------------
656
661
662 PROTECTED:
663
664 // ----------------------------------------------------------------------
665 // Mutex operations for guarded ports
666 //
667 // You can override these operations to provide more sophisticated
668 // synchronization
669 // ----------------------------------------------------------------------
670
672 virtual void lock();
673
675 virtual void unLock();
676
677 PRIVATE:
678
679 // ----------------------------------------------------------------------
680 // Message dispatch functions
681 // ----------------------------------------------------------------------
682
684 virtual MsgDispatchStatus doDispatch();
685
686 PRIVATE:
687
688 // ----------------------------------------------------------------------
689 // Calls for messages received on special input ports
690 // ----------------------------------------------------------------------
691
693 static void m_p_CmdDisp_in(
694 Fw::PassiveComponentBase* callComp,
695 NATIVE_INT_TYPE portNum,
696 FwOpcodeType opCode,
697 U32 cmdSeq,
698 Fw::CmdArgBuffer& args
699 );
700
701 PRIVATE:
702
703 // ----------------------------------------------------------------------
704 // Calls for messages received on typed input ports
705 // ----------------------------------------------------------------------
706
708 static Fw::ParamValid m_p_getPrm_in(
709 Fw::PassiveComponentBase* callComp,
710 NATIVE_INT_TYPE portNum,
711 FwPrmIdType id,
712 Fw::ParamBuffer& val
713 );
714
716 static void m_p_pingIn_in(
717 Fw::PassiveComponentBase* callComp,
718 NATIVE_INT_TYPE portNum,
719 U32 key
720 );
721
723 static void m_p_setPrm_in(
724 Fw::PassiveComponentBase* callComp,
725 NATIVE_INT_TYPE portNum,
726 FwPrmIdType id,
727 Fw::ParamBuffer& val
728 );
729
730 PRIVATE:
731
732 // ----------------------------------------------------------------------
733 // Special input ports
734 // ----------------------------------------------------------------------
735
737 Fw::InputCmdPort m_CmdDisp_InputPort[NUM_CMDDISP_INPUT_PORTS];
738
739 PRIVATE:
740
741 // ----------------------------------------------------------------------
742 // Typed input ports
743 // ----------------------------------------------------------------------
744
747
749 Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
750
753
754 PRIVATE:
755
756 // ----------------------------------------------------------------------
757 // Special output ports
758 // ----------------------------------------------------------------------
759
762
765
767 Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
768
769#if FW_ENABLE_TEXT_LOGGING == 1
770
773
774#endif
775
777 Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
778
779 PRIVATE:
780
781 // ----------------------------------------------------------------------
782 // Typed output ports
783 // ----------------------------------------------------------------------
784
786 Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
787
788 PRIVATE:
789
790 // ----------------------------------------------------------------------
791 // Counter values for event throttling
792 // ----------------------------------------------------------------------
793
795 NATIVE_UINT_TYPE m_PrmIdNotFoundThrottle;
796
797 PRIVATE:
798
799 // ----------------------------------------------------------------------
800 // Mutexes
801 // ----------------------------------------------------------------------
802
804 Os::Mutex m_guardedPortMutex;
805
806 };
807
808}
809
810#endif
PlatformIntType NATIVE_INT_TYPE
Definition BasicTypes.h:51
PlatformUIntType NATIVE_UINT_TYPE
Definition BasicTypes.h:52
U32 FwOpcodeType
Definition FpConfig.h:56
U32 FwPrmIdType
Definition FpConfig.h:65
C++-compatible configuration header for fprime configuration.
Enum representing a command response.
void init()
Object initializer.
Definition ObjBase.cpp:27
Enum representing parameter validity.
Auto-generated base for PrmDb component.
virtual void unLock()
Unlock the guarded mutex.
NATIVE_INT_TYPE getNum_getPrm_InputPorts()
Svc::InputPingPort * get_pingIn_InputPort(NATIVE_INT_TYPE portNum)
void log_WARNING_HI_PrmFileReadError(Svc::PrmDb_PrmReadError stage, I32 record, I32 error)
bool isConnected_Time_OutputPort(NATIVE_INT_TYPE portNum)
void log_WARNING_HI_PrmFileWriteError(Svc::PrmDb_PrmWriteError stage, I32 record, I32 error)
void log_ACTIVITY_HI_PrmIdUpdated(U32 Id)
virtual ~PrmDbComponentBase()
Destroy PrmDbComponentBase object.
void log_WARNING_LO_PrmIdNotFound_ThrottleClear()
Reset throttle value for PrmIdNotFound.
bool isConnected_pingOut_OutputPort(NATIVE_INT_TYPE portNum)
PrmDbComponentBase(const char *compName="")
Construct PrmDbComponentBase object.
@ EVENTID_PRMDBFULL
Parameter database is full.
@ EVENTID_PRMFILESAVECOMPLETE
Save of parameter file completed.
@ EVENTID_PRMIDADDED
Parameter ID added to database.
@ EVENTID_PRMFILEREADERROR
Failed to read parameter file.
@ EVENTID_PRMIDNOTFOUND
Parameter ID not found in database.
@ EVENTID_PRMFILELOADCOMPLETE
Load of parameter file completed.
@ EVENTID_PRMFILEWRITEERROR
Failed to write parameter file.
@ EVENTID_PRMIDUPDATED
Parameter ID updated in database.
NATIVE_INT_TYPE getNum_pingOut_OutputPorts()
@ EVENTID_PRMIDNOTFOUND_THROTTLE
Throttle reset count for PrmIdNotFound.
void set_CmdReg_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputCmdRegPort *port)
Connect port to CmdReg[portNum].
void set_CmdStatus_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputCmdResponsePort *port)
Connect port to CmdStatus[portNum].
virtual void pingIn_handler(NATIVE_INT_TYPE portNum, U32 key)=0
Handler for input port pingIn.
NATIVE_INT_TYPE getNum_CmdStatus_OutputPorts()
virtual void PRM_SAVE_FILE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
void pingIn_handlerBase(NATIVE_INT_TYPE portNum, U32 key)
Handler base-class function for input port pingIn.
@ OPCODE_PRM_SAVE_FILE
Command to save parameter image to file. Uses file name passed to constructor.
Fw::InputCmdPort * get_CmdDisp_InputPort(NATIVE_INT_TYPE portNum)
NATIVE_INT_TYPE getNum_CmdDisp_InputPorts()
virtual void pingIn_preMsgHook(NATIVE_INT_TYPE portNum, U32 key)
Pre-message hook for async input port pingIn.
void set_Log_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
void PRM_SAVE_FILE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
NATIVE_INT_TYPE getNum_Time_OutputPorts()
bool isConnected_CmdStatus_OutputPort(NATIVE_INT_TYPE portNum)
virtual void setPrm_preMsgHook(NATIVE_INT_TYPE portNum, FwPrmIdType id, Fw::ParamBuffer &val)
Pre-message hook for async input port setPrm.
virtual void lock()
Lock the guarded mutex.
void setPrm_handlerBase(NATIVE_INT_TYPE portNum, FwPrmIdType id, Fw::ParamBuffer &val)
Handler base-class function for input port setPrm.
bool isConnected_Log_OutputPort(NATIVE_INT_TYPE portNum)
friend class PrmDbComponentBaseFriend
Friend class for white-box testing.
virtual void setPrm_handler(NATIVE_INT_TYPE portNum, FwPrmIdType id, Fw::ParamBuffer &val)=0
Handler for input port setPrm.
virtual void PRM_SAVE_FILE_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command PRM_SAVE_FILE.
void regCommands()
Register commands with the Command Dispatcher.
virtual Fw::ParamValid getPrm_handler(NATIVE_INT_TYPE portNum, FwPrmIdType id, Fw::ParamBuffer &val)=0
Handler for input port getPrm.
void pingOut_out(NATIVE_INT_TYPE portNum, U32 key)
Invoke output port pingOut.
void log_ACTIVITY_HI_PrmFileLoadComplete(U32 records)
Fw::InputPrmGetPort * get_getPrm_InputPort(NATIVE_INT_TYPE portNum)
void log_WARNING_LO_PrmIdNotFound(U32 Id)
bool isConnected_CmdReg_OutputPort(NATIVE_INT_TYPE portNum)
void log_ACTIVITY_HI_PrmFileSaveComplete(U32 records)
Fw::ParamValid getPrm_handlerBase(NATIVE_INT_TYPE portNum, FwPrmIdType id, Fw::ParamBuffer &val)
Handler base-class function for input port getPrm.
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
NATIVE_INT_TYPE getNum_Log_OutputPorts()
Fw::InputPrmSetPort * get_setPrm_InputPort(NATIVE_INT_TYPE portNum)
NATIVE_INT_TYPE getNum_pingIn_InputPorts()
NATIVE_INT_TYPE getNum_CmdReg_OutputPorts()
NATIVE_INT_TYPE getNum_setPrm_InputPorts()
void set_pingOut_OutputPort(NATIVE_INT_TYPE portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
void set_Time_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].