Proxmark3GUI/common/pm3process.h

54 lines
1.3 KiB
C
Raw Normal View History

2020-04-06 23:48:08 +08:00
#ifndef PM3PROCESS_H
#define PM3PROCESS_H
#include <QProcess>
#include <QThread>
2020-04-06 23:48:08 +08:00
#include <QString>
#include <QDebug>
#include <QTimer>
2020-04-07 18:16:00 +08:00
#include <QtSerialPort/QSerialPortInfo>
#include <QtSerialPort/QSerialPort>
#include <QProcessEnvironment>
#include <QDir>
2020-04-06 23:48:08 +08:00
2020-08-05 19:08:02 +08:00
#include "util.h"
2020-04-06 23:48:08 +08:00
class PM3Process : public QProcess
{
Q_OBJECT
public:
2020-04-22 23:13:00 +08:00
explicit PM3Process(QThread* thread, QObject* parent = nullptr);
2020-04-16 00:39:10 +08:00
bool waitForReadyRead(int msecs = 2000);
void testThread();
public slots:
void connectPM3(const QString& path, const QStringList args);
2020-08-13 09:30:47 +08:00
void setSerialListener(const QString& name, bool state);
void setSerialListener(bool state);
2020-04-22 16:00:56 +08:00
qint64 write(QString data);
void reconnectPM3();
void setProcEnv(const QStringList* env);
void setWorkingDir(const QString& dir);
2021-02-22 12:47:55 +08:00
void killPM3();
private slots:
void onTimeout();
2020-04-22 16:42:58 +08:00
void onReadyRead();
private:
bool isRequiringOutput;
2020-04-22 21:14:33 +08:00
QString* requiredOutput; // It only works in this class now
void setRequiringOutput(bool st);// It only works in this class now
QTimer* serialListener;
QSerialPortInfo* portInfo;
QString currPath;
QString currPort = "";
QStringList currArgs;
signals:
2020-08-13 09:30:47 +08:00
void PM3StatedChanged(bool st, const QString& info = "");
void newOutput(const QString& output);
2020-08-05 19:08:02 +08:00
void changeClientType(Util::ClientType);
2020-04-06 23:48:08 +08:00
};
#endif // PM3PROCESS_H