#include <pv/data/analogsegment.hpp>
#include <pv/data/logic.hpp>
#include <pv/data/logicsegment.hpp>
+#include <pv/data/signalbase.hpp>
#include <pv/devices/device.hpp>
#include <pv/view/signal.hpp>
shared_ptr<data::Segment> any_segment;
shared_ptr<data::LogicSegment> lsegment;
- vector< shared_ptr<sigrok::Channel> > achannel_list;
+ vector< shared_ptr<data::SignalBase> > achannel_list;
vector< shared_ptr<data::AnalogSegment> > asegment_list;
for (shared_ptr<view::Signal> signal : sigs) {
}
// Check whether the user wants to export a certain sample range
+ uint64_t end_sample;
+
if (sample_range_.first == sample_range_.second) {
start_sample_ = 0;
sample_count_ = any_segment->get_sample_count();
} else {
if (sample_range_.first > sample_range_.second) {
start_sample_ = sample_range_.second;
- sample_count_ = sample_range_.first - sample_range_.second;
+ end_sample = min(sample_range_.first, any_segment->get_sample_count());
+ sample_count_ = end_sample - start_sample_;
} else {
start_sample_ = sample_range_.first;
- sample_count_ = sample_range_.second - sample_range_.first;
+ end_sample = min(sample_range_.second, any_segment->get_sample_count());
+ sample_count_ = end_sample - start_sample_;
}
}
interrupt_ = true;
}
-void StoreSession::store_proc(vector< shared_ptr<sigrok::Channel> > achannel_list,
+void StoreSession::store_proc(vector< shared_ptr<data::SignalBase> > achannel_list,
vector< shared_ptr<data::AnalogSegment> > asegment_list,
shared_ptr<data::LogicSegment> lsegment)
{
const auto context = session_.device_manager().context();
for (unsigned int i = 0; i < achannel_list.size(); i++) {
- shared_ptr<sigrok::Channel> achannel = achannel_list.at(i);
+ shared_ptr<sigrok::Channel> achannel = (achannel_list.at(i))->channel();
shared_ptr<data::AnalogSegment> asegment = asegment_list.at(i);
const float *adata =