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

#include <FailureInjection.h>

Inheritance diagram for FailureInjection:
Collaboration diagram for FailureInjection:

Signals

void activityChanged (void)

Public Member Functions

 FailureInjection (QObject *parent=nullptr)
 < newest first: [{ time, unitName, typeName, instance, result }]
QVariantList units (void) const
QVariantList types (void) const
QVariantList activity (void) const
Q_INVOKABLE void logRow (const QString &unitName, const QString &typeName, const QString &instanceLabel, const QString &time)
Q_INVOKABLE void logInjection (const QString &unitName, const QString &typeName, int unitEnum, const QString &instanceLabel, const QString &time)
 Record one injected failure: adds a log row and remembers the unit so Reset can restore it.
Q_INVOKABLE void resolveResult (int ackResult, int failureCode=0)
Q_INVOKABLE QVariantList injectedUnits (void) const
 Distinct FAILURE_UNIT values injected this session, so Reset restores only those.
Q_INVOKABLE void markUnitReset (int unitEnum)
 Untrack one FAILURE_UNIT once its reset is accepted, so an interrupted Reset all keeps the rest retryable.
Q_INVOKABLE void resolvePendingInterrupted (void)
Q_INVOKABLE void notifyActiveVehicle (quint32 vehicleId)
Q_INVOKABLE QVariantList detailParams (int unitEnum, int typeEnum) const

Detailed Description

QML singleton backing the Failure Injection page.

  • Catalog: the MAVLink FAILURE_UNIT / FAILURE_TYPE enums, with display names derived by stripping the enum-name prefix.
  • Session state: the activity log and injected units, kept here because the page is destroyed and recreated on navigation. notifyActiveVehicle() clears them when the active vehicle changes.

Definition at line 12 of file FailureInjection.h.

Constructor & Destructor Documentation

◆ FailureInjection()

FailureInjection::FailureInjection ( QObject * parent = nullptr)
explicit

< newest first: [{ time, unitName, typeName, instance, result }]

< [{ name, unit }] [{ name, type }]

Definition at line 67 of file FailureInjection.cc.

Member Function Documentation

◆ activity()

QVariantList FailureInjection::activity ( void ) const
inline

Definition at line 29 of file FailureInjection.h.

◆ activityChanged

void FailureInjection::activityChanged ( void )
signal

◆ detailParams()

QVariantList FailureInjection::detailParams ( int unitEnum,
int typeEnum ) const

Vehicle parameters that refine how a (unit, type) failure manifests, e.g. BATTERY+WRONG -> SYS_FAIL_BAT_LVL. Returns [{ param, label }]; empty when the combo has no detail parameters.

Definition at line 189 of file FailureInjection.cc.

◆ injectedUnits()

QVariantList FailureInjection::injectedUnits ( void ) const

Distinct FAILURE_UNIT values injected this session, so Reset restores only those.

Definition at line 147 of file FailureInjection.cc.

◆ logInjection()

void FailureInjection::logInjection ( const QString & unitName,
const QString & typeName,
int unitEnum,
const QString & instanceLabel,
const QString & time )

Record one injected failure: adds a log row and remembers the unit so Reset can restore it.

Definition at line 89 of file FailureInjection.cc.

References logRow().

◆ logRow()

void FailureInjection::logRow ( const QString & unitName,
const QString & typeName,
const QString & instanceLabel,
const QString & time )

Add a log row (prepended, newest first, result "pending") without tracking the unit for Reset. instanceLabel is a display descriptor for the affected instance(s), e.g. "all", "2", "1, 3, 5".

Definition at line 78 of file FailureInjection.cc.

References activityChanged().

Referenced by logInjection().

◆ markUnitReset()

void FailureInjection::markUnitReset ( int unitEnum)

Untrack one FAILURE_UNIT once its reset is accepted, so an interrupted Reset all keeps the rest retryable.

Definition at line 156 of file FailureInjection.cc.

◆ notifyActiveVehicle()

void FailureInjection::notifyActiveVehicle ( quint32 vehicleId)

Note the active vehicle's system id; a switch to a different vehicle clears the session so Reset all can't target the wrong vehicle. Id 0 (no vehicle: transient disconnect/reboot) is ignored.

Definition at line 177 of file FailureInjection.cc.

References activityChanged().

◆ resolvePendingInterrupted()

void FailureInjection::resolvePendingInterrupted ( void )

Resolve any still-"pending" rows to "Interrupted"; called on page (re)load to clear stragglers whose ack was lost when the previous page instance was destroyed mid-send.

Definition at line 161 of file FailureInjection.cc.

References activityChanged().

◆ resolveResult()

void FailureInjection::resolveResult ( int ackResult,
int failureCode = 0 )

Resolve the oldest still-pending injection with a MAV_RESULT ack code; sets the row result. failureCode (Vehicle::MavCmdResultFailureCode_t) carries the reason when the command never reached the vehicle, which ackResult alone cannot express.

Definition at line 98 of file FailureInjection.cc.

References activityChanged(), and QGCMAVLink::mavResultToString().

◆ types()

QVariantList FailureInjection::types ( void ) const
inline

Definition at line 27 of file FailureInjection.h.

◆ units()

QVariantList FailureInjection::units ( void ) const
inline

Definition at line 25 of file FailureInjection.h.


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