Proxmark3GUI/common/pm3process.h

40 lines
1,002 B
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>
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 QString port);
void setSerialListener(const QString &name, bool state);
2020-04-22 16:00:56 +08:00
qint64 write(QString data);
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;
signals:
2020-04-22 23:13:00 +08:00
void PM3StatedChanged(bool st, QString info = "");
2020-04-22 16:42:58 +08:00
void newOutput(QString output);
2020-04-06 23:48:08 +08:00
};
#endif // PM3PROCESS_H