]> sigrok.org Git - pulseview.git/blobdiff - pv/devicemanager.h
Use libsigrok C++ bindings (patch version 7).
[pulseview.git] / pv / devicemanager.h
index 0a8f2e0dca7d24fedb53cf7b734d321320ff180a..0a47a35a004659b09da56ce7545135159a448939 100644 (file)
 #ifndef PULSEVIEW_PV_DEVICEMANAGER_H
 #define PULSEVIEW_PV_DEVICEMANAGER_H
 
-#include <glib.h>
-
 #include <list>
 #include <map>
 #include <memory>
 #include <string>
 
-struct sr_context;
-struct sr_dev_driver;
+namespace Glib {
+       class VariantBase;
+}
+
+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<sigrok::Context> context);
 
        ~DeviceManager();
 
-       const std::list< std::shared_ptr<pv::device::Device> >&
-               devices() const;
-
-       std::list< std::shared_ptr<pv::device::Device> > driver_scan(
-               struct sr_dev_driver *const driver,
-               GSList *const drvopts = NULL);
-
-       const std::shared_ptr<device::Device> find_device_from_info(
-               const std::map<std::string, std::string> search_info);
+       std::shared_ptr<sigrok::Context> context();
 
-private:
-       void init_drivers();
+       const std::list< std::shared_ptr<sigrok::HardwareDevice> >&
+               devices() const;
 
-       void release_devices();
+       std::list< std::shared_ptr<sigrok::HardwareDevice> > driver_scan(
+               std::shared_ptr<sigrok::Driver> driver,
+               std::map<const sigrok::ConfigKey *, Glib::VariantBase> drvopts);
 
-       void scan_all_drivers();
+       const std::map<std::string, std::string> get_device_info(
+               const std::shared_ptr<sigrok::Device> device);
 
-       void release_driver(struct sr_dev_driver *const driver);
+       const std::shared_ptr<sigrok::HardwareDevice> find_device_from_info(
+               const std::map<std::string, std::string> search_info);
 
-       static bool compare_devices(std::shared_ptr<device::Device> a,
-               std::shared_ptr<device::Device> b);
+       static std::string device_description(std::shared_ptr<sigrok::Device> device);
 
 private:
-       struct sr_context *const _sr_ctx;
-       std::list< std::shared_ptr<pv::device::Device> > _devices;
+       static bool compare_devices(std::shared_ptr<sigrok::HardwareDevice> a,
+               std::shared_ptr<sigrok::HardwareDevice> b);
+
+protected:
+       std::shared_ptr<sigrok::Context> _context;
+       std::list< std::shared_ptr<sigrok::HardwareDevice> > _devices;
 };
 
 } // namespace pv