connect(close_btn, SIGNAL(clicked(bool)),
this, SLOT(on_view_close_clicked()));
- connect(&session, SIGNAL(trigger_event(util::Timestamp)),
+ connect(&session, SIGNAL(trigger_event(int, util::Timestamp)),
qobject_cast<views::ViewBase*>(v.get()),
- SLOT(trigger_event(util::Timestamp)));
+ SLOT(trigger_event(int, util::Timestamp)));
if (type == views::ViewTypeTrace) {
views::trace::View *tv =
for (const shared_ptr<data::SignalData> d : all_signal_data_)
d->clear();
+ trigger_list_.clear();
+
// Revert name back to default name (e.g. "Session 1") for real devices
// as the (possibly saved) data is gone. File devices keep their name.
shared_ptr<devices::HardwareDevice> hw_device =
return value;
}
+vector<util::Timestamp> Session::get_triggers(uint32_t segment_id) const
+{
+ vector<util::Timestamp> result;
+
+ for (pair<uint32_t, util::Timestamp> entry : trigger_list_)
+ if (entry.first == segment_id)
+ result.push_back(entry.second);
+
+ return result;
+}
+
const unordered_set< shared_ptr<data::SignalBase> > Session::signalbases() const
{
return signalbases_;
cur_analog_segments_.clear();
}
highest_segment_id_ = -1;
+ frame_began_ = false;
try {
device_->start();
}
}
- trigger_event(sample_count / get_samplerate());
+ // If no frame began then this is a trigger for a new segment
+ const uint32_t segment_id =
+ (frame_began_) ? highest_segment_id_ : (highest_segment_id_ + 1);
+
+ util::Timestamp timestamp = sample_count / get_samplerate();
+ trigger_list_.emplace_back(segment_id, timestamp);
+ trigger_event(segment_id, timestamp);
}
void Session::feed_in_frame_begin()
cur_analog_segments_.clear();
}
- if (frame_began_)
- frame_began_ = false;
+ frame_began_ = false;
signal_segment_completed();
}
uint32_t get_segment_count() const;
+ vector<util::Timestamp> get_triggers(uint32_t segment_id) const;
+
void register_view(shared_ptr<views::ViewBase> view);
void deregister_view(shared_ptr<views::ViewBase> view);
void name_changed();
- void trigger_event(util::Timestamp location);
+ void trigger_event(int segment_id, util::Timestamp location);
void new_segment(int new_segment_id);
void segment_completed(int segment_id);
unordered_set< shared_ptr<data::SignalBase> > signalbases_;
unordered_set< shared_ptr<data::SignalData> > all_signal_data_;
+ /// trigger_list_ contains pairs of <segment_id, timestamp> values.
+ vector< std::pair<uint32_t, util::Timestamp> > trigger_list_;
+
mutable recursive_mutex data_mutex_;
shared_ptr<data::Logic> logic_data_;
uint64_t cur_samplerate_;
for (shared_ptr<DecodeTrace> dt : decode_traces_)
dt->set_current_segment(current_segment_);
+ trigger_markers_.clear();
+ for (util::Timestamp timestamp : session_.get_triggers(segment_id))
+ trigger_markers_.push_back(make_shared<TriggerMarker>(*this, timestamp));
+
viewport_->update();
segment_changed(segment_id);
void View::set_segment_display_mode(Trace::SegmentDisplayMode mode)
{
+ trigger_markers_.clear();
+
segment_display_mode_ = mode;
for (shared_ptr<Signal> signal : signals_)
i->animate_to_layout_v_offset();
}
-void View::trigger_event(util::Timestamp location)
+void View::trigger_event(int segment_id, util::Timestamp location)
{
+ // TODO This doesn't work if we're showing multiple segments at once
+ if ((uint32_t)segment_id != current_segment_)
+ return;
+
// Set up ruler_shift if the Key_View_TriggerIsZeroTime option is set.
GlobalSettings settings;
bool trigger_is_zero_time = settings.value(GlobalSettings::Key_View_TriggerIsZeroTime).toBool();
void segment_display_mode_changed(int mode, bool segment_selectable);
public Q_SLOTS:
- void trigger_event(util::Timestamp location);
+ void trigger_event(int segment_id, util::Timestamp location);
private:
void get_scroll_layout(double &length, pv::util::Timestamp &offset) const;
(void)settings;
}
-void ViewBase::trigger_event(util::Timestamp location)
+void ViewBase::trigger_event(int segment_id, util::Timestamp location)
{
+ (void)segment_id;
(void)location;
}
virtual void restore_settings(QSettings &settings);
public Q_SLOTS:
- virtual void trigger_event(util::Timestamp location);
+ virtual void trigger_event(int segment_id, util::Timestamp location);
virtual void signals_changed();
virtual void capture_state_updated(int state);
virtual void on_new_segment(int new_segment_id);