QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
OnboardLogEntry.cc
Go to the documentation of this file.
1#include "OnboardLogEntry.h"
2#include "MAVLinkLib.h"
3#include "QGC.h"
5
6#include <QtCore/QtMath>
7
8QGC_LOGGING_CATEGORY(OnboardLogEntryLog, "AnalyzeView.QGCOnboardLogEntry")
9
10const uint32_t OnboardLogDownloadData::kChunkSize = OnboardLogDownloadData::kTableBins * MAVLINK_MSG_LOG_DATA_FIELD_DATA_LEN;
11
13 : ID(logEntry->id())
14 , entry(logEntry)
15{
16 // qCDebug(OnboardLogEntryLog) << Q_FUNC_INFO << this;
17}
18
20{
21 // qCDebug(OnboardLogEntryLog) << Q_FUNC_INFO << this;
22}
23
25{
27 chunk_table = QBitArray(chunkBins(), false);
28}
29
31{
32 const qreal num = static_cast<qreal>((entry->size() - (current_chunk * kChunkSize))) / static_cast<qreal>(MAVLINK_MSG_LOG_DATA_FIELD_DATA_LEN);
33 return qMin(static_cast<uint32_t>(qCeil(num)), kTableBins);
34}
35
37{
38 const qreal num = static_cast<qreal>(entry->size()) / static_cast<qreal>(kChunkSize);
39 return qCeil(num);
40}
41
42bool OnboardLogDownloadData::chunkEquals(const bool val) const
43{
44 return (chunk_table == QBitArray(chunk_table.size(), val));
45}
46
47/*===========================================================================*/
48
49QGCOnboardLogEntry::QGCOnboardLogEntry(uint logId, const QDateTime &dateTime, uint logSize, bool received, QObject *parent)
50 : QObject(parent)
51 , _logID(logId)
52 , _logSize(logSize)
53 , _logTimeUTC(dateTime)
54 , _received(received)
55{
56 // qCDebug(OnboardLogEntryLog) << Q_FUNC_INFO << this;
57}
58
59QGCOnboardLogEntry::~QGCOnboardLogEntry()
60{
61 // qCDebug(OnboardLogEntryLog) << Q_FUNC_INFO << this;
62}
63
64QString QGCOnboardLogEntry::sizeStr() const
65{
66 return QGC::bigSizeToString(_logSize);
67}
#define QGC_LOGGING_CATEGORY(name, categoryStr)
QString bigSizeToString(quint64 size)
Locale-aware byte-size with unit: B, KB, MB, GB, TB. 1 fractional digit above 1 KB.
Definition QGC.cc:174
static const uint32_t kChunkSize
static constexpr uint32_t kTableBins
QGCOnboardLogEntry *const entry
uint32_t numChunks() const
The number of kChunkSize chunks in the file.
bool chunkEquals(const bool val) const
True if all bins in the chunk have been set to val.
uint32_t chunkBins() const
The number of MAVLINK_MSG_LOG_DATA_FIELD_DATA_LEN bins in the current chunk.