mutex DecoderStack::global_decode_mutex_;
-DecoderStack::DecoderStack(pv::SigSession &session,
+DecoderStack::DecoderStack(pv::Session &session,
const srd_decoder *const dec) :
session_(session),
sample_count_(0),
namespace pv {
-class SigSession;
+class Session;
namespace view {
class LogicSignal;
static const unsigned int DecodeNotifyPeriod;
public:
- DecoderStack(pv::SigSession &session_,
+ DecoderStack(pv::Session &session_,
const srd_decoder *const decoder);
virtual ~DecoderStack();
void new_decode_data();
private:
- pv::SigSession &session_;
+ pv::Session &session_;
/**
* This mutex prevents more than one decode operation occuring
namespace pv {
-class SigSession;
+class Session;
class DeviceManager
{
namespace dialogs {
StoreProgress::StoreProgress(const QString &file_name,
- const SigSession &session, QWidget *parent) :
+ const Session &session, QWidget *parent) :
QProgressDialog(tr("Saving..."), tr("Cancel"), 0, 0, parent),
session_(file_name.toStdString(), session)
{
namespace pv {
-class SigSession;
+class Session;
namespace dialogs {
Q_OBJECT
public:
- StoreProgress(const QString &file_name, const SigSession &session,
+ StoreProgress(const QString &file_name, const Session &session,
QWidget *parent = 0);
virtual ~StoreProgress();
void MainWindow::run_stop()
{
switch(session_.get_capture_state()) {
- case SigSession::Stopped:
+ case Session::Stopped:
session_.start_capture([&](QString message) {
session_error("Capture failed", message); });
break;
- case SigSession::AwaitingTrigger:
- case SigSession::Running:
+ case Session::AwaitingTrigger:
+ case Session::Running:
session_.stop_capture();
break;
}
void MainWindow::capture_state_changed(int state)
{
- sampling_bar_->set_capture_state((pv::SigSession::capture_state)state);
+ sampling_bar_->set_capture_state((pv::Session::capture_state)state);
}
void MainWindow::device_selected()
DeviceManager &device_manager_;
- SigSession session_;
+ Session session_;
pv::view::View *view_;
namespace pv {
namespace popups {
-Channels::Channels(SigSession &session, QWidget *parent) :
+Channels::Channels(Session &session, QWidget *parent) :
Popup(parent),
session_(session),
updating_channels_(false),
namespace pv {
-class SigSession;
+class Session;
namespace prop {
namespace binding {
Q_OBJECT
public:
- Channels(SigSession &session_, QWidget *parent);
+ Channels(Session &session_, QWidget *parent);
private:
void set_all_channels(bool set);
void disable_all_channels();
private:
- pv::SigSession &session_;
+ pv::Session &session_;
QFormLayout layout_;
using Glib::Variant;
namespace pv {
-SigSession::SigSession(DeviceManager &device_manager) :
+Session::Session(DeviceManager &device_manager) :
device_manager_(device_manager),
session_(device_manager.context()->create_session()),
capture_state_(Stopped)
set_default_device();
}
-SigSession::~SigSession()
+Session::~Session()
{
// Stop and join to the thread
stop_capture();
}
-DeviceManager& SigSession::device_manager()
+DeviceManager& Session::device_manager()
{
return device_manager_;
}
-const DeviceManager& SigSession::device_manager() const
+const DeviceManager& Session::device_manager() const
{
return device_manager_;
}
-const shared_ptr<sigrok::Session>& SigSession::session() const
+const shared_ptr<sigrok::Session>& Session::session() const
{
return session_;
}
-shared_ptr<Device> SigSession::device() const
+shared_ptr<Device> Session::device() const
{
return device_;
}
-void SigSession::set_device(shared_ptr<Device> device)
+void Session::set_device(shared_ptr<Device> device)
{
// Ensure we are not capturing before setting the device
stop_capture();
device_selected();
}
-void SigSession::set_file(const string &name)
+void Session::set_file(const string &name)
{
session_ = device_manager_.context()->load_session(name);
device_ = session_->devices()[0];
device_selected();
}
-void SigSession::set_default_device()
+void Session::set_default_device()
{
shared_ptr<HardwareDevice> default_device;
const list< shared_ptr<HardwareDevice> > &devices =
}
}
-SigSession::capture_state SigSession::get_capture_state() const
+Session::capture_state Session::get_capture_state() const
{
lock_guard<mutex> lock(sampling_mutex_);
return capture_state_;
}
-void SigSession::start_capture(function<void (const QString)> error_handler)
+void Session::start_capture(function<void (const QString)> error_handler)
{
stop_capture();
// Begin the session
sampling_thread_ = std::thread(
- &SigSession::sample_thread_proc, this, device_,
+ &Session::sample_thread_proc, this, device_,
error_handler);
}
-void SigSession::stop_capture()
+void Session::stop_capture()
{
if (get_capture_state() != Stopped)
session_->stop();
sampling_thread_.join();
}
-set< shared_ptr<data::SignalData> > SigSession::get_data() const
+set< shared_ptr<data::SignalData> > Session::get_data() const
{
shared_lock<shared_mutex> lock(signals_mutex_);
set< shared_ptr<data::SignalData> > data;
return data;
}
-boost::shared_mutex& SigSession::signals_mutex() const
+boost::shared_mutex& Session::signals_mutex() const
{
return signals_mutex_;
}
-const vector< shared_ptr<view::Signal> >& SigSession::signals() const
+const vector< shared_ptr<view::Signal> >& Session::signals() const
{
return signals_;
}
#ifdef ENABLE_DECODE
-bool SigSession::add_decoder(srd_decoder *const dec)
+bool Session::add_decoder(srd_decoder *const dec)
{
map<const srd_channel*, shared_ptr<view::LogicSignal> > channels;
shared_ptr<data::DecoderStack> decoder_stack;
return true;
}
-vector< shared_ptr<view::DecodeTrace> > SigSession::get_decode_signals() const
+vector< shared_ptr<view::DecodeTrace> > Session::get_decode_signals() const
{
shared_lock<shared_mutex> lock(signals_mutex_);
return decode_traces_;
}
-void SigSession::remove_decode_signal(view::DecodeTrace *signal)
+void Session::remove_decode_signal(view::DecodeTrace *signal)
{
for (auto i = decode_traces_.begin(); i != decode_traces_.end(); i++)
if ((*i).get() == signal)
}
#endif
-void SigSession::set_capture_state(capture_state state)
+void Session::set_capture_state(capture_state state)
{
lock_guard<mutex> lock(sampling_mutex_);
const bool changed = capture_state_ != state;
capture_state_changed(state);
}
-void SigSession::update_signals(shared_ptr<Device> device)
+void Session::update_signals(shared_ptr<Device> device)
{
assert(device);
assert(capture_state_ == Stopped);
signals_changed();
}
-shared_ptr<view::Signal> SigSession::signal_from_channel(
+shared_ptr<view::Signal> Session::signal_from_channel(
shared_ptr<Channel> channel) const
{
lock_guard<boost::shared_mutex> lock(signals_mutex_);
return shared_ptr<view::Signal>();
}
-void SigSession::read_sample_rate(shared_ptr<Device> device)
+void Session::read_sample_rate(shared_ptr<Device> device)
{
const auto keys = device_->config_keys(ConfigKey::DEVICE_OPTIONS);
const auto iter = keys.find(ConfigKey::SAMPLERATE);
}
}
-void SigSession::sample_thread_proc(shared_ptr<Device> device,
+void Session::sample_thread_proc(shared_ptr<Device> device,
function<void (const QString)> error_handler)
{
assert(device);
}
}
-void SigSession::feed_in_header(shared_ptr<Device> device)
+void Session::feed_in_header(shared_ptr<Device> device)
{
read_sample_rate(device);
}
-void SigSession::feed_in_meta(shared_ptr<Device> device,
+void Session::feed_in_meta(shared_ptr<Device> device,
shared_ptr<Meta> meta)
{
(void)device;
signals_changed();
}
-void SigSession::feed_in_frame_begin()
+void Session::feed_in_frame_begin()
{
if (cur_logic_snapshot_ || !cur_analog_snapshots_.empty())
frame_began();
}
-void SigSession::feed_in_logic(shared_ptr<Logic> logic)
+void Session::feed_in_logic(shared_ptr<Logic> logic)
{
lock_guard<mutex> lock(data_mutex_);
data_received();
}
-void SigSession::feed_in_analog(shared_ptr<Analog> analog)
+void Session::feed_in_analog(shared_ptr<Analog> analog)
{
lock_guard<mutex> lock(data_mutex_);
data_received();
}
-void SigSession::data_feed_in(shared_ptr<Device> device, shared_ptr<Packet> packet)
+void Session::data_feed_in(shared_ptr<Device> device, shared_ptr<Packet> packet)
{
assert(device);
assert(packet);
class Signal;
}
-class SigSession : public QObject
+class Session : public QObject
{
Q_OBJECT
};
public:
- SigSession(DeviceManager &device_manager);
+ Session(DeviceManager &device_manager);
- ~SigSession();
+ ~Session();
DeviceManager& device_manager();
const size_t StoreSession::BlockSize = 1024 * 1024;
StoreSession::StoreSession(const std::string &file_name,
- const SigSession &session) :
+ const Session &session) :
file_name_(file_name),
session_(session),
interrupt_(false),
namespace pv {
-class SigSession;
+class Session;
namespace data {
class LogicSnapshot;
public:
StoreSession(const std::string &file_name,
- const SigSession &session);
+ const Session &session);
~StoreSession();
private:
const std::string file_name_;
- const SigSession &session_;
+ const Session &session_;
std::shared_ptr<sigrok::Output> output_;
const uint64_t SamplingBar::MaxSampleCount = 1000000000000ULL;
const uint64_t SamplingBar::DefaultSampleCount = 1000000;
-SamplingBar::SamplingBar(SigSession &session, MainWindow &main_window) :
+SamplingBar::SamplingBar(Session &session, MainWindow &main_window) :
QToolBar("Sampling Bar", &main_window),
session_(session),
main_window_(main_window),
sample_count_.show_min_max_step(0, UINT64_MAX, 1);
- set_capture_state(pv::SigSession::Stopped);
+ set_capture_state(pv::Session::Stopped);
configure_button_.setIcon(QIcon::fromTheme("configure",
QIcon(":/icons/configure.png")));
return device_selector_.itemData(index).value<shared_ptr<Device>>();
}
-void SamplingBar::set_capture_state(pv::SigSession::capture_state state)
+void SamplingBar::set_capture_state(pv::Session::capture_state state)
{
const QIcon *icons[] = {&icon_grey_, &icon_red_, &icon_green_};
run_stop_button_.setIcon(*icons[state]);
- run_stop_button_.setText((state == pv::SigSession::Stopped) ?
+ run_stop_button_.setText((state == pv::Session::Stopped) ?
tr("Run") : tr("Stop"));
run_stop_button_.setShortcut(QKeySequence(Qt::Key_Space));
}
namespace pv {
class MainWindow;
-class SigSession;
+class Session;
namespace toolbars {
static const uint64_t DefaultSampleCount;
public:
- SamplingBar(SigSession &session, pv::MainWindow &main_window);
+ SamplingBar(Session &session, pv::MainWindow &main_window);
void set_device_list(
const std::list< std::pair<std::shared_ptr<sigrok::Device>, std::string> > &devices,
std::shared_ptr<sigrok::Device> get_selected_device() const;
- void set_capture_state(pv::SigSession::capture_state state);
+ void set_capture_state(pv::Session::capture_state state);
Q_SIGNALS:
void run_stop();
bool eventFilter(QObject *watched, QEvent *event);
private:
- SigSession &session_;
+ Session &session_;
MainWindow &main_window_;
QComboBox device_selector_;
const float AnalogSignal::EnvelopeThreshold = 256.0f;
AnalogSignal::AnalogSignal(
- pv::SigSession &session,
+ pv::Session &session,
shared_ptr<Channel> channel,
shared_ptr<data::Analog> data) :
Signal(session, channel),
static const float EnvelopeThreshold;
public:
- AnalogSignal(pv::SigSession &session,
+ AnalogSignal(pv::Session &session,
std::shared_ptr<sigrok::Channel> channel,
std::shared_ptr<pv::data::Analog> data);
QColor(0x6B, 0x23, 0x37)
};
-DecodeTrace::DecodeTrace(pv::SigSession &session,
+DecodeTrace::DecodeTrace(pv::Session &session,
std::shared_ptr<pv::data::DecoderStack> decoder_stack, int index) :
Trace(QString::fromUtf8(
decoder_stack->stack().front()->decoder()->name)),
namespace pv {
-class SigSession;
+class Session;
namespace data {
class DecoderStack;
static const QColor OutlineColours[16];
public:
- DecodeTrace(pv::SigSession &session,
+ DecodeTrace(pv::Session &session,
std::shared_ptr<pv::data::DecoderStack> decoder_stack,
int index);
void on_show_hide_decoder(int index);
private:
- pv::SigSession &session_;
+ pv::Session &session_;
std::shared_ptr<pv::data::DecoderStack> decoder_stack_;
uint64_t decode_start_, decode_end_;
};
LogicSignal::LogicSignal(
- pv::SigSession &session,
+ pv::Session &session,
shared_ptr<Device> device,
shared_ptr<Channel> channel,
shared_ptr<data::Logic> data) :
static const QColor SignalColours[10];
public:
- LogicSignal(pv::SigSession &session,
+ LogicSignal(pv::Session &session,
std::shared_ptr<sigrok::Device> device,
std::shared_ptr<sigrok::Channel> channel,
std::shared_ptr<pv::data::Logic> data);
namespace pv {
-class SigSession;
+class Session;
namespace view {
/**
* Returns the session of the onwer.
*/
- virtual pv::SigSession& session() = 0;
+ virtual pv::Session& session() = 0;
/**
* Returns the session of the owner.
*/
- virtual const pv::SigSession& session() const = 0;
+ virtual const pv::Session& session() const = 0;
/**
* Returns the view of the owner.
"SCL"
};
-Signal::Signal(pv::SigSession &session,
+Signal::Signal(pv::Session &session,
std::shared_ptr<sigrok::Channel> channel) :
Trace(channel->name().c_str()),
session_(session),
namespace pv {
-class SigSession;
+class Session;
namespace data {
class SignalData;
Q_OBJECT
protected:
- Signal(pv::SigSession &session,
+ Signal(pv::Session &session,
std::shared_ptr<sigrok::Channel> channel);
public:
void on_disable();
protected:
- pv::SigSession &session_;
+ pv::Session &session_;
std::shared_ptr<sigrok::Channel> channel_;
QComboBox *name_widget_;
[](const shared_ptr<RowItem> &r) { return r->enabled(); });
}
-pv::SigSession& TraceGroup::session()
+pv::Session& TraceGroup::session()
{
assert(owner_);
return owner_->session();
}
-const pv::SigSession& TraceGroup::session() const
+const pv::Session& TraceGroup::session() const
{
assert(owner_);
return owner_->session();
/**
* Returns the session of the onwer.
*/
- pv::SigSession& session();
+ pv::Session& session();
/**
* Returns the session of the onwer.
*/
- const pv::SigSession& session() const;
+ const pv::Session& session() const;
/**
* Returns the view of the owner.
const QSizeF View::LabelPadding(4, 0);
-View::View(SigSession &session, QWidget *parent) :
+View::View(Session &session, QWidget *parent) :
QAbstractScrollArea(parent),
session_(session),
viewport_(new Viewport(*this)),
header_->raise();
}
-SigSession& View::session()
+Session& View::session()
{
return session_;
}
-const SigSession& View::session() const
+const Session& View::session() const
{
return session_;
}
namespace pv {
-class SigSession;
+class Session;
namespace view {
static const QSizeF LabelPadding;
public:
- explicit View(SigSession &session, QWidget *parent = 0);
+ explicit View(Session &session, QWidget *parent = 0);
- SigSession& session();
- const SigSession& session() const;
+ Session& session();
+ const Session& session() const;
/**
* Returns the view of the owner.
void on_hover_point_changed();
private:
- SigSession &session_;
+ Session &session_;
Viewport *viewport_;
Ruler *ruler_;
class QPainter;
class QPaintEvent;
-class SigSession;
+class Session;
namespace pv {
namespace view {
{
pv::DeviceManager dm(ctx);
- pv::SigSession ss(dm);
+ pv::Session ss(dm);
const GSList *l = srd_decoder_list();
BOOST_REQUIRE(l);