]> sigrok.org Git - pulseview.git/commitdiff
store session: do send end() packet after data export to output file
authorGerhard Sittig <redacted>
Sun, 29 Dec 2019 06:13:47 +0000 (07:13 +0100)
committerUwe Hermann <redacted>
Sun, 29 Dec 2019 20:46:40 +0000 (21:46 +0100)
Extend the StoreSession::store_proc() method to send a SR_DF_END packet
after all analog/logic data packets were sent and before the output file
and output module get shutdown.

This fixes bug #1470.

pv/storesession.cpp

index 42b13c46c24303c5fad2ad7ef6cf55ca13322a0f..f024a36cb8a8c49792eb5d8bd14d424429f42d2c 100644 (file)
@@ -251,6 +251,7 @@ void StoreSession::store_proc(vector< shared_ptr<data::SignalBase> > achannel_li
        const unsigned int samples_per_block =
                min(asamples_per_block, lsamples_per_block);
 
        const unsigned int samples_per_block =
                min(asamples_per_block, lsamples_per_block);
 
+       const auto context = session_.device_manager().context();
        while (!interrupt_ && sample_count_) {
                progress_updated();
 
        while (!interrupt_ && sample_count_) {
                progress_updated();
 
@@ -258,8 +259,6 @@ void StoreSession::store_proc(vector< shared_ptr<data::SignalBase> > achannel_li
                        min((uint64_t)samples_per_block, sample_count_);
 
                try {
                        min((uint64_t)samples_per_block, sample_count_);
 
                try {
-                       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))->channel();
                                shared_ptr<data::AnalogSegment> asegment = asegment_list.at(i);
                        for (unsigned int i = 0; i < achannel_list.size(); i++) {
                                shared_ptr<sigrok::Channel> achannel = (achannel_list.at(i))->channel();
                                shared_ptr<data::AnalogSegment> asegment = asegment_list.at(i);
@@ -303,6 +302,11 @@ void StoreSession::store_proc(vector< shared_ptr<data::SignalBase> > achannel_li
                units_stored_ = unit_count_ - (sample_count_ >> progress_scale);
        }
 
                units_stored_ = unit_count_ - (sample_count_ >> progress_scale);
        }
 
+       auto dfend = context->create_end_packet();
+       const string ldata_str = output_->receive(dfend);
+       if (output_stream_.is_open())
+               output_stream_ << ldata_str;
+
        // Zeroing the progress variables indicates completion
        units_stored_ = unit_count_ = 0;
 
        // Zeroing the progress variables indicates completion
        units_stored_ = unit_count_ = 0;