X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fdevicemanager.h;h=511ba76091083679bdf96b021a6c4f312e12b5a2;hb=de0b46dec23da226e277638c75d8b65290f9167c;hp=b7f2d49a7e016ce49e6b66dc0124b17b1779dbb3;hpb=dc0867ff7ec693953afb62f9512ad7dd3339a2b2;p=pulseview.git diff --git a/pv/devicemanager.h b/pv/devicemanager.h index b7f2d49a..511ba760 100644 --- a/pv/devicemanager.h +++ b/pv/devicemanager.h @@ -21,15 +21,22 @@ #ifndef PULSEVIEW_PV_DEVICEMANAGER_H #define PULSEVIEW_PV_DEVICEMANAGER_H -#include - #include #include +#include #include -struct sr_context; -struct sr_dev_driver; -struct sr_dev_inst; +namespace Glib { + class VariantBase; +} + +namespace sigrok { + class ConfigKey; + class Context; + class Driver; + class Device; + class HardwareDevice; +} namespace pv { @@ -38,38 +45,39 @@ class SigSession; class DeviceManager { public: - DeviceManager(struct sr_context *sr_ctx); + DeviceManager(std::shared_ptr context); ~DeviceManager(); - const std::list& devices() const; - - void use_device(sr_dev_inst *sdi, SigSession *owner); + std::shared_ptr context(); - void release_device(sr_dev_inst *sdi); + const std::list< std::shared_ptr >& + devices() const; - std::list 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); - static std::string format_device_title(const sr_dev_inst *const sdi); + const std::map get_device_info( + const std::shared_ptr device); -private: - void init_drivers(); - - 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(const sr_dev_inst *const a, - const sr_dev_inst *const b); + void update_display_name(std::shared_ptr dev); private: - struct sr_context *const _sr_ctx; - std::list _devices; - std::map _used_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