#pragma once #include class ILaser { public: virtual ~ILaser() = default; public: virtual bool init() = 0; virtual bool setEnabled(bool enabled) = 0; virtual bool setLaserLevel(std::size_t level) = 0; public: bool enable() { return setEnabled(true); } bool disable() { return setEnabled(false); } }; class PwmLaser : public ILaser { public: explicit PwmLaser(const std::string& pwmChip, const std::string& pwm); ~PwmLaser() override = default; // ILaser public: bool init() override; private: std::string m_pwmChip; std::string m_pwm; };