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)
 
- 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 runningChanged ()
 Emitted when the running state 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)
 
CompInfoParamcompInfoParam (uint8_t compId)
 
CompInfoGeneralcompInfoGeneral (uint8_t compId)
 
ComponentInformationCachefileCache ()
 
ComponentInformationTranslationtranslation ()
 
float progress () const
 
- Public Member Functions inherited from QGCStateMachine
 QGCStateMachine (const QString &machineName, Vehicle *vehicle, QObject *parent=nullptr)
 
Vehiclevehicle () const
 
QString machineName () const
 
StateContextcontext ()
 
const StateContextcontext () const
 
bool active () const
 
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 (EventHandler 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)
 
FunctionStateaddFunctionState (const QString &stateName, std::function< void()> function)
 
AsyncFunctionStateaddAsyncFunctionState (const QString &stateName, AsyncFunctionState::SetupFunction setupFunction, int timeoutMsecs=0)
 
QGCStateaddErrorRecoveryState (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)
 
DelayStateaddDelayState (int delayMsecs)
 
ParallelStateaddParallelState (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)
 
QGCFinalStateaddFinalState (const QString &stateName=QString())
 
ConditionalStateaddConditionalState (const QString &stateName, ConditionalState::Predicate predicate, ConditionalState::Action action=nullptr)
 
template<typename Func >
WaitForSignalStateaddWaitForSignalState (const QString &stateName, const QObject *sender, Func signal, int timeoutMsecs=0)
 
SubMachineStateaddSubMachineState (const QString &stateName, SubMachineState::MachineFactory factory)
 
EventQueuedStateaddEventQueuedState (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.
 
FunctionStateaddLogAndContinueErrorState (const QString &stateName, QAbstractState *nextState, const QString &message=QString())
 Create a logging error handler state that advances to nextState.
 
FunctionStateaddLogAndStopErrorState (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 running.
 
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 >
GuardedTransitionaddGuardedTransition (QState *from, Func signal, QAbstractState *to, GuardedTransition::Guard guard, QAbstractAnimation *animation=nullptr)
 
MachineEventTransitionaddEventTransition (QState *from, const QString &eventName, QAbstractState *to, QAbstractAnimation *animation=nullptr)
 
TimeoutTransitionaddTimeoutTransition (QState *from, int timeoutMsecs, QAbstractState *to, QAbstractAnimation *animation=nullptr)
 
template<typename SenderType , typename Func >
RetryTransitionaddRetryTransition (SenderType *from, Func signal, QAbstractState *to, std::function< void()> retryAction, int maxRetries=1)
 
template<typename SenderType , typename Func >
GuardedTransitionaddConditionalTransition (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 >
InternalTransitionaddInternalTransition (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

Definition at line 16 of file ComponentInformationManager.cc.

◆ ~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

Definition at line 167 of file ComponentInformationManager.cc.

Referenced by requestAllComponentInformation().

◆ progressUpdate

void ComponentInformationManager::progressUpdate ( float  progress)
signal

◆ requestAllComponentInformation()

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

◆ translation()

ComponentInformationTranslation * ComponentInformationManager::translation ( )
inline

Definition at line 34 of file ComponentInformationManager.h.

Friends And Related Symbol Documentation

◆ RequestMetaDataTypeStateMachine

friend class RequestMetaDataTypeStateMachine
friend

Definition at line 86 of file ComponentInformationManager.h.

Member Data Documentation

◆ cachedFileMaxAgeSec

constexpr 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: