![]() |
F´ Flight Software - C/C++ Documentation
devel
A framework for building embedded system applications to NASA flight quality standards.
|
The Svc::CmdDispatcher
is responsible for dispatching incoming commands to the components that implement those commands. The commands are sent in encoded Fw::Com
form from an external sender like a ground system or a sequencer. The dispatcher decodes the packet and extracts the opcode. This opcode is looked up in a table and dispatched to the component via a port indicated in the table. The output port for each opcode is set by a call to a registration port.
The requirements for Svc::CmdDispatcher
are as follows:
Requirement | Description | Verification Method |
---|---|---|
CD-001 | The Svc::CmdDispatcher component shall accept command buffers and decode them into commands | Inspection, Unit Test |
CD-002 | The Svc::CmdDispatcher component shall dispatch commands to components | Unit Test |
CD-003 | The Svc::CmdDispatcher component shall provide an interface to register commands | Inspection |
CD-004 | The Svc::CmdDispatcher component shall process command status from components and report the results to the command buffer sender. | Unit Test |
The Svc::CmdDispatcher
component has the following component diagram:
The Svc::CmdDispatcher
component uses the following port types:
Port Data Type | Name | Direction | Kind | Usage |
---|---|---|---|---|
`Fw::Cmd` | cmdSend | Output | n/a | Send commands to components |
`Fw::CmdResponse` | compStat | Input | Asynchronous | Port for components to report command status |
`Fw::CmdResponse` | seqStatus | Output | n/a | Send command status to command buffer source |
`Fw::Com` | cmdBuff | Input | Asynchronous | Receive command buffer |
`Fw::CmdReg` | cmdReg | Input | Synchronous | Command Registration |
The Svc::CmdDispatcher
component provides command dispatching. The architecture autocoder generates port instances for components that specify commands that implement the commanding pattern. Svc::CommandDispatcher
implements the command decoding and dispatching to supply the components with commands.
An autogenerated function on components create a public function regCommands
that tells components to register the set of op codes that are implemented by the component. The autogenerated port is connected to the compCmdReg
input port on Svc::CmdDispatcher
that corresponds to the number of the compCmdSend
port used to dispatch commands. The port handler looks through the dispatch table for an unused entry and adds the opcode. It maps the opcode to the dispatch port number corresponding to the registration port number.
When the command dispatcher receives a command buffer, it decodes the opcode. It searches the dispatch table for the opcode, then assigns a sequence number to the command and stores the opcode, sequence number, context value and source port in a pending command table. The command is then dispatched to the component that implements the command. When the component completes execution of the command, it reports the status back via the compStat
port. The sequence number is matched to the entry in the pending command table, and the seqStatus
output port corresponding to the source port is called (if it is connected) with the status and the context value. Note that this requires that the component sending the command buffer have connections to the same cmdBuff
and seqStatus
port numbers.
The Svc::CmdDispatcher
component accepts command registration from other components:
The Svc::CmdDispatcher
component dispatches commands to other components:
Svc::CmdDispatcher
has no state machines.
Svc::CmdDispatcher
has no significant algorithms.
Document | Link |
---|---|
Design Checklist | Link |
Code Checklist | Link |
Unit Test Checklist | Link |
To see unit test coverage run fprime-util check --coverage
Date | Description |
---|---|
6/25/2015 | Design review edits |
7/22/2015 | Design review actions |
9/16/2015 | Unit Test additions |
1/28/2016 | Added context value discussion |
5/17/2021 | Added CMD Reregistration option |