GCC Code Coverage Report


Directory: /home/runner/work/fprime/fprime/Svc/Ccsds/Utils/
File: IdlePacket.cpp
Date: 2026-10-14 22:12:50
Exec Total Coverage
Lines: 13 13 100.0%
Functions: 1 1 100.0%
Branches: 9 10 90.0%

Line Branch Exec Source
1 // ======================================================================
2 // \title IdlePacket.cpp
3 // \brief Space Packet Protocol idle packet helpers shared by CCSDS framers
4 // ======================================================================
5
6 #include "Svc/Ccsds/Utils/IdlePacket.hpp"
7 #include "Fw/Types/Assert.hpp"
8 #include "Svc/Ccsds/Types/FppConstantsAc.hpp"
9 #include "config/ApidEnumAc.hpp"
10
11 namespace Svc {
12 namespace Ccsds {
13 namespace Utils {
14 namespace IdlePacket {
15
16 231 Fw::SerializeStatus serialize(Fw::SerialBufferBase& serializer, FwSizeType size) {
17 231 FW_ASSERT(size >= MIN_SIZE, static_cast<FwAssertArgType>(size));
18 231 FW_ASSERT(size <= MAX_SIZE, static_cast<FwAssertArgType>(size));
19 // Length token is defined as the number of bytes of payload data minus 1
20 231 const FwSizeType lengthToken = size - SpacePacketHeader::SERIALIZED_SIZE - 1;
21
22
1/1
✓ Branch 1 taken 231 times.
231 SpacePacketHeader header;
23
1/1
✓ Branch 1 taken 231 times.
231 header.set_packetIdentification(static_cast<U16>(ComCfg::Apid::SPP_IDLE_PACKET));
24 // Sequence Flags = 0b11 (unsegmented) & unused sequence count
25
1/1
✓ Branch 1 taken 231 times.
231 header.set_packetSequenceControl(static_cast<U16>(0x3 << SpacePacketSubfields::SeqFlagsOffset));
26
1/1
✓ Branch 1 taken 231 times.
231 header.set_packetDataLength(static_cast<U16>(lengthToken));
27
28
1/1
✓ Branch 1 taken 231 times.
231 Fw::SerializeStatus status = serializer.serializeFrom(header);
29
3/4
✓ Branch 0 taken 157916 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 157685 times.
✓ Branch 3 taken 231 times.
157916 for (FwSizeType i = SpacePacketHeader::SERIALIZED_SIZE; (status == Fw::FW_SERIALIZE_OK) && (i < size); i++) {
30
1/1
✓ Branch 1 taken 157685 times.
157685 status = serializer.serializeFrom(DATA_PATTERN);
31 }
32 231 return status;
33 231 }
34
35 } // namespace IdlePacket
36 } // namespace Utils
37 } // namespace Ccsds
38 } // namespace Svc
39