| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include <new> | ||
| 2 | #include "Svc/FpySequencer/FpySequencer.hpp" | ||
| 3 | namespace Svc { | ||
| 4 | |||
| 5 | // ---------------------------------------------------------------------- | ||
| 6 | // Functions to implement for internal state machine actions | ||
| 7 | // ---------------------------------------------------------------------- | ||
| 8 | |||
| 9 | //! Implementation for action signalEntered of state machine Svc_FpySequencer_SequencerStateMachine | ||
| 10 | //! | ||
| 11 | //! simply raises the "entered" signal | ||
| 12 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_signalEntered( | |
| 13 | SmId smId, //!< The state machine id | ||
| 14 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 15 | ) { | ||
| 16 | ✗ | this->sequencer_sendSignal_entered(); | |
| 17 | ✗ | } | |
| 18 | |||
| 19 | //! Implementation for action setSequenceFilePath of state machine | ||
| 20 | //! Svc_FpySequencer_SequencerStateMachine | ||
| 21 | //! | ||
| 22 | //! sets the current sequence file path member var, resolving it against | ||
| 23 | //! the SEQ_BASE_DIR parameter so that subsequent telemetry, events, and | ||
| 24 | //! file IO see the fully qualified path | ||
| 25 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_setSequenceFilePath( | |
| 26 | SmId smId, //!< The state machine id | ||
| 27 | Svc_FpySequencer_SequencerStateMachine::Signal signal, //!< The signal | ||
| 28 | const Svc::FpySequencer_SequenceExecutionArgs& value //!< The value | ||
| 29 | ) { | ||
| 30 | ✗ | Fw::ParamValid valid; | |
| 31 | ✗ | Fw::ParamString baseDir = this->paramGet_SEQ_BASE_DIR(valid); | |
| 32 | ✗ | if (baseDir.length() == 0) { | |
| 33 | // the assignment here ensures the string is null terminated | ||
| 34 | // because it uses the string_copy method | ||
| 35 | // also, the filePath string in SequenceExecutionArgs is guaranteed | ||
| 36 | // to be truncated to FileNameStringSize chars, so it will not | ||
| 37 | // be truncated by this assignment | ||
| 38 | ✗ | this->m_sequenceFilePath = value.get_filePath(); | |
| 39 | ✗ | return; | |
| 40 | } | ||
| 41 | |||
| 42 | Fw::FormatStatus status; | ||
| 43 | // the result will get truncated to FileNameStringSize | ||
| 44 | ✗ | status = this->m_sequenceFilePath.format("%s/%s", baseDir.toChar(), value.get_filePath().toChar()); | |
| 45 | ✗ | if (status == Fw::FormatStatus::SUCCESS) { | |
| 46 | ✗ | return; | |
| 47 | } | ||
| 48 | |||
| 49 | // the only runtime-reachable non-success status is OVERFLOWED, which means the | ||
| 50 | // base dir and file name together are longer than the sequence file path buffer. | ||
| 51 | // the other statuses can only result from a bad format string literal, which is a | ||
| 52 | // coding error. let the user know the path was truncated; validate() will then fail | ||
| 53 | // to open the (truncated) path and report a FileOpenError. | ||
| 54 | ✗ | FW_ASSERT(status == Fw::FormatStatus::OVERFLOWED, static_cast<I32>(status)); | |
| 55 | ✗ | this->log_WARNING_HI_SequenceFilePathTooLong(baseDir, value.get_filePath()); | |
| 56 | ✗ | } | |
| 57 | |||
| 58 | //! Implementation for action setSequenceBlockState of state machine | ||
| 59 | //! Svc_FpySequencer_SequencerStateMachine | ||
| 60 | //! | ||
| 61 | //! sets the block state of the sequence to be run | ||
| 62 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_setSequenceBlockState( | |
| 63 | SmId smId, //!< The state machine id | ||
| 64 | Svc_FpySequencer_SequencerStateMachine::Signal signal, //!< The signal | ||
| 65 | const Svc::FpySequencer_SequenceExecutionArgs& value //!< The value | ||
| 66 | ) { | ||
| 67 | ✗ | this->m_sequenceBlockState = value.get_block(); | |
| 68 | ✗ | } | |
| 69 | |||
| 70 | //! Implementation for action setSequenceArguments of state machine | ||
| 71 | //! Svc_FpySequencer_SequencerStateMachine | ||
| 72 | //! | ||
| 73 | //! sets the arguments of the sequence to be run | ||
| 74 | ✗ | void FpySequencer ::Svc_FpySequencer_SequencerStateMachine_action_setSequenceArguments( | |
| 75 | SmId smId, | ||
| 76 | Svc_FpySequencer_SequencerStateMachine::Signal signal, | ||
| 77 | const Svc::FpySequencer_SequenceExecutionArgs& value) { | ||
| 78 | ✗ | this->m_sequenceArgs = value.get_buffer(); | |
| 79 | ✗ | } | |
| 80 | |||
| 81 | //! Implementation for action report_seqSucceeded of state machine | ||
| 82 | //! Svc_FpySequencer_SequencerStateMachine | ||
| 83 | //! | ||
| 84 | //! reports that a sequence was completed | ||
| 85 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_report_seqSucceeded( | |
| 86 | SmId smId, //!< The state machine id | ||
| 87 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 88 | ) { | ||
| 89 | ✗ | this->m_tlm.sequencesSucceeded++; | |
| 90 | ✗ | this->log_ACTIVITY_HI_SequenceDone(this->m_sequenceFilePath); | |
| 91 | ✗ | this->m_sequenceFilePath = NO_SEQ; | |
| 92 | ✗ | if (this->isConnected_seqDoneOut_OutputPort(0)) { | |
| 93 | // report that the sequence succeeded to internal callers | ||
| 94 | ✗ | this->seqDoneOut_out(0, 0, 0, Fw::CmdResponse::OK); | |
| 95 | } | ||
| 96 | ✗ | } | |
| 97 | |||
| 98 | //! Implementation for action report_seqCancelled of state machine | ||
| 99 | //! Svc_FpySequencer_SequencerStateMachine | ||
| 100 | //! | ||
| 101 | //! reports that a sequence was cancelled | ||
| 102 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_report_seqCancelled( | |
| 103 | SmId smId, //!< The state machine id | ||
| 104 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 105 | ) { | ||
| 106 | ✗ | this->m_tlm.sequencesCancelled++; | |
| 107 | ✗ | this->log_ACTIVITY_HI_SequenceCancelled(this->m_sequenceFilePath); | |
| 108 | ✗ | if (this->isConnected_seqDoneOut_OutputPort(0)) { | |
| 109 | // report that the sequence failed to internal callers | ||
| 110 | ✗ | this->seqDoneOut_out(0, 0, 0, Fw::CmdResponse::EXECUTION_ERROR); | |
| 111 | } | ||
| 112 | ✗ | } | |
| 113 | |||
| 114 | //! Implementation for action dispatchStatement of state machine | ||
| 115 | //! Svc_FpySequencer_SequencerStateMachine | ||
| 116 | //! | ||
| 117 | //! iterates to the next statement and dispatches it | ||
| 118 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_dispatchStatement( | |
| 119 | SmId smId, //!< The state machine id | ||
| 120 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 121 | ) { | ||
| 122 | ✗ | Signal result = this->dispatchStatement(); | |
| 123 | ✗ | switch (result) { | |
| 124 | ✗ | case Signal::result_dispatchStatement_noMoreStatements: { | |
| 125 | ✗ | this->sequencer_sendSignal_result_dispatchStatement_noMoreStatements(); | |
| 126 | ✗ | break; | |
| 127 | } | ||
| 128 | ✗ | case Signal::result_dispatchStatement_success: { | |
| 129 | ✗ | this->sequencer_sendSignal_result_dispatchStatement_success(); | |
| 130 | ✗ | break; | |
| 131 | } | ||
| 132 | ✗ | case Signal::result_dispatchStatement_failure: { | |
| 133 | ✗ | this->sequencer_sendSignal_result_dispatchStatement_failure(); | |
| 134 | ✗ | break; | |
| 135 | } | ||
| 136 | ✗ | default: { | |
| 137 | ✗ | FW_ASSERT(false, static_cast<FwAssertArgType>(result)); | |
| 138 | } | ||
| 139 | } | ||
| 140 | ✗ | } | |
| 141 | |||
| 142 | //! Implementation for action setGoalState_RUNNING of state machine | ||
| 143 | //! Svc_FpySequencer_SequencerStateMachine | ||
| 144 | //! | ||
| 145 | //! sets the goal state to RUNNING | ||
| 146 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_setGoalState_RUNNING( | |
| 147 | SmId smId, //!< The state machine id | ||
| 148 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 149 | ) { | ||
| 150 | ✗ | this->m_goalState = FpySequencer_GoalState::RUNNING; | |
| 151 | ✗ | } | |
| 152 | |||
| 153 | //! Implementation for action setGoalState_VALID of state machine | ||
| 154 | //! Svc_FpySequencer_SequencerStateMachine | ||
| 155 | //! | ||
| 156 | //! sets the goal state to VALID | ||
| 157 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_setGoalState_VALID( | |
| 158 | SmId smId, //!< The state machine id | ||
| 159 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 160 | ) { | ||
| 161 | ✗ | this->m_goalState = FpySequencer_GoalState::VALID; | |
| 162 | ✗ | } | |
| 163 | |||
| 164 | //! Implementation for action setGoalState_IDLE of state machine | ||
| 165 | //! Svc_FpySequencer_SequencerStateMachine | ||
| 166 | //! | ||
| 167 | //! sets the goal state to IDLE | ||
| 168 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_setGoalState_IDLE( | |
| 169 | SmId smId, //!< The state machine id | ||
| 170 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 171 | ) { | ||
| 172 | ✗ | this->m_goalState = FpySequencer_GoalState::IDLE; | |
| 173 | ✗ | } | |
| 174 | |||
| 175 | //! Implementation for action sendCmdResponse_OK of state machine | ||
| 176 | //! Svc_FpySequencer_SequencerStateMachine | ||
| 177 | //! | ||
| 178 | //! responds to the calling command with OK | ||
| 179 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_sendCmdResponse_OK( | |
| 180 | SmId smId, //!< The state machine id | ||
| 181 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 182 | ) { | ||
| 183 | ✗ | if (this->m_sequenceBlockState == BlockState::BLOCK) { | |
| 184 | // respond if we were waiting on a response | ||
| 185 | ✗ | this->cmdResponse_out(this->m_savedOpCode, this->m_savedCmdSeq, Fw::CmdResponse::OK); | |
| 186 | } | ||
| 187 | ✗ | } | |
| 188 | |||
| 189 | //! Implementation for action sendCmdResponse_EXECUTION_ERROR of state machine | ||
| 190 | //! Svc_FpySequencer_SequencerStateMachine | ||
| 191 | //! | ||
| 192 | //! responds to the calling command with EXECUTION_ERROR | ||
| 193 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_sendCmdResponse_EXECUTION_ERROR( | |
| 194 | SmId smId, //!< The state machine id | ||
| 195 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 196 | ) { | ||
| 197 | ✗ | if (this->m_sequenceBlockState == BlockState::BLOCK) { | |
| 198 | // respond if we were waiting on a response | ||
| 199 | ✗ | this->cmdResponse_out(this->m_savedOpCode, this->m_savedCmdSeq, Fw::CmdResponse::EXECUTION_ERROR); | |
| 200 | } | ||
| 201 | ✗ | } | |
| 202 | |||
| 203 | //! Implementation for action resetRuntime of state machine | ||
| 204 | //! Svc_FpySequencer_SequencerStateMachine | ||
| 205 | //! | ||
| 206 | //! resets the sequence runtime | ||
| 207 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_resetRuntime( | |
| 208 | SmId smId, //!< The state machine id | ||
| 209 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 210 | ) { | ||
| 211 | // explicitly call dtor | ||
| 212 | ✗ | this->m_runtime.~Runtime(); | |
| 213 | ✗ | new (&this->m_runtime) Runtime(); | |
| 214 | ✗ | } | |
| 215 | |||
| 216 | //! Implementation for action validate of state machine | ||
| 217 | //! Svc_FpySequencer_SequencerStateMachine | ||
| 218 | //! | ||
| 219 | //! performs all steps necessary for sequence validation, and raises a signal | ||
| 220 | //! result_success or result_failure | ||
| 221 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_validate( | |
| 222 | SmId smId, //!< The state machine id | ||
| 223 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 224 | ) { | ||
| 225 | ✗ | Fw::Success result = this->validate(); | |
| 226 | ✗ | FW_ASSERT(result == Fw::Success::SUCCESS || result == Fw::Success::FAILURE, static_cast<FwAssertArgType>(result)); | |
| 227 | ✗ | if (result == Fw::Success::FAILURE) { | |
| 228 | ✗ | this->sequencer_sendSignal_result_failure(); | |
| 229 | ✗ | return; | |
| 230 | } | ||
| 231 | ✗ | this->sequencer_sendSignal_result_success(); | |
| 232 | ✗ | } | |
| 233 | |||
| 234 | //! Implementation for action checkShouldWake of state machine Svc_FpySequencer_SequencerStateMachine | ||
| 235 | //! | ||
| 236 | //! checks if sequencer should wake from sleep | ||
| 237 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_checkShouldWake( | |
| 238 | SmId smId, //!< The state machine id | ||
| 239 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 240 | ) { | ||
| 241 | ✗ | Signal result = this->checkShouldWake(); | |
| 242 | ✗ | switch (result) { | |
| 243 | ✗ | case Signal::result_checkShouldWake_keepSleeping: { | |
| 244 | ✗ | this->sequencer_sendSignal_result_checkShouldWake_keepSleeping(); | |
| 245 | ✗ | break; | |
| 246 | } | ||
| 247 | ✗ | case Signal::result_checkShouldWake_wakeup: { | |
| 248 | ✗ | this->sequencer_sendSignal_result_checkShouldWake_wakeup(); | |
| 249 | ✗ | break; | |
| 250 | } | ||
| 251 | ✗ | case Signal::result_timeOpFailed: { | |
| 252 | ✗ | this->sequencer_sendSignal_result_timeOpFailed(); | |
| 253 | ✗ | break; | |
| 254 | } | ||
| 255 | ✗ | default: { | |
| 256 | ✗ | FW_ASSERT(false, static_cast<FwAssertArgType>(result)); | |
| 257 | } | ||
| 258 | } | ||
| 259 | ✗ | } | |
| 260 | |||
| 261 | //! Implementation for action checkStatementTimeout of state machine Svc_FpySequencer_SequencerStateMachine | ||
| 262 | //! | ||
| 263 | //! checks if the current statement has timed out | ||
| 264 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_checkStatementTimeout( | |
| 265 | SmId smId, //!< The state machine id | ||
| 266 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 267 | ) { | ||
| 268 | ✗ | Signal result = this->checkStatementTimeout(); | |
| 269 | ✗ | switch (result) { | |
| 270 | ✗ | case Signal::result_checkStatementTimeout_noTimeout: { | |
| 271 | ✗ | this->sequencer_sendSignal_result_checkStatementTimeout_noTimeout(); | |
| 272 | ✗ | break; | |
| 273 | } | ||
| 274 | ✗ | case Signal::result_checkStatementTimeout_statementTimeout: { | |
| 275 | ✗ | this->sequencer_sendSignal_result_checkStatementTimeout_statementTimeout(); | |
| 276 | ✗ | break; | |
| 277 | } | ||
| 278 | ✗ | case Signal::result_timeOpFailed: { | |
| 279 | ✗ | this->sequencer_sendSignal_result_timeOpFailed(); | |
| 280 | ✗ | break; | |
| 281 | } | ||
| 282 | ✗ | default: { | |
| 283 | ✗ | FW_ASSERT(false, static_cast<FwAssertArgType>(result)); | |
| 284 | } | ||
| 285 | } | ||
| 286 | ✗ | } | |
| 287 | |||
| 288 | //! Implementation for action incrementSequenceCounter of state machine Svc_FpySequencer_SequencerStateMachine | ||
| 289 | //! | ||
| 290 | //! increments the m_sequencesStarted counter | ||
| 291 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_incrementSequenceCounter( | |
| 292 | SmId smId, //!< The state machine id | ||
| 293 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 294 | ) { | ||
| 295 | ✗ | this->m_sequencesStarted++; | |
| 296 | ✗ | } | |
| 297 | |||
| 298 | //! Implementation for action pushArgsToStack of state machine Svc_FpySequencer_SequencerStateMachine | ||
| 299 | //! | ||
| 300 | //! pushes sequence arguments to the stack | ||
| 301 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_pushArgsToStack( | |
| 302 | SmId smId, //!< The state machine id | ||
| 303 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 304 | ) { | ||
| 305 | ✗ | const Svc::SeqArgs& args = this->m_sequenceArgs; | |
| 306 | |||
| 307 | // Early return if no arguments provided | ||
| 308 | ✗ | if (args.get_size() == 0) { | |
| 309 | ✗ | return; | |
| 310 | } | ||
| 311 | |||
| 312 | // Push args buffer to stack. Args are already serialized in big-endian format | ||
| 313 | // by F' serialization system, so no endianness conversion is needed. | ||
| 314 | ✗ | this->m_runtime.stack.push(args.get_buffer(), static_cast<Fpy::StackSizeType>(args.get_size())); | |
| 315 | } | ||
| 316 | |||
| 317 | //! Implementation for action clearSequenceFile of state machine Svc_FpySequencer_SequencerStateMachine | ||
| 318 | //! | ||
| 319 | //! clears all variables related to the loading/validating of the sequence file | ||
| 320 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_clearSequenceFile( | |
| 321 | SmId smId, //!< The state machine id | ||
| 322 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 323 | ) { | ||
| 324 | ✗ | this->m_sequenceFilePath = ""; | |
| 325 | ✗ | } | |
| 326 | |||
| 327 | //! Implementation for action clearSequenceArguments of state machine Svc_FpySequencer_SequencerStateMachine | ||
| 328 | //! | ||
| 329 | //! clears all arguments of the sequence file | ||
| 330 | ✗ | void FpySequencer ::Svc_FpySequencer_SequencerStateMachine_action_clearSequenceArguments( | |
| 331 | SmId smId, | ||
| 332 | Svc_FpySequencer_SequencerStateMachine::Signal signal) { | ||
| 333 | ✗ | this->m_sequenceArgs = {0, 0}; | |
| 334 | ✗ | } | |
| 335 | |||
| 336 | //! Implementation for action clearBreakpoint of state machine Svc_FpySequencer_SequencerStateMachine | ||
| 337 | //! | ||
| 338 | //! clears the breakpoint, allowing execution of the sequence to continue | ||
| 339 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_clearBreakpoint( | |
| 340 | SmId smId, //!< The state machine id | ||
| 341 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 342 | ) { | ||
| 343 | ✗ | this->m_breakpoint.breakpointInUse = false; | |
| 344 | ✗ | this->m_breakpoint.breakpointIndex = 0; | |
| 345 | ✗ | this->m_breakpoint.breakOnlyOnceOnBreakpoint = false; | |
| 346 | ✗ | this->m_breakpoint.breakBeforeNextLine = false; | |
| 347 | ✗ | } | |
| 348 | |||
| 349 | //! Implementation for action report_seqBroken of state machine Svc_FpySequencer_SequencerStateMachine | ||
| 350 | //! | ||
| 351 | //! reports that a breakpoint was hit | ||
| 352 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_report_seqBroken( | |
| 353 | SmId smId, //!< The state machine id | ||
| 354 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 355 | ) { | ||
| 356 | ✗ | this->log_ACTIVITY_HI_SequencePaused(this->m_runtime.nextStatementIndex); | |
| 357 | ✗ | } | |
| 358 | |||
| 359 | //! Implementation for action setBreakpoint of state machine Svc_FpySequencer_SequencerStateMachine | ||
| 360 | //! | ||
| 361 | //! sets the breakpoint to the provided args | ||
| 362 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_setBreakpoint( | |
| 363 | SmId smId, //!< The state machine id | ||
| 364 | Svc_FpySequencer_SequencerStateMachine::Signal signal, //!< The signal | ||
| 365 | const Svc::FpySequencer_BreakpointArgs& value //!< The value | ||
| 366 | ) { | ||
| 367 | ✗ | this->m_breakpoint.breakpointInUse = value.get_breakOnBreakpoint(); | |
| 368 | ✗ | this->m_breakpoint.breakOnlyOnceOnBreakpoint = value.get_breakOnlyOnceOnBreakpoint(); | |
| 369 | ✗ | this->m_breakpoint.breakpointIndex = value.get_breakpointIndex(); | |
| 370 | ✗ | this->log_ACTIVITY_HI_BreakpointSet(value.get_breakpointIndex(), value.get_breakOnlyOnceOnBreakpoint()); | |
| 371 | ✗ | } | |
| 372 | |||
| 373 | //! Implementation for action setBreakBeforeNextLine of state machine Svc_FpySequencer_SequencerStateMachine | ||
| 374 | //! | ||
| 375 | //! sets the "break on next line" flag to true | ||
| 376 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_setBreakBeforeNextLine( | |
| 377 | SmId smId, //!< The state machine id | ||
| 378 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 379 | ) { | ||
| 380 | ✗ | this->m_breakpoint.breakBeforeNextLine = true; | |
| 381 | ✗ | } | |
| 382 | |||
| 383 | //! Implementation for action clearBreakBeforeNextLine of state machine Svc_FpySequencer_SequencerStateMachine | ||
| 384 | //! | ||
| 385 | //! sets the "break on next line" flag to false | ||
| 386 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_clearBreakBeforeNextLine( | |
| 387 | SmId smId, //!< The state machine id | ||
| 388 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 389 | ) { | ||
| 390 | ✗ | this->m_breakpoint.breakBeforeNextLine = false; | |
| 391 | ✗ | } | |
| 392 | |||
| 393 | //! Implementation for action report_seqFailed of state machine Svc_FpySequencer_SequencerStateMachine | ||
| 394 | //! | ||
| 395 | //! called when a sequence failed to execute successfully | ||
| 396 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_report_seqFailed( | |
| 397 | SmId smId, //!< The state machine id | ||
| 398 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 399 | ) { | ||
| 400 | ✗ | if (this->isConnected_seqDoneOut_OutputPort(0)) { | |
| 401 | // report that the sequence failed to internal callers | ||
| 402 | ✗ | this->seqDoneOut_out(0, 0, 0, Fw::CmdResponse::EXECUTION_ERROR); | |
| 403 | } | ||
| 404 | ✗ | } | |
| 405 | |||
| 406 | //! Implementation for action report_seqStarted of state machine Svc_FpySequencer_SequencerStateMachine | ||
| 407 | //! | ||
| 408 | //! reports that a sequence was started | ||
| 409 | ✗ | void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_report_seqStarted( | |
| 410 | SmId smId, //!< The state machine id | ||
| 411 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 412 | ) { | ||
| 413 | ✗ | if (this->isConnected_seqStartOut_OutputPort(0)) { | |
| 414 | // report that the sequence started to internal callers | ||
| 415 | // NOTE: Sequence Arguments would be cleared if a VALIDATION command is sent, not a full RUN command. | ||
| 416 | ✗ | this->seqStartOut_out(0, this->m_sequenceFilePath, this->m_sequenceArgs); | |
| 417 | } | ||
| 418 | ✗ | } | |
| 419 | // ---------------------------------------------------------------------- | ||
| 420 | // Functions to implement for internal state machine guards | ||
| 421 | // ---------------------------------------------------------------------- | ||
| 422 | |||
| 423 | //! Implementation for guard goalStateIs_RUNNING of state machine | ||
| 424 | //! Svc_FpySequencer_SequencerStateMachine | ||
| 425 | //! | ||
| 426 | //! return true if the goal state is RUNNING | ||
| 427 | ✗ | bool FpySequencer::Svc_FpySequencer_SequencerStateMachine_guard_goalStateIs_RUNNING( | |
| 428 | SmId smId, //!< The state machine id | ||
| 429 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 430 | ) const { | ||
| 431 | ✗ | return this->m_goalState == FpySequencer_GoalState::RUNNING; | |
| 432 | } | ||
| 433 | |||
| 434 | //! Implementation for guard shouldBreak of state machine Svc_FpySequencer_SequencerStateMachine | ||
| 435 | //! | ||
| 436 | //! return true if should break at this point in execution, before dispatching | ||
| 437 | //! next stmt | ||
| 438 | ✗ | bool FpySequencer::Svc_FpySequencer_SequencerStateMachine_guard_shouldBreak( | |
| 439 | SmId smId, //!< The state machine id | ||
| 440 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 441 | ) const { | ||
| 442 | // there are really two mechanisms for pausing the execution of the seq | ||
| 443 | // one is the "break on next line flag", and the other is the breakpoint | ||
| 444 | ✗ | return this->m_breakpoint.breakBeforeNextLine || | |
| 445 | ✗ | (this->m_breakpoint.breakpointInUse && | |
| 446 | ✗ | this->m_breakpoint.breakpointIndex == this->m_runtime.nextStatementIndex); | |
| 447 | } | ||
| 448 | |||
| 449 | //! Implementation for guard breakOnce of state machine Svc_FpySequencer_SequencerStateMachine | ||
| 450 | //! | ||
| 451 | //! return true if this breakpoint should only happen once | ||
| 452 | ✗ | bool FpySequencer::Svc_FpySequencer_SequencerStateMachine_guard_breakOnce( | |
| 453 | SmId smId, //!< The state machine id | ||
| 454 | Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| 455 | ) const { | ||
| 456 | ✗ | return this->m_breakpoint.breakOnlyOnceOnBreakpoint; | |
| 457 | } | ||
| 458 | } // namespace Svc | ||
| 459 |