-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.h
More file actions
160 lines (118 loc) · 4.12 KB
/
mainwindow.h
File metadata and controls
160 lines (118 loc) · 4.12 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QDebug>
#include <QTableWidget>
#include <QObject>
#include <QImage>
#include <QtSerialPort/QtSerialPort>
#include <QtSerialPort/QSerialPortInfo>
#include <QTimer>
#include <QMessageBox>
#include <QKeyEvent>
#include <QMouseEvent>
#include "wrightvaluedialog.h"
#include "modbusmaster.h"
#include "setupdialog.h"
#include "qcustomplot.h"
#include "graph_set.h"
//#include <QChar>
#define ILLEGAL_FUNC_ERR 1 /*illegal function error*/
#define ILLEG_DAT_ADR_ERR 2 /*illegal data address*/
#define ILLEGAL_DATA_ERR 3 /*illegal data value*/
#define ACKNOWLEDGE_ERR 5 /*acknowledge*/
#define MEMORY_PARITY_ERR 8 /*memory parity error*/
#define ASCII_WRITE_EEPROM 102
#define ASCII_READ_EEPROM 100
#define ASCII_READ_RAM 101
#define ASCII_READ_COILS 110
#define ASCII_READ_DIS_IN 111
#define ASCII_READ_HOLD_REG 112
#define ASCII_IN_REG 113
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
void setupPlot();
void setupRealtimeDataDemo(QCustomPlot *customPlot);
QDateTime julianDoubleToDateTime(double julian);
//Variables
ModBusMaster ModbusMaster_new;
QTimer *timer_poll = new QTimer(this);
QTimer *timer = new QTimer(this);
QTimer *TimeOuttimer = new QTimer(this);
QTimer *Polltimer = new QTimer(this);
QSerialPort *serial;
QCPRange xrange,yrange;
QString ID,Function,Address,Quantity,CRC,ByteCount,receivedData;
QString sendtable,received;
QStringList portlist;
unsigned char g_ucSciRxNbOfBytes;
QChar *pucPtrToSCIBuffRx;
QLabel *statusImage;
QLabel *statusImage2 = new QLabel;
QLabel *statusEcount = new QLabel;
QLabel *statusPcount = new QLabel;
QLabel *statusPtimer = new QLabel;
QLabel *statusLimitCounter = new QLabel;
QImage *greenI,*redI;
QImage podngred,podnggreen;
bool Sci_New_Packet = false, packageStarted = false, Charerror = false , pollbool = false, pollbutonbool = false;
bool polltimerbool = false, SetupEntered = false, GraphicSetupEntered = false, osmanb = false,firstvalueB = false,packageerror = false;
double xkey, ykey;
int osmanint=1, xtempval, ytempval;
double xmax, xmin, ymax, ymin, xratio=1.0, yratio=1.0;
int TimeOuttime,errorcount=0,packagecount=0,polltimerSec=0,polltimerMin=0,polltimerHour=0;
int limitRow=0,limitColumn=0, limitcounter=0;
public slots:
void timerSlot();
void PolltimerSlot();
void TimeOuttimerSlot();
void PollingTimetimerSlot();
signals:
void osman(QString,QString,QString,int);
void setupopen();
private slots:
void on_pushButton_clicked();
void on_pushButton_2_clicked();
void on_tableWidget_customContextMenuRequested(const QPoint &pos);
void on_tableWidget_itemDoubleClicked(QTableWidgetItem *item);
void on_tableWidget_cellDoubleClicked(int row, int column);
void on_actionSetup_triggered();
void serialReceived();
// void horzScrollBarChanged(int value);
// void vertScrollBarChanged(int value);
void xAxisChanged(QCPRange range);
void yAxisChanged(QCPRange range);
void on_actionOne_Register_Graphical_View_triggered();
void on_actionStart_triggered();
void on_actionPause_triggered();
void on_actionContinue_triggered();
void realtimeDataSlot();
void on_horizontalSlider_sliderMoved(int position);
// void on_verticalSlider_sliderMoved(int position);
// void on_verticalSlider_valueChanged(int value);
void on_horizontalSlider_valueChanged(int value);
void plotMousePress(QMouseEvent *);
void on_pushButton_3_clicked();
private:
Ui::MainWindow *ui;
// WrightValueDialog *write;
// WrightValueDialog *write = new WrightValueDialog;
WrightValueDialog write;
SetupDialog setupdialog;
Graph_set GraphicSettings;
// SetupDialog *setupdialog = new SetupDialog(this);
unsigned char gs_ucErrortReg;
unsigned int gs_uiExor1;
QTimer dataTimer;
//function prototypes
// unsigned char asciiToBin(unsigned char);
void PrintResults();
};
#endif // MAINWINDOW_H