dev commit

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

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

@ -7,13 +7,10 @@ MainWindow::MainWindow(QWidget *parent)
{ {
ui->setupUi(this); ui->setupUi(this);
pm3=new PM3Process; pm3=new PM3Process;
mifare=new Mifare;
connect(pm3,&PM3Process::readyRead,this,&MainWindow::refresh); connect(pm3,&PM3Process::readyRead,this,&MainWindow::refresh);
connect(ui->commandEdit,&QLineEdit::editingFinished,this,&MainWindow::sendMSG); connect(ui->commandEdit,&QLineEdit::editingFinished,this,&MainWindow::sendMSG);
ui->portBox->addItem("");
foreach(QString port,pm3->findPort())
{
ui->portBox->addItem(port);
}
dataModel=new QStandardItemModel; dataModel=new QStandardItemModel;
dataModel->setColumnCount(3); dataModel->setColumnCount(3);
@ -70,7 +67,7 @@ void MainWindow::on_sendButton_clicked()
void MainWindow::refresh() void MainWindow::refresh()
{ {
QByteArray btay=pm3->readLine(); QString btay=pm3->readLine();
while(btay!="") while(btay!="")
{ {
qDebug()<<btay; qDebug()<<btay;
@ -95,3 +92,13 @@ void MainWindow::on_clearButton_clicked()
{ {
ui->outputEdit->clear(); 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 <QMessageBox>
#include <QStandardItemModel> #include <QStandardItemModel>
#include "pm3process.h" #include "pm3process.h"
#include "mifare.h"
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; } namespace Ui { class MainWindow; }
@ -32,9 +33,12 @@ private slots:
void on_clearButton_clicked(); void on_clearButton_clicked();
void sendMSG(); void sendMSG();
void on_portButton_clicked();
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
PM3Process* pm3; PM3Process* pm3;
Mifare* mifare;
QStandardItemModel* dataModel; QStandardItemModel* dataModel;
QStandardItemModel* keyModel; QStandardItemModel* keyModel;
}; };

@ -49,6 +49,13 @@
<item> <item>
<widget class="QComboBox" name="portBox"/> <widget class="QComboBox" name="portBox"/>
</item> </item>
<item>
<widget class="QPushButton" name="portButton">
<property name="text">
<string>Refresh</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="connectButton"> <widget class="QPushButton" name="connectButton">
<property name="text"> <property name="text">
@ -80,44 +87,168 @@
<attribute name="title"> <attribute name="title">
<string>Mifare</string> <string>Mifare</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_3"> <widget class="QWidget" name="gridLayoutWidget">
<item> <property name="geometry">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <rect>
<item> <x>90</x>
<widget class="QTableView" name="dataView"> <y>290</y>
<property name="sizePolicy"> <width>320</width>
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <height>80</height>
<horstretch>2</horstretch> </rect>
<verstretch>0</verstretch> </property>
</sizepolicy> <layout class="QGridLayout" name="gridLayout">
</property> <item row="0" column="0">
<attribute name="verticalHeaderMinimumSectionSize"> <widget class="QPushButton" name="pushButton">
<number>20</number> <property name="text">
</attribute> <string>PushButton</string>
<attribute name="verticalHeaderDefaultSectionSize"> </property>
<number>20</number> </widget>
</attribute> </item>
</widget> <item row="0" column="1">
</item> <widget class="QPushButton" name="pushButton_4">
<item> <property name="text">
<widget class="QTableView" name="keyView"> <string>PushButton</string>
<property name="sizePolicy"> </property>
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> </widget>
<horstretch>1</horstretch> </item>
<verstretch>0</verstretch> <item row="0" column="2">
</sizepolicy> <widget class="QPushButton" name="pushButton_6">
</property> <property name="text">
<attribute name="verticalHeaderMinimumSectionSize"> <string>PushButton</string>
<number>20</number> </property>
</attribute> </widget>
<attribute name="verticalHeaderDefaultSectionSize"> </item>
<number>20</number> <item row="0" column="3">
</attribute> <widget class="QPushButton" name="pushButton_8">
</widget> <property name="text">
</item> <string>PushButton</string>
</layout> </property>
</item> </widget>
</layout> </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">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<attribute name="verticalHeaderMinimumSectionSize">
<number>20</number>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>20</number>
</attribute>
</widget>
</item>
<item>
<widget class="QTableView" name="keyView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<attribute name="verticalHeaderMinimumSectionSize">
<number>20</number>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>20</number>
</attribute>
</widget>
</item>
</layout>
</widget>
</widget> </widget>
<widget class="QWidget" name="rawTab"> <widget class="QWidget" name="rawTab">
<attribute name="title"> <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