-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlptdrvi2cinterface.h
83 lines (64 loc) · 1.65 KB
/
lptdrvi2cinterface.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef LPTDRVI2CINTERFACE_H
#define LPTDRVI2CINTERFACE_H
#include <QWaitCondition>
#include <QMutex>
#include <QByteArray>
#include <QStringList>
#include "i2cportinterface.h"
#include "lptdrvprovider.h"
class LptDrvI2cInterface : public I2cPortInterface
{
QByteArray inputBuffer;
LptDrvProvider prov;
QString reasonText;
struct operation
{
unsigned char adr;
QByteArray data;
unsigned int size;
unsigned int time;
enum {READ,WRITE,STOP,WAIT} type;
};
QList<operation> operations;
UINT err;
public:
LptDrvI2cInterface();
bool open();
void close();
void checkAsk(bool a);
void writeNow (unsigned char adr,QByteArray data);
QByteArray readNow (unsigned char adr,unsigned int size);
QByteArray writeReadNow (unsigned char adr,QByteArray data ,unsigned int size);
bool isOk();
void addWrite (unsigned char adr,QByteArray data);
void addRead (unsigned char adr,unsigned int size);
void addStop();
void addWait(int time);
bool preform();
int getBufferLength();
QByteArray getBuffer();
virtual bool isAvable()
{
#ifdef Q_OS_LINUX
return false;
#else
return true;
#endif
}
virtual QString name() {return "MICI2C";}
virtual QString description() {return QObject::tr("I2C over Micronas LptDrv - LPT Port");}
virtual QString reason()
{
#ifdef Q_OS_LINUX
return QObject::tr("Only for Win32");
#else
return reasonText;
#endif
}
bool load();
void unload();
void setPortName(QString n);
QString getPortName();
QStringList getPortList();
};
#endif // LPTDRVI2CINTERFACE_H