X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fsession.hpp;h=19fd993872edc04ba8bae3ca8ad11568dce9a894;hp=7229c7e337f3ec71efa1041d9799b3c3e4fe2c42;hb=056f443e2a6f8db80161ce08d7ff8111175bc3d6;hpb=83b1c8d251386ac1980284c4668cbdd8e425550f diff --git a/pv/session.hpp b/pv/session.hpp index 7229c7e3..19fd9938 100644 --- a/pv/session.hpp +++ b/pv/session.hpp @@ -29,12 +29,6 @@ #include #include -#ifdef _WIN32 -// Windows: Avoid boost/thread namespace pollution (which includes windows.h). -#define NOGDI -#define NORESOURCE -#endif - #include #include #include @@ -61,10 +55,13 @@ class Device; class InputFormat; class Logic; class Meta; +class Option; class OutputFormat; class Packet; class Session; -} +} // namespace sigrok + +using sigrok::Option; namespace pv { @@ -73,6 +70,7 @@ class DeviceManager; namespace data { class Analog; class AnalogSegment; +class DecodeSignal; class Logic; class LogicSegment; class SignalBase; @@ -102,6 +100,8 @@ public: Running }; + static shared_ptr sr_context; + public: Session(DeviceManager &device_manager, QString name); @@ -163,19 +163,22 @@ public: double get_samplerate() const; + uint32_t get_segment_count() 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: @@ -186,11 +189,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); @@ -198,6 +207,7 @@ private: void feed_in_trigger(); void feed_in_frame_begin(); + void feed_in_frame_end(); void feed_in_logic(shared_ptr logic); @@ -206,6 +216,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(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_; @@ -228,33 +259,13 @@ private: 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