F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FpySequencerStateMachine.cpp
Go to the documentation of this file.
1 #include <new>
3 namespace Svc {
4 
5 // ----------------------------------------------------------------------
6 // Functions to implement for internal state machine actions
7 // ----------------------------------------------------------------------
8 
12 void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_signalEntered(
13  SmId smId,
15 ) {
17 }
18 
23 void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_setSequenceFilePath(
24  SmId smId,
27 ) {
28  this->m_sequenceFilePath = value.getfilePath();
29 }
30 
35 void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_setSequenceBlockState(
36  SmId smId,
39 ) {
40  this->m_sequenceBlockState = value.getblock();
41 }
42 
47 void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_report_seqSucceeded(
48  SmId smId,
50 ) {
51  this->m_tlm.sequencesSucceeded++;
52  this->log_ACTIVITY_HI_SequenceDone(this->m_sequenceFilePath);
53 }
54 
59 void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_report_seqCancelled(
60  SmId smId,
62 ) {
63  this->m_tlm.sequencesCancelled++;
64  this->log_ACTIVITY_HI_SequenceCancelled(this->m_sequenceFilePath);
65 }
66 
71 void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_dispatchStatement(
72  SmId smId,
74 ) {
75  Signal result = this->dispatchStatement();
76  switch (result) {
79  break;
80  }
83  break;
84  }
87  break;
88  }
89  default: {
90  FW_ASSERT(0, static_cast<FwAssertArgType>(result));
91  }
92  }
93 }
94 
99 void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_setGoalState_RUNNING(
100  SmId smId,
102 ) {
103  this->m_goalState = FpySequencer_GoalState::RUNNING;
104 }
105 
110 void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_setGoalState_VALID(
111  SmId smId,
113 ) {
114  this->m_goalState = FpySequencer_GoalState::VALID;
115 }
116 
121 void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_setGoalState_IDLE(
122  SmId smId,
124 ) {
125  this->m_goalState = FpySequencer_GoalState::IDLE;
126 }
127 
132 void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_sendCmdResponse_OK(
133  SmId smId,
135 ) {
136  if (this->m_sequenceBlockState == FpySequencer_BlockState::BLOCK) {
137  // respond if we were waiting on a response
138  this->cmdResponse_out(this->m_savedOpCode, this->m_savedCmdSeq, Fw::CmdResponse::OK);
139  }
140 }
141 
146 void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_sendCmdResponse_EXECUTION_ERROR(
147  SmId smId,
149 ) {
150  if (this->m_sequenceBlockState == FpySequencer_BlockState::BLOCK) {
151  // respond if we were waiting on a response
152  this->cmdResponse_out(this->m_savedOpCode, this->m_savedCmdSeq, Fw::CmdResponse::EXECUTION_ERROR);
153  }
154 }
155 
160 void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_resetRuntime(
161  SmId smId,
163 ) {
164  // explicitly call dtor
165  this->m_runtime.~Runtime();
166  new (&this->m_runtime) Runtime();
167 }
168 
174 void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_validate(
175  SmId smId,
177 ) {
178  Fw::Success result = this->validate();
179  if (result == Fw::Success::FAILURE) {
181  return;
182  }
184 }
185 
189 void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_checkShouldWake(
190  SmId smId,
192 ) {
193  Signal result = this->checkShouldWake();
194  switch (result) {
197  break;
198  }
201  break;
202  }
205  break;
206  }
207  default: {
208  FW_ASSERT(0, static_cast<FwAssertArgType>(result));
209  }
210  }
211 }
212 
216 void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_checkStatementTimeout(
217  SmId smId,
219 ) {
220  Signal result = this->checkStatementTimeout();
221  switch (result) {
224  break;
225  }
228  break;
229  }
232  break;
233  }
234  default: {
235  FW_ASSERT(0, static_cast<FwAssertArgType>(result));
236  }
237  }
238 }
239 
243 void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_incrementSequenceCounter(
244  SmId smId,
246 ) {
247  this->m_sequencesStarted++;
248 }
249 
253 void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_clearSequenceFile(
254  SmId smId,
256 ) {
257  this->m_sequenceFilePath = "";
258 }
259 
260 // ----------------------------------------------------------------------
261 // Functions to implement for internal state machine guards
262 // ----------------------------------------------------------------------
263 
269  SmId smId,
271 ) const {
272  return this->m_goalState == FpySequencer_GoalState::RUNNING;
273 }
274 
275 } // namespace Svc
void sequencer_sendSignal_result_dispatchStatement_noMoreStatements()
Send signal result_dispatchStatement_noMoreStatements to state machine sequencer. ...
void sequencer_sendSignal_result_checkShouldWake_keepSleeping()
Send signal result_checkShouldWake_keepSleeping to state machine sequencer.
called in dispatchStatement method when a statement was unable to be sent out
called in dispatchStatement method when there were no more statements in the sequence ...
void sequencer_sendSignal_result_dispatchStatement_success()
Send signal result_dispatchStatement_success to state machine sequencer.
bool Svc_FpySequencer_SequencerStateMachine_guard_goalStateIs_RUNNING(SmId smId, Svc_FpySequencer_SequencerStateMachine::Signal signal) const override
Svc::FpySequencer_BlockState::T getblock() const
Get member block.
void sequencer_sendSignal_result_checkShouldWake_wakeup()
Send signal result_checkShouldWake_wakeup to state machine sequencer.
void sequencer_sendSignal_result_success()
Send signal result_success to state machine sequencer.
void sequencer_sendSignal_result_dispatchStatement_failure()
Send signal result_dispatchStatement_failure to state machine sequencer.
called in dispatchStatement method when a statement was successfully dispatched
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
void sequencer_sendSignal_result_checkStatementTimeout_noTimeout()
Send signal result_checkStatementTimeout_noTimeout to state machine sequencer.
Representing failure.
Command successfully executed.
void sequencer_sendSignal_result_timeOpFailed()
Send signal result_timeOpFailed to state machine sequencer.
Command had execution error.
void sequencer_sendSignal_result_checkStatementTimeout_statementTimeout()
Send signal result_checkStatementTimeout_statementTimeout to state machine sequencer.
void log_ACTIVITY_HI_SequenceCancelled(const Fw::StringBase &filePath) const
Log event SequenceCancelled.
RateGroupDivider component implementation.
void sequencer_sendSignal_result_failure()
Send signal result_failure to state machine sequencer.
void sequencer_sendSignal_entered()
Send signal entered to state machine sequencer.
void log_ACTIVITY_HI_SequenceDone(const Fw::StringBase &filePath) const
Log event SequenceDone.
FpySequencer_SequencerStateMachineStateMachineBase::Signal Signal
#define FW_ASSERT(...)
Definition: Assert.hpp:14
Success/Failure.