X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fsession.hpp;h=689b3f832dcf40752f789fb9f3bc59db2e64bc98;hp=d17c9dc364205344d157e7c271601cb5c6e9c5a7;hb=e71eb81c946c3524e01eaef9781ccbf170143d0c;hpb=78b0af3ebcbeab50e1c1634af729c0a7f97fb435 diff --git a/pv/session.hpp b/pv/session.hpp index d17c9dc3..689b3f83 100644 --- a/pv/session.hpp +++ b/pv/session.hpp @@ -18,8 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef PULSEVIEW_PV_SIGSESSION_HPP -#define PULSEVIEW_PV_SIGSESSION_HPP +#ifndef PULSEVIEW_PV_SESSION_HPP +#define PULSEVIEW_PV_SESSION_HPP #include #include @@ -35,7 +35,7 @@ #define NOGDI #define NORESOURCE #endif -#include +#include #include #include @@ -65,6 +65,10 @@ class LogicSegment; class SignalData; } +namespace devices { +class Device; +} + namespace view { class DecodeTrace; class LogicSignal; @@ -91,20 +95,14 @@ public: const DeviceManager& device_manager() const; - const std::shared_ptr& session() const; + std::shared_ptr session() const; - std::shared_ptr device() const; + std::shared_ptr device() const; /** * Sets device instance that will be used in the next capture session. */ - void set_device(std::shared_ptr device); - - /** - * Sets a sigrok session file as the capture device. - * @param name the path to the file. - */ - void set_session_file(const std::string &name); + void set_device(std::shared_ptr device); void set_default_device(); @@ -133,21 +131,18 @@ public: private: void set_capture_state(capture_state state); - void update_signals(std::shared_ptr device); + void update_signals(); std::shared_ptr signal_from_channel( std::shared_ptr channel) const; - void read_sample_rate(std::shared_ptr); - private: - void sample_thread_proc(std::shared_ptr device, + void sample_thread_proc(std::shared_ptr device, std::function error_handler); - void feed_in_header(std::shared_ptr device); + void feed_in_header(); - void feed_in_meta(std::shared_ptr device, - std::shared_ptr meta); + void feed_in_meta(std::shared_ptr meta); void feed_in_frame_begin(); @@ -160,12 +155,7 @@ private: private: DeviceManager &device_manager_; - std::shared_ptr session_; - - /** - * The device instance that will be used in the next capture session. - */ - std::shared_ptr device_; + std::shared_ptr device_; std::vector< std::shared_ptr > decode_traces_; @@ -175,7 +165,7 @@ private: mutable boost::shared_mutex signals_mutex_; std::unordered_set< std::shared_ptr > signals_; - mutable std::mutex data_mutex_; + mutable std::recursive_mutex data_mutex_; std::shared_ptr logic_data_; uint64_t cur_samplerate_; std::shared_ptr cur_logic_segment_; @@ -184,6 +174,8 @@ private: std::thread sampling_thread_; + bool out_of_memory_; + Q_SIGNALS: void capture_state_changed(int state); void device_selected(); @@ -199,4 +191,4 @@ Q_SIGNALS: } // namespace pv -#endif // PULSEVIEW_PV_SIGSESSION_HPP +#endif // PULSEVIEW_PV_SESSION_HPP