-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.cpp
62 lines (46 loc) · 1.11 KB
/
mainwindow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QtGui>
#include <QtCore>
#include "globals.h"
#include "scard.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(update()));
timer->start(1000);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::update()
{
scard sc;
/*
* 1. Estalish a context
*/
sc.establishContext();
/*
* 2. Let the user choose a reader.
*/
/*
* 2.a. List all available readers
*/
sc.cardListReaders();
sc.cardConnect();
sc.cardGetAttribATR(SCARD_ATTR_ATR_STRING);
sc.cardGetAttribSerialNumber(SCARD_ATTR_VENDOR_IFD_SERIAL_NO);
// sc.cardGetAttribDeviceSystemName(SCARD_ATTR_POWER_MGMT_SUPPORT);
sc.cardGetProp();
sc.cardReadData();
ui->lineEdit_serialNumber->setText(sc.get_serialNumber());
ui->lineEdit_ATR->setText(sc.getATR());
ui->lineEdit_UID->setText(sc.get_UID());
}
void MainWindow::on_actionTest_triggered()
{
}