QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
ComponentInformationManager Class Reference

#include <ComponentInformationManager.h>

Inheritance diagram for ComponentInformationManager:
Collaboration diagram for ComponentInformationManager:

Public Types

typedef void(* RequestAllCompleteFn) (void *requestAllCompleteFnData)
Public Types inherited from QGCStateMachine
using EntryCallback = std::function<void()>
 Name of the currently active state (for QML binding).
using ExitCallback = std::function<void()>
using EventHandler = std::function<bool(QEvent*)>

Signals

void progressUpdate (float progress)
void requestAllComplete ()
Signals inherited from QGCStateMachine
void error ()
void progressUpdate (float progress)
void machineEvent (const QString &eventName)
void currentStateNameChanged ()
 Emitted when the current state changes (for QML binding).
void inProgressChanged ()
 Emitted when inProgress() changes (for QML binding).
void stateHistoryChanged ()
 Emitted when the state history changes (for QML binding).

Public Member Functions

 ComponentInformationManager (Vehicle *vehicle, QObject *parent=nullptr)
 ~ComponentInformationManager () override
void requestAllComponentInformation (RequestAllCompleteFn requestAllCompletFn, void *requestAllCompleteFnData)
CompInfoParam * compInfoParam (uint8_t compId)
CompInfoGeneral * compInfoGeneral (uint8_t compId)
ComponentInformationCache & fileCache ()
ComponentInformationTranslation * translation ()
float progress () const
Public Member Functions inherited from QGCStateMachine
 QGCStateMachine (const QString &machineName, Vehicle *vehicle, QObject *parent=nullptr)
Vehicle * vehicle () const
QString machineName () const
StateContext & context ()
const StateContext & context () const
bool inProgress () const
bool isRunning () const =delete
 Use inProgress() instead: isRunning() is false until Qt processes the queued start.
void setRunning (bool running)=delete
 Use start() and stop() instead: setRunning() calls QStateMachine::start() and bypasses start().
QString currentStateName () const
QStringList stateHistory () const
void setStateHistoryLimit (int limit)
 Set the maximum number of state history entries to keep.
void setOnEntry (EntryCallback callback)
 Set a callback to be invoked when the machine starts.
void setOnExit (ExitCallback callback)
 Set a callback to be invoked when the machine stops.
void setCallbacks (EntryCallback onEntry, ExitCallback onExit=nullptr)
 Set both entry and exit callbacks.
void setEventHandler (EventHandlerEventHandler handler)
void enablePropertyRestore ()
bool isPropertyRestoreEnabled () const
 Check if property restoration is enabled.
void setGlobalErrorState (QAbstractState *errorState)
QAbstractState * globalErrorState () const
 Get the global error state.
void registerState (QGCState *state)
void registerState (QGCAbstractState *state)
FunctionState * addFunctionState (const QString &stateName, std::function< void()> function)
AsyncFunctionState * addAsyncFunctionState (const QString &stateName, AsyncFunctionState::SetupFunction setupFunction, int timeoutMsecs=0)
QGCState * addErrorRecoveryState (const QString &stateName, ErrorRecoveryBuilder::Action action, int maxRetries=0, int retryDelayMsecs=1000, ErrorRecoveryBuilder::ExhaustedBehavior exhaustedBehavior=ErrorRecoveryBuilder::EmitError, ErrorRecoveryBuilder::Action fallback=nullptr, ErrorRecoveryBuilder::VoidAction rollback=nullptr, int timeoutMsecs=0)
DelayState * addDelayState (int delayMsecs)
ParallelState * addParallelState (const QString &stateName)
void postEvent (const QString &eventName, const QVariant &data=QVariant(), EventPriority priority=NormalPriority)
int postDelayedEvent (const QString &eventName, int delayMsecs, const QVariant &data=QVariant())
bool cancelDelayedEvent (int eventId)
void setInitialState (QAbstractState *state, bool autoStart=false)
QGCFinalState * addFinalState (const QString &stateName=QString())
ConditionalState * addConditionalState (const QString &stateName, ConditionalState::Predicate predicate, ConditionalState::Action action=nullptr)
template<typename Func>
WaitForSignalState * addWaitForSignalState (const QString &stateName, const QObject *sender, Func signal, int timeoutMsecs=0)
SubMachineState * addSubMachineState (const QString &stateName, SubMachineState::MachineFactory factory)
EventQueuedState * addEventQueuedState (const QString &stateName, const QString &eventName, int timeoutMsecs=0)
QState * createTimedActionState (const QString &stateName, int durationMsecs, std::function< void()> onEntry=nullptr, std::function< void()> onExit=nullptr)
bool isStateActive (QAbstractState *state) const
QSet< QAbstractState * > activeStates () const
QAbstractState * findState (const QString &stateName) const
template<typename T>
QList< T * > findStates () const
 Find all states of a specific type.
bool isInErrorState () const
 Check if the machine is in an error state.
FunctionState * addLogAndContinueErrorState (const QString &stateName, QAbstractState *nextState, const QString &message=QString())
 Create a logging error handler state that advances to nextState.
FunctionState * addLogAndStopErrorState (const QString &stateName, const QString &message=QString())
 Create a logging error handler state that stops the machine.
QString lastError () const
 Get the last error message (from Qt's internal error handling).
void clearError (bool restart=false)
bool resetToState (QAbstractState *state)
bool recoverFromError ()
void setRecoveryState (QAbstractState *state)
QAbstractState * recoveryState () const
 Get the recovery state.
bool attemptRecovery ()
void ensureRunning ()
 Start the machine if not already in progress.
void stopMachine (bool deleteOnStop=true)
void restart ()
 Restart the machine (stop then start).
template<typename Func>
QSignalTransition * addTransition (QState *from, Func signal, QAbstractState *to, QAbstractAnimation *animation=nullptr)
template<typename Func>
GuardedTransition * addGuardedTransition (QState *from, Func signal, QAbstractState *to, GuardedTransition::Guard guard, QAbstractAnimation *animation=nullptr)
MachineEventTransition * addEventTransition (QState *from, const QString &eventName, QAbstractState *to, QAbstractAnimation *animation=nullptr)
TimeoutTransition * addTimeoutTransition (QState *from, int timeoutMsecs, QAbstractState *to, QAbstractAnimation *animation=nullptr)
template<typename SenderType, typename Func>
RetryTransition * addRetryTransition (SenderType *from, Func signal, QAbstractState *to, std::function< void()> retryAction, int maxRetries=1)
template<typename SenderType, typename Func>
GuardedTransition * addConditionalTransition (SenderType *from, Func signal, QAbstractState *to, std::function< bool()> guard)
template<typename Sender, typename Signal>
QSignalTransition * addSelfLoopTransition (QState *state, Sender *sender, Signal signal, std::function< void()> action)
template<typename Sender, typename Signal>
InternalTransition * addInternalTransition (QState *state, Sender *sender, Signal signal, std::function< void()> action)
QList< QAbstractTransition * > transitionsFrom (QAbstractState *state) const
QList< QAbstractTransition * > transitionsTo (QAbstractState *state) const
QList< QAbstractState * > reachableFrom (QAbstractState *state) const
QList< QAbstractState * > predecessorsOf (QAbstractState *state) const
QString dumpCurrentState () const
QString dumpConfiguration () const
void logCurrentState () const
 Log the current state to debug output.
void logConfiguration () const
 Log the full configuration to debug output.
void setHistoryRecordingEnabled (bool enabled, int maxEntries=1000)
 Enable/disable structured transition history recording.
bool historyRecordingEnabled () const
QString dumpRecordedHistory () const
QJsonArray recordedHistoryJson () const
void setProfilingEnabled (bool enabled)
 Enable/disable state timing profiler.
bool profilingEnabled () const
QString profilingSummary () const
void setStructuredLoggingEnabled (bool enabled)
 Enable/disable structured state-machine logger.
bool structuredLoggingEnabled () const
QString exportAsDot () const
QList< QAbstractState * > unreachableStates () const
int maxPathLength () const
QList< QAbstractState * > deadEndStates () const
void setProgressWeights (const QList< QPair< QAbstractState *, int > > &stateWeights)
void setSubProgress (float subProgress)
float progress () const
 Get the current overall progress (0.0 to 1.0).
void resetProgress ()
 Reset progress tracking (call when restarting the machine).
void setTimeoutOverride (const QString &stateName, int timeoutMsecs)
void removeTimeoutOverride (const QString &stateName)
int timeoutOverride (const QString &stateName) const
 Get the timeout override for a state, or -1 if not set.
QHash< QString, int > allTimeoutOverrides () const
 Get all timeout overrides.
void clearTimeoutOverrides ()
 Clear all timeout overrides.
QHash< QString, int > timeoutStats () const
 Get timeout statistics (how often each state timed out).
void recordTimeout (const QString &stateName)
 Record a timeout for statistics.
void clearTimeoutStats ()
 Clear timeout statistics.

Static Public Attributes

static constexpr int cachedFileMaxAgeSec = 3 * 24 * 3600
 3 days

Friends

class RequestMetaDataTypeStateMachine

Additional Inherited Members

Public Slots inherited from QGCStateMachine
void start ()
 Start the state machine with debug logging.
Protected Member Functions inherited from QGCStateMachine
virtual void onEnter ()
 Override to perform actions when machine starts.
virtual void onLeave ()
 Override to perform actions when machine stops.
void onEntry (QEvent *event) override
void onExit (QEvent *event) override
bool event (QEvent *event) override

Detailed Description

Definition at line 19 of file ComponentInformationManager.h.

Member Typedef Documentation

◆ RequestAllCompleteFn

typedef void(* ComponentInformationManager::RequestAllCompleteFn) (void *requestAllCompleteFnData)

Definition at line 27 of file ComponentInformationManager.h.

Constructor & Destructor Documentation

◆ ComponentInformationManager()

ComponentInformationManager::ComponentInformationManager ( Vehicle * vehicle,
QObject * parent = nullptr )
explicit

◆ ~ComponentInformationManager()

ComponentInformationManager::~ComponentInformationManager ( )
override

Definition at line 38 of file ComponentInformationManager.cc.

Member Function Documentation

◆ compInfoGeneral()

CompInfoGeneral * ComponentInformationManager::compInfoGeneral ( uint8_t compId)

Definition at line 262 of file ComponentInformationManager.cc.

◆ compInfoParam()

CompInfoParam * ComponentInformationManager::compInfoParam ( uint8_t compId)

Definition at line 253 of file ComponentInformationManager.cc.

References QGCStateMachine::vehicle().

◆ fileCache()

ComponentInformationCache & ComponentInformationManager::fileCache ( )
inline

Definition at line 33 of file ComponentInformationManager.h.

◆ progress()

float ComponentInformationManager::progress ( ) const

◆ progressUpdate

void ComponentInformationManager::progressUpdate ( float progress)
signal

References progress().

Referenced by requestAllComponentInformation().

◆ requestAllComplete

void ComponentInformationManager::requestAllComplete ( )
signal

◆ requestAllComponentInformation()

void ComponentInformationManager::requestAllComponentInformation ( RequestAllCompleteFn requestAllCompletFn,
void * requestAllCompleteFnData )

◆ translation()

ComponentInformationTranslation * ComponentInformationManager::translation ( )
inline

Definition at line 34 of file ComponentInformationManager.h.

◆ RequestMetaDataTypeStateMachine

Member Data Documentation

◆ cachedFileMaxAgeSec

int ComponentInformationManager::cachedFileMaxAgeSec = 3 * 24 * 3600
staticconstexpr

3 days

Definition at line 38 of file ComponentInformationManager.h.


The documentation for this class was generated from the following files: