X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fdevicemanager.h;h=511ba76091083679bdf96b021a6c4f312e12b5a2;hb=06149d431d48726903ace7216c20f3a8d110cdf8;hp=2ce523dc6251d424921bba5a696a2fbcdcd100bd;hpb=85843b14c48affe67820ec8c9e357cd26e0ed943;p=pulseview.git diff --git a/pv/devicemanager.h b/pv/devicemanager.h index 2ce523dc..511ba760 100644 --- a/pv/devicemanager.h +++ b/pv/devicemanager.h @@ -21,61 +21,63 @@ #ifndef PULSEVIEW_PV_DEVICEMANAGER_H #define PULSEVIEW_PV_DEVICEMANAGER_H -#include - #include #include +#include #include -#include +namespace Glib { + class VariantBase; +} -struct sr_context; -struct sr_dev_driver; +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< boost::shared_ptr >& - devices() const; + std::shared_ptr context(); - void use_device(boost::shared_ptr dev_inst, - SigSession *owner); + const std::list< std::shared_ptr >& + devices() const; - void release_device(boost::shared_ptr dev_inst); + std::list< std::shared_ptr > driver_scan( + std::shared_ptr driver, + std::map drvopts); - std::list< boost::shared_ptr > driver_scan( - struct sr_dev_driver *const driver, - GSList *const drvopts = NULL); + const std::map get_device_info( + const std::shared_ptr device); -private: - void init_drivers(); + const std::shared_ptr find_device_from_info( + const std::map search_info); - void release_devices(); + const std::string build_display_name(std::shared_ptr device); - void scan_all_drivers(); + const std::string get_display_name(std::shared_ptr dev); - void release_driver(struct sr_dev_driver *const driver); - - static bool compare_devices(boost::shared_ptr a, - boost::shared_ptr b); + void update_display_name(std::shared_ptr dev); private: - struct sr_context *const _sr_ctx; - std::list< boost::shared_ptr > _devices; - std::map< boost::shared_ptr, pv::SigSession*> - _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