PulseView  unreleased development snapshot
A Qt-based sigrok GUI
pv::Session Class Reference

#include <session.hpp>

Inheritance diagram for pv::Session:
Collaboration diagram for pv::Session:

Public Types

enum  capture_state { Stopped, AwaitingTrigger, Running }
 

Public Slots

void on_data_saved ()
 

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 (ViewType type, Session *session)
 
void session_error_raised (const QString text, const QString info_text)
 

Public Member Functions

 Session (DeviceManager &device_manager, QString name)
 
 ~Session ()
 
DeviceManagerdevice_manager ()
 
const DeviceManagerdevice_manager () const
 
shared_ptr< sigrok::Session > session () const
 
shared_ptr< devices::Devicedevice () const
 
QString name () const
 
void set_name (QString name)
 
QString save_path () const
 
void set_save_path (QString path)
 
const vector< shared_ptr< views::ViewBase > > views () const
 
shared_ptr< views::ViewBasemain_view () const
 
shared_ptr< pv::toolbars::MainBarmain_bar () const
 
void set_main_bar (shared_ptr< pv::toolbars::MainBar > main_bar)
 
bool data_saved () const
 
void save_setup (QSettings &settings) const
 
void save_settings (QSettings &settings) const
 
void restore_setup (QSettings &settings)
 
void restore_settings (QSettings &settings)
 
void select_device (shared_ptr< devices::Device > device)
 
void set_device (shared_ptr< devices::Device > device)
 
void set_default_device ()
 
bool using_file_device () const
 
void load_init_file (const string &file_name, const string &format, const string &setup_file_name)
 
void load_file (QString file_name, QString setup_file_name=QString(), shared_ptr< sigrok::InputFormat > format=nullptr, const map< string, Glib::VariantBase > &options=map< string, Glib::VariantBase >())
 
capture_state get_capture_state () const
 
void start_capture (function< void(const QString)> error_handler)
 
void stop_capture ()
 
double get_samplerate () const
 
Glib::DateTime get_acquisition_start_time () const
 
uint32_t get_highest_segment_id () const
 
uint64_t get_segment_sample_count (uint32_t segment_id) const
 
vector< util::Timestampget_triggers (uint32_t segment_id) const
 
void register_view (shared_ptr< views::ViewBase > view)
 
void deregister_view (shared_ptr< views::ViewBase > view)
 
bool has_view (shared_ptr< views::ViewBase > view)
 
const vector< shared_ptr< data::SignalBase > > signalbases () const
 
uint32_t get_signal_count (data::SignalBase::ChannelType type) const
 
uint32_t get_next_signal_index (data::SignalBase::ChannelType type)
 
void add_generated_signal (shared_ptr< data::SignalBase > signal)
 
void remove_generated_signal (shared_ptr< data::SignalBase > signal)
 
bool all_segments_complete (uint32_t segment_id) const
 
MetadataObjManagermetadata_obj_manager ()
 

Static Public Attributes

static shared_ptr< sigrok::Context > sr_context
 

Private Member Functions

void set_capture_state (capture_state state)
 
void update_signals ()
 
shared_ptr< data::SignalBasesignalbase_from_channel (shared_ptr< sigrok::Channel > channel) const
 
void sample_thread_proc (function< void(const QString)> error_handler)
 
void free_unused_memory ()
 
void signal_new_segment ()
 
void signal_segment_completed ()
 
void feed_in_header ()
 
void feed_in_meta (shared_ptr< sigrok::Meta > meta)
 
void feed_in_trigger ()
 
void feed_in_frame_begin ()
 
void feed_in_frame_end ()
 
void feed_in_logic (shared_ptr< sigrok::Logic > logic)
 
void feed_in_analog (shared_ptr< sigrok::Analog > analog)
 
void data_feed_in (shared_ptr< sigrok::Device > device, shared_ptr< sigrok::Packet > packet)
 

Static Private Member Functions

static map< string, Glib::VariantBase > input_format_options (vector< string > user_spec, map< string, shared_ptr< Option >> fmt_opts)
 

Private Attributes

bool shutting_down_
 
DeviceManagerdevice_manager_
 
shared_ptr< devices::Devicedevice_
 
QString default_name_
 
QString name_
 
QString save_path_
 
vector< shared_ptr< views::ViewBase > > views_
 
shared_ptr< pv::views::ViewBasemain_view_
 
shared_ptr< pv::toolbars::MainBarmain_bar_
 
mutex sampling_mutex_
 Protects access to capture_state_. More...
 
capture_state capture_state_
 
vector< shared_ptr< data::SignalBase > > signalbases_
 
unordered_set< shared_ptr< data::SignalData > > all_signal_data_
 
deque< data::SignalGroup * > signal_groups_
 
map< uint8_t, uint32_t > next_index_list_
 
vector< std::pair< uint32_t, util::Timestamp > > trigger_list_
 trigger_list_ contains pairs of <segment_id, timestamp> values More...
 
recursive_mutex data_mutex_
 
shared_ptr< data::Logiclogic_data_
 
uint64_t cur_samplerate_
 
shared_ptr< data::LogicSegmentcur_logic_segment_
 
map< shared_ptr< sigrok::Channel >, shared_ptr< data::AnalogSegment > > cur_analog_segments_
 
int32_t highest_segment_id_
 
vector< uint64_t > segment_sample_count_
 
std::thread sampling_thread_
 
bool out_of_memory_
 
bool data_saved_
 
bool frame_began_
 
QElapsedTimer acq_time_
 
Glib::DateTime acq_start_time_
 
MetadataObjManager metadata_obj_manager_
 

Detailed Description

Definition at line 117 of file session.hpp.

Member Enumeration Documentation

Enumerator
Stopped 
AwaitingTrigger 
Running 

Definition at line 122 of file session.hpp.

Constructor & Destructor Documentation

pv::Session::Session ( DeviceManager device_manager,
QString  name 
)

Definition at line 120 of file session.cpp.

pv::Session::~Session ( )

Definition at line 133 of file session.cpp.

Here is the call graph for this function:

Member Function Documentation

void pv::Session::add_generated_signal ( shared_ptr< data::SignalBase signal)

Definition at line 974 of file session.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::Session::add_view ( ViewType  type,
Session session 
)
signal

Definition at line 308 of file moc_session.cpp.

Here is the caller graph for this function:

bool pv::Session::all_segments_complete ( uint32_t  segment_id) const

Definition at line 1039 of file session.cpp.

Here is the caller graph for this function:

void pv::Session::capture_state_changed ( int  state)
signal

Definition at line 256 of file moc_session.cpp.

Here is the caller graph for this function:

void pv::Session::data_feed_in ( shared_ptr< sigrok::Device >  device,
shared_ptr< sigrok::Packet >  packet 
)
private

Definition at line 1640 of file session.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::Session::data_received ( )
signal

Definition at line 302 of file moc_session.cpp.

Here is the caller graph for this function:

bool pv::Session::data_saved ( ) const

Indicates whether the captured data was saved to disk already or not

Definition at line 216 of file session.cpp.

void pv::Session::deregister_view ( shared_ptr< views::ViewBase view)

Definition at line 887 of file session.cpp.

shared_ptr< devices::Device > pv::Session::device ( ) const

Definition at line 163 of file session.cpp.

Here is the caller graph for this function:

void pv::Session::device_changed ( )
signal

Definition at line 263 of file moc_session.cpp.

Here is the caller graph for this function:

DeviceManager & pv::Session::device_manager ( )

Definition at line 146 of file session.cpp.

Here is the caller graph for this function:

const DeviceManager & pv::Session::device_manager ( ) const

Definition at line 151 of file session.cpp.

void pv::Session::feed_in_analog ( shared_ptr< sigrok::Analog >  analog)
private

Definition at line 1564 of file session.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::Session::feed_in_frame_begin ( )
private

Definition at line 1487 of file session.cpp.

Here is the caller graph for this function:

void pv::Session::feed_in_frame_end ( )
private

Definition at line 1492 of file session.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::Session::feed_in_header ( )
private

Definition at line 1426 of file session.cpp.

Here is the caller graph for this function:

void pv::Session::feed_in_logic ( shared_ptr< sigrok::Logic >  logic)
private

Definition at line 1517 of file session.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::Session::feed_in_meta ( shared_ptr< sigrok::Meta >  meta)
private

Definition at line 1431 of file session.cpp.

Here is the caller graph for this function:

void pv::Session::feed_in_trigger ( )
private

Definition at line 1447 of file session.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::Session::free_unused_memory ( )
private

Definition at line 1321 of file session.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Glib::DateTime pv::Session::get_acquisition_start_time ( ) const

Definition at line 928 of file session.cpp.

Here is the caller graph for this function:

Session::capture_state pv::Session::get_capture_state ( ) const

Definition at line 788 of file session.cpp.

Here is the caller graph for this function:

uint32_t pv::Session::get_highest_segment_id ( ) const

Definition at line 933 of file session.cpp.

Here is the caller graph for this function:

uint32_t pv::Session::get_next_signal_index ( data::SignalBase::ChannelType  type)

Definition at line 968 of file session.cpp.

Here is the caller graph for this function:

double pv::Session::get_samplerate ( ) const

Definition at line 910 of file session.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

uint64_t pv::Session::get_segment_sample_count ( uint32_t  segment_id) const

Definition at line 938 of file session.cpp.

Here is the caller graph for this function:

uint32_t pv::Session::get_signal_count ( data::SignalBase::ChannelType  type) const

Definition at line 962 of file session.cpp.

vector< util::Timestamp > pv::Session::get_triggers ( uint32_t  segment_id) const

Definition at line 946 of file session.cpp.

Here is the caller graph for this function:

bool pv::Session::has_view ( shared_ptr< views::ViewBase view)

Definition at line 901 of file session.cpp.

map< string, Glib::VariantBase > pv::Session::input_format_options ( vector< string >  user_spec,
map< string, shared_ptr< Option >>  fmt_opts 
)
staticprivate

Convert generic options to data types that are specific to InputFormat.

Parameters
[in]user_specVector of tokenized words, string format.
[in]fmt_optsInput format's options, result of InputFormat::options().
Returns
Map of options suitable for InputFormat::create_input().

Definition at line 666 of file session.cpp.

Here is the caller graph for this function:

void pv::Session::load_file ( QString  file_name,
QString  setup_file_name = QString(),
shared_ptr< sigrok::InputFormat >  format = nullptr,
const map< string, Glib::VariantBase > &  options = map<string, Glib::VariantBase>() 
)

Definition at line 735 of file session.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::Session::load_init_file ( const string &  file_name,
const string &  format,
const string &  setup_file_name 
)

Definition at line 706 of file session.cpp.

Here is the call graph for this function:

shared_ptr< pv::toolbars::MainBar > pv::Session::main_bar ( ) const

Definition at line 211 of file session.cpp.

Here is the caller graph for this function:

shared_ptr< views::ViewBase > pv::Session::main_view ( ) const

Definition at line 201 of file session.cpp.

Here is the caller graph for this function:

MetadataObjManager * pv::Session::metadata_obj_manager ( )

Definition at line 1050 of file session.cpp.

Here is the caller graph for this function:

QString pv::Session::name ( ) const

Definition at line 168 of file session.cpp.

Here is the caller graph for this function:

void pv::Session::name_changed ( )
signal

Definition at line 275 of file moc_session.cpp.

Here is the caller graph for this function:

void pv::Session::new_segment ( int  new_segment_id)
signal

Definition at line 288 of file moc_session.cpp.

Here is the caller graph for this function:

void pv::Session::on_data_saved ( )
slot

Definition at line 1713 of file session.cpp.

void pv::Session::register_view ( shared_ptr< views::ViewBase view)

Definition at line 848 of file session.cpp.

Here is the call graph for this function:

void pv::Session::remove_generated_signal ( shared_ptr< data::SignalBase signal)

Definition at line 984 of file session.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::Session::restore_settings ( QSettings settings)

Definition at line 469 of file session.cpp.

Here is the call graph for this function:

void pv::Session::restore_setup ( QSettings settings)

Definition at line 376 of file session.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::Session::sample_thread_proc ( function< void(const QString)>  error_handler)
private

Definition at line 1224 of file session.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

QString pv::Session::save_path ( ) const

Definition at line 186 of file session.cpp.

Here is the caller graph for this function:

void pv::Session::save_settings ( QSettings settings) const

Definition at line 308 of file session.cpp.

Here is the call graph for this function:

void pv::Session::save_setup ( QSettings settings) const

Definition at line 221 of file session.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::Session::segment_completed ( int  segment_id)
signal

Definition at line 295 of file moc_session.cpp.

Here is the caller graph for this function:

void pv::Session::select_device ( shared_ptr< devices::Device device)

Attempts to set device instance, may fall back to demo if needed

Definition at line 551 of file session.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

shared_ptr< sigrok::Session > pv::Session::session ( ) const

Definition at line 156 of file session.cpp.

Here is the caller graph for this function:

void pv::Session::session_error_raised ( const QString  text,
const QString  info_text 
)
signal

Definition at line 315 of file moc_session.cpp.

Here is the caller graph for this function:

void pv::Session::set_capture_state ( capture_state  state)
private

Definition at line 1055 of file session.cpp.

Here is the caller graph for this function:

void pv::Session::set_default_device ( )

Definition at line 631 of file session.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::Session::set_device ( shared_ptr< devices::Device device)

Sets device instance that will be used in the next capture session.

Definition at line 563 of file session.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::Session::set_main_bar ( shared_ptr< pv::toolbars::MainBar main_bar)

Definition at line 206 of file session.cpp.

Here is the call graph for this function:

void pv::Session::set_name ( QString  name)

Definition at line 173 of file session.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::Session::set_save_path ( QString  path)

Definition at line 191 of file session.cpp.

Here is the caller graph for this function:

void pv::Session::signal_new_segment ( )
private

Definition at line 1331 of file session.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::Session::signal_segment_completed ( )
private

Definition at line 1362 of file session.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

shared_ptr< data::SignalBase > pv::Session::signalbase_from_channel ( shared_ptr< sigrok::Channel >  channel) const
private

Definition at line 1213 of file session.cpp.

Here is the caller graph for this function:

const vector< shared_ptr< data::SignalBase > > pv::Session::signalbases ( ) const

Definition at line 957 of file session.cpp.

Here is the caller graph for this function:

void pv::Session::signals_changed ( )
signal

Definition at line 269 of file moc_session.cpp.

Here is the caller graph for this function:

void pv::Session::start_capture ( function< void(const QString)>  error_handler)

Definition at line 794 of file session.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::Session::stop_capture ( )

Definition at line 838 of file session.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::Session::trigger_event ( int  segment_id,
util::Timestamp  location 
)
signal

Definition at line 281 of file moc_session.cpp.

Here is the caller graph for this function:

void pv::Session::update_signals ( )
private

Definition at line 1073 of file session.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool pv::Session::using_file_device ( ) const

Definition at line 646 of file session.cpp.

Here is the caller graph for this function:

const vector< shared_ptr< views::ViewBase > > pv::Session::views ( ) const

Definition at line 196 of file session.cpp.

Here is the caller graph for this function:

Member Data Documentation

Glib::DateTime pv::Session::acq_start_time_
private

Definition at line 318 of file session.hpp.

QElapsedTimer pv::Session::acq_time_
private

Definition at line 317 of file session.hpp.

unordered_set< shared_ptr<data::SignalData> > pv::Session::all_signal_data_
private

Definition at line 295 of file session.hpp.

capture_state pv::Session::capture_state_
private

Definition at line 292 of file session.hpp.

map< shared_ptr<sigrok::Channel>, shared_ptr<data::AnalogSegment> > pv::Session::cur_analog_segments_
private

Definition at line 307 of file session.hpp.

shared_ptr<data::LogicSegment> pv::Session::cur_logic_segment_
private

Definition at line 305 of file session.hpp.

uint64_t pv::Session::cur_samplerate_
private

Definition at line 304 of file session.hpp.

recursive_mutex pv::Session::data_mutex_
mutableprivate

Definition at line 302 of file session.hpp.

bool pv::Session::data_saved_
private

Definition at line 314 of file session.hpp.

QString pv::Session::default_name_
private

Definition at line 284 of file session.hpp.

shared_ptr<devices::Device> pv::Session::device_
private

Definition at line 283 of file session.hpp.

DeviceManager& pv::Session::device_manager_
private

Definition at line 282 of file session.hpp.

bool pv::Session::frame_began_
private

Definition at line 315 of file session.hpp.

int32_t pv::Session::highest_segment_id_
private

Definition at line 308 of file session.hpp.

shared_ptr<data::Logic> pv::Session::logic_data_
private

Definition at line 303 of file session.hpp.

shared_ptr<pv::toolbars::MainBar> pv::Session::main_bar_
private

Definition at line 289 of file session.hpp.

shared_ptr<pv::views::ViewBase> pv::Session::main_view_
private

Definition at line 287 of file session.hpp.

MetadataObjManager pv::Session::metadata_obj_manager_
private

Definition at line 320 of file session.hpp.

QString pv::Session::name_
private

Definition at line 284 of file session.hpp.

map<uint8_t, uint32_t> pv::Session::next_index_list_
private

Definition at line 297 of file session.hpp.

bool pv::Session::out_of_memory_
private

Definition at line 313 of file session.hpp.

mutex pv::Session::sampling_mutex_
mutableprivate

Protects access to capture_state_.

Definition at line 291 of file session.hpp.

std::thread pv::Session::sampling_thread_
private

Definition at line 311 of file session.hpp.

QString pv::Session::save_path_
private

Definition at line 284 of file session.hpp.

vector<uint64_t> pv::Session::segment_sample_count_
private

Definition at line 309 of file session.hpp.

bool pv::Session::shutting_down_
private

Definition at line 280 of file session.hpp.

deque<data::SignalGroup*> pv::Session::signal_groups_
private

Definition at line 296 of file session.hpp.

vector< shared_ptr<data::SignalBase> > pv::Session::signalbases_
private

Definition at line 294 of file session.hpp.

shared_ptr< sigrok::Context > pv::Session::sr_context
static

Definition at line 128 of file session.hpp.

vector< std::pair<uint32_t, util::Timestamp> > pv::Session::trigger_list_
private

trigger_list_ contains pairs of <segment_id, timestamp> values

Definition at line 300 of file session.hpp.

vector< shared_ptr<views::ViewBase> > pv::Session::views_
private

Definition at line 286 of file session.hpp.


The documentation for this class was generated from the following files: