-
Notifications
You must be signed in to change notification settings - Fork 3
/
ads.h
79 lines (64 loc) · 1.53 KB
/
ads.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
#ifndef ADS_H
#define ADS_H
#include <QObject>
#include <QDebug>
#include <QThread>
#include <QTimer>
#include "TcAdsDef.h"
#include "TcAdsAPI.h"
/* 说明:ads文件主要的服务对象是本程序的界面部分
* 所有的对应的操作函数,都是具体针对于界面上的所对应按钮
* 本函数虽然可以应用于别的地方,但是不推荐应用于别的地方
*/
/* 说明:本节内有些信号与槽可以删掉,
* 在外部用一个就好了
*/
typedef struct {
double position;
double speed;
}vStruct;
class Operation: public QObject
{
Q_OBJECT
public:
Operation(QObject* parent = nullptr);
~Operation();
public slots:
void setStatus(short, short);
void setSpeed(QString axisNumber, double value);
void readStatus();
void readSpeed(int*);
void setSwitch(bool);
void setAPosition(double*);
void setOutMovePos(QVector<double>); // 设定相对式坐标量的变动值
signals:
void setValue(vStruct*);
void setUiStatus(QString);
private:
long nErr;
long nPort;
AmsAddr Addr;
PAmsAddr pAddr;
vStruct* mValueStruct;
};
class Ads: public QObject
{
Q_OBJECT
public:
Ads(QObject* parent = nullptr);
~Ads();
Operation *mOperation;
signals:
void setStatus(short, short);
void setSpeed(QString, double);
void readStatus();
void readSpeed(int*);
void setSwitch(bool);
void setAPosition(double*);
void goToAPosition();
private slots:
void getData();
private:
QTimer *mTimer;
};
#endif // ADS_H