X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fdevicemanager.h;h=511ba76091083679bdf96b021a6c4f312e12b5a2;hb=4cb0b03353200f6747723e54a5a0e7e57e0ae096;hp=ca86a7fe9c15c69f727ccbf3b04711a8650e8250;hpb=f9abf97e78bc4825d80926b0ebc6cbaef40768b1;p=pulseview.git diff --git a/pv/devicemanager.h b/pv/devicemanager.h index ca86a7fe..511ba760 100644 --- a/pv/devicemanager.h +++ b/pv/devicemanager.h @@ -21,52 +21,63 @@ #ifndef PULSEVIEW_PV_DEVICEMANAGER_H #define PULSEVIEW_PV_DEVICEMANAGER_H -#include - #include +#include #include #include -struct sr_context; -struct sr_dev_driver; +namespace Glib { + class VariantBase; +} + +namespace sigrok { + class ConfigKey; + class Context; + class Driver; + class Device; + class HardwareDevice; +} namespace pv { class SigSession; -namespace device { -class Device; -} - class DeviceManager { public: - DeviceManager(struct sr_context *sr_ctx); + DeviceManager(std::shared_ptr context); ~DeviceManager(); - const std::list< std::shared_ptr >& + std::shared_ptr context(); + + const std::list< std::shared_ptr >& devices() const; - std::list< std::shared_ptr > driver_scan( - struct sr_dev_driver *const driver, - GSList *const drvopts = NULL); + std::list< std::shared_ptr > driver_scan( + std::shared_ptr driver, + std::map drvopts); -private: - void init_drivers(); + const std::map get_device_info( + const std::shared_ptr device); - void release_devices(); + const std::shared_ptr find_device_from_info( + const std::map search_info); - void scan_all_drivers(); + const std::string build_display_name(std::shared_ptr device); - void release_driver(struct sr_dev_driver *const driver); + const std::string get_display_name(std::shared_ptr dev); - static bool compare_devices(std::shared_ptr a, - std::shared_ptr b); + void update_display_name(std::shared_ptr dev); private: - struct sr_context *const _sr_ctx; - std::list< std::shared_ptr > _devices; + bool compare_devices(std::shared_ptr a, + std::shared_ptr b); + +protected: + std::shared_ptr _context; + std::list< std::shared_ptr > _devices; + std::map< std::shared_ptr, std::string > _display_names; }; } // namespace pv