]> sigrok.org Git - pulseview.git/blobdiff - pv/devicemanager.h
SigSession: Replaced do { } while(0) with { }
[pulseview.git] / pv / devicemanager.h
index 891ba3d2c1ac28a254917a7da49def32828779d2..511ba76091083679bdf96b021a6c4f312e12b5a2 100644 (file)
 #ifndef PULSEVIEW_PV_DEVICEMANAGER_H
 #define PULSEVIEW_PV_DEVICEMANAGER_H
 
-#include <glib.h>
-
 #include <list>
 #include <map>
+#include <memory>
 #include <string>
 
-#include <boost/shared_ptr.hpp>
+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 DevInst;
 class SigSession;
 
 class DeviceManager
 {
 public:
-       DeviceManager(struct sr_context *sr_ctx);
+       DeviceManager(std::shared_ptr<sigrok::Context> context);
 
        ~DeviceManager();
 
-       const std::list< boost::shared_ptr<pv::DevInst> >& devices() const;
-
-       void use_device(boost::shared_ptr<pv::DevInst> dev_inst,
-               SigSession *owner);
+       std::shared_ptr<sigrok::Context> context();
 
-       void release_device(boost::shared_ptr<pv::DevInst> dev_inst);
+       const std::list< std::shared_ptr<sigrok::HardwareDevice> >&
+               devices() const;
 
-       std::list< boost::shared_ptr<DevInst> > driver_scan(
-               struct sr_dev_driver *const driver,
-               GSList *const drvopts = NULL);
+       std::list< std::shared_ptr<sigrok::HardwareDevice> > driver_scan(
+               std::shared_ptr<sigrok::Driver> driver,
+               std::map<const sigrok::ConfigKey *, Glib::VariantBase> drvopts);
 
-private:
-       void init_drivers();
+       const std::map<std::string, std::string> get_device_info(
+               const std::shared_ptr<sigrok::Device> device);
 
-       void release_devices();
+       const std::shared_ptr<sigrok::HardwareDevice> find_device_from_info(
+               const std::map<std::string, std::string> search_info);
 
-       void scan_all_drivers();
+       const std::string build_display_name(std::shared_ptr<sigrok::Device> device);
 
-       void release_driver(struct sr_dev_driver *const driver);
+       const std::string get_display_name(std::shared_ptr<sigrok::Device> dev);
 
-       static bool compare_devices(boost::shared_ptr<DevInst> a,
-               boost::shared_ptr<DevInst> b);
+       void update_display_name(std::shared_ptr<sigrok::Device> dev);
 
 private:
-       struct sr_context *const _sr_ctx;
-       std::list< boost::shared_ptr<pv::DevInst> > _devices;
-       std::map< boost::shared_ptr<pv::DevInst>, pv::SigSession*>
-               _used_devices;
+       bool compare_devices(std::shared_ptr<sigrok::Device> a,
+               std::shared_ptr<sigrok::Device> b);
+
+protected:
+       std::shared_ptr<sigrok::Context> _context;
+       std::list< std::shared_ptr<sigrok::HardwareDevice> > _devices;
+       std::map< std::shared_ptr<sigrok::Device>, std::string > _display_names;
 };
 
 } // namespace pv