]> sigrok.org Git - pulseview.git/blobdiff - pv/devicemanager.hpp
AnalogSignal: Use setting change handler for threshold display
[pulseview.git] / pv / devicemanager.hpp
index 823cb2bc9542ee8632690be4780db421a8bcc1de..2c9343001211409e8e836d95c9d5d623417ebcd2 100644 (file)
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef PULSEVIEW_PV_DEVICEMANAGER_H
-#define PULSEVIEW_PV_DEVICEMANAGER_H
+#ifndef PULSEVIEW_PV_DEVICEMANAGER_HPP
+#define PULSEVIEW_PV_DEVICEMANAGER_HPP
 
 #include <list>
 #include <map>
 #include <memory>
+#include <set>
 #include <string>
+#include <vector>
+
+using std::list;
+using std::map;
+using std::set;
+using std::shared_ptr;
+using std::string;
+using std::vector;
 
 namespace Glib {
-       class VariantBase;
+class VariantBase;
 }
 
 namespace sigrok {
-       class ConfigKey;
-       class Context;
-       class Driver;
-       class Device;
-       class HardwareDevice;
+class ConfigKey;
+class Context;
+class Driver;
 }
 
+using sigrok::ConfigKey;
+
 namespace pv {
 
-class SigSession;
+namespace devices {
+class Device;
+class HardwareDevice;
+}
+
+class Session;
 
 class DeviceManager
 {
 public:
-       DeviceManager(std::shared_ptr<sigrok::Context> context);
+       DeviceManager(shared_ptr<sigrok::Context> context, std::string driver);
 
-       ~DeviceManager();
+       ~DeviceManager() = default;
 
-       std::shared_ptr<sigrok::Context> context();
+       const shared_ptr<sigrok::Context>& context() const;
 
-       const std::list< std::shared_ptr<sigrok::HardwareDevice> >&
-               devices() const;
+       shared_ptr<sigrok::Context> context();
 
-       std::list< std::shared_ptr<sigrok::HardwareDevice> > driver_scan(
-               std::shared_ptr<sigrok::Driver> driver,
-               std::map<const sigrok::ConfigKey *, Glib::VariantBase> drvopts);
+       const list< shared_ptr<devices::HardwareDevice> >& devices() const;
+       shared_ptr<devices::HardwareDevice> user_spec_device() const;
 
-       const std::map<std::string, std::string> get_device_info(
-               const std::shared_ptr<sigrok::Device> device);
+       list< shared_ptr<devices::HardwareDevice> > driver_scan(
+               shared_ptr<sigrok::Driver> driver,
+               map<const sigrok::ConfigKey *, Glib::VariantBase> drvopts);
 
-       const std::shared_ptr<sigrok::HardwareDevice> find_device_from_info(
-               const std::map<std::string, std::string> search_info);
+       const map<string, string> get_device_info(
+               const shared_ptr<devices::Device> device);
 
-       const std::string build_display_name(std::shared_ptr<sigrok::Device> device);
-
-       const std::string get_display_name(std::shared_ptr<sigrok::Device> dev);
-
-       void update_display_name(std::shared_ptr<sigrok::Device> dev);
+       const shared_ptr<devices::HardwareDevice> find_device_from_info(
+               const map<string, string> search_info);
 
 private:
-       bool compare_devices(std::shared_ptr<sigrok::Device> a,
-               std::shared_ptr<sigrok::Device> b);
+       bool compare_devices(shared_ptr<devices::Device> a,
+               shared_ptr<devices::Device> b);
+
+       static map<const ConfigKey *, Glib::VariantBase>
+       drive_scan_options(vector<string> user_spec,
+               set<const ConfigKey *> driver_opts);
 
 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_;
+       shared_ptr<sigrok::Context> context_;
+       list< shared_ptr<devices::HardwareDevice> > devices_;
+       shared_ptr<devices::HardwareDevice> user_spec_device_;
 };
 
 } // namespace pv
 
-#endif // PULSEVIEW_PV_DEVICEMANAGER_H
+#endif // PULSEVIEW_PV_DEVICEMANAGER_HPP