projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Build fixes for Qt5 Windows/mingw/MXE support.
[pulseview.git]
/
pv
/
storesession.cpp
diff --git
a/pv/storesession.cpp
b/pv/storesession.cpp
index 9a481dd86696ba60ae5e4b61c03bd9719156b1c8..eaa17ea5f98096519f88f44be1373a8a697c171c 100644
(file)
--- a/
pv/storesession.cpp
+++ b/
pv/storesession.cpp
@@
-14,8
+14,7
@@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <cassert>
*/
#include <cassert>
@@
-36,8
+35,8
@@
#include <pv/data/analogsegment.hpp>
#include <pv/data/logic.hpp>
#include <pv/data/logicsegment.hpp>
#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/devices/device.hpp>
-#include <pv/view/signal.hpp>
#include <libsigrokcxx/libsigrokcxx.hpp>
#include <libsigrokcxx/libsigrokcxx.hpp>
@@
-62,6
+61,7
@@
using std::vector;
using Glib::VariantBase;
using Glib::VariantBase;
+using sigrok::ChannelType;
using sigrok::ConfigKey;
using sigrok::Error;
using sigrok::OutputFormat;
using sigrok::ConfigKey;
using sigrok::Error;
using sigrok::OutputFormat;
@@
-105,22
+105,20
@@
const QString& StoreSession::error() const
bool StoreSession::start()
{
bool StoreSession::start()
{
- const unordered_set< shared_ptr<
view::Signal> > sigs(session_.signal
s());
+ const unordered_set< shared_ptr<
data::SignalBase> > sigs(session_.signalbase
s());
shared_ptr<data::Segment> any_segment;
shared_ptr<data::LogicSegment> lsegment;
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;
vector< shared_ptr<data::AnalogSegment> > asegment_list;
- for (shared_ptr<
view::Signal
> signal : sigs) {
+ for (shared_ptr<
data::SignalBase
> signal : sigs) {
if (!signal->enabled())
continue;
if (!signal->enabled())
continue;
- shared_ptr<data::SignalData> data = signal->data();
-
- if (dynamic_pointer_cast<data::Logic>(data)) {
+ if (signal->type() == ChannelType::LOGIC) {
// All logic channels share the same data segments
// All logic channels share the same data segments
- shared_ptr<data::Logic> ldata =
dynamic_pointer_cast<data::Logic>(data
);
+ shared_ptr<data::Logic> ldata =
signal->logic_data(
);
const deque< shared_ptr<data::LogicSegment> > &lsegments =
ldata->logic_segments();
const deque< shared_ptr<data::LogicSegment> > &lsegments =
ldata->logic_segments();
@@
-134,10
+132,9
@@
bool StoreSession::start()
any_segment = lsegment;
}
any_segment = lsegment;
}
- if (
dynamic_pointer_cast<data::Analog>(data)
) {
+ if (
signal->type() == ChannelType::ANALOG
) {
// Each analog channel has its own segments
// Each analog channel has its own segments
- shared_ptr<data::Analog> adata =
- dynamic_pointer_cast<data::Analog>(data);
+ shared_ptr<data::Analog> adata = signal->analog_data();
const deque< shared_ptr<data::AnalogSegment> > &asegments =
adata->analog_segments();
const deque< shared_ptr<data::AnalogSegment> > &asegments =
adata->analog_segments();
@@
-150,7
+147,7
@@
bool StoreSession::start()
asegment_list.push_back(asegments.front());
any_segment = asegments.front();
asegment_list.push_back(asegments.front());
any_segment = asegments.front();
- achannel_list.push_back(signal
->channel()
);
+ achannel_list.push_back(signal);
}
}
}
}
@@
-160,16
+157,20
@@
bool StoreSession::start()
}
// Check whether the user wants to export a certain sample range
}
// 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;
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;
} 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_;
}
}
}
}
@@
-210,7
+211,7
@@
void StoreSession::cancel()
interrupt_ = true;
}
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)
{
vector< shared_ptr<data::AnalogSegment> > asegment_list,
shared_ptr<data::LogicSegment> lsegment)
{
@@
-255,7
+256,7
@@
void StoreSession::store_proc(vector< shared_ptr<sigrok::Channel> > achannel_lis
const auto context = session_.device_manager().context();
for (unsigned int i = 0; i < achannel_list.size(); i++) {
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 =
shared_ptr<data::AnalogSegment> asegment = asegment_list.at(i);
const float *adata =
@@
-299,6
+300,7
@@
void StoreSession::store_proc(vector< shared_ptr<sigrok::Channel> > achannel_lis
// Zeroing the progress variables indicates completion
units_stored_ = unit_count_ = 0;
// Zeroing the progress variables indicates completion
units_stored_ = unit_count_ = 0;
+ store_successful();
progress_updated();
output_.reset();
progress_updated();
output_.reset();