]> sigrok.org Git - pulseview.git/blobdiff - pv/devicemanager.h
pv::DeviceManager now manages opening/closing devices
[pulseview.git] / pv / devicemanager.h
index f4be73b9274565e93832becba4e01985a54dece0..b7f2d49a7e016ce49e6b66dc0124b17b1779dbb3 100644 (file)
@@ -24,6 +24,7 @@
 #include <glib.h>
 
 #include <list>
+#include <map>
 #include <string>
 
 struct sr_context;
@@ -32,6 +33,8 @@ struct sr_dev_inst;
 
 namespace pv {
 
+class SigSession;
+
 class DeviceManager
 {
 public:
@@ -41,6 +44,10 @@ public:
 
        const std::list<sr_dev_inst*>& devices() const;
 
+       void use_device(sr_dev_inst *sdi, SigSession *owner);
+
+       void release_device(sr_dev_inst *sdi);
+
        std::list<sr_dev_inst*> driver_scan(
                struct sr_dev_driver *const driver,
                GSList *const drvopts = NULL);
@@ -50,16 +57,19 @@ public:
 private:
        void init_drivers();
 
-       static void release_devices();
+       void release_devices();
 
        void scan_all_drivers();
 
+       void release_driver(struct sr_dev_driver *const driver);
+
        static bool compare_devices(const sr_dev_inst *const a,
                const sr_dev_inst *const b);
 
 private:
        struct sr_context *const _sr_ctx;
        std::list<sr_dev_inst*> _devices;
+       std::map<sr_dev_inst*, pv::SigSession*> _used_devices;
 };
 
 } // namespace pv