Files
checker_host/base/beep.h

46 lines
669 B
C
Raw Normal View History

#ifndef BEEP_H
#define BEEP_H
#include <QFile>
#include <QDebug>
#include <QObject>
#include <QThread>
#include <QMutexLocker>
#include <QMutex>
class beep : public QObject
{
Q_OBJECT
public:
explicit beep(QObject *parent = nullptr);
bool stop();
void start();
// 用户程序调用这个函数开启蜂鸣器
void set_beep(int delay_on_ms,int delay_off_ms,int ticks);
bool set_state(bool state);
private:
bool get_state();
private:
bool is_run;
bool state;
int delay_on_ms;
int delay_off_ms;
int ticks;
QMutex lock;
QFile file;
private slots:
void run_cb();
};
beep *Beep();
#endif // BEEP_H