+ }
+
+ signals_changed();
+}
+
+void SigSession::feed_in_frame_begin()
+{
+ if (_cur_logic_snapshot || !_cur_analog_snapshots.empty())
+ frame_began();
+}
+
+void SigSession::feed_in_logic(shared_ptr<Logic> logic)
+{
+ lock_guard<mutex> lock(_data_mutex);
+
+ if (!_logic_data)
+ {
+ qDebug() << "Unexpected logic packet";
+ return;
+ }
+
+ if (!_cur_logic_snapshot)
+ {
+ // This could be the first packet after a trigger
+ set_capture_state(Running);
+
+ // Get sample limit.
+ uint64_t sample_limit;
+ try {
+ sample_limit = VariantBase::cast_dynamic<Variant<guint64>>(
+ _device->config_get(ConfigKey::LIMIT_SAMPLES)).get();
+ } catch (Error) {
+ sample_limit = 0;
+ }
+
+ // Create a new data snapshot
+ _cur_logic_snapshot = shared_ptr<data::LogicSnapshot>(
+ new data::LogicSnapshot(logic, sample_limit));
+ _logic_data->push_snapshot(_cur_logic_snapshot);
+
+ // @todo Putting this here means that only listeners querying
+ // for logic will be notified. Currently the only user of
+ // frame_began is DecoderStack, but in future we need to signal
+ // this after both analog and logic sweeps have begun.
+ frame_began();
+ }
+ else
+ {
+ // Append to the existing data snapshot
+ _cur_logic_snapshot->append_payload(logic);
+ }
+
+ data_received();
+}
+
+void SigSession::feed_in_analog(shared_ptr<Analog> analog)
+{
+ lock_guard<mutex> lock(_data_mutex);
+
+ const vector<shared_ptr<Channel>> channels = analog->channels();
+ const unsigned int channel_count = channels.size();
+ const size_t sample_count = analog->num_samples() / channel_count;
+ const float *data = analog->data_pointer();
+ bool sweep_beginning = false;
+
+ for (auto channel : channels)
+ {
+ shared_ptr<data::AnalogSnapshot> snapshot;
+
+ // Try to get the snapshot of the channel
+ const map< shared_ptr<Channel>, shared_ptr<data::AnalogSnapshot> >::
+ iterator iter = _cur_analog_snapshots.find(channel);
+ if (iter != _cur_analog_snapshots.end())
+ snapshot = (*iter).second;