mirror of
https://github.com/wh201906/Proxmark3GUI.git
synced 2026-07-14 22:55:32 +08:00
Add _readblk() (not tested)
This commit is contained in:
+8
-3
@@ -1,10 +1,11 @@
|
||||
#include "util.h"
|
||||
|
||||
Util::Util(QObject *parent) : QObject(parent)
|
||||
Util::Util(Util::ClientType clientType, QObject *parent) : QObject(parent)
|
||||
{
|
||||
isRequiringOutput = false;
|
||||
requiredOutput = new QString();
|
||||
timeStamp = QTime::currentTime();
|
||||
this->clientType = clientType;
|
||||
}
|
||||
|
||||
void Util::processOutput(QString output)
|
||||
@@ -31,7 +32,7 @@ QString Util::execCMDWithOutput(QString cmd, unsigned long timeout)
|
||||
isRequiringOutput = true;
|
||||
requiredOutput->clear();
|
||||
execCMD(cmd);
|
||||
while( QTime::currentTime() < targetTime)
|
||||
while(QTime::currentTime() < targetTime)
|
||||
{
|
||||
QApplication::processEvents();
|
||||
if(timeStamp > currTime)
|
||||
@@ -47,6 +48,10 @@ QString Util::execCMDWithOutput(QString cmd, unsigned long timeout)
|
||||
void Util::delay(unsigned int msec)
|
||||
{
|
||||
QTime timer = QTime::currentTime().addMSecs(msec);
|
||||
while( QTime::currentTime() < timer )
|
||||
while(QTime::currentTime() < timer)
|
||||
QApplication::processEvents(QEventLoop::AllEvents, 100);
|
||||
}
|
||||
Util::ClientType Util::getClientType()
|
||||
{
|
||||
return this->clientType;
|
||||
}
|
||||
|
||||
+8
-1
@@ -13,11 +13,17 @@ class Util : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Util(QObject *parent = nullptr);
|
||||
enum ClientType
|
||||
{
|
||||
OFFICIAL,
|
||||
ICEMAN,
|
||||
};
|
||||
explicit Util(Util::ClientType clientType, QObject *parent = nullptr);
|
||||
|
||||
void execCMD(QString cmd);
|
||||
QString execCMDWithOutput(QString cmd, unsigned long timeout = 2000);
|
||||
void delay(unsigned int msec);
|
||||
ClientType getClientType();
|
||||
public slots:
|
||||
void processOutput(QString output);
|
||||
|
||||
@@ -28,6 +34,7 @@ private:
|
||||
signals:
|
||||
void refreshOutput(const QString& output);
|
||||
void write(QString data);
|
||||
ClientType clientType;
|
||||
};
|
||||
|
||||
#endif // UTIL_H
|
||||
|
||||
Reference in New Issue
Block a user