X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdevicemanager.h;h=891ba3d2c1ac28a254917a7da49def32828779d2;hp=070c3cc7d94ef202e52968333d3ec608589768bc;hb=e183f4e328db8bb134652254ba9bf0707dc16c66;hpb=107ca6d350b51186d12dac9273f6ed130b3f5dd7 diff --git a/pv/devicemanager.h b/pv/devicemanager.h index 070c3cc7..891ba3d2 100644 --- a/pv/devicemanager.h +++ b/pv/devicemanager.h @@ -24,13 +24,19 @@ #include #include +#include +#include + +#include struct sr_context; struct sr_dev_driver; -struct sr_dev_inst; namespace pv { +class DevInst; +class SigSession; + class DeviceManager { public: @@ -38,25 +44,34 @@ 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); 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