| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // ====================================================================== | ||
| 2 | // \title CmdSplitter.cpp | ||
| 3 | // \author watney | ||
| 4 | // \brief cpp file for CmdSplitter component implementation class | ||
| 5 | // ====================================================================== | ||
| 6 | |||
| 7 | #include <limits> | ||
| 8 | |||
| 9 | #include <Fw/Cmd/CmdPacket.hpp> | ||
| 10 | #include <Fw/FPrimeBasicTypes.hpp> | ||
| 11 | #include <Fw/Types/Assert.hpp> | ||
| 12 | #include <Svc/CmdSplitter/CmdSplitter.hpp> | ||
| 13 | #include <config/FppConstantsAc.hpp> | ||
| 14 | |||
| 15 | namespace Svc { | ||
| 16 | |||
| 17 | // ---------------------------------------------------------------------- | ||
| 18 | // Construction, initialization, and destruction | ||
| 19 | // ---------------------------------------------------------------------- | ||
| 20 | |||
| 21 | 4 | CmdSplitter ::CmdSplitter(const char* const compName) | |
| 22 | 4 | : CmdSplitterComponentBase(compName), m_remoteBase(std::numeric_limits<FwOpcodeType>::max()) {} | |
| 23 | |||
| 24 | 8 | CmdSplitter ::~CmdSplitter() {} | |
| 25 | |||
| 26 | 2 | void CmdSplitter ::configure(const FwOpcodeType remoteBaseOpcode) { | |
| 27 | 2 | this->m_remoteBase = remoteBaseOpcode; | |
| 28 | 2 | } | |
| 29 | |||
| 30 | // ---------------------------------------------------------------------- | ||
| 31 | // Handler implementations for user-defined typed input ports | ||
| 32 | // ---------------------------------------------------------------------- | ||
| 33 | |||
| 34 | 3 | void CmdSplitter ::CmdBuff_handler(const FwIndexType portNum, Fw::ComBuffer& data, U32 context) { | |
| 35 |
1/1✓ Branch 2 taken 3 times.
|
3 | Fw::CmdPacket cmdPkt; |
| 36 |
1/1✓ Branch 4 taken 3 times.
|
3 | Fw::SerializeStatus stat = cmdPkt.deserializeFrom(data); |
| 37 | |||
| 38 | 3 | FW_ASSERT(portNum < CmdSplitterPorts); | |
| 39 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
|
3 | if (stat != Fw::FW_SERIALIZE_OK) { |
| 40 | // Let the local command dispatcher deal with it | ||
| 41 |
1/1✓ Branch 5 taken 1 times.
|
1 | this->LocalCmd_out(portNum, data, context); |
| 42 | } else { | ||
| 43 | // Check if local or remote | ||
| 44 |
3/3✓ Branch 2 taken 2 times.
✓ Branch 8 taken 1 times.
✓ Branch 9 taken 1 times.
|
2 | if (cmdPkt.getOpCode() < this->m_remoteBase) { |
| 45 |
1/1✓ Branch 5 taken 1 times.
|
1 | this->LocalCmd_out(portNum, data, context); |
| 46 | } else { | ||
| 47 |
1/1✓ Branch 5 taken 1 times.
|
1 | this->RemoteCmd_out(portNum, data, context); |
| 48 | } | ||
| 49 | } | ||
| 50 | 6 | } | |
| 51 | |||
| 52 | 1 | void CmdSplitter ::seqCmdStatus_handler(const FwIndexType portNum, | |
| 53 | FwOpcodeType opCode, | ||
| 54 | U32 cmdSeq, | ||
| 55 | const Fw::CmdResponse& response) { | ||
| 56 | 1 | FW_ASSERT(portNum < CmdSplitterPorts); | |
| 57 | // Forward the command status | ||
| 58 | 1 | this->forwardSeqCmdStatus_out(portNum, opCode, cmdSeq, response); | |
| 59 | 1 | } | |
| 60 | |||
| 61 | } // end namespace Svc | ||
| 62 |