-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreader.h
executable file
·58 lines (45 loc) · 1.12 KB
/
reader.h
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
#ifndef READER_H
#define READER_H
#include <QObject>
#include <QSocketNotifier>
#include <QRegExp>
#include <QTimer>
#include <QCryptographicHash>
#include <libudev.h>
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <unistd.h>
#include <fcntl.h>
const int id_length = 15;
const QString id_regexp = ";[0-9]{16,16}=";
const QString name_regexp = "^%*/*\\^*?$";
const QString deviceManufacturer = "Mag-Tek";
class Reader : public QObject
{
Q_OBJECT
public:
explicit Reader(QObject *parent = 0);
private:
QString deviceLocation;
FILE *device;
QSocketNotifier *notifier;
struct udev *udev;
struct udev_enumerate *enumerate;
struct udev_list_entry *devices, *dev_list_entry;
struct udev_device *dev;
void send(QString);
QString getCardID(QString raw);
bool checkCardID(QString id);
QString getCardName(QString raw);
void initUdev();
void cleanUdev();
signals:
void sendMessage(QString mess);
public slots:
void readData();
void ready();
void notReady();
QString lookForDevice();
};
#endif // READER_H