projects
/
pulseview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
23a923e
)
Add DecodeSignal and Session error logging
author
Soeren Apel
<soeren@apelpie.net>
Wed, 4 Apr 2018 17:07:27 +0000
(19:07 +0200)
committer
Soeren Apel
<soeren@apelpie.net>
Wed, 4 Apr 2018 17:07:27 +0000
(19:07 +0200)
pv/data/decodesignal.cpp
patch
|
blob
|
history
pv/data/decodesignal.hpp
patch
|
blob
|
history
pv/globalsettings.cpp
patch
|
blob
|
history
pv/mainwindow.cpp
patch
|
blob
|
history
pv/session.cpp
patch
|
blob
|
history
diff --git
a/pv/data/decodesignal.cpp
b/pv/data/decodesignal.cpp
index 95ea45a4e0a707f62fd2b8e6ba259dc4ebd5fc52..f5dc000169611e355e0d13c07182f81de4bffc5e 100644
(file)
--- a/
pv/data/decodesignal.cpp
+++ b/
pv/data/decodesignal.cpp
@@
-156,7
+156,10
@@
void DecodeSignal::reset_decode()
logic_mux_data_.reset();
logic_mux_data_invalid_ = true;
logic_mux_data_.reset();
logic_mux_data_invalid_ = true;
- error_message_ = QString();
+ if (!error_message_.isEmpty()) {
+ error_message_ = QString();
+ qDebug().noquote().nospace() << name() << ": Error cleared";
+ }
decode_reset();
}
decode_reset();
}
@@
-178,14
+181,14
@@
void DecodeSignal::begin_decode()
reset_decode();
if (stack_.size() == 0) {
reset_decode();
if (stack_.size() == 0) {
-
error_message_ = tr("No decoders"
);
+
set_error_message(tr("No decoders")
);
return;
}
assert(channels_.size() > 0);
if (get_assigned_signal_count() == 0) {
return;
}
assert(channels_.size() > 0);
if (get_assigned_signal_count() == 0) {
-
error_message_ = tr("There are no channels assigned to this decoder"
);
+
set_error_message(tr("There are no channels assigned to this decoder")
);
return;
}
return;
}
@@
-199,8
+202,8
@@
void DecodeSignal::begin_decode()
// Check that all decoders have the required channels
for (const shared_ptr<decode::Decoder> &dec : stack_)
if (!dec->have_required_channels()) {
// Check that all decoders have the required channels
for (const shared_ptr<decode::Decoder> &dec : stack_)
if (!dec->have_required_channels()) {
-
error_message_ =
tr("One or more required channels "
- "have not been specified");
+
set_error_message(
tr("One or more required channels "
+ "have not been specified")
)
;
return;
}
return;
}
@@
-238,7
+241,7
@@
void DecodeSignal::begin_decode()
connect_input_notifiers();
if (get_input_segment_count() == 0) {
connect_input_notifiers();
if (get_input_segment_count() == 0) {
-
error_message_ = tr("No input data"
);
+
set_error_message(tr("No input data")
);
return;
}
return;
}
@@
-582,6
+585,12
@@
void DecodeSignal::restore_settings(QSettings &settings)
begin_decode();
}
begin_decode();
}
+void DecodeSignal::set_error_message(QString msg)
+{
+ error_message_ = msg;
+ qDebug().noquote().nospace() << name() << ": " << msg;
+}
+
uint32_t DecodeSignal::get_input_segment_count() const
{
uint64_t count = std::numeric_limits<uint64_t>::max();
uint32_t DecodeSignal::get_input_segment_count() const
{
uint64_t count = std::numeric_limits<uint64_t>::max();
@@
-895,7
+904,7
@@
void DecodeSignal::decode_data(
if (srd_session_send(srd_session_, i, chunk_end, chunk,
data_size, unit_size) != SRD_OK) {
if (srd_session_send(srd_session_, i, chunk_end, chunk,
data_size, unit_size) != SRD_OK) {
-
error_message_ = tr("Decoder reported an error"
);
+
set_error_message(tr("Decoder reported an error")
);
delete[] chunk;
break;
}
delete[] chunk;
break;
}
@@
-1022,7
+1031,7
@@
void DecodeSignal::start_srd_session()
srd_decoder_inst *const di = dec->create_decoder_inst(srd_session_);
if (!di) {
srd_decoder_inst *const di = dec->create_decoder_inst(srd_session_);
if (!di) {
-
error_message_ = tr("Failed to create decoder instance"
);
+
set_error_message(tr("Failed to create decoder instance")
);
srd_session_destroy(srd_session_);
srd_session_ = nullptr;
return;
srd_session_destroy(srd_session_);
srd_session_ = nullptr;
return;
diff --git
a/pv/data/decodesignal.hpp
b/pv/data/decodesignal.hpp
index 1455274af33877a56ca7ffe91e3ac403ef143aab..807f0e70628c0fffaecac06d3eedc487380b0ad4 100644
(file)
--- a/
pv/data/decodesignal.hpp
+++ b/
pv/data/decodesignal.hpp
@@
-137,6
+137,8
@@
public:
virtual void restore_settings(QSettings &settings);
private:
virtual void restore_settings(QSettings &settings);
private:
+ void set_error_message(QString msg);
+
uint32_t get_input_segment_count() const;
uint32_t get_input_samplerate(uint32_t segment_id) const;
uint32_t get_input_segment_count() const;
uint32_t get_input_samplerate(uint32_t segment_id) const;
diff --git
a/pv/globalsettings.cpp
b/pv/globalsettings.cpp
index 8be4265b247e729d00f9bccacd433283d868250f..088a6e27bda0701771e75c8a33c41debc89ed7f2 100644
(file)
--- a/
pv/globalsettings.cpp
+++ b/
pv/globalsettings.cpp
@@
-107,7
+107,7
@@
void GlobalSettings::setValue(const QString &key, const QVariant &value)
QSettings::setValue(key, value);
QSettings::setValue(key, value);
- qDebug() << "Setting" << key << "changed to" << value;
+ qDebug()
.noquote()
<< "Setting" << key << "changed to" << value;
// Call all registered callbacks
for (GlobalSettingsInterface *cb : callbacks_)
// Call all registered callbacks
for (GlobalSettingsInterface *cb : callbacks_)
diff --git
a/pv/mainwindow.cpp
b/pv/mainwindow.cpp
index e88d382e87c4d6b84cc594ab36469001b305e099..19caab32e2d8d63265758eee8b0bc0b28d2168ed 100644
(file)
--- a/
pv/mainwindow.cpp
+++ b/
pv/mainwindow.cpp
@@
-30,6
+30,7
@@
#include <QAction>
#include <QApplication>
#include <QCloseEvent>
#include <QAction>
#include <QApplication>
#include <QCloseEvent>
+#include <QDebug>
#include <QDockWidget>
#include <QHBoxLayout>
#include <QMessageBox>
#include <QDockWidget>
#include <QHBoxLayout>
#include <QMessageBox>
@@
-562,6
+563,8
@@
bool MainWindow::restoreState(const QByteArray &state, int version)
void MainWindow::session_error(const QString text, const QString info_text)
{
void MainWindow::session_error(const QString text, const QString info_text)
{
+ qDebug().noquote() << "Notifying user of session error:" << info_text;
+
QMetaObject::invokeMethod(this, "show_session_error",
Qt::QueuedConnection, Q_ARG(QString, text),
Q_ARG(QString, info_text));
QMetaObject::invokeMethod(this, "show_session_error",
Qt::QueuedConnection, Q_ARG(QString, text),
Q_ARG(QString, info_text));
diff --git
a/pv/session.cpp
b/pv/session.cpp
index e8174915e4043c37d508c3371b0c8007d168bd06..bf9e3a2c0897973854223520fb37c1fae83018f7 100644
(file)
--- a/
pv/session.cpp
+++ b/
pv/session.cpp
@@
-299,8
+299,8
@@
void Session::restore_settings(QSettings &settings)
filename.toStdString());
set_device(device);
filename.toStdString());
set_device(device);
- // TODO Perform error handling
-
start_capture([](QString infoMessage) { (void)
infoMessage; });
+ start_capture([](QString infoMessage) {
+
qDebug().noquote() << "Session error:" <<
infoMessage; });
set_name(QFileInfo(filename).fileName());
}
set_name(QFileInfo(filename).fileName());
}
@@
-953,10
+953,8
@@
void Session::sample_thread_proc(function<void (const QString)> error_handler)
set_capture_state(Stopped);
// Confirm that SR_DF_END was received
set_capture_state(Stopped);
// Confirm that SR_DF_END was received
- if (cur_logic_segment_) {
- qDebug("SR_DF_END was not received.");
- assert(false);
- }
+ if (cur_logic_segment_)
+ qDebug() << "WARNING: SR_DF_END was not received.";
// Optimize memory usage
free_unused_memory();
// Optimize memory usage
free_unused_memory();