F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
Svc::CmdSequencerComponentImpl Class Reference

#include <Svc/CmdSequencer/CmdSequencerImpl.hpp>

Inheritance diagram for Svc::CmdSequencerComponentImpl:
Svc::CmdSequencerComponentBase Fw::ActiveComponentBase Fw::QueuedComponentBase Fw::PassiveComponentBase Fw::ObjBase

Classes

class  FPrimeSequence
 A sequence that uses the F Prime binary format. More...
 
class  Sequence
 A sequence with unspecified binary format. More...
 

Public Member Functions

 CmdSequencerComponentImpl (const char *compName)
 Construct a CmdSequencer. More...
 
void init (const NATIVE_INT_TYPE queueDepth, const NATIVE_INT_TYPE instance)
 Initialize a CmdSequencer. More...
 
void setTimeout (const NATIVE_UINT_TYPE seconds)
 
void setSequenceFormat (Sequence &sequence)
 
void allocateBuffer (const NATIVE_INT_TYPE identifier, Fw::MemAllocator &allocator, const NATIVE_UINT_TYPE bytes)
 
void loadSequence (const Fw::StringBase &fileName)
 
void deallocateBuffer (Fw::MemAllocator &allocator)
 Return allocated buffer. Call during shutdown. More...
 
 ~CmdSequencerComponentImpl ()
 Destroy a CmdDispatcherComponentBase. More...
 
- Public Member Functions inherited from Svc::CmdSequencerComponentBase
void init (FwQueueSizeType queueDepth, FwEnumStoreType instance=0)
 Initialize CmdSequencerComponentBase object. More...
 
Fw::InputCmdPortget_cmdIn_InputPort (FwIndexType portNum)
 
Fw::InputCmdResponsePortget_cmdResponseIn_InputPort (FwIndexType portNum)
 
Svc::InputPingPortget_pingIn_InputPort (FwIndexType portNum)
 
Svc::InputSchedPortget_schedIn_InputPort (FwIndexType portNum)
 
Svc::InputCmdSeqCancelPortget_seqCancelIn_InputPort (FwIndexType portNum)
 
Svc::InputCmdSeqInPortget_seqRunIn_InputPort (FwIndexType portNum)
 
void set_cmdRegOut_OutputPort (FwIndexType portNum, Fw::InputCmdRegPort *port)
 Connect port to cmdRegOut[portNum]. More...
 
void set_cmdResponseOut_OutputPort (FwIndexType portNum, Fw::InputCmdResponsePort *port)
 Connect port to cmdResponseOut[portNum]. More...
 
void set_logOut_OutputPort (FwIndexType portNum, Fw::InputLogPort *port)
 Connect port to logOut[portNum]. More...
 
void set_timeCaller_OutputPort (FwIndexType portNum, Fw::InputTimePort *port)
 Connect port to timeCaller[portNum]. More...
 
void set_tlmOut_OutputPort (FwIndexType portNum, Fw::InputTlmPort *port)
 Connect port to tlmOut[portNum]. More...
 
void set_comCmdOut_OutputPort (FwIndexType portNum, Fw::InputComPort *port)
 Connect port to comCmdOut[portNum]. More...
 
void set_pingOut_OutputPort (FwIndexType portNum, Svc::InputPingPort *port)
 Connect port to pingOut[portNum]. More...
 
void set_seqDone_OutputPort (FwIndexType portNum, Fw::InputCmdResponsePort *port)
 Connect port to seqDone[portNum]. More...
 
void regCommands ()
 Register commands with the Command Dispatcher. More...
 
- Public Member Functions inherited from Fw::ActiveComponentBase
void start (Os::Task::ParamType priority=Os::Task::TASK_DEFAULT, Os::Task::ParamType stackSize=Os::Task::TASK_DEFAULT, Os::Task::ParamType cpuAffinity=Os::Task::TASK_DEFAULT, Os::Task::ParamType identifier=Os::Task::TASK_DEFAULT)
 called by instantiator when task is to be started More...
 
void exit ()
 exit task in active component More...
 
Os::Task::Status join ()
 Join the thread. More...
 
 DEPRECATED (Os::Task::Status join(void **value_ptr), "Switch to .join()")
 Join to thread with discarded value_ptr. More...
 
- Public Member Functions inherited from Fw::PassiveComponentBase
void setIdBase (const U32)
 Set the ID base. More...
 
U32 getIdBase () const
 

Additional Inherited Members

- Public Types inherited from Fw::ActiveComponentBase
enum  { ACTIVE_COMPONENT_EXIT }
 
- Public Types inherited from Fw::QueuedComponentBase
enum  MsgDispatchStatus { MSG_DISPATCH_OK , MSG_DISPATCH_EMPTY , MSG_DISPATCH_ERROR , MSG_DISPATCH_EXIT }
 
- Protected Types inherited from Svc::CmdSequencerComponentBase
enum  { NUM_CMDIN_INPUT_PORTS = 1 }
 Enumerations for numbers of special input ports. More...
 
enum  {
  NUM_CMDRESPONSEIN_INPUT_PORTS = 1 , NUM_PINGIN_INPUT_PORTS = 1 , NUM_SCHEDIN_INPUT_PORTS = 1 , NUM_SEQCANCELIN_INPUT_PORTS = 1 ,
  NUM_SEQRUNIN_INPUT_PORTS = 1
}
 Enumerations for numbers of typed input ports. More...
 
enum  {
  NUM_LOGTEXT_OUTPUT_PORTS = 1 , NUM_CMDREGOUT_OUTPUT_PORTS = 1 , NUM_CMDRESPONSEOUT_OUTPUT_PORTS = 1 , NUM_LOGOUT_OUTPUT_PORTS = 1 ,
  NUM_TIMECALLER_OUTPUT_PORTS = 1 , NUM_TLMOUT_OUTPUT_PORTS = 1
}
 Enumerations for numbers of special output ports. More...
 
enum  { NUM_COMCMDOUT_OUTPUT_PORTS = 1 , NUM_PINGOUT_OUTPUT_PORTS = 1 , NUM_SEQDONE_OUTPUT_PORTS = 1 }
 Enumerations for numbers of typed output ports. More...
 
enum  {
  OPCODE_CS_RUN = 0x0 , OPCODE_CS_VALIDATE = 0x1 , OPCODE_CS_CANCEL = 0x2 , OPCODE_CS_START = 0x3 ,
  OPCODE_CS_STEP = 0x4 , OPCODE_CS_AUTO = 0x5 , OPCODE_CS_MANUAL = 0x6 , OPCODE_CS_JOIN_WAIT = 0x7
}
 Command opcodes. More...
 
enum  {
  EVENTID_CS_SEQUENCELOADED = 0x0 , EVENTID_CS_SEQUENCECANCELED = 0x1 , EVENTID_CS_FILEREADERROR = 0x2 , EVENTID_CS_FILEINVALID = 0x3 ,
  EVENTID_CS_RECORDINVALID = 0x4 , EVENTID_CS_FILESIZEERROR = 0x5 , EVENTID_CS_FILENOTFOUND = 0x6 , EVENTID_CS_FILECRCFAILURE = 0x7 ,
  EVENTID_CS_COMMANDCOMPLETE = 0x8 , EVENTID_CS_SEQUENCECOMPLETE = 0x9 , EVENTID_CS_COMMANDERROR = 0xa , EVENTID_CS_INVALIDMODE = 0xb ,
  EVENTID_CS_RECORDMISMATCH = 0xc , EVENTID_CS_TIMEBASEMISMATCH = 0xd , EVENTID_CS_TIMECONTEXTMISMATCH = 0xe , EVENTID_CS_PORTSEQUENCESTARTED = 0xf ,
  EVENTID_CS_UNEXPECTEDCOMPLETION = 0x10 , EVENTID_CS_MODESWITCHED = 0x11 , EVENTID_CS_NOSEQUENCEACTIVE = 0x12 , EVENTID_CS_SEQUENCEVALID = 0x13 ,
  EVENTID_CS_SEQUENCETIMEOUT = 0x14 , EVENTID_CS_CMDSTEPPED = 0x15 , EVENTID_CS_CMDSTARTED = 0x16 , EVENTID_CS_JOINWAITING = 0x17 ,
  EVENTID_CS_JOINWAITINGNOTCOMPLETE = 0x18
}
 Event IDs. More...
 
enum  {
  CHANNELID_CS_LOADCOMMANDS = 0x0 , CHANNELID_CS_CANCELCOMMANDS = 0x1 , CHANNELID_CS_ERRORS = 0x2 , CHANNELID_CS_COMMANDSEXECUTED = 0x3 ,
  CHANNELID_CS_SEQUENCESCOMPLETED = 0x4
}
 Channel IDs. More...
 
- Protected Types inherited from Fw::ActiveComponentBase
enum  Lifecycle { CREATED , DISPATCHING , FINALIZING , DONE }
 Tracks the lifecycle of the component. More...
 
- Protected Member Functions inherited from Svc::CmdSequencerComponentBase
 CmdSequencerComponentBase (const char *compName="")
 Construct CmdSequencerComponentBase object. More...
 
virtual ~CmdSequencerComponentBase ()
 Destroy CmdSequencerComponentBase object. More...
 
FwIndexType getNum_cmdIn_InputPorts () const
 
FwIndexType getNum_cmdResponseIn_InputPorts () const
 
FwIndexType getNum_pingIn_InputPorts () const
 
FwIndexType getNum_schedIn_InputPorts () const
 
FwIndexType getNum_seqCancelIn_InputPorts () const
 
FwIndexType getNum_seqRunIn_InputPorts () const
 
FwIndexType getNum_cmdRegOut_OutputPorts () const
 
FwIndexType getNum_cmdResponseOut_OutputPorts () const
 
FwIndexType getNum_logOut_OutputPorts () const
 
FwIndexType getNum_timeCaller_OutputPorts () const
 
FwIndexType getNum_tlmOut_OutputPorts () const
 
FwIndexType getNum_comCmdOut_OutputPorts () const
 
FwIndexType getNum_pingOut_OutputPorts () const
 
FwIndexType getNum_seqDone_OutputPorts () const
 
bool isConnected_cmdRegOut_OutputPort (FwIndexType portNum)
 
bool isConnected_cmdResponseOut_OutputPort (FwIndexType portNum)
 
bool isConnected_logOut_OutputPort (FwIndexType portNum)
 
bool isConnected_timeCaller_OutputPort (FwIndexType portNum)
 
bool isConnected_tlmOut_OutputPort (FwIndexType portNum)
 
bool isConnected_comCmdOut_OutputPort (FwIndexType portNum)
 
bool isConnected_pingOut_OutputPort (FwIndexType portNum)
 
bool isConnected_seqDone_OutputPort (FwIndexType portNum)
 
virtual void schedIn_handler (FwIndexType portNum, U32 context)=0
 Handler for input port schedIn. More...
 
void cmdResponseIn_handlerBase (FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)
 Handler base-class function for input port cmdResponseIn. More...
 
void pingIn_handlerBase (FwIndexType portNum, U32 key)
 Handler base-class function for input port pingIn. More...
 
void schedIn_handlerBase (FwIndexType portNum, U32 context)
 Handler base-class function for input port schedIn. More...
 
void seqCancelIn_handlerBase (FwIndexType portNum)
 Handler base-class function for input port seqCancelIn. More...
 
void seqRunIn_handlerBase (FwIndexType portNum, Fw::String &filename)
 Handler base-class function for input port seqRunIn. More...
 
virtual void cmdResponseIn_preMsgHook (FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)
 Pre-message hook for async input port cmdResponseIn. More...
 
virtual void pingIn_preMsgHook (FwIndexType portNum, U32 key)
 Pre-message hook for async input port pingIn. More...
 
virtual void schedIn_preMsgHook (FwIndexType portNum, U32 context)
 Pre-message hook for async input port schedIn. More...
 
virtual void seqCancelIn_preMsgHook (FwIndexType portNum)
 Pre-message hook for async input port seqCancelIn. More...
 
virtual void seqRunIn_preMsgHook (FwIndexType portNum, Fw::String &filename)
 Pre-message hook for async input port seqRunIn. More...
 
void comCmdOut_out (FwIndexType portNum, Fw::ComBuffer &data, U32 context)
 Invoke output port comCmdOut. More...
 
void pingOut_out (FwIndexType portNum, U32 key)
 Invoke output port pingOut. More...
 
void seqDone_out (FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)
 Invoke output port seqDone. More...
 
void cmdResponse_out (FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
 Emit command response. More...
 
void CS_RUN_cmdHandlerBase (FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
 
void CS_VALIDATE_cmdHandlerBase (FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
 
void CS_CANCEL_cmdHandlerBase (FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
 
void CS_START_cmdHandlerBase (FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
 
void CS_STEP_cmdHandlerBase (FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
 
void CS_AUTO_cmdHandlerBase (FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
 
void CS_MANUAL_cmdHandlerBase (FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
 
void CS_JOIN_WAIT_cmdHandlerBase (FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
 
virtual void CS_RUN_preMsgHook (FwOpcodeType opCode, U32 cmdSeq)
 Pre-message hook for command CS_RUN. More...
 
virtual void CS_VALIDATE_preMsgHook (FwOpcodeType opCode, U32 cmdSeq)
 Pre-message hook for command CS_VALIDATE. More...
 
virtual void CS_CANCEL_preMsgHook (FwOpcodeType opCode, U32 cmdSeq)
 Pre-message hook for command CS_CANCEL. More...
 
virtual void CS_START_preMsgHook (FwOpcodeType opCode, U32 cmdSeq)
 Pre-message hook for command CS_START. More...
 
virtual void CS_STEP_preMsgHook (FwOpcodeType opCode, U32 cmdSeq)
 Pre-message hook for command CS_STEP. More...
 
virtual void CS_AUTO_preMsgHook (FwOpcodeType opCode, U32 cmdSeq)
 Pre-message hook for command CS_AUTO. More...
 
virtual void CS_MANUAL_preMsgHook (FwOpcodeType opCode, U32 cmdSeq)
 Pre-message hook for command CS_MANUAL. More...
 
virtual void CS_JOIN_WAIT_preMsgHook (FwOpcodeType opCode, U32 cmdSeq)
 Pre-message hook for command CS_JOIN_WAIT. More...
 
void log_ACTIVITY_LO_CS_SequenceLoaded (const Fw::StringBase &fileName)
 
void log_ACTIVITY_HI_CS_SequenceCanceled (const Fw::StringBase &fileName)
 
void log_WARNING_HI_CS_FileReadError (const Fw::StringBase &fileName)
 
void log_WARNING_HI_CS_FileInvalid (const Fw::StringBase &fileName, Svc::CmdSequencer_FileReadStage stage, I32 error)
 
void log_WARNING_HI_CS_RecordInvalid (const Fw::StringBase &fileName, U32 recordNumber, I32 error)
 
void log_WARNING_HI_CS_FileSizeError (const Fw::StringBase &fileName, U32 size)
 
void log_WARNING_HI_CS_FileNotFound (const Fw::StringBase &fileName)
 
void log_WARNING_HI_CS_FileCrcFailure (const Fw::StringBase &fileName, U32 storedCRC, U32 computedCRC)
 
void log_ACTIVITY_LO_CS_CommandComplete (const Fw::StringBase &fileName, U32 recordNumber, U32 opCode)
 
void log_ACTIVITY_HI_CS_SequenceComplete (const Fw::StringBase &fileName)
 
void log_WARNING_HI_CS_CommandError (const Fw::StringBase &fileName, U32 recordNumber, U32 opCode, U32 errorStatus)
 
void log_WARNING_HI_CS_InvalidMode ()
 
void log_WARNING_HI_CS_RecordMismatch (const Fw::StringBase &fileName, U32 header_records, U32 extra_bytes)
 
void log_WARNING_HI_CS_TimeBaseMismatch (const Fw::StringBase &fileName, U16 time_base, U16 seq_time_base)
 
void log_WARNING_HI_CS_TimeContextMismatch (const Fw::StringBase &fileName, U8 currTimeBase, U8 seqTimeBase)
 
void log_ACTIVITY_HI_CS_PortSequenceStarted (const Fw::StringBase &filename)
 
void log_WARNING_HI_CS_UnexpectedCompletion (U32 opcode)
 
void log_ACTIVITY_HI_CS_ModeSwitched (Svc::CmdSequencer_SeqMode mode)
 
void log_WARNING_LO_CS_NoSequenceActive ()
 
void log_ACTIVITY_HI_CS_SequenceValid (const Fw::StringBase &filename)
 
void log_WARNING_HI_CS_SequenceTimeout (const Fw::StringBase &filename, U32 command)
 
void log_ACTIVITY_HI_CS_CmdStepped (const Fw::StringBase &filename, U32 command)
 
void log_ACTIVITY_HI_CS_CmdStarted (const Fw::StringBase &filename)
 
void log_ACTIVITY_HI_CS_JoinWaiting (const Fw::StringBase &filename, U32 recordNumber, U32 opCode)
 
void log_WARNING_HI_CS_JoinWaitingNotComplete ()
 
void tlmWrite_CS_LoadCommands (U32 arg, Fw::Time _tlmTime=Fw::Time())
 
void tlmWrite_CS_CancelCommands (U32 arg, Fw::Time _tlmTime=Fw::Time())
 
void tlmWrite_CS_Errors (U32 arg, Fw::Time _tlmTime=Fw::Time())
 
void tlmWrite_CS_CommandsExecuted (U32 arg, Fw::Time _tlmTime=Fw::Time())
 
void tlmWrite_CS_SequencesCompleted (U32 arg, Fw::Time _tlmTime=Fw::Time())
 
Fw::Time getTime ()
 
- Protected Member Functions inherited from Fw::ActiveComponentBase
 ActiveComponentBase (const char *name)
 Constructor. More...
 
virtual ~ActiveComponentBase ()
 Destructor. More...
 
void init (NATIVE_INT_TYPE instance)
 initialization code More...
 
virtual void preamble ()
 A function that will be called before the event loop is entered. More...
 
MsgDispatchStatus dispatch ()
 The function that will dispatching messages. More...
 
virtual void finalizer ()
 A function that will be called after exiting the loop. More...
 
- Protected Member Functions inherited from Fw::QueuedComponentBase
 QueuedComponentBase (const char *name)
 Constructor. More...
 
virtual ~QueuedComponentBase ()
 Destructor. More...
 
void init (NATIVE_INT_TYPE instance)
 initialization function More...
 
Os::Queue::QueueStatus createQueue (NATIVE_INT_TYPE depth, NATIVE_INT_TYPE msgSize)
 
NATIVE_INT_TYPE getNumMsgsDropped ()
 return number of messages dropped More...
 
void incNumMsgDropped ()
 increment the number of messages dropped More...
 
- Protected Member Functions inherited from Fw::PassiveComponentBase
 PassiveComponentBase (const char *name)
 Named constructor. More...
 
virtual ~PassiveComponentBase ()
 Destructor. More...
 
void init (NATIVE_INT_TYPE instance)
 Initialization function. More...
 
NATIVE_INT_TYPE getInstance () const
 
- Protected Member Functions inherited from Fw::ObjBase
 ObjBase (const char *name)
 ObjBase constructor. More...
 
virtual ~ObjBase ()
 Destructor. More...
 
void init ()
 Object initializer. More...
 
- Protected Attributes inherited from Fw::ActiveComponentBase
Os::Task m_task
 task object for active component More...
 
- Protected Attributes inherited from Fw::QueuedComponentBase
Os::Queue m_queue
 queue object for active component More...
 

Detailed Description

Definition at line 22 of file CmdSequencerImpl.hpp.

Constructor & Destructor Documentation

◆ CmdSequencerComponentImpl()

Svc::CmdSequencerComponentImpl::CmdSequencerComponentImpl ( const char *  compName)

Construct a CmdSequencer.

Parameters
compNameThe component name

Definition at line 25 of file CmdSequencerImpl.cpp.

◆ ~CmdSequencerComponentImpl()

Svc::CmdSequencerComponentImpl::~CmdSequencerComponentImpl ( )

Destroy a CmdDispatcherComponentBase.

Definition at line 87 of file CmdSequencerImpl.cpp.

Member Function Documentation

◆ allocateBuffer()

void Svc::CmdSequencerComponentImpl::allocateBuffer ( const NATIVE_INT_TYPE  identifier,
Fw::MemAllocator allocator,
const NATIVE_UINT_TYPE  bytes 
)

Give the sequence a memory buffer. Call this after constructor and init, and after setting the sequence format, but before task is spawned.

Parameters
identifierThe identifier
allocatorThe allocator
bytesThe number of bytes

Definition at line 62 of file CmdSequencerImpl.cpp.

◆ deallocateBuffer()

void Svc::CmdSequencerComponentImpl::deallocateBuffer ( Fw::MemAllocator allocator)

Return allocated buffer. Call during shutdown.

Parameters
allocatorThe allocator

Definition at line 81 of file CmdSequencerImpl.cpp.

◆ init()

void Svc::CmdSequencerComponentImpl::init ( const NATIVE_INT_TYPE  queueDepth,
const NATIVE_INT_TYPE  instance 
)

Initialize a CmdSequencer.

Parameters
queueDepthThe queue depth
instanceThe instance number

Definition at line 47 of file CmdSequencerImpl.cpp.

◆ loadSequence()

void Svc::CmdSequencerComponentImpl::loadSequence ( const Fw::StringBase fileName)

(Optional) Load a sequence to run later. When you call this function, the event ports must be connected.

Parameters
fileNameThe file name

Definition at line 72 of file CmdSequencerImpl.cpp.

◆ setSequenceFormat()

void Svc::CmdSequencerComponentImpl::setSequenceFormat ( Sequence sequence)

(Optional) Set the sequence format. CmdSequencer will use the sequence object you pass in to load and run sequences. By default, it uses an FPrimeSequence object.

Parameters
sequenceThe sequence object

Definition at line 56 of file CmdSequencerImpl.cpp.

◆ setTimeout()

void Svc::CmdSequencerComponentImpl::setTimeout ( const NATIVE_UINT_TYPE  seconds)

(Optional) Set a timeout. Sequence will quit if a command takes longer than the number of seconds in the timeout value.

Parameters
secondsThe number of seconds

Definition at line 52 of file CmdSequencerImpl.cpp.


The documentation for this class was generated from the following files: