Proxmark3GUI/pm3process.cpp

30 lines
774 B
C++
Raw Normal View History

2020-04-06 23:48:08 +08:00
#include "pm3process.h"
PM3Process::PM3Process(QObject* parent): QProcess(parent)
{
2020-04-07 18:16:00 +08:00
setProcessChannelMode(PM3Process::MergedChannels);
}
2020-04-06 23:48:08 +08:00
2020-04-07 18:16:00 +08:00
QStringList PM3Process::findPort()
{
QSerialPort serial;
QStringList retList;
foreach(const QSerialPortInfo &info, QSerialPortInfo::availablePorts())
{
serial.setPort(info);
if(serial.open(QIODevice::ReadWrite))
{
retList<<info.portName();
serial.close();
}
}
return retList;
2020-04-06 23:48:08 +08:00
}
2020-04-07 18:16:00 +08:00
bool PM3Process::start(const QString path, const QString port)
2020-04-06 23:48:08 +08:00
{
2020-04-07 18:16:00 +08:00
// using "-f" option to make the client output flushed after every print.
QProcess::start(path, QStringList()<<port<<"-f",QProcess::Unbuffered|QProcess::ReadWrite);
return waitForStarted();
2020-04-06 23:48:08 +08:00
}