7 Signal FpySequencer::dispatchStatement() {
8 if (this->m_runtime.nextStatementIndex == this->m_sequenceObj.getheader().getstatementCount()) {
13 FW_ASSERT(this->m_runtime.nextStatementIndex < this->m_sequenceObj.getheader().getstatementCount());
15 const Fpy::Statement& nextStatement = this->m_sequenceObj.
getstatements()[this->m_runtime.nextStatementIndex];
16 this->m_runtime.nextStatementIndex++;
17 this->m_runtime.currentStatementOpcode = nextStatement.getopCode();
18 this->m_runtime.currentStatementType = nextStatement.gettype();
25 result = this->dispatchDirective(nextStatement);
27 result = this->dispatchCommand(nextStatement);
30 this->m_statementsDispatched++;
41 Fw::Success FpySequencer::dispatchCommand(
const Fpy::Statement& stmt) {
49 stat = cmdBuf.
serialize(stmt.getopCode());
52 stat, this->m_runtime.nextStatementIndex - 1);
55 stat = cmdBuf.
serialize(stmt.getargBuf().getBuffAddr(), stmt.getargBuf().getBuffLength(),
true);
58 stmt.getargBuf().getBuffLength(), stat, this->m_runtime.nextStatementIndex - 1);
69 U32 cmdUid =
static_cast<U32
>(((this->m_sequencesStarted & 0xFFFF) << 16) | (this->m_statementsDispatched & 0xFFFF));
79 Fw::Success FpySequencer::dispatchDirective(
const Fpy::Statement& stmt) {
83 stmt.getargBuf().getBuffLength());
84 argBuf.
setBuffLen(stmt.getargBuf().getBuffLength());
86 switch (stmt.getopCode()) {
88 FpySequencer_WaitRelDirective directive;
89 status = argBuf.deserialize(directive);
92 argBuf.getBuffLength());
99 FpySequencer_WaitAbsDirective directive;
100 status = argBuf.deserialize(directive);
103 argBuf.getBuffLength());
118 Signal FpySequencer::checkShouldWake() {
121 #ifdef FW_USE_TIME_BASE 122 if (currentTime.
getTimeBase() != this->m_runtime.wakeupTime.getTimeBase()) {
130 #ifdef FW_USE_TIME_CONTEXT 131 if (currentTime.
getContext() != this->m_runtime.wakeupTime.getContext()) {
139 if (currentTime < this->m_runtime.wakeupTime) {
149 Signal FpySequencer::checkStatementTimeout() {
152 if (timeout <= 0 || timeout > static_cast<F32>(std::numeric_limits<U32>::max())) {
159 #ifdef FW_USE_TIME_BASE 160 if (currentTime.
getTimeBase() != this->m_runtime.currentStatementDispatchTime.getTimeBase()) {
163 this->m_runtime.currentStatementDispatchTime.getTimeBase());
167 #ifdef FW_USE_TIME_CONTEXT 168 if (currentTime.
getContext() != this->m_runtime.currentStatementDispatchTime.getContext()) {
171 this->m_runtime.currentStatementDispatchTime.getContext());
176 if (this->m_runtime.currentStatementDispatchTime.getSeconds() > currentTime.
getSeconds()) {
182 if (this->m_runtime.currentStatementDispatchTime.getSeconds() == currentTime.
getSeconds() &&
183 this->m_runtime.currentStatementDispatchTime.getUSeconds() > currentTime.
getUSeconds()) {
189 U64 dispatchUSeconds = this->m_runtime.currentStatementDispatchTime.getSeconds() * 1000000 +
190 this->m_runtime.currentStatementDispatchTime.getUSeconds();
192 U64 timeoutUSeconds =
static_cast<U64>(timeout * 1000000.0f);
194 if (currentUSeconds - dispatchUSeconds < timeoutUSeconds) {
200 this->m_runtime.currentStatementOpcode,
201 this->m_runtime.nextStatementIndex - 1,
202 this->m_sequenceFilePath);
Serialization/Deserialization operation was successful.
called in dispatchStatement method when a statement was unable to be sent out
FwSizeType getBuffCapacity() const
returns capacity, not current size, of buffer
called in dispatchStatement method when there were no more statements in the sequence ...
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
raised when we should keep sleeping
TimeBase getTimeBase() const
SerializeStatus
forward declaration for string
float F32
32-bit floating point
void log_WARNING_HI_StatementTimedOut(Svc::Fpy::StatementType stmtType, U32 stmtOpcode, U32 stmtIdx, const Fw::StringBase &filePath) const
Log event StatementTimedOut.
Serializable::SizeType getBuffLength() const
returns current buffer size
called in dispatchStatement method when a statement was successfully dispatched
F32 paramGet_STATEMENT_TIMEOUT_SECS(Fw::ParamValid &valid)
External serialize buffer with no copy semantics.
void directive_waitAbs_internalInterfaceInvoke(const Svc::FpySequencer_WaitAbsDirective &directive)
Internal interface base-class function for directive_waitAbs.
void log_WARNING_HI_DirectiveDeserializeError(U32 opcode, U32 stmtIdx, I32 errorCode, U64 buffLeft, U64 buffLength) const
Log event DirectiveDeserializeError.
void log_WARNING_HI_CommandSerializeError(U32 cmdOpcode, U64 bufCapacity, U64 curPos, U64 writeSize, U8 errorCode, U32 stmtIdx) const
Log event CommandSerializeError.
Type_of_statements & getstatements()
Get member statements.
FwTimeContextStoreType getContext() const
raised when the statement has not timed out yet
void log_WARNING_HI_MismatchedTimeContext(I32 internalTimeContext, I32 otherTimeContext) const
Log event MismatchedTimeContext.
void cmdOut_out(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Invoke output port cmdOut.
RateGroupDivider component implementation.
raised when we are done sleeping
Enum representing parameter validity.
void log_WARNING_HI_MismatchedTimeBase(I32 internalTimeBase, I32 otherTimeBase) const
Log event MismatchedTimeBase.
raised when the statement times out, according to the timeout parameter
void directive_waitRel_internalInterfaceInvoke(const Svc::FpySequencer_WaitRelDirective &directive)
Internal interface base-class function for directive_waitRel.
void log_WARNING_HI_UnknownSequencerDirective(U32 opcode, U32 stmtIdx, const Fw::StringBase &filePath) const
Log event UnknownSequencerDirective.
FpySequencer_SequencerStateMachineStateMachineBase::Signal Signal
SerializeStatus setBuffLen(Serializable::SizeType length)
sets buffer length manually after filling with data