X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fsession.hpp;h=2ee31cfee5afb8ef6de44171322d1d20086e755a;hp=4ac7f509b516dcf18b4738753b1dd5038041f6ec;hb=46ebcd3f6f85092a9eb6401f6f56cee8fa08131a;hpb=6f925ba9d6faf1077b73c5a5808259576081716a diff --git a/pv/session.hpp b/pv/session.hpp index 4ac7f509..2ee31cfe 100644 --- a/pv/session.hpp +++ b/pv/session.hpp @@ -20,6 +20,7 @@ #ifndef PULSEVIEW_PV_SESSION_HPP #define PULSEVIEW_PV_SESSION_HPP +#include #include #include #include @@ -29,13 +30,6 @@ #include #include -#ifdef _WIN32 -// Windows: Avoid boost/thread namespace pollution (which includes windows.h). -#define NOGDI -#define NORESOURCE -#endif -#include - #include #include #include @@ -62,10 +56,13 @@ class Device; class InputFormat; class Logic; class Meta; +class Option; class OutputFormat; class Packet; class Session; -} +} // namespace sigrok + +using sigrok::Option; namespace pv { @@ -74,6 +71,7 @@ class DeviceManager; namespace data { class Analog; class AnalogSegment; +class DecodeSignal; class Logic; class LogicSegment; class SignalBase; @@ -103,6 +101,8 @@ public: Running }; + static shared_ptr sr_context; + public: Session(DeviceManager &device_manager, QString name); @@ -164,19 +164,24 @@ public: double get_samplerate() const; + uint32_t get_segment_count() const; + + vector get_triggers(uint32_t segment_id) const; + void register_view(shared_ptr view); void deregister_view(shared_ptr view); bool has_view(shared_ptr view); - const unordered_set< shared_ptr > - signalbases() const; + const unordered_set< shared_ptr > signalbases() const; + + bool all_segments_complete(uint32_t segment_id) const; #ifdef ENABLE_DECODE - bool add_decoder(srd_decoder *const dec); + shared_ptr add_decode_signal(); - void remove_decode_signal(shared_ptr signalbase); + void remove_decode_signal(shared_ptr signal); #endif private: @@ -187,11 +192,17 @@ private: shared_ptr signalbase_from_channel( shared_ptr channel) const; -private: + static map input_format_options( + vector user_spec, + map> fmt_opts); + void sample_thread_proc(function error_handler); void free_unused_memory(); + void signal_new_segment(); + void signal_segment_completed(); + void feed_in_header(); void feed_in_meta(shared_ptr meta); @@ -199,6 +210,7 @@ private: void feed_in_trigger(); void feed_in_frame_begin(); + void feed_in_frame_end(); void feed_in_logic(shared_ptr logic); @@ -207,6 +219,27 @@ private: void data_feed_in(shared_ptr device, shared_ptr packet); +Q_SIGNALS: + void capture_state_changed(int state); + void device_changed(); + + void signals_changed(); + + void name_changed(); + + void trigger_event(int segment_id, util::Timestamp location); + + void new_segment(int new_segment_id); + void segment_completed(int segment_id); + + void data_received(); + + void add_view(const QString &title, views::ViewType type, + Session *session); + +public Q_SLOTS: + void on_data_saved(); + private: DeviceManager &device_manager_; shared_ptr device_; @@ -223,39 +256,22 @@ private: unordered_set< shared_ptr > signalbases_; unordered_set< shared_ptr > all_signal_data_; + /// trigger_list_ contains pairs of values. + vector< std::pair > trigger_list_; + mutable recursive_mutex data_mutex_; shared_ptr logic_data_; uint64_t cur_samplerate_; shared_ptr cur_logic_segment_; map< shared_ptr, shared_ptr > cur_analog_segments_; + int32_t highest_segment_id_; std::thread sampling_thread_; bool out_of_memory_; bool data_saved_; - -Q_SIGNALS: - void capture_state_changed(int state); - void device_changed(); - - void signals_changed(); - - void name_changed(); - - void trigger_event(util::Timestamp location); - - void frame_began(); - - void data_received(); - - void frame_ended(); - - void add_view(const QString &title, views::ViewType type, - Session *session); - -public Q_SLOTS: - void on_data_saved(); + bool frame_began_; }; } // namespace pv