17 m_numCmdsDispatched(0),
20 memset(this->m_entryTable,0,
sizeof(this->m_entryTable));
21 memset(this->m_sequenceTracker,0,
sizeof(this->m_sequenceTracker));
29 bool slotFound =
false;
31 if ((not this->m_entryTable[slot].used) and (not slotFound)) {
32 this->m_entryTable[slot].opcode = opCode;
33 this->m_entryTable[slot].port = portNum;
34 this->m_entryTable[slot].used =
true;
37 }
else if ((this->m_entryTable[slot].used) &&
38 (this->m_entryTable[slot].opcode == opCode) &&
39 (this->m_entryTable[slot].port == portNum) &&
43 }
else if (this->m_entryTable[slot].used) {
55 this->m_numCmdErrors++;
65 (this->m_sequenceTracker[pending].seq == cmdSeq) &&
66 (this->m_sequenceTracker[pending].used)
68 portToCall = this->m_sequenceTracker[pending].callerPort;
69 context = this->m_sequenceTracker[pending].context;
70 FW_ASSERT(opCode == this->m_sequenceTracker[pending].opCode);
72 this->m_sequenceTracker[pending].used =
false;
77 if (portToCall != -1) {
101 bool entryFound =
false;
104 if ((this->m_entryTable[entry].used) and (cmdPkt.
getOpCode() == this->m_entryTable[entry].opcode)) {
112 bool pendingFound =
false;
115 if (not this->m_sequenceTracker[pending].used) {
117 this->m_sequenceTracker[pending].used =
true;
118 this->m_sequenceTracker[pending].opCode = cmdPkt.
getOpCode();
119 this->m_sequenceTracker[pending].seq = this->m_seq;
120 this->m_sequenceTracker[pending].context = context;
121 this->m_sequenceTracker[pending].callerPort = portNum;
127 if (not pendingFound) {
137 this->m_entryTable[entry].port,
145 this->m_numCmdsDispatched++;
150 this->m_numCmdErrors++;
162 void CommandDispatcherImpl::CMD_NO_OP_cmdHandler(
FwOpcodeType opCode, U32 cmdSeq) {
176 void CommandDispatcherImpl::CMD_TEST_CMD_1_cmdHandler(
FwOpcodeType opCode, U32 cmdSeq, I32 arg1,
F32 arg2,
U8 arg3) {
181 void CommandDispatcherImpl::CMD_CLEAR_TRACKING_cmdHandler(
FwOpcodeType opCode, U32 cmdSeq) {
184 this->m_sequenceTracker[entry].used =
false;
189 void CommandDispatcherImpl::pingIn_handler(
NATIVE_INT_TYPE portNum, U32 key) {
PlatformIntType NATIVE_INT_TYPE
float F32
32-bit floating point
uint8_t U8
8-bit unsigned integer
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Component responsible for dispatching incoming commands to registered components.
@ CMD_DISPATCHER_SEQUENCER_TABLE_SIZE
PlatformAssertArgType FwAssertArgType
FwOpcodeType getOpCode() const
SerializeStatus deserialize(SerializeBufferBase &buffer)
deserialize to contents
CmdArgBuffer & getArgBuffer()
Enum representing a command response.
@ EXECUTION_ERROR
Command had execution error.
@ VALIDATION_ERROR
Command failed validation.
@ OK
Command successfully executed.
@ INVALID_OPCODE
Invalid opcode dispatched.
const char * toChar() const
Auto-generated base for CommandDispatcher component.
void log_DIAGNOSTIC_OpCodeReregistered(U32 Opcode, I32 port)
bool isConnected_seqCmdStatus_OutputPort(FwIndexType portNum)
void log_ACTIVITY_HI_TestCmd1Args(I32 arg1, F32 arg2, U8 arg3)
void log_ACTIVITY_HI_NoOpReceived()
void log_DIAGNOSTIC_OpCodeRegistered(U32 Opcode, I32 port, I32 slot)
Log event OpCodeRegistered.
void log_COMMAND_OpCodeCompleted(U32 Opcode)
void tlmWrite_CommandErrors(U32 arg, Fw::Time _tlmTime=Fw::Time())
FwIndexType getNum_seqCmdStatus_OutputPorts() const
bool isConnected_compCmdSend_OutputPort(FwIndexType portNum)
void log_WARNING_HI_MalformedCommand(Fw::DeserialStatus Status)
void log_ACTIVITY_HI_NoOpStringReceived(const Fw::StringBase &message)
void log_COMMAND_OpCodeDispatched(U32 Opcode, I32 port)
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
void log_WARNING_HI_TooManyCommands(U32 Opcode)
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
void log_WARNING_HI_InvalidCommand(U32 Opcode)
void seqCmdStatus_out(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)
Invoke output port seqCmdStatus.
void compCmdSend_out(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Invoke output port compCmdSend.
void tlmWrite_CommandsDispatched(U32 arg, Fw::Time _tlmTime=Fw::Time())
void log_COMMAND_OpCodeError(U32 Opcode, Fw::CmdResponse error)
CommandDispatcherImpl(const char *name)
Command Dispatcher constructor.
virtual ~CommandDispatcherImpl()
Component destructor.
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.