- _sampling_thread.reset(new boost::thread(
- &SigSession::load_input_thread_proc, this,
- name, in, error_handler));
- }
+ device_selected();
+}
+
+void Session::set_file(const string &name)
+{
+ session_ = device_manager_.context()->load_session(name);
+ device_ = session_->devices()[0];
+ decode_traces_.clear();
+ session_->add_datafeed_callback([=]
+ (shared_ptr<Device> device, shared_ptr<Packet> packet) {
+ data_feed_in(device, packet);
+ });
+ device_manager_.update_display_name(device_);
+ update_signals(device_);
+ device_selected();
+}
+
+void Session::set_default_device()
+{
+ shared_ptr<HardwareDevice> default_device;
+ const list< shared_ptr<HardwareDevice> > &devices =
+ device_manager_.devices();
+
+ if (!devices.empty()) {
+ // Fall back to the first device in the list.
+ default_device = devices.front();
+
+ // Try and find the demo device and select that by default
+ for (shared_ptr<HardwareDevice> dev : devices)
+ if (dev->driver()->name().compare("demo") == 0) {
+ default_device = dev;
+ break;
+ }