F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
SubtopologyTopologyAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title SubtopologyTopologyAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for Subtopology topology
5 // ======================================================================
6 
8 
9 // ----------------------------------------------------------------------
10 // Component instances
11 // ----------------------------------------------------------------------
12 
13 namespace ComCcsds {
14 
16 
17 }
18 
19 namespace ComCcsds {
20 
22 
23 }
24 
25 namespace ComCcsds {
26 
28 
29 }
30 
31 namespace ComCcsds {
32 
34 
35 }
36 
37 namespace ComCcsds {
38 
40 
41 }
42 
43 namespace ComCcsds {
44 
46 
47 }
48 
49 namespace ComCcsds {
50 
52 
53 }
54 
55 namespace ComCcsds {
56 
58 
59 }
60 
61 namespace ComCcsds {
62 
64 
65 }
66 
67 namespace ComCcsds {
68 
70 
71 }
72 
73 namespace ComCcsds {
74 
76 
77 }
78 
79 namespace ComCcsds {
80 
82 
83 }
84 
85 namespace ComCcsds {
86 
87  // ----------------------------------------------------------------------
88  // Component configuration objects
89  // ----------------------------------------------------------------------
90 
91  namespace ConfigObjects {
92 
95  }
96 
99  }
100 
101  }
102 
103  // ----------------------------------------------------------------------
104  // Helper functions
105  // ----------------------------------------------------------------------
106 
107  void initComponents(const TopologyState& state) {
120  }
121 
122  void configComponents(const TopologyState& state) {
124  if (state.comCcsds.hostname != nullptr && state.comCcsds.port != 0) {
126  }
127  Svc::ComQueue::QueueConfigurationTable configurationTable;
128 
129  // Events (highest-priority)
132 
133  // Telemetry
136 
137  // File Downlink Queue
140 
141  // Allocation identifier is 0 as the MallocAllocator discards it
150  0,
153  );
156  1,
159  );
160  }
161 
162  void setBaseIds() {
175  }
176 
178 
179  // Downlink
181  0,
182  ComCcsds::comStub.get_drvConnected_InputPort(0)
183  );
185  0,
186  ComCcsds::comStub.get_drvSendReturnIn_InputPort(0)
187  );
189  0,
190  ComCcsds::spacePacketFramer.get_dataIn_InputPort(0)
191  );
193  0,
194  ComCcsds::tmFramer.get_comStatusIn_InputPort(0)
195  );
197  0,
198  ComCcsds::tmFramer.get_dataReturnIn_InputPort(0)
199  );
201  0,
202  ComCcsds::comDriver.get_send_InputPort(0)
203  );
205  0,
206  ComCcsds::commsBufferManager.get_bufferGetCallee_InputPort(0)
207  );
209  0,
210  ComCcsds::commsBufferManager.get_bufferSendIn_InputPort(0)
211  );
213  0,
214  ComCcsds::comQueue.get_comStatusIn_InputPort(0)
215  );
217  0,
218  ComCcsds::tmFramer.get_dataIn_InputPort(0)
219  );
221  0,
222  ComCcsds::comQueue.get_dataReturnIn_InputPort(0)
223  );
225  0,
226  ComCcsds::apidManager.get_getApidSeqCountIn_InputPort(0)
227  );
229  0,
230  ComCcsds::spacePacketFramer.get_comStatusIn_InputPort(0)
231  );
233  0,
234  ComCcsds::comStub.get_dataIn_InputPort(0)
235  );
237  0,
238  ComCcsds::spacePacketFramer.get_dataReturnIn_InputPort(0)
239  );
240 
241  // Uplink
243  0,
244  ComCcsds::commsBufferManager.get_bufferGetCallee_InputPort(0)
245  );
247  0,
248  ComCcsds::commsBufferManager.get_bufferSendIn_InputPort(0)
249  );
251  0,
252  ComCcsds::comStub.get_drvReceiveIn_InputPort(0)
253  );
255  0,
256  ComCcsds::frameAccumulator.get_dataIn_InputPort(0)
257  );
259  0,
260  ComCcsds::comDriver.get_recvReturnIn_InputPort(0)
261  );
263  0,
264  ComCcsds::commsBufferManager.get_bufferGetCallee_InputPort(0)
265  );
267  0,
268  ComCcsds::commsBufferManager.get_bufferSendIn_InputPort(0)
269  );
271  0,
272  ComCcsds::spacePacketDeframer.get_dataReturnIn_InputPort(0)
273  );
275  0,
276  ComCcsds::commsBufferManager.get_bufferGetCallee_InputPort(0)
277  );
279  0,
280  ComCcsds::commsBufferManager.get_bufferSendIn_InputPort(0)
281  );
283  0,
284  ComCcsds::tcDeframer.get_dataIn_InputPort(0)
285  );
287  0,
288  ComCcsds::comStub.get_dataReturnIn_InputPort(0)
289  );
291  0,
292  ComCcsds::fprimeRouter.get_dataIn_InputPort(0)
293  );
295  0,
296  ComCcsds::tcDeframer.get_dataReturnIn_InputPort(0)
297  );
299  0,
300  ComCcsds::apidManager.get_validateApidSeqCountIn_InputPort(0)
301  );
303  0,
304  ComCcsds::spacePacketDeframer.get_dataIn_InputPort(0)
305  );
307  0,
308  ComCcsds::frameAccumulator.get_dataReturnIn_InputPort(0)
309  );
310  }
311 
312  void regCommands() {
314  }
315 
316  void readParameters() {
317  // Nothing to do
318  }
319 
320  void loadParameters() {
321  // Nothing to do
322  }
323 
324  void startTasks(const TopologyState& state) {
326  static_cast<FwTaskPriorityType>(Priorities::ComCcsds_cmdSeq),
327  static_cast<Os::Task::ParamType>(StackSizes::ComCcsds_cmdSeq),
328  Os::Task::TASK_DEFAULT, // Default CPU
329  static_cast<Os::Task::ParamType>(TaskIds::ComCcsds_cmdSeq)
330  );
331  // Initialize socket client communication if and only if there is a valid specification
332  if (state.comCcsds.hostname != nullptr && state.comCcsds.port != 0) {
333  Os::TaskString name("ReceiveTask");
335  }
337  static_cast<FwTaskPriorityType>(Priorities::ComCcsds_comQueue),
338  static_cast<Os::Task::ParamType>(StackSizes::ComCcsds_comQueue),
339  Os::Task::TASK_DEFAULT, // Default CPU
340  static_cast<Os::Task::ParamType>(TaskIds::ComCcsds_comQueue)
341  );
342  }
343 
344  void stopTasks(const TopologyState& state) {
348  }
349 
350  void freeThreads(const TopologyState& state) {
351  (void) ComCcsds::cmdSeq.ActiveComponentBase::join();
352  (void)ComCcsds::comDriver.join();
353  (void) ComCcsds::comQueue.ActiveComponentBase::join();
354  }
355 
356  void tearDownComponents(const TopologyState& state) {
361  }
362 
363  // ----------------------------------------------------------------------
364  // Setup and teardown functions
365  // ----------------------------------------------------------------------
366 
367  void setup(const TopologyState& state) {
368  initComponents(state);
369  configComponents(state);
370  setBaseIds();
372  regCommands();
373  readParameters();
374  loadParameters();
375  startTasks(state);
376  }
377 
378  void teardown(const TopologyState& state) {
379  stopTasks(state);
380  freeThreads(state);
381  tearDownComponents(state);
382  }
383 
384 }
void init(FwEnumStoreType instance=0)
Initialize TcpClientComponentBase object.
void set_allocate_OutputPort(FwIndexType portNum, Fw::InputBufferGetPort *port)
Connect port to allocate[portNum].
void setBaseIds()
Set component base Ids.
static constexpr FwSizeType TASK_DEFAULT
Definition: Task.hpp:31
void freeThreads(const TopologyState &state)
Free threads.
void init(FwEnumStoreType instance=0)
Initialize SpacePacketDeframerComponentBase object.
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
void setIdBase(const FwIdType)
Set the ID base.
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
BufferBin bins[BUFFERMGR_MAX_NUM_BINS]
set of bins to define buffers
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
QueueConfigurationEntry entries[TOTAL_PORT_COUNT]
Definition: ComQueue.hpp:63
configuration table for each queue
Definition: ComQueue.hpp:62
Svc::FrameAccumulator frameAccumulator(FW_OPTIONAL_NAME("frameAccumulator"))
frameAccumulator
Svc::FrameDetectors::CcsdsTcFrameDetector frameDetector
void init(FwEnumStoreType instance=0)
Initialize FprimeRouterComponentBase object.
void regCommands()
Register commands with the Command Dispatcher.
Svc::ComStub comStub(FW_OPTIONAL_NAME("comStub"))
comStub
void init(FwEnumStoreType instance=0)
Initialize TcDeframerComponentBase object.
Svc::FprimeRouter fprimeRouter(FW_OPTIONAL_NAME("fprimeRouter"))
fprimeRouter
void set_drvSendOut_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to drvSendOut[portNum].
SocketIpStatus configure(const char *hostname, const U16 port, const U32 send_timeout_seconds=SOCKET_SEND_TIMEOUT_SECONDS, const U32 send_timeout_microseconds=SOCKET_SEND_TIMEOUT_MICROSECONDS, FwSizeType buffer_size=1024)
Configures the TcpClient settings but does not open the connection.
#define FW_OPTIONAL_NAME(name)
Definition: FpConfig.h:60
void set_bufferAllocate_OutputPort(FwIndexType portNum, Fw::InputBufferGetPort *port)
Connect port to bufferAllocate[portNum].
void regCommands()
Register commands.
void start(const Fw::StringBase &name, const FwTaskPriorityType priority=Os::Task::TASK_PRIORITY_DEFAULT, const Os::Task::ParamType stack=Os::Task::TASK_DEFAULT, const Os::Task::ParamType cpuAffinity=Os::Task::TASK_DEFAULT)
start the socket read task to start producing data
void set_ready_OutputPort(FwIndexType portNum, Drv::InputByteStreamReadyPort *port)
Connect port to ready[portNum].
void readParameters()
Read parameters.
void stopTasks(const TopologyState &state)
Stop tasks.
void set_bufferAllocate_OutputPort(FwIndexType portNum, Fw::InputBufferGetPort *port)
Connect port to bufferAllocate[portNum].
void connectComponents()
Connect components.
void exit()
exit task in active component
Svc::CmdSequencer cmdSeq(FW_OPTIONAL_NAME("cmdSeq"))
cmdSeq
void cleanup()
Definition: ComQueue.cpp:44
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
Fw::Buffer::SizeType bufferSize
size of the buffers in this bin. Set to zero for unused bins.
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
void tearDownComponents(const TopologyState &state)
Tear down components.
Svc::Ccsds::ApidManager apidManager(FW_OPTIONAL_NAME("apidManager"))
apidManager
Svc::Ccsds::SpacePacketFramer spacePacketFramer(FW_OPTIONAL_NAME("spacePacketFramer"))
spacePacketFramer
void set_bufferDeallocate_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferDeallocate[portNum].
Svc::Ccsds::TmFramer tmFramer(FW_OPTIONAL_NAME("tmFramer"))
tmFramer
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
void set_sendReturnOut_OutputPort(FwIndexType portNum, Drv::InputByteStreamDataPort *port)
Connect port to sendReturnOut[portNum].
FwIndexType priority
Priority of the queue [0, TOTAL_PORT_COUNT)
Definition: ComQueue.hpp:50
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
void setup(const TopologyState &state)
Set up the topology.
void set_bufferAllocate_OutputPort(FwIndexType portNum, Fw::InputBufferGetPort *port)
Connect port to bufferAllocate[portNum].
void set_getApidSeqCount_OutputPort(FwIndexType portNum, Svc::Ccsds::InputApidSequenceCountPort *port)
Connect port to getApidSeqCount[portNum].
void init(FwEnumStoreType instance=0)
Initialize BufferManagerComponentBase object.
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
void configComponents(const TopologyState &state)
Configure components.
Svc::Ccsds::TcDeframer tcDeframer(FW_OPTIONAL_NAME("tcDeframer"))
tcDeframer
void allocateBuffer(const FwEnumStoreType identifier, Fw::MemAllocator &allocator, const FwSizeType bytes)
void init(FwEnumStoreType instance=0)
Initialize FrameAccumulatorComponentBase object.
Svc::BufferManager commsBufferManager(FW_OPTIONAL_NAME("commsBufferManager"))
commsBufferManager
FwSizeType depth
Depth of the queue [0, infinity)
Definition: ComQueue.hpp:49
void init(FwEnumStoreType instance=0)
Initialize TmFramerComponentBase object.
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
Drv::TcpClient comDriver(FW_OPTIONAL_NAME("comDriver"))
comDriver
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
void startTasks(const TopologyState &state)
Start tasks.
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
void set_recv_OutputPort(FwIndexType portNum, Drv::InputByteStreamDataPort *port)
Connect port to recv[portNum].
void set_deallocate_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to deallocate[portNum].
interface class used to codify what must be supported to allow frame detection
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
void init(FwSizeType queueDepth, FwEnumStoreType instance=0)
Initialize CmdSequencerComponentBase object.
void teardown(const TopologyState &state)
Tear down the topology.
void setup(U16 mgrID, FwEnumStoreType memID, Fw::MemAllocator &allocator, const BufferBins &bins)
set up configuration
void cleanup()
Deallocate internal resources (set up by configure() call)
void deallocateBuffer(Fw::MemAllocator &allocator)
Return allocated buffer. Call during shutdown.
void stop()
stop the socket read task and close the associated socket.
void set_comStatusOut_OutputPort(FwIndexType portNum, Fw::InputSuccessConditionPort *port)
Connect port to comStatusOut[portNum].
void init(FwEnumStoreType instance=0)
Initialize ApidManagerComponentBase object.
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
void init(FwSizeType queueDepth, FwEnumStoreType instance=0)
Initialize ComQueueComponentBase object.
Svc::Ccsds::SpacePacketDeframer spacePacketDeframer(FW_OPTIONAL_NAME("spacePacketDeframer"))
spacePacketDeframer
void configure(const FrameDetector &detector, FwEnumStoreType allocationId, Fw::MemAllocator &allocator, FwSizeType store_size)
configure memory allocation for the circular buffer
void set_drvReceiveReturnOut_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to drvReceiveReturnOut[portNum].
void set_validateApidSeqCount_OutputPort(FwIndexType portNum, Svc::Ccsds::InputApidSequenceCountPort *port)
Connect port to validateApidSeqCount[portNum].
void set_bufferDeallocate_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferDeallocate[portNum].
void init(FwEnumStoreType instance=0)
Initialize SpacePacketFramerComponentBase object.
void start(FwTaskPriorityType priority=Os::Task::TASK_PRIORITY_DEFAULT, FwSizeType stackSize=Os::Task::TASK_DEFAULT, FwSizeType cpuAffinity=Os::Task::TASK_DEFAULT, FwTaskIdType identifier=static_cast< FwTaskIdType >(Os::Task::TASK_DEFAULT))
called by instantiator when task is to be started
void init(FwEnumStoreType instance=0)
Initialize ComStubComponentBase object.
void set_comStatusOut_OutputPort(FwIndexType portNum, Fw::InputSuccessConditionPort *port)
Connect port to comStatusOut[portNum].
void initComponents(const TopologyState &state)
Initialize components.
void set_comStatusOut_OutputPort(FwIndexType portNum, Fw::InputSuccessConditionPort *port)
Connect port to comStatusOut[portNum].
Svc::ComQueue comQueue(FW_OPTIONAL_NAME("comQueue"))
comQueue
U16 numBuffers
number of buffers in this bin. Set to zero for unused bins.
void set_bufferDeallocate_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferDeallocate[portNum].
void loadParameters()
Load parameters.
void configure(QueueConfigurationTable queueConfig, FwEnumStoreType allocationId, Fw::MemAllocator &allocator)
Definition: ComQueue.cpp:51