Skip to content

Commit

Permalink
debugger/iioexplorer: Add format explanations
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei-Fabian-Pop <[email protected]>
  • Loading branch information
Andrei-Fabian-Pop committed Sep 17, 2024
1 parent fe5fe23 commit 54f1b59
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions plugins/debugger/include/debugger/iiostandarditem.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class IIOStandardItem : public QObject, public QStandardItem
QString name();
QString path();
QString format();
QString formatExplanation();
QString trigger();
QString triggerStatus();
IIOStandardItem::Type type();
Expand Down Expand Up @@ -105,6 +106,7 @@ protected Q_SLOTS:
QString m_id;
QString m_path;
QString m_format;
QString m_formatExplanations;
QString m_triggerName;
QString m_triggerStatus;
IIOStandardItem::Type m_type;
Expand Down
16 changes: 15 additions & 1 deletion plugins/debugger/src/iioexplorer/iiostandarditem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ IIOStandardItem::IIOStandardItem(QList<IIOWidget *> widgets, QString name, QStri
, m_name(name)
, m_path(path)
, m_format()
, m_formatExplanations()
, m_triggerName()
, m_triggerStatus()
, m_isWatched(false)
Expand All @@ -32,6 +33,7 @@ IIOStandardItem::IIOStandardItem(QList<IIOWidget *> widgets, QString name, QStri
, m_name(name)
, m_path(path)
, m_format()
, m_formatExplanations()
, m_triggerName()
, m_triggerStatus()
, m_isWatched(false)
Expand Down Expand Up @@ -69,6 +71,8 @@ QString IIOStandardItem::path() { return m_path; }

QString IIOStandardItem::format() { return m_format; }

QString IIOStandardItem::formatExplanation() { return m_formatExplanations; }

QString IIOStandardItem::trigger() { return m_triggerName; }

QString IIOStandardItem::triggerStatus() { return m_triggerStatus; }
Expand Down Expand Up @@ -233,8 +237,18 @@ void IIOStandardItem::extractDataFromChannel()
.arg(format->length)
.arg(repeat)
.arg(format->shift);
m_formatExplanations =
QString("%1, %2%3%4, %5 bits out of %6 shifted to the right by %7")
.arg(format->is_be ? "Big Endian" : "Little Endian")
.arg(format->is_signed ? "Signed" : "Unsigned")
.arg(format->is_fully_defined ? ", Fully Defined" : "")
.arg(format->repeat > 1 ? ", Repeated " + QString::number(format->repeat) + " times"
: "")
.arg(format->bits)
.arg(format->length)
.arg(format->shift);
m_index = iio_channel_get_index(m_channel);
m_details.append("Format: " + m_format);
m_details.append("Format: " + m_format + " (" + m_formatExplanations + ")");
}
}

Expand Down

0 comments on commit 54f1b59

Please sign in to comment.