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 ComFprime {
14 
16 
17 }
18 
19 namespace ComFprime {
20 
22 
23 }
24 
25 namespace ComFprime {
26 
28 
29 }
30 
31 namespace ComFprime {
32 
34 
35 }
36 
37 namespace ComFprime {
38 
40 
41 }
42 
43 namespace ComFprime {
44 
46 
47 }
48 
49 namespace ComFprime {
50 
52 
53 }
54 
55 namespace ComFprime {
56 
58 
59 }
60 
61 namespace ComFprime {
62 
64 
65 }
66 
67 namespace ComFprime {
68 
69  // ----------------------------------------------------------------------
70  // Helper functions
71  // ----------------------------------------------------------------------
72 
73  void initComponents(const TopologyState& state) {
83  }
84 
85  void configComponents(const TopologyState& state) {
87  if (state.hostname != nullptr && state.port != 0) {
88  ComFprime::comDriver.configure(state.hostname, state.port);
89  }
90  Svc::ComQueue::QueueConfigurationTable configurationTable;
91  // Events (highest-priority)
94  // Telemetry
97  // File Downlink Queue
100  // Allocation identifier is 0 as the MallocAllocator discards it
109  0,
112  );
115  1,
118  );
119  }
120 
121  void setBaseIds() {
131  }
132 
134 
135  // Downlink
137  0,
138  ComFprime::comStub.get_drvConnected_InputPort(0)
139  );
141  0,
142  ComFprime::comStub.get_drvSendReturnIn_InputPort(0)
143  );
145  0,
146  ComFprime::fprimeFramer.get_dataIn_InputPort(0)
147  );
149  0,
150  ComFprime::fprimeFramer.get_comStatusIn_InputPort(0)
151  );
153  0,
154  ComFprime::fprimeFramer.get_dataReturnIn_InputPort(0)
155  );
157  0,
158  ComFprime::comDriver.get_send_InputPort(0)
159  );
161  0,
162  ComFprime::commsBufferManager.get_bufferGetCallee_InputPort(0)
163  );
165  0,
166  ComFprime::commsBufferManager.get_bufferSendIn_InputPort(0)
167  );
169  0,
170  ComFprime::comQueue.get_comStatusIn_InputPort(0)
171  );
173  0,
174  ComFprime::comStub.get_dataIn_InputPort(0)
175  );
177  0,
178  ComFprime::comQueue.get_dataReturnIn_InputPort(0)
179  );
180 
181  // Uplink
183  0,
184  ComFprime::commsBufferManager.get_bufferGetCallee_InputPort(0)
185  );
187  0,
188  ComFprime::commsBufferManager.get_bufferSendIn_InputPort(0)
189  );
191  0,
192  ComFprime::comStub.get_drvReceiveIn_InputPort(0)
193  );
195  0,
196  ComFprime::frameAccumulator.get_dataIn_InputPort(0)
197  );
199  0,
200  ComFprime::comDriver.get_recvReturnIn_InputPort(0)
201  );
203  0,
204  ComFprime::fprimeRouter.get_dataIn_InputPort(0)
205  );
207  0,
208  ComFprime::frameAccumulator.get_dataReturnIn_InputPort(0)
209  );
211  0,
212  ComFprime::commsBufferManager.get_bufferGetCallee_InputPort(0)
213  );
215  0,
216  ComFprime::commsBufferManager.get_bufferSendIn_InputPort(0)
217  );
219  0,
220  ComFprime::deframer.get_dataReturnIn_InputPort(0)
221  );
223  0,
224  ComFprime::commsBufferManager.get_bufferGetCallee_InputPort(0)
225  );
227  0,
228  ComFprime::commsBufferManager.get_bufferSendIn_InputPort(0)
229  );
231  0,
232  ComFprime::deframer.get_dataIn_InputPort(0)
233  );
235  0,
236  ComFprime::comStub.get_dataReturnIn_InputPort(0)
237  );
238  }
239 
240  void regCommands() {
242  }
243 
244  void readParameters() {
245  // Nothing to do
246  }
247 
248  void loadParameters() {
249  // Nothing to do
250  }
251 
252  void startTasks(const TopologyState& state) {
254  static_cast<FwTaskPriorityType>(Priorities::ComFprime_cmdSeq),
255  static_cast<Os::Task::ParamType>(StackSizes::ComFprime_cmdSeq),
256  Os::Task::TASK_DEFAULT, // Default CPU
257  static_cast<Os::Task::ParamType>(TaskIds::ComFprime_cmdSeq)
258  );
259  // Initialize socket client communication if and only if there is a valid specification
260  if (state.hostname != nullptr && state.port != 0) {
261  Os::TaskString name("ReceiveTask");
263  }
265  static_cast<FwTaskPriorityType>(Priorities::ComFprime_comQueue),
266  static_cast<Os::Task::ParamType>(StackSizes::ComFprime_comQueue),
267  Os::Task::TASK_DEFAULT, // Default CPU
268  static_cast<Os::Task::ParamType>(TaskIds::ComFprime_comQueue)
269  );
270  }
271 
272  void stopTasks(const TopologyState& state) {
276  }
277 
278  void freeThreads(const TopologyState& state) {
279  (void) ComFprime::cmdSeq.ActiveComponentBase::join();
280  (void)ComFprime::comDriver.join();
281  (void) ComFprime::comQueue.ActiveComponentBase::join();
282  }
283 
284  void tearDownComponents(const TopologyState& state) {
288  }
289 
290  // ----------------------------------------------------------------------
291  // Setup and teardown functions
292  // ----------------------------------------------------------------------
293 
294  void setup(const TopologyState& state) {
295  initComponents(state);
296  configComponents(state);
297  setBaseIds();
299  regCommands();
300  readParameters();
301  loadParameters();
302  startTasks(state);
303  }
304 
305  void teardown(const TopologyState& state) {
306  stopTasks(state);
307  freeThreads(state);
308  tearDownComponents(state);
309  }
310 
311 }
void init(FwEnumStoreType instance=0)
Initialize TcpClientComponentBase object.
void set_allocate_OutputPort(FwIndexType portNum, Fw::InputBufferGetPort *port)
Connect port to allocate[portNum].
static constexpr FwSizeType TASK_DEFAULT
Definition: Task.hpp:31
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
void setIdBase(const FwIdType)
Set the ID base.
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
void startTasks(const TopologyState &state)
Start tasks.
void readParameters()
Read parameters.
Svc::FrameDetectors::CcsdsTcFrameDetector frameDetector
void set_comStatusOut_OutputPort(FwIndexType portNum, Fw::InputSuccessConditionPort *port)
Connect port to comStatusOut[portNum].
void init(FwEnumStoreType instance=0)
Initialize FprimeRouterComponentBase object.
void regCommands()
Register commands with the Command Dispatcher.
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.
Svc::CmdSequencer cmdSeq(FW_OPTIONAL_NAME("cmdSeq"))
cmdSeq
Svc::BufferManager commsBufferManager(FW_OPTIONAL_NAME("commsBufferManager"))
commsBufferManager
#define FW_OPTIONAL_NAME(name)
Definition: FpConfig.h:60
void set_bufferAllocate_OutputPort(FwIndexType portNum, Fw::InputBufferGetPort *port)
Connect port to bufferAllocate[portNum].
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].
Svc::FprimeRouter fprimeRouter(FW_OPTIONAL_NAME("fprimeRouter"))
fprimeRouter
void exit()
exit task in active component
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 connectComponents()
Connect components.
void regCommands()
Register commands.
void init(FwEnumStoreType instance=0)
Initialize FprimeDeframerComponentBase object.
void set_bufferDeallocate_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferDeallocate[portNum].
void set_sendReturnOut_OutputPort(FwIndexType portNum, Drv::InputByteStreamDataPort *port)
Connect port to sendReturnOut[portNum].
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
FwIndexType priority
Priority of the queue [0, TOTAL_PORT_COUNT)
Definition: ComQueue.hpp:50
void set_bufferAllocate_OutputPort(FwIndexType portNum, Fw::InputBufferGetPort *port)
Connect port to bufferAllocate[portNum].
void init(FwEnumStoreType instance=0)
Initialize BufferManagerComponentBase object.
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
void set_bufferDeallocate_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferDeallocate[portNum].
void allocateBuffer(const FwEnumStoreType identifier, Fw::MemAllocator &allocator, const FwSizeType bytes)
void init(FwEnumStoreType instance=0)
Initialize FrameAccumulatorComponentBase object.
Svc::FprimeDeframer deframer(FW_OPTIONAL_NAME("deframer"))
deframer
FwSizeType depth
Depth of the queue [0, infinity)
Definition: ComQueue.hpp:49
Svc::FrameAccumulator frameAccumulator(FW_OPTIONAL_NAME("frameAccumulator"))
frameAccumulator
Svc::FprimeFramer fprimeFramer(FW_OPTIONAL_NAME("fprimeFramer"))
fprimeFramer
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
void set_bufferAllocate_OutputPort(FwIndexType portNum, Fw::InputBufferGetPort *port)
Connect port to bufferAllocate[portNum].
void tearDownComponents(const TopologyState &state)
Tear down components.
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].
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
void freeThreads(const TopologyState &state)
Free threads.
void init(FwSizeType queueDepth, FwEnumStoreType instance=0)
Initialize CmdSequencerComponentBase object.
void configComponents(const TopologyState &state)
Configure components.
void setup(U16 mgrID, FwEnumStoreType memID, Fw::MemAllocator &allocator, const BufferBins &bins)
set up configuration
void teardown(const TopologyState &state)
Tear down the topology.
Svc::ComStub comStub(FW_OPTIONAL_NAME("comStub"))
comStub
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
void cleanup()
Deallocate internal resources (set up by configure() call)
void setup(const TopologyState &state)
Set up the topology.
void deallocateBuffer(Fw::MemAllocator &allocator)
Return allocated buffer. Call during shutdown.
void setBaseIds()
Set component base Ids.
void stop()
stop the socket read task and close the associated socket.
Svc::ComQueue comQueue(FW_OPTIONAL_NAME("comQueue"))
comQueue
void init(FwSizeType queueDepth, FwEnumStoreType instance=0)
Initialize ComQueueComponentBase object.
void loadParameters()
Load parameters.
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 init(FwEnumStoreType instance=0)
Initialize FprimeFramerComponentBase object.
void stopTasks(const TopologyState &state)
Stop tasks.
void set_bufferDeallocate_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferDeallocate[portNum].
Drv::TcpClient comDriver(FW_OPTIONAL_NAME("comDriver"))
comDriver
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.
U16 numBuffers
number of 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 configure(QueueConfigurationTable queueConfig, FwEnumStoreType allocationId, Fw::MemAllocator &allocator)
Definition: ComQueue.cpp:51