GCC Code Coverage Report


Directory: /home/runner/work/fprime/fprime/Svc/CmdSplitter/
File: CmdSplitter.cpp
Date: 2026-09-03 22:13:32
Exec Total Coverage
Lines: 0 20 0.0%
Functions: 0 5 0.0%
Branches: 0 10 0.0%

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 CmdSplitter ::CmdSplitter(const char* const compName)
22 : CmdSplitterComponentBase(compName), m_remoteBase(std::numeric_limits<FwOpcodeType>::max()) {}
23
24 CmdSplitter ::~CmdSplitter() {}
25
26 void CmdSplitter ::configure(const FwOpcodeType remoteBaseOpcode) {
27 this->m_remoteBase = remoteBaseOpcode;
28 }
29
30 // ----------------------------------------------------------------------
31 // Handler implementations for user-defined typed input ports
32 // ----------------------------------------------------------------------
33
34 void CmdSplitter ::CmdBuff_handler(const FwIndexType portNum, Fw::ComBuffer& data, U32 context) {
35 Fw::CmdPacket cmdPkt;
36 Fw::SerializeStatus stat = cmdPkt.deserializeFrom(data);
37
38 FW_ASSERT(portNum < CmdSplitterPorts);
39 if (stat != Fw::FW_SERIALIZE_OK) {
40 // Let the local command dispatcher deal with it
41 this->LocalCmd_out(portNum, data, context);
42 } else {
43 // Check if local or remote
44 if (cmdPkt.getOpCode() < this->m_remoteBase) {
45 this->LocalCmd_out(portNum, data, context);
46 } else {
47 this->RemoteCmd_out(portNum, data, context);
48 }
49 }
50 }
51
52 void CmdSplitter ::seqCmdStatus_handler(const FwIndexType portNum,
53 FwOpcodeType opCode,
54 U32 cmdSeq,
55 const Fw::CmdResponse& response) {
56 FW_ASSERT(portNum < CmdSplitterPorts);
57 // Forward the command status
58 this->forwardSeqCmdStatus_out(portNum, opCode, cmdSeq, response);
59 }
60
61 } // end namespace Svc
62