diff options
author | Jacopo Mondi <jacopo.mondi@ideasonboard.com> | 2023-08-08 13:13:17 +0200 |
---|---|---|
committer | Jacopo Mondi <jacopo.mondi@ideasonboard.com> | 2023-08-08 14:34:28 +0200 |
commit | 2855c178b0457405f3b8bb6dfa4c7ebd0450b652 (patch) | |
tree | c69b26f3d984bf2f6cc0774f72d6acbd7ddae6e2 /include | |
parent | 59fde8be87724184c89dee112499b4921caa82c6 (diff) |
libcamera: device_match: Introduce USBDeviceMatch
Introduce a USB-specific DeviceMatch derived class.
Generalize the DeviceMatch::match() function by making its only
parameter a CameraDevice instance and dynamically cast to the correct
derived class in the overloaded match() functions.
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/libcamera/internal/device_match.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/include/libcamera/internal/device_match.h b/include/libcamera/internal/device_match.h index 6df7dece..e6608cac 100644 --- a/include/libcamera/internal/device_match.h +++ b/include/libcamera/internal/device_match.h @@ -12,12 +12,12 @@ namespace libcamera { -class MediaDevice; +class CameraDevice; class DeviceMatch { public: - virtual bool match(const MediaDevice *device) const = 0; + virtual bool match(const CameraDevice *device) const = 0; }; class MediaDeviceMatch : public DeviceMatch @@ -26,11 +26,26 @@ public: void add(const std::string &entity); MediaDeviceMatch(const std::string &driver); - bool match(const MediaDevice *device) const override; + bool match(const CameraDevice *device) const override; private: std::string driver_; std::vector<std::string> entities_; }; +class USBDeviceMatch : public DeviceMatch +{ +public: + USBDeviceMatch(const std::string &vid, const std::string &pid) + : vid_(vid), pid_(pid) + { + } + + bool match(const CameraDevice *device) const override; + +private: + std::string vid_; + std::string pid_; +}; + }; /* namespace libcamera */ |