Proxmark3GUI/common/util.h

46 lines
910 B
C
Raw Normal View History

2020-04-22 16:42:58 +08:00
#ifndef UTIL_H
2020-04-22 16:00:56 +08:00
#define UTIL_H
#include <QObject>
2020-04-22 21:14:33 +08:00
#include <QString>
#include <QDebug>
#include <QThread>
#include <QApplication>
#include <QTime>
#include <QTimer>
2020-08-05 19:08:02 +08:00
#include <QMetaType>
2020-04-22 16:00:56 +08:00
class Util : public QObject
{
Q_OBJECT
public:
2020-08-01 21:30:55 +08:00
enum ClientType
{
2020-08-05 19:08:02 +08:00
CLIENTTYPE_OFFICIAL,
CLIENTTYPE_ICEMAN,
2020-08-01 21:30:55 +08:00
};
2020-08-05 19:08:02 +08:00
Q_ENUM(Util::ClientType)
explicit Util(QObject *parent = nullptr);
2020-04-22 16:00:56 +08:00
2020-04-22 21:14:33 +08:00
void execCMD(QString cmd);
QString execCMDWithOutput(QString cmd, unsigned long waitTime = 2000);
2020-04-22 21:14:33 +08:00
void delay(unsigned int msec);
2020-08-01 21:30:55 +08:00
ClientType getClientType();
2020-04-22 21:14:33 +08:00
public slots:
void processOutput(QString output);
2020-08-05 19:08:02 +08:00
void setClientType(Util::ClientType clientType);
2020-04-22 16:00:56 +08:00
2020-04-22 21:14:33 +08:00
private:
bool isRequiringOutput;
QString* requiredOutput;
QTime timeStamp;
2020-08-01 21:48:59 +08:00
ClientType clientType;
2020-04-22 21:14:33 +08:00
signals:
void refreshOutput(const QString& output);
void write(QString data);
2020-04-22 16:00:56 +08:00
};
#endif // UTIL_H