X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fdevicemanager.h;h=3ed74e078f2baa3234b9807eb6d62e4e2af6f7ac;hb=921b90c0b3ae0cf44247da3d87bd7dc0612e9681;hp=f4be73b9274565e93832becba4e01985a54dece0;hpb=dd63af740355865cc0659dfba74ecf4445414bc8;p=pulseview.git diff --git a/pv/devicemanager.h b/pv/devicemanager.h index f4be73b9..3ed74e07 100644 --- a/pv/devicemanager.h +++ b/pv/devicemanager.h @@ -24,14 +24,22 @@ #include #include +#include #include +#include + struct sr_context; struct sr_dev_driver; -struct sr_dev_inst; namespace pv { +class SigSession; + +namespace device { +class DevInst; +} + class DeviceManager { public: @@ -39,27 +47,35 @@ public: ~DeviceManager(); - const std::list& devices() const; + const std::list< boost::shared_ptr >& + devices() const; + + void use_device(boost::shared_ptr dev_inst, + SigSession *owner); - std::list driver_scan( + void release_device(boost::shared_ptr dev_inst); + + std::list< boost::shared_ptr > driver_scan( struct sr_dev_driver *const driver, GSList *const drvopts = NULL); - static std::string format_device_title(const sr_dev_inst *const sdi); - private: void init_drivers(); - static void release_devices(); + void release_devices(); void scan_all_drivers(); - static bool compare_devices(const sr_dev_inst *const a, - const sr_dev_inst *const b); + void release_driver(struct sr_dev_driver *const driver); + + static bool compare_devices(boost::shared_ptr a, + boost::shared_ptr b); private: struct sr_context *const _sr_ctx; - std::list _devices; + std::list< boost::shared_ptr > _devices; + std::map< boost::shared_ptr, pv::SigSession*> + _used_devices; }; } // namespace pv