QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
ULogUtility Namespace Reference

Classes

class  MessageHandler
 

Typedefs

using MessageCallback = std::function< bool(const ulog_cpp::TypedDataView &sample)>
 

Functions

bool isValidHeader (const char *data, qint64 size)
 
int getVersion (const char *data, qint64 size)
 
uint64_t getHeaderTimestamp (const char *data, qint64 size)
 
bool iterateMessages (const char *data, qint64 size, const std::string &messageName, const MessageCallback &callback, QString &errorMessage)
 

Variables

constexpr char kMagicBytes [] = {'U', 'L', 'o', 'g'}
 ULog file magic bytes: "ULog" followed by 0x01 (version 1) followed by 0x12 (file compat)
 
constexpr int kMagicSize = 4
 
constexpr int kHeaderSize = 16
 

Typedef Documentation

◆ MessageCallback

using ULogUtility::MessageCallback = typedef std::function<bool(const ulog_cpp::TypedDataView &sample)>

Callback for processing ULog messages

Parameters
sampleThe typed data view for the message
Returns
true to continue processing, false to stop

Definition at line 59 of file ULogUtility.h.

Function Documentation

◆ getHeaderTimestamp()

uint64_t ULogUtility::getHeaderTimestamp ( const char *  data,
qint64  size 
)

Get the ULog header timestamp (microseconds since epoch)

Parameters
dataPointer to data (must be at least kHeaderSize bytes)
sizeSize of available data
Returns
Timestamp in microseconds, or 0 if invalid

Definition at line 36 of file ULogUtility.cc.

References getHeaderTimestamp(), and kHeaderSize.

Referenced by getHeaderTimestamp().

◆ getVersion()

int ULogUtility::getVersion ( const char *  data,
qint64  size 
)

Get the ULog format version from header

Parameters
dataPointer to data (must be at least 5 bytes)
sizeSize of available data
Returns
Version number (typically 1), or -1 if invalid

Definition at line 25 of file ULogUtility.cc.

References getVersion().

Referenced by getVersion().

◆ isValidHeader()

bool ULogUtility::isValidHeader ( const char *  data,
qint64  size 
)

Check if data starts with a valid ULog header magic

Parameters
dataPointer to data
sizeSize of available data
Returns
true if data starts with "ULog" magic bytes

Definition at line 17 of file ULogUtility.cc.

References kMagicBytes, and kMagicSize.

◆ iterateMessages()

bool ULogUtility::iterateMessages ( const char *  data,
qint64  size,
const std::string &  messageName,
const MessageCallback callback,
QString &  errorMessage 
)

Parse a ULog file and call callback for each matching message

Parameters
dataPointer to the ULog data
sizeSize of the data in bytes
messageNameName of the message to filter for
callbackFunction called for each matching message
errorMessageOutput error message if parsing fails
Returns
true on success (even if no messages found), false on parse error

Definition at line 129 of file ULogUtility.cc.

Referenced by ULogParser::getTagsFromLog().

Variable Documentation

◆ kHeaderSize

constexpr int ULogUtility::kHeaderSize = 16
constexpr

Definition at line 28 of file ULogUtility.h.

Referenced by getHeaderTimestamp().

◆ kMagicBytes

constexpr char ULogUtility::kMagicBytes[] = {'U', 'L', 'o', 'g'}
constexpr

ULog file magic bytes: "ULog" followed by 0x01 (version 1) followed by 0x12 (file compat)

Definition at line 26 of file ULogUtility.h.

Referenced by isValidHeader().

◆ kMagicSize

constexpr int ULogUtility::kMagicSize = 4
constexpr

Definition at line 27 of file ULogUtility.h.

Referenced by isValidHeader().