* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-#ifdef _WIN32
-// Windows: Avoid boost/thread namespace pollution (which includes windows.h).
-#define NOGDI
-#define NORESOURCE
-#endif
-
#include <QFileInfo>
#include <cassert>
+#include <memory>
#include <mutex>
#include <stdexcept>
#include <sys/stat.h>
-#include "session.hpp"
#include "devicemanager.hpp"
+#include "session.hpp"
#include "data/analog.hpp"
#include "data/analogsegment.hpp"
+#include "data/decode/decoder.hpp"
#include "data/decoderstack.hpp"
#include "data/logic.hpp"
#include "data/logicsegment.hpp"
#include "data/signalbase.hpp"
-#include "data/decode/decoder.hpp"
#include "devices/hardwaredevice.hpp"
#include "devices/inputfile.hpp"
#include "toolbars/mainbar.hpp"
-#include "view/analogsignal.hpp"
-#include "view/decodetrace.hpp"
-#include "view/logicsignal.hpp"
-#include "view/signal.hpp"
-#include "view/view.hpp"
+#include "views/trace/analogsignal.hpp"
+#include "views/trace/decodetrace.hpp"
+#include "views/trace/logicsignal.hpp"
+#include "views/trace/signal.hpp"
+#include "views/trace/view.hpp"
#include <libsigrokcxx/libsigrokcxx.hpp>
using std::runtime_error;
using std::shared_ptr;
using std::string;
+using std::unique_ptr;
using std::unordered_set;
using std::vector;
// Make the signals list
for (shared_ptr<views::ViewBase> viewbase : views_) {
- views::TraceView::View *trace_view =
- qobject_cast<views::TraceView::View*>(viewbase.get());
+ views::trace::View *trace_view =
+ qobject_cast<views::trace::View*>(viewbase.get());
if (trace_view) {
- unordered_set< shared_ptr<views::TraceView::Signal> >
+ unordered_set< shared_ptr<views::trace::Signal> >
prev_sigs(trace_view->signals());
trace_view->clear_signals();
for (auto channel : sr_dev->channels()) {
shared_ptr<data::SignalBase> signalbase;
- shared_ptr<views::TraceView::Signal> signal;
+ shared_ptr<views::trace::Signal> signal;
// Find the channel in the old signals
const auto iter = find_if(
prev_sigs.cbegin(), prev_sigs.cend(),
- [&](const shared_ptr<views::TraceView::Signal> &s) {
+ [&](const shared_ptr<views::trace::Signal> &s) {
return s->base()->channel() == channel;
});
if (iter != prev_sigs.end()) {
signalbase.get(), SLOT(on_capture_state_changed(int)));
}
- signal = shared_ptr<views::TraceView::Signal>(
- new views::TraceView::LogicSignal(*this,
+ signal = shared_ptr<views::trace::Signal>(
+ new views::trace::LogicSignal(*this,
device_, signalbase));
trace_view->add_signal(signal);
break;
signalbase.get(), SLOT(on_capture_state_changed(int)));
}
- signal = shared_ptr<views::TraceView::Signal>(
- new views::TraceView::AnalogSignal(
+ signal = shared_ptr<views::trace::Signal>(
+ new views::trace::AnalogSignal(
*this, signalbase));
trace_view->add_signal(signal);
break;
set_capture_state(device_->session()->trigger() ?
AwaitingTrigger : Running);
- device_->run();
+ try {
+ device_->run();
+ } catch (Error e) {
+ error_handler(e.what());
+ set_capture_state(Stopped);
+ return;
+ }
+
set_capture_state(Stopped);
// Confirm that SR_DF_END was received
const vector<shared_ptr<Channel>> channels = analog->channels();
const unsigned int channel_count = channels.size();
const size_t sample_count = analog->num_samples() / channel_count;
- const float *data = static_cast<const float *>(analog->data_pointer());
bool sweep_beginning = false;
+ unique_ptr<float> data(new float[analog->num_samples()]);
+ analog->get_data_as_float(data.get());
+
if (signalbases_.empty())
update_signals();
+ float *channel_data = data.get();
for (auto channel : channels) {
shared_ptr<data::AnalogSegment> segment;
assert(segment);
// Append the samples in the segment
- segment->append_interleaved_samples(data++, sample_count,
+ segment->append_interleaved_samples(channel_data++, sample_count,
channel_count);
}