X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fdialogs%2Fconnect.cpp;h=4d33cc9f3b6d1d2e1ebbc798147f53e307d80744;hb=7bb0fbf4d3809dbbd0fe5b35fc7e475b1065ae20;hp=e5cc3dd70c088c9ad698229aaac3d3da26e8d9a1;hpb=fe3a1c218407f6b8a0d7ac7c454593809212ea9e;p=pulseview.git diff --git a/pv/dialogs/connect.cpp b/pv/dialogs/connect.cpp index e5cc3dd..4d33cc9 100644 --- a/pv/dialogs/connect.cpp +++ b/pv/dialogs/connect.cpp @@ -24,7 +24,8 @@ #include "connect.hpp" -#include "pv/devicemanager.hpp" +#include +#include using std::list; using std::map; @@ -38,7 +39,8 @@ using Glib::VariantBase; using sigrok::ConfigKey; using sigrok::Driver; using sigrok::Error; -using sigrok::HardwareDevice; + +using pv::devices::HardwareDevice; namespace pv { namespace dialogs { @@ -104,10 +106,10 @@ void Connect::populate_drivers() * @todo Add support for non-monotonic devices i.e. DMMs * and sensors. */ - bool supported_device = driver->config_check( - ConfigKey::LOGIC_ANALYZER, ConfigKey::DEVICE_OPTIONS) | - driver->config_check( - ConfigKey::OSCILLOSCOPE, ConfigKey::DEVICE_OPTIONS); + const auto keys = driver->config_keys(); + + bool supported_device = keys.count(ConfigKey::LOGIC_ANALYZER) | + keys.count(ConfigKey::OSCILLOSCOPE); if (supported_device) drivers_.addItem(QString("%1 (%2)").arg( @@ -167,16 +169,16 @@ void Connect::scan_pressed() serial.toUtf8().constData()); } - list< shared_ptr > devices = + const list< shared_ptr > devices = device_manager_.driver_scan(driver, drvopts); - for (shared_ptr device : devices) - { + for (shared_ptr device : devices) { assert(device); QString text = QString::fromStdString( - device_manager_.get_display_name(device)); - text += QString(" with %1 channels").arg(device->channels().size()); + device->display_name(device_manager_)); + text += QString(" with %1 channels").arg( + device->device()->channels().size()); QListWidgetItem *const item = new QListWidgetItem(text, &device_list_); @@ -195,7 +197,7 @@ void Connect::device_selected(int index) unset_connection(); - if (driver->config_check(ConfigKey::SERIALCOMM, ConfigKey::SCAN_OPTIONS)) + if (driver->scan_options().count(ConfigKey::SERIALCOMM)) set_serial_connection(driver); }