dev commit

pull/2/head
wh201906 5 years ago
parent d651d2788d
commit 643c298662

@ -18,10 +18,12 @@ DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += \
main.cpp \
mainwindow.cpp \
mifare.cpp \
pm3process.cpp
HEADERS += \
mainwindow.h \
mifare.h \
pm3process.h
FORMS += \

@ -7,13 +7,10 @@ MainWindow::MainWindow(QWidget *parent)
{
ui->setupUi(this);
pm3=new PM3Process;
mifare=new Mifare;
connect(pm3,&PM3Process::readyRead,this,&MainWindow::refresh);
connect(ui->commandEdit,&QLineEdit::editingFinished,this,&MainWindow::sendMSG);
ui->portBox->addItem("");
foreach(QString port,pm3->findPort())
{
ui->portBox->addItem(port);
}
dataModel=new QStandardItemModel;
dataModel->setColumnCount(3);
@ -70,7 +67,7 @@ void MainWindow::on_sendButton_clicked()
void MainWindow::refresh()
{
QByteArray btay=pm3->readLine();
QString btay=pm3->readLine();
while(btay!="")
{
qDebug()<<btay;
@ -95,3 +92,13 @@ void MainWindow::on_clearButton_clicked()
{
ui->outputEdit->clear();
}
void MainWindow::on_portButton_clicked()
{
ui->portBox->clear();
ui->portBox->addItem("");
foreach(QString port,pm3->findPort())
{
ui->portBox->addItem(port);
}
}

@ -7,6 +7,7 @@
#include <QMessageBox>
#include <QStandardItemModel>
#include "pm3process.h"
#include "mifare.h"
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
@ -32,9 +33,12 @@ private slots:
void on_clearButton_clicked();
void sendMSG();
void on_portButton_clicked();
private:
Ui::MainWindow *ui;
PM3Process* pm3;
Mifare* mifare;
QStandardItemModel* dataModel;
QStandardItemModel* keyModel;
};

@ -49,6 +49,13 @@
<item>
<widget class="QComboBox" name="portBox"/>
</item>
<item>
<widget class="QPushButton" name="portButton">
<property name="text">
<string>Refresh</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="connectButton">
<property name="text">
@ -80,8 +87,133 @@
<attribute name="title">
<string>Mifare</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<widget class="QWidget" name="gridLayoutWidget">
<property name="geometry">
<rect>
<x>90</x>
<y>290</y>
<width>320</width>
<height>80</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pushButton_4">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButton_6">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="pushButton_8">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>150</x>
<y>410</y>
<width>338</width>
<height>55</height>
</rect>
</property>
<property name="title">
<string>Read/Write</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_3">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_5">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_7">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>170</x>
<y>480</y>
<width>338</width>
<height>55</height>
</rect>
</property>
<property name="title">
<string>Attack</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QPushButton" name="pushButton_9">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_10">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_11">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_12">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QTableView" name="dataView">
@ -116,8 +248,7 @@
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="rawTab">
<attribute name="title">

@ -0,0 +1,44 @@
#include "mifare.h"
Mifare::Mifare(QObject *parent) : QObject(parent)
{
isProcessingData=false;
isProcessingKey=false;
}
void Mifare::processData(const QString str)
{
if(isProcessingData)
{
if(inputType==FROM_RDBL)
}
}
void Mifare::processKey(const QString str)
{
if(isProcessingKey)
{
}
}
void Mifare::setProcessingState(ProcessingState st)
{
if(st==Mifare::NONE)
{
isProcessingKey=false;
isProcessingData=false;
}
else if(st==Mifare::KEY)
{
isProcessingKey=true;
isProcessingData=false;
}
else if(st==Mifare::DATA)
{
isProcessingKey=false;
isProcessingData=true;
}
}
void Mifare::setInputType(InputType tp)
{
inputType=tp;
}

@ -0,0 +1,40 @@
#ifndef MIFARE_H
#define MIFARE_H
#include <QObject>
class Mifare : public QObject
{
Q_OBJECT
public:
explicit Mifare(QObject *parent = nullptr);
enum ProcessingState
{
NONE,
DATA,
KEY,
};
enum InputType
{
FROM_RDBL,
FROM_RDSC,
FROM_CHK,
FROM_NESTED,
};
void setProcessingState(ProcessingState st);
void setInputType(InputType tp);
public slots:
void processData(const QString str);
void processKey(const QString str);
signals:
private:
bool isProcessingData=false;
bool isProcessingKey=false;
InputType inputType;
QStringList dataList;
QStringList keyList[2];
};
#endif // MIFARE_H
Loading…
Cancel
Save