(shared_ptr<sigrok::Device> device, shared_ptr<Packet> packet) {
data_feed_in(device, packet);
});
- update_signals(device_);
+ update_signals();
decode_traces_.clear();
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);
+ 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
- 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) {
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
case SR_CHANNEL_LOGIC:
signal = shared_ptr<view::Signal>(
new view::LogicSignal(*this,
- device, channel,
+ device_, channel,
logic_data_));
break;
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()) ?