Http Version - Added Alarm Button.
This commit is contained in:
parent
99bc9209af
commit
07bd73bb33
1 changed files with 163 additions and 25 deletions
|
|
@ -6,6 +6,8 @@
|
|||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
#include <QMediaPlayer>
|
||||
#include <QAudioOutput>
|
||||
#include <QTimer>
|
||||
#include <QThread>
|
||||
#include <chrono>
|
||||
|
|
@ -24,10 +26,14 @@ class RequestWorker : public QObject
|
|||
int min_height = 0;
|
||||
bool stop_timer = false;
|
||||
int reply_number = 0;
|
||||
int alarm_thres = 0;
|
||||
bool enable_alarm = false;
|
||||
bool player_started = false;
|
||||
QMediaPlayer *player = nullptr;
|
||||
QAudioOutput *audioOutput = nullptr;
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> prev_time;
|
||||
public:
|
||||
explicit RequestWorker(QObject *parent = nullptr);
|
||||
|
||||
QString status() const;
|
||||
void setStatus(const QString &newStatus);
|
||||
|
||||
|
|
@ -35,12 +41,15 @@ signals:
|
|||
void requestFailed();
|
||||
void networkReply(int distance, float rate_of_fill, int expected_to_fill);
|
||||
void statusChanged();
|
||||
|
||||
void playMedia();
|
||||
public slots:
|
||||
void startAlarm();
|
||||
void stopAlarm();
|
||||
void setConfig(QJsonObject config);
|
||||
void start();
|
||||
void stop();
|
||||
private slots:
|
||||
void playAlarm();
|
||||
void makeRequest();
|
||||
void requestFinished(QNetworkReply *rep);
|
||||
private:
|
||||
|
|
|
|||
Loading…
Reference in a new issue