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

Unified log file parser for both DataFlash (.bin/.log) and PX4 ULog (.ulg) files. More...

#include <LogFileParser.h>

+ Inheritance diagram for LogFileParser:
+ Collaboration diagram for LogFileParser:

Signals

void parseCompleteChanged ()
 
void parseErrorChanged ()
 
void availableFieldsChanged ()
 
void parametersChanged ()
 
void eventsChanged ()
 
void messagesChanged ()
 
void plottableFieldsChanged ()
 
void modeSegmentsChanged ()
 
void modeNamesChanged ()
 
void dropoutsChanged ()
 
void detectedVehicleTypeChanged ()
 
void timeRangeChanged ()
 
void sampleCountChanged ()
 
void startTimeChanged ()
 
void parsingChanged ()
 
void parseProgressChanged ()
 
void parseFileFinished (const QString &filePath, bool ok, const QString &errorMessage)
 

Public Member Functions

 LogFileParser (QObject *parent=nullptr)
 
 ~LogFileParser ()
 
bool parseComplete () const
 
QString parseError () const
 
QStringList availableFields () const
 
QVariantList parameters () const
 
QVariantList events () const
 
QVariantList messages () const
 
QStringList plottableFields () const
 
QVariantList modeSegments () const
 
QStringList modeNames () const
 
QVariantList dropouts () const
 
QString detectedVehicleType () const
 
double minTimestamp () const
 
double maxTimestamp () const
 
int sampleCount () const
 
QDateTime startTime () const
 
bool parsing () const
 
float parseProgress () const
 
Q_INVOKABLE bool parseFile (const QString &filePath)
 
Q_INVOKABLE void startParsingAsync (const QString &filePath)
 
Q_INVOKABLE void clear ()
 
Q_INVOKABLE QVariantList fieldSamples (const QString &fieldName) const
 
Q_INVOKABLE QVariantList fieldSamplesFiltered (const QString &fieldName, double minX, double maxX, int pixelWidth) const
 
Q_INVOKABLE QVariantMap fieldMinMax (const QString &fieldName) const
 
Q_INVOKABLE double fieldValueAt (const QString &fieldName, double timestampSeconds) const
 
Q_INVOKABLE QString modeAt (double timestampSeconds) const
 
Q_INVOKABLE QString modeColor (const QString &modeName) const
 
Q_INVOKABLE QVariantList eventsNear (double timestampSeconds, double thresholdSeconds) const
 
Q_INVOKABLE QVariantList gpsPath () const
 
Q_INVOKABLE QString gpsAltitudeFieldName () const
 
Q_INVOKABLE QVariantMap gpsCoordAt (double timestampSeconds) const
 

Detailed Description

Unified log file parser for both DataFlash (.bin/.log) and PX4 ULog (.ulg) files.

Dispatches by file extension, verifies the header magic bytes match the expected format, then parses the file into a canonical set of properties that the log viewer UI consumes identically for both formats:

  • availableFields / plottableFields — two-level "Type.Field" hierarchy
  • fieldSamples(name) — time-series (QPointF) for charting
  • modeSegments — flight-mode bands for the chart timeline
  • events — timestamped events / errors / warnings
  • parameters — parameter name/value pairs from the log
  • messages — free-text log messages
  • dropouts — (ULog only) data-dropout intervals rendered as chart overlays

Definition at line 32 of file LogFileParser.h.

Constructor & Destructor Documentation

◆ LogFileParser()

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

Definition at line 51 of file LogFileParser.cc.

◆ ~LogFileParser()

LogFileParser::~LogFileParser ( )

Definition at line 57 of file LogFileParser.cc.

Member Function Documentation

◆ availableFields()

QStringList LogFileParser::availableFields ( ) const
inline

Definition at line 61 of file LogFileParser.h.

◆ availableFieldsChanged

void LogFileParser::availableFieldsChanged ( )
signal

Referenced by clear().

◆ clear()

◆ detectedVehicleType()

QString LogFileParser::detectedVehicleType ( ) const
inline

Definition at line 69 of file LogFileParser.h.

◆ detectedVehicleTypeChanged

void LogFileParser::detectedVehicleTypeChanged ( )
signal

Referenced by clear().

◆ dropouts()

QVariantList LogFileParser::dropouts ( ) const
inline

Definition at line 68 of file LogFileParser.h.

◆ dropoutsChanged

void LogFileParser::dropoutsChanged ( )
signal

Referenced by clear().

◆ events()

QVariantList LogFileParser::events ( ) const
inline

Definition at line 63 of file LogFileParser.h.

◆ eventsChanged

void LogFileParser::eventsChanged ( )
signal

Referenced by clear().

◆ eventsNear()

QVariantList LogFileParser::eventsNear ( double  timestampSeconds,
double  thresholdSeconds 
) const

Definition at line 386 of file LogFileParser.cc.

◆ fieldMinMax()

QVariantMap LogFileParser::fieldMinMax ( const QString &  fieldName) const

Definition at line 243 of file LogFileParser.cc.

◆ fieldSamples()

QVariantList LogFileParser::fieldSamples ( const QString &  fieldName) const

Definition at line 232 of file LogFileParser.cc.

◆ fieldSamplesFiltered()

QVariantList LogFileParser::fieldSamplesFiltered ( const QString &  fieldName,
double  minX,
double  maxX,
int  pixelWidth 
) const

Definition at line 257 of file LogFileParser.cc.

◆ fieldValueAt()

double LogFileParser::fieldValueAt ( const QString &  fieldName,
double  timestampSeconds 
) const

Definition at line 331 of file LogFileParser.cc.

◆ gpsAltitudeFieldName()

QString LogFileParser::gpsAltitudeFieldName ( ) const

Returns the field name used for altitude data paired with the GPS path source, e.g. "vehicle_global_position.alt". Returns empty string if no GPS data was found. Must be called after gpsPath() has been evaluated.

Definition at line 411 of file LogFileParser.cc.

◆ gpsCoordAt()

QVariantMap LogFileParser::gpsCoordAt ( double  timestampSeconds) const

Returns {latitude, longitude} for the GPS position nearest to timestampSeconds. Returns an empty map if GPS data is not available.

Definition at line 416 of file LogFileParser.cc.

◆ gpsPath()

QVariantList LogFileParser::gpsPath ( ) const

Returns a list of GPS path points as QVariantMap entries with latitude and longitude keys (compatible with QML MapPolyline.path via implicit coordinate coercion). Tries known field name patterns for both PX4 ULog and APM DataFlash. Returns an empty list if no GPS data is found.

Definition at line 461 of file LogFileParser.cc.

◆ maxTimestamp()

double LogFileParser::maxTimestamp ( ) const
inline

Definition at line 71 of file LogFileParser.h.

◆ messages()

QVariantList LogFileParser::messages ( ) const
inline

Definition at line 64 of file LogFileParser.h.

◆ messagesChanged

void LogFileParser::messagesChanged ( )
signal

Referenced by clear().

◆ minTimestamp()

double LogFileParser::minTimestamp ( ) const
inline

Definition at line 70 of file LogFileParser.h.

◆ modeAt()

QString LogFileParser::modeAt ( double  timestampSeconds) const

Definition at line 373 of file LogFileParser.cc.

◆ modeColor()

QString LogFileParser::modeColor ( const QString &  modeName) const

Definition at line 349 of file LogFileParser.cc.

◆ modeNames()

QStringList LogFileParser::modeNames ( ) const
inline

Definition at line 67 of file LogFileParser.h.

◆ modeNamesChanged

void LogFileParser::modeNamesChanged ( )
signal

Referenced by clear().

◆ modeSegments()

QVariantList LogFileParser::modeSegments ( ) const
inline

Definition at line 66 of file LogFileParser.h.

◆ modeSegmentsChanged

void LogFileParser::modeSegmentsChanged ( )
signal

Referenced by clear().

◆ parameters()

QVariantList LogFileParser::parameters ( ) const
inline

Definition at line 62 of file LogFileParser.h.

◆ parametersChanged

void LogFileParser::parametersChanged ( )
signal

Referenced by clear().

◆ parseComplete()

bool LogFileParser::parseComplete ( ) const
inline

Definition at line 59 of file LogFileParser.h.

◆ parseCompleteChanged

void LogFileParser::parseCompleteChanged ( )
signal

Referenced by clear().

◆ parseError()

QString LogFileParser::parseError ( ) const
inline

Definition at line 60 of file LogFileParser.h.

◆ parseErrorChanged

void LogFileParser::parseErrorChanged ( )
signal

Referenced by clear().

◆ parseFile()

bool LogFileParser::parseFile ( const QString &  filePath)

Definition at line 62 of file LogFileParser.cc.

References clear(), LogParseResult::errorMessage, and LogParseResult::ok.

◆ parseFileFinished

void LogFileParser::parseFileFinished ( const QString &  filePath,
bool  ok,
const QString &  errorMessage 
)
signal

Referenced by startParsingAsync().

◆ parseProgress()

float LogFileParser::parseProgress ( ) const
inline

Definition at line 75 of file LogFileParser.h.

◆ parseProgressChanged

void LogFileParser::parseProgressChanged ( )
signal

Referenced by clear(), and startParsingAsync().

◆ parsing()

bool LogFileParser::parsing ( ) const
inline

Definition at line 74 of file LogFileParser.h.

◆ parsingChanged

void LogFileParser::parsingChanged ( )
signal

Referenced by clear(), and startParsingAsync().

◆ plottableFields()

QStringList LogFileParser::plottableFields ( ) const
inline

Definition at line 65 of file LogFileParser.h.

◆ plottableFieldsChanged

void LogFileParser::plottableFieldsChanged ( )
signal

Referenced by clear().

◆ sampleCount()

int LogFileParser::sampleCount ( ) const
inline

Definition at line 72 of file LogFileParser.h.

◆ sampleCountChanged

void LogFileParser::sampleCountChanged ( )
signal

Referenced by clear().

◆ startParsingAsync()

void LogFileParser::startParsingAsync ( const QString &  filePath)

◆ startTime()

QDateTime LogFileParser::startTime ( ) const
inline

Definition at line 73 of file LogFileParser.h.

◆ startTimeChanged

void LogFileParser::startTimeChanged ( )
signal

Referenced by clear().

◆ timeRangeChanged

void LogFileParser::timeRangeChanged ( )
signal

Referenced by clear().


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