Files
checker_host/base/beep.h
ranchuan cc5b1b7458 广播命令已接收的回复不再触发回调
检测命令0x0c只能使用单播方式,广播方式因为不能即时回复停止信号,回复会出错
  添加电阻测试命令,添加自检命令
2023-12-13 18:29:46 +08:00

46 lines
669 B
C++

#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);
private:
bool get_state();
bool set_state(bool 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