summaryrefslogtreecommitdiff
path: root/src/laser.h
blob: 31fe7e306068b592da9fc77faba21af26b2a7b30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#pragma once

#include <string>

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;
};