#ifndef BUZZERCONN_H #define BUZZERCONN_H #include #include #include #include #include #include #include #include typedef struct strReturnData{ int status_code; QString text; }ReturnData_t; class BuzzerConn : public QObject { Q_OBJECT public: explicit BuzzerConn(QObject *parent = nullptr); double offset; QList latest_offsets; double latest_button_pressed; double starttime; bool connected; int connection_progress; QString buzz_url; private: QNetworkAccessManager *networkManager; QNetworkAccessManager *reloadNetworkManager; QDateTime *date; signals: public slots: ReturnData_t senddata(QNetworkAccessManager * NetMan, QUrl serviceUrl, int timeout); //function to communicate with the buzzer Q_INVOKABLE QList gettimes(int timeout); //function to get the times from the buzzer as a list with the normal network manager Q_INVOKABLE bool connect(); //function to connect to buzzer Q_INVOKABLE bool calcoffset(QList times); //function that calculates the average time offset between the buzzer and the device Q_INVOKABLE bool buzzer_triggered(); //function that checks ih the buzzer has been pushed since the last call of this function Q_INVOKABLE bool start(); //syncs the buzzer and the base to make a start possible Q_INVOKABLE double get(QString key); //can return some things (offset, lastpressed, currtime, connection_progress, connected) Q_INVOKABLE QString test(); Q_INVOKABLE bool refresh(); //refreshed the connection to the buzzer }; #endif // BUZZERCONN_H