+void SigSession::load_session_thread_proc(
+ function<void (const QString)> error_handler)
+{
+ (void)error_handler;
+
+ sr_session_datafeed_callback_add(data_feed_in_proc, NULL);
+
+ set_capture_state(Running);
+
+ sr_session_run();
+
+ sr_session_destroy();
+ set_capture_state(Stopped);
+
+ // Confirm that SR_DF_END was received
+ assert(!_cur_logic_snapshot);
+ assert(_cur_analog_snapshots.empty());
+}
+
+void SigSession::load_input_thread_proc(const string name,
+ sr_input *in, function<void (const QString)> error_handler)
+{
+ (void)error_handler;
+
+ assert(in);
+ assert(in->format);
+
+ sr_session_datafeed_callback_add(data_feed_in_proc, NULL);
+
+ set_capture_state(Running);
+
+ in->format->loadfile(in, name.c_str());
+
+ sr_session_destroy();
+ set_capture_state(Stopped);
+
+ // Confirm that SR_DF_END was received
+ assert(!_cur_logic_snapshot);
+ assert(_cur_analog_snapshots.empty());
+
+ delete in;
+}
+
+void SigSession::sample_thread_proc(shared_ptr<device::DevInst> dev_inst,
+ function<void (const QString)> error_handler)
+{
+ assert(dev_inst);
+ assert(dev_inst->dev_inst());
+ assert(error_handler);
+
+ sr_session_new();
+ sr_session_datafeed_callback_add(data_feed_in_proc, NULL);
+
+ if (sr_session_dev_add(dev_inst->dev_inst()) != SR_OK) {
+ error_handler(tr("Failed to use device."));
+ sr_session_destroy();
+ return;
+ }
+
+ if (sr_session_start() != SR_OK) {
+ error_handler(tr("Failed to start session."));
+ return;
+ }
+
+ set_capture_state(dev_inst->is_trigger_enabled() ?
+ AwaitingTrigger : Running);
+
+ sr_session_run();
+ sr_session_destroy();
+
+ set_capture_state(Stopped);
+
+ // Confirm that SR_DF_END was received
+ if (_cur_logic_snapshot)
+ {
+ qDebug("SR_DF_END was not received.");
+ assert(0);
+ }
+}
+
+void SigSession::feed_in_header(const sr_dev_inst *sdi)
+{
+ read_sample_rate(sdi);
+}
+