X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fsigsession.h;h=b4f07db4394397579e8d429bf9d9ca3d763e88b5;hb=7d29656f1e4de945eee3a9ea5dbc0ef88c4a7e30;hp=29929a9dde63d1b1bbc4520885d28cc3e719370e;hpb=8d634081d8b0cc741dd34d8c646474ff6754aea8;p=pulseview.git diff --git a/pv/sigsession.h b/pv/sigsession.h index 29929a9..b4f07db 100644 --- a/pv/sigsession.h +++ b/pv/sigsession.h @@ -22,8 +22,10 @@ #define PULSEVIEW_PV_SIGSESSION_H #include +#include #include +#include #include #include @@ -45,6 +47,12 @@ class SigSession : public QObject { Q_OBJECT +public: + enum capture_state { + Stopped, + Running + }; + public: SigSession(); @@ -52,15 +60,25 @@ public: void load_file(const std::string &name); + capture_state get_capture_state() const; + void start_capture(struct sr_dev_inst* sdi, uint64_t record_length, uint64_t sample_rate); - std::vector< boost::shared_ptr >& + void stop_capture(); + + std::vector< boost::shared_ptr > get_signals(); boost::shared_ptr get_data(); private: + void set_capture_state(capture_state state); + +private: + void sample_thread_proc(struct sr_dev_inst *sdi, + uint64_t record_length, uint64_t sample_rate); + void data_feed_in(const struct sr_dev_inst *sdi, struct sr_datafeed_packet *packet); @@ -68,11 +86,23 @@ private: struct sr_datafeed_packet *packet); private: + mutable boost::mutex _state_mutex; + capture_state _capture_state; + + mutable boost::mutex _signals_mutex; std::vector< boost::shared_ptr > _signals; + + mutable boost::mutex _data_mutex; boost::shared_ptr _logic_data; boost::shared_ptr _cur_logic_snapshot; + std::auto_ptr _sampling_thread; + signals: + void capture_state_changed(int state); + + void signals_changed(); + void data_updated(); private: