projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Session: Removed device parameter from update_signals
[pulseview.git]
/
pv
/
session.cpp
diff --git
a/pv/session.cpp
b/pv/session.cpp
index d5126660f56b140d2337d64b1df625a4ea44b148..dd78f4a176088ebb69cc5089558b4d310a7d4415 100644
(file)
--- a/
pv/session.cpp
+++ b/
pv/session.cpp
@@
-133,7
+133,7
@@
void Session::set_device(shared_ptr<devices::Device> device)
(shared_ptr<sigrok::Device> device, shared_ptr<Packet> packet) {
data_feed_in(device, packet);
});
(shared_ptr<sigrok::Device> device, shared_ptr<Packet> packet) {
data_feed_in(device, packet);
});
- update_signals(
device_
);
+ update_signals();
decode_traces_.clear();
decode_traces_.clear();
@@
-301,13
+301,20
@@
void Session::set_capture_state(capture_state state)
capture_state_changed(state);
}
capture_state_changed(state);
}
-void Session::update_signals(
shared_ptr<devices::Device> device
)
+void Session::update_signals()
{
{
- assert(device);
+ assert(device
_
);
assert(capture_state_ == Stopped);
assert(capture_state_ == Stopped);
+ const shared_ptr<sigrok::Device> sr_dev = device_->device();
+ if (!sr_dev) {
+ signals_.clear();
+ logic_data_.reset();
+ return;
+ }
+
// Detect what data types we will receive
// Detect what data types we will receive
- auto channels =
device->device()
->channels();
+ auto channels =
sr_dev
->channels();
unsigned int logic_channel_count = std::count_if(
channels.begin(), channels.end(),
[] (shared_ptr<Channel> channel) {
unsigned int logic_channel_count = std::count_if(
channels.begin(), channels.end(),
[] (shared_ptr<Channel> channel) {
@@
-334,7
+341,7
@@
void Session::update_signals(shared_ptr<devices::Device> device)
unordered_set< shared_ptr<view::Signal> > prev_sigs(signals_);
signals_.clear();
unordered_set< shared_ptr<view::Signal> > prev_sigs(signals_);
signals_.clear();
- for (auto channel :
device->device()
->channels()) {
+ for (auto channel :
sr_dev
->channels()) {
shared_ptr<view::Signal> signal;
// Find the channel in the old signals
shared_ptr<view::Signal> signal;
// Find the channel in the old signals
@@
-357,7
+364,7
@@
void Session::update_signals(shared_ptr<devices::Device> device)
case SR_CHANNEL_LOGIC:
signal = shared_ptr<view::Signal>(
new view::LogicSignal(*this,
case SR_CHANNEL_LOGIC:
signal = shared_ptr<view::Signal>(
new view::LogicSignal(*this,
- device, channel,
+ device
_
, channel,
logic_data_));
break;
logic_data_));
break;
@@
-400,7
+407,12
@@
shared_ptr<view::Signal> Session::signal_from_channel(
void Session::read_sample_rate(shared_ptr<sigrok::Device> device)
{
assert(device);
void Session::read_sample_rate(shared_ptr<sigrok::Device> device)
{
assert(device);
- const auto keys = device->config_keys(ConfigKey::DEVICE_OPTIONS);
+ map< const ConfigKey*, set<sigrok::Capability> > keys;
+
+ try {
+ keys = device->config_keys(ConfigKey::DEVICE_OPTIONS);
+ } catch (const Error) {}
+
const auto iter = keys.find(ConfigKey::SAMPLERATE);
cur_samplerate_ = (iter != keys.end() &&
(*iter).second.find(sigrok::GET) != (*iter).second.end()) ?
const auto iter = keys.find(ConfigKey::SAMPLERATE);
cur_samplerate_ = (iter != keys.end() &&
(*iter).second.find(sigrok::GET) != (*iter).second.end()) ?