- auto context = session_.session()->context();
- auto logic = context->create_logic_packet(data, length, unit_size);
- output_->receive(logic);
+ 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);
+
+ const float *adata =
+ asegment->get_samples(start_sample_, start_sample_ + packet_len);
+
+ auto analog = context->create_analog_packet(
+ vector<shared_ptr<sigrok::Channel> >{achannel},
+ (float *)adata, packet_len,
+ sigrok::Quantity::VOLTAGE, sigrok::Unit::VOLT,
+ vector<const sigrok::QuantityFlag *>());
+ const string adata_str = output_->receive(analog);
+
+ if (output_stream_.is_open())
+ output_stream_ << adata_str;
+
+ delete[] adata;
+ }
+
+ if (lsegment) {
+ const uint8_t* ldata =
+ lsegment->get_samples(start_sample_, start_sample_ + packet_len);
+
+ const size_t length = packet_len * lunit_size;
+ auto logic = context->create_logic_packet((void*)ldata, length, lunit_size);
+ const string ldata_str = output_->receive(logic);
+
+ if (output_stream_.is_open())
+ output_stream_ << ldata_str;
+
+ delete[] ldata;
+ }