GCC Code Coverage Report


Directory: Svc/GenericHub/
File: GenericHub.cpp
Date: 2026-09-03 21:18:03
Exec Total Coverage
Lines: 179 179 100.0%
Functions: 12 12 100.0%
Branches: 154 180 85.6%

Line Branch Exec Source
1 // ======================================================================
2 // \title GenericHub.cpp
3 // \author mstarch
4 // \brief cpp file for GenericHub component implementation class
5 //
6 // \copyright
7 // Copyright 2009-2015, by the California Institute of Technology.
8 // ALL RIGHTS RESERVED. United States Government Sponsorship
9 // acknowledged.
10 //
11 // ======================================================================
12
13 #include <Fw/FPrimeBasicTypes.hpp>
14 #include <Svc/GenericHub/GenericHub.hpp>
15 #include "Fw/Logger/Logger.hpp"
16 #include "Fw/Types/Assert.hpp"
17
18 // Required port serialization or the hub cannot work
19 static_assert(FW_PORT_SERIALIZATION, "FW_PORT_SERIALIZATION must be enabled to use GenericHub");
20
21 namespace Svc {
22
23 // ----------------------------------------------------------------------
24 // Construction, initialization, and destruction
25 // ----------------------------------------------------------------------
26
27 16 GenericHub::GenericHub(const char* const compName) : GenericHubComponentBase(compName) {}
28
29 32 GenericHub::~GenericHub() {}
30
31 10027 void GenericHub::send_data(const HubType type, const FwIndexType port, const U8* data, const FwSizeType size) {
32 10027 FW_ASSERT(data != nullptr);
33 Fw::SerializeStatus status;
34 // Buffer to send and a buffer used to write to it
35
1/1
✓ Branch 3 taken 10027 times.
10027 Fw::Buffer outgoing = allocate_out(0, static_cast<U32>(size + sizeof(U32) + sizeof(U32) + sizeof(FwBuffSizeType)));
36
1/1
✓ Branch 2 taken 10027 times.
10027 auto serialize = outgoing.getSerializer();
37 // Write data to our buffer
38
1/1
✓ Branch 2 taken 10027 times.
10027 status = serialize.serializeFrom(static_cast<U32>(type));
39 10027 FW_ASSERT(status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(status));
40
1/1
✓ Branch 2 taken 10027 times.
10027 status = serialize.serializeFrom(static_cast<U32>(port));
41 10027 FW_ASSERT(status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(status));
42
1/1
✓ Branch 2 taken 10027 times.
10027 status = serialize.serializeFrom(data, static_cast<FwBuffSizeType>(size));
43 10027 FW_ASSERT(status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(status));
44
2/2
✓ Branch 3 taken 10027 times.
✓ Branch 6 taken 10027 times.
10027 outgoing.setSize(serialize.getSize());
45
1/1
✓ Branch 5 taken 10027 times.
10027 toBufferDriver_out(0, outgoing);
46 20054 }
47
48 // ----------------------------------------------------------------------
49 // Handler implementations for user-defined typed input ports
50 // ----------------------------------------------------------------------
51
52 4992 void GenericHub::bufferIn_handler(const FwIndexType portNum, Fw::Buffer& fwBuffer) {
53 4992 this->send_data(HUB_TYPE_BUFFER, portNum, fwBuffer.getData(), fwBuffer.getSize());
54 4992 bufferInReturn_out(portNum, fwBuffer);
55 4992 }
56
57 4992 void GenericHub::bufferOutReturn_handler(FwIndexType portNum, Fw::Buffer& fwBuffer) {
58 // Return the buffer
59 4992 fromBufferDriverReturn_out(0, fwBuffer);
60 4992 }
61
62 3 void GenericHub ::cmdDispIn_handler(FwIndexType portNum, Fw::ComBuffer& data, U32 context) {
63 Fw::SerializeStatus status;
64 // Buffer to send and a buffer used to write to it. Must hold a maximum-size
65 // command buffer (serialized without its length token) plus the context word.
66 3 U8 buffer[FW_COM_BUFFER_MAX_SIZE + sizeof(U32)];
67
68
1/1
✓ Branch 2 taken 3 times.
3 Fw::ExternalSerializeBuffer serializer(buffer, sizeof(buffer));
69
1/1
✓ Branch 2 taken 3 times.
3 serializer.resetSer();
70
71
2/2
✓ Branch 6 taken 3 times.
✓ Branch 14 taken 3 times.
3 status = serializer.serializeFrom(data.getBuffAddr(), data.getSize(), Fw::Serialization::OMIT_LENGTH);
72 3 FW_ASSERT(status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(status));
73
1/1
✓ Branch 2 taken 3 times.
3 status = serializer.serializeFrom(context);
74 3 FW_ASSERT(status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(status));
75
1/1
✓ Branch 2 taken 3 times.
3 FwSizeType size = serializer.getSize();
76
77
1/1
✓ Branch 4 taken 3 times.
3 this->send_data(HUB_TYPE_CMD_DISP, portNum, buffer, size);
78 6 }
79
80 2 void GenericHub ::cmdRespIn_handler(FwIndexType portNum,
81 FwOpcodeType opCode,
82 U32 cmdSeq,
83 const Fw::CmdResponse& response) {
84 2 Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
85 2 U8 buffer[sizeof(opCode) + sizeof(cmdSeq) + Fw::CmdResponse::SERIALIZED_SIZE];
86
1/1
✓ Branch 2 taken 2 times.
2 Fw::ExternalSerializeBuffer serializer(buffer, sizeof(buffer));
87
1/1
✓ Branch 2 taken 2 times.
2 serializer.resetSer();
88
89
1/1
✓ Branch 2 taken 2 times.
2 status = serializer.serializeFrom(opCode);
90 2 FW_ASSERT(status == Fw::SerializeStatus::FW_SERIALIZE_OK);
91
1/1
✓ Branch 2 taken 2 times.
2 status = serializer.serializeFrom(cmdSeq);
92 2 FW_ASSERT(status == Fw::SerializeStatus::FW_SERIALIZE_OK);
93
1/1
✓ Branch 5 taken 2 times.
2 status = serializer.serializeFrom(response);
94 2 FW_ASSERT(status == Fw::SerializeStatus::FW_SERIALIZE_OK);
95
1/1
✓ Branch 2 taken 2 times.
2 FwSizeType size = serializer.getSize();
96
97
1/1
✓ Branch 4 taken 2 times.
2 this->send_data(HUB_TYPE_CMD_RESP, portNum, buffer, size);
98 4 }
99
100 10034 void GenericHub::fromBufferDriver_handler(const FwIndexType portNum, Fw::Buffer& fwBuffer) {
101 10034 HubType type = HUB_TYPE_MAX;
102 10034 U32 type_in = 0;
103 10034 U32 port = 0;
104 10034 FwBuffSizeType size = 0;
105 10034 Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
106
107 // Representation of incoming data prepped for serialization
108
1/1
✓ Branch 2 taken 10034 times.
10034 auto incoming = fwBuffer.getDeserializer();
109 // Check the size of the data first
110
3/3
✓ Branch 4 taken 10034 times.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 10033 times.
10034 if (fwBuffer.getSize() < (sizeof(U32) + sizeof(U32) + sizeof(FwBuffSizeType))) {
111 1 status = Fw::FW_DESERIALIZE_SIZE_MISMATCH;
112 } else {
113
1/1
✓ Branch 2 taken 10033 times.
10033 status = incoming.deserializeTo(type_in);
114 }
115 // If the deserialization was good, but the type is invalid, set invalid data
116
4/4
✓ Branch 0 taken 10033 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 10032 times.
10034 if ((status == Fw::FW_SERIALIZE_OK) && (type_in >= HUB_TYPE_MAX)) {
117 1 status = Fw::FW_DESERIALIZE_INVALID_DATA;
118 }
119 // If the deserialization was good and the type was valid, set the type and move onto port deserialization
120
2/2
✓ Branch 0 taken 10032 times.
✓ Branch 1 taken 1 times.
10033 else if (status == Fw::FW_SERIALIZE_OK) {
121 10032 type = static_cast<HubType>(type_in);
122
1/1
✓ Branch 2 taken 10032 times.
10032 status = incoming.deserializeTo(port);
123 }
124 // If the deserialization was good, move onto size deserialization
125
2/2
✓ Branch 0 taken 10032 times.
✓ Branch 1 taken 2 times.
10034 if (status == Fw::FW_SERIALIZE_OK) {
126
1/1
✓ Branch 2 taken 10032 times.
10032 status = incoming.deserializeTo(size);
127 }
128 // All deserialization looks good, check that the size matches the buffer size before calling the appropriate ports
129
4/4
✓ Branch 0 taken 10032 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 10031 times.
✓ Branch 3 taken 3 times.
20066 if (status == Fw::FW_SERIALIZE_OK &&
130
3/3
✓ Branch 4 taken 10032 times.
✓ Branch 6 taken 10031 times.
✓ Branch 7 taken 1 times.
10032 (size == (fwBuffer.getSize() - sizeof(U32) - sizeof(U32) - sizeof(FwBuffSizeType)))) {
131 // invokeSerial deserializes arguments before calling a normal invoke, this will return ownership immediately
132
1/1
✓ Branch 4 taken 10031 times.
10031 U8* rawData = fwBuffer.getData() + sizeof(U32) + sizeof(U32) + sizeof(FwBuffSizeType);
133
1/1
✓ Branch 4 taken 10031 times.
10031 FwSizeType rawSize = fwBuffer.getSize() - sizeof(U32) - sizeof(U32) - sizeof(FwBuffSizeType);
134
2/2
✓ Branch 0 taken 5029 times.
✓ Branch 1 taken 5002 times.
10031 if (type == HUB_TYPE_PORT) {
135 // Com buffer representations should be copied before the call returns, so we need not "allocate" new data
136
1/1
✓ Branch 2 taken 5029 times.
5029 Fw::ExternalSerializeBuffer wrapper(rawData, rawSize);
137
1/1
✓ Branch 2 taken 5029 times.
5029 status = wrapper.setBuffLen(rawSize);
138 5029 FW_ASSERT(status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(status));
139 // Confirm that the port is valid and connected before calling out
140
4/4
✓ Branch 1 taken 5028 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 5028 times.
✓ Branch 4 taken 1 times.
10057 if (port < this->getNum_serialOut_OutputPorts() &&
141
2/3
✓ Branch 5 taken 5028 times.
✓ Branch 7 taken 5028 times.
✗ Branch 8 not taken.
5028 this->isConnected_serialOut_OutputPort(static_cast<FwIndexType>(port))) {
142
1/1
✓ Branch 5 taken 5028 times.
5028 serialOut_out(static_cast<FwIndexType>(port), wrapper);
143 }
144 // Deallocate the existing buffer
145
1/1
✓ Branch 5 taken 5029 times.
5029 fromBufferDriverReturn_out(0, fwBuffer);
146
2/2
✓ Branch 2 taken 4993 times.
✓ Branch 3 taken 9 times.
10031 } else if (type == HUB_TYPE_BUFFER) {
147 // Fw::Buffers can reuse the existing data buffer as the storage type! No deallocation done.
148
2/2
✓ Branch 7 taken 4993 times.
✓ Branch 10 taken 4993 times.
4993 fwBuffer.set(rawData, rawSize, fwBuffer.getContext());
149 // Confirm that the port is valid and connected before calling out
150
4/4
✓ Branch 1 taken 4992 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4992 times.
✓ Branch 4 taken 1 times.
9985 if (port < this->getNum_bufferOut_OutputPorts() &&
151
2/3
✓ Branch 5 taken 4992 times.
✓ Branch 7 taken 4992 times.
✗ Branch 8 not taken.
4992 this->isConnected_bufferOut_OutputPort(static_cast<FwIndexType>(port))) {
152
1/1
✓ Branch 5 taken 4992 times.
4992 bufferOut_out(static_cast<FwIndexType>(port), fwBuffer);
153 } else {
154 // Return the buffer if the port is invalid or not connected to avoid leaks
155
1/1
✓ Branch 5 taken 1 times.
1 fromBufferDriverReturn_out(0, fwBuffer);
156 }
157
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 8 times.
9 } else if (type == HUB_TYPE_EVENT) {
158 1 FwEventIdType id;
159
1/1
✓ Branch 2 taken 1 times.
1 Fw::Time timeTag;
160
1/1
✓ Branch 2 taken 1 times.
1 Fw::LogSeverity severity;
161
1/1
✓ Branch 2 taken 1 times.
1 Fw::LogBuffer args;
162
163 // Deserialize tokens for events
164
1/1
✓ Branch 2 taken 1 times.
1 status = incoming.deserializeTo(id);
165
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if (status == Fw::FW_SERIALIZE_OK) {
166
1/1
✓ Branch 2 taken 1 times.
1 status = incoming.deserializeTo(timeTag);
167 }
168
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if (status == Fw::FW_SERIALIZE_OK) {
169
1/1
✓ Branch 2 taken 1 times.
1 status = incoming.deserializeTo(severity);
170 }
171
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if (status == Fw::FW_SERIALIZE_OK) {
172
1/1
✓ Branch 2 taken 1 times.
1 status = incoming.deserializeTo(args);
173 }
174
175 // Send it!
176
3/6
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
2 if ((status == Fw::FW_SERIALIZE_OK) && (port < this->getNum_eventOut_OutputPorts()) &&
177
2/3
✓ Branch 5 taken 1 times.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
1 this->isConnected_eventOut_OutputPort(static_cast<FwIndexType>(port))) {
178
1/1
✓ Branch 5 taken 1 times.
1 this->eventOut_out(static_cast<FwIndexType>(port), id, timeTag, severity, args);
179 }
180 // Deallocate the existing buffer
181
1/1
✓ Branch 5 taken 1 times.
1 fromBufferDriverReturn_out(0, fwBuffer);
182
2/2
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 7 times.
9 } else if (type == HUB_TYPE_CHANNEL) {
183 1 FwChanIdType id;
184
1/1
✓ Branch 2 taken 1 times.
1 Fw::Time timeTag;
185
1/1
✓ Branch 2 taken 1 times.
1 Fw::TlmBuffer val;
186
187 // Deserialize tokens for channels
188
1/1
✓ Branch 2 taken 1 times.
1 status = incoming.deserializeTo(id);
189
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if (status == Fw::FW_SERIALIZE_OK) {
190
1/1
✓ Branch 2 taken 1 times.
1 status = incoming.deserializeTo(timeTag);
191 }
192
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if (status == Fw::FW_SERIALIZE_OK) {
193
1/1
✓ Branch 2 taken 1 times.
1 status = incoming.deserializeTo(val);
194 }
195
3/6
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
2 if ((status == Fw::FW_SERIALIZE_OK) && (port < this->getNum_tlmOut_OutputPorts()) &&
196
2/3
✓ Branch 5 taken 1 times.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
1 this->isConnected_tlmOut_OutputPort(static_cast<FwIndexType>(port))) {
197 // Send it!
198
1/1
✓ Branch 5 taken 1 times.
1 this->tlmOut_out(static_cast<FwIndexType>(port), id, timeTag, val);
199 }
200
201 // Return the received buffer
202
1/1
✓ Branch 5 taken 1 times.
1 fromBufferDriverReturn_out(0, fwBuffer);
203
2/2
✓ Branch 4 taken 5 times.
✓ Branch 5 taken 2 times.
8 } else if (type == HUB_TYPE_CMD_DISP) {
204 5 U32 context;
205 // Check that the size is sufficient for the context
206 // The wrapped command must fit the ComBuffer capacity; SERIALIZED_SIZE is the capacity
207 // plus the stored length and would admit sizes the ComBuffer cannot hold
208
4/4
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 3 times.
5 if (rawSize < sizeof(U32) || (rawSize - sizeof(U32)) > FW_COM_BUFFER_MAX_SIZE) {
209 2 status = Fw::FW_DESERIALIZE_SIZE_MISMATCH;
210 }
211 // Shift the command buffer out and deserialize the context
212
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 2 times.
5 if (status == Fw::FW_SERIALIZE_OK) {
213
1/1
✓ Branch 2 taken 3 times.
3 Fw::ComBuffer wrapper(rawData, (rawSize - sizeof(U32)));
214
1/1
✓ Branch 2 taken 3 times.
3 status = wrapper.setBuffLen(rawSize - sizeof(U32));
215 3 FW_ASSERT(status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(status));
216 // Skip the command buffer that has already been wrapped
217
1/1
✓ Branch 2 taken 3 times.
3 status = incoming.deserializeSkip(rawSize - sizeof(U32));
218 3 FW_ASSERT(status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(status));
219
1/1
✓ Branch 2 taken 3 times.
3 status = incoming.deserializeTo(context);
220 // Send it!
221
3/6
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 3 times.
✗ Branch 6 not taken.
6 if ((status == Fw::FW_SERIALIZE_OK) && (port < this->getNum_cmdDispOut_OutputPorts()) &&
222
2/3
✓ Branch 5 taken 3 times.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
3 this->isConnected_cmdDispOut_OutputPort(static_cast<FwIndexType>(port))) {
223
1/1
✓ Branch 5 taken 3 times.
3 this->cmdDispOut_out(static_cast<FwIndexType>(port), wrapper, context);
224 }
225 3 }
226 // Deallocate the existing buffer
227
1/1
✓ Branch 5 taken 5 times.
5 fromBufferDriverReturn_out(0, fwBuffer);
228
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 } else if (type == HUB_TYPE_CMD_RESP) {
229 2 FwOpcodeType opCode;
230 2 U32 cmdSeq;
231
1/1
✓ Branch 2 taken 2 times.
2 Fw::CmdResponse response;
232
233 // Deserialize tokens for channels
234
1/1
✓ Branch 2 taken 2 times.
2 status = incoming.deserializeTo(opCode);
235
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (status == Fw::FW_SERIALIZE_OK) {
236
1/1
✓ Branch 2 taken 2 times.
2 status = incoming.deserializeTo(cmdSeq);
237 }
238
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (status == Fw::FW_SERIALIZE_OK) {
239
1/1
✓ Branch 2 taken 2 times.
2 status = incoming.deserializeTo(response);
240 }
241 // Send it!
242
3/6
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
4 if ((status == Fw::FW_SERIALIZE_OK) && (port < this->getNum_cmdRespOut_OutputPorts()) &&
243
2/3
✓ Branch 5 taken 2 times.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
2 this->isConnected_cmdRespOut_OutputPort(static_cast<FwIndexType>(port))) {
244
1/1
✓ Branch 5 taken 2 times.
2 this->cmdRespOut_out(static_cast<FwIndexType>(port), opCode, cmdSeq, response);
245 }
246 // Return the received buffer
247
1/1
✓ Branch 5 taken 2 times.
2 fromBufferDriverReturn_out(0, fwBuffer);
248 2 }
249 } else {
250 // On deserialization failure, return the buffer to avoid leaks
251
1/1
✓ Branch 5 taken 3 times.
3 fromBufferDriverReturn_out(0, fwBuffer);
252 }
253 20068 }
254
255 10034 void GenericHub::toBufferDriverReturn_handler(FwIndexType portNum, Fw::Buffer& fwBuffer) {
256 // Deallocate the existing buffer
257 10034 deallocate_out(portNum, fwBuffer);
258 10034 }
259
260 1 void GenericHub::eventIn_handler(const FwIndexType portNum,
261 FwEventIdType id,
262 Fw::Time& timeTag,
263 const Fw::LogSeverity& severity,
264 Fw::LogBuffer& args) {
265 1 Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
266 1 U8 buffer[sizeof(FwEventIdType) + Fw::Time::SERIALIZED_SIZE + Fw::LogSeverity::SERIALIZED_SIZE +
267 FW_LOG_BUFFER_MAX_SIZE];
268
1/1
✓ Branch 2 taken 1 times.
1 Fw::ExternalSerializeBuffer serializer(buffer, sizeof(buffer));
269
1/1
✓ Branch 2 taken 1 times.
1 serializer.resetSer();
270
1/1
✓ Branch 2 taken 1 times.
1 status = serializer.serializeFrom(id);
271 1 FW_ASSERT(status == Fw::SerializeStatus::FW_SERIALIZE_OK);
272
1/1
✓ Branch 4 taken 1 times.
1 status = serializer.serializeFrom(timeTag);
273 1 FW_ASSERT(status == Fw::SerializeStatus::FW_SERIALIZE_OK);
274
1/1
✓ Branch 5 taken 1 times.
1 status = serializer.serializeFrom(severity);
275 1 FW_ASSERT(status == Fw::SerializeStatus::FW_SERIALIZE_OK);
276
1/1
✓ Branch 4 taken 1 times.
1 status = serializer.serializeFrom(args);
277 1 FW_ASSERT(status == Fw::SerializeStatus::FW_SERIALIZE_OK);
278
1/1
✓ Branch 2 taken 1 times.
1 FwSizeType size = serializer.getSize();
279
1/1
✓ Branch 4 taken 1 times.
1 this->send_data(HubType::HUB_TYPE_EVENT, portNum, buffer, size);
280 2 }
281
282 1 void GenericHub::tlmIn_handler(const FwIndexType portNum, FwChanIdType id, Fw::Time& timeTag, Fw::TlmBuffer& val) {
283 1 Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
284 1 U8 buffer[sizeof(FwChanIdType) + Fw::Time::SERIALIZED_SIZE + FW_TLM_BUFFER_MAX_SIZE];
285
1/1
✓ Branch 2 taken 1 times.
1 Fw::ExternalSerializeBuffer serializer(buffer, sizeof(buffer));
286
1/1
✓ Branch 2 taken 1 times.
1 serializer.resetSer();
287
1/1
✓ Branch 2 taken 1 times.
1 status = serializer.serializeFrom(id);
288 1 FW_ASSERT(status == Fw::SerializeStatus::FW_SERIALIZE_OK);
289
1/1
✓ Branch 4 taken 1 times.
1 status = serializer.serializeFrom(timeTag);
290 1 FW_ASSERT(status == Fw::SerializeStatus::FW_SERIALIZE_OK);
291
1/1
✓ Branch 4 taken 1 times.
1 status = serializer.serializeFrom(val);
292 1 FW_ASSERT(status == Fw::SerializeStatus::FW_SERIALIZE_OK);
293
1/1
✓ Branch 2 taken 1 times.
1 FwSizeType size = serializer.getSize();
294
1/1
✓ Branch 4 taken 1 times.
1 this->send_data(HubType::HUB_TYPE_CHANNEL, portNum, buffer, size);
295 2 }
296
297 // ----------------------------------------------------------------------
298 // Handler implementations for user-defined serial input ports
299 // ----------------------------------------------------------------------
300
301 5028 void GenericHub::serialIn_handler(FwIndexType portNum, /*!< The port number*/
302 Fw::LinearBufferBase& Buffer /*!< The serialization buffer*/
303 ) {
304 5028 send_data(HUB_TYPE_PORT, portNum, Buffer.getBuffAddr(), Buffer.getSize());
305 5028 }
306
307 } // end namespace Svc
308