-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwidget.h
More file actions
174 lines (133 loc) · 3.72 KB
/
Copy pathwidget.h
File metadata and controls
174 lines (133 loc) · 3.72 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
#include <QDesktopWidget>
#include <QRect>
#include <QTcpSocket>
#include <QAbstractSocket>
#include <QDebug>
#include <QKeyEvent>
#include <QList>
#include <QFileDialog>
#include <QMessageBox>
#include <QScrollBar>
#include <QTimer>
#include <QStringList>
#include <QtSerialPort>
#include "subplottab.h"
#include "lineform.h"
#include "qcustomplot/qcustomplot.h"
//#define TEST
#define COBS_TYPE float // <- merda c'è anche definito in in lineform.h
namespace Ui {
class Widget;
}
//struct __attribute__((packed)) dataType{
// float time;
// int16_t data1;
// float data2;
// int16_t data3;
// float data4;
//};
//struct __attribute__((packed)) dataType{
// float time;
// float data1;
// float data2;
// float data3;
// float data4;
// float data5;
// float data6;
// float data7;
// float data8;
// float data9;
//};
struct __attribute__((packed)) dataType{
unsigned int pck_n;
float time;
float data1;
float data2;
float data3;
float data4;
float data5;
float data6;
};
union {
dataType data;
unsigned char data_byte[sizeof(dataType)];
} data_u;
int MyCOBSdecode(QByteArray data_byte_encode, size_t packetlen);
class Widget : public QWidget
{
Q_OBJECT
public:
explicit Widget(QWidget *parent = 0);
~Widget();
private:
QString mode;
Ui::Widget *ui;
QTcpSocket *socket;
void sckSend(QString tosend);
int hist_len;
int hist_idx;
QList<QString> states_str;
QList<QString> states_colors;
QPoint windowPos;
int plotSettingsWidth = 300;
QTimer* timerPlot;
// QString plotData;
// bool isFirst;
// bool validData;
int numData = 7; //<------------------------------------------------------ COBS NUMBER OF FIELDS!!!
QVector<QVector<double>> parsedData;
long int last_packet_id;
void addSubplotTab();
void removeSubplotTab();
int currentTabIdx;
SubplotTab* currentTab;
///SERIAL
QString serialportname;
QString serialbaud;
QSerialPort serialport;
QByteArray incomingdata_buffered;
#ifdef TEST
QTime timerTest;
#endif
protected:
bool eventFilter(QObject *obj, QEvent *event);
void moveEvent(QMoveEvent *event);
private slots:
void sckConnect();
void sckConnected();
void sckDisconnect();
void sckDisconnected();
void sckBytesWritten(qint64 bytes);
void sckReadyRead();
void skcStateChanged(QAbstractSocket::SocketState socketState);
void sckError(QAbstractSocket::SocketError socketError);
void serialReadyRead();
void on_lineEdit_cmdSend_returnPressed();
void on_pushButton_saveIncomingData_clicked();
void on_pushButton_plotSettings_clicked();
void plotSelected(int);
void plotUpdate();
void on_checkBox_enablePlot_toggled(bool checked);
void on_horizontalSlider_fps_sliderMoved(int position);
void on_spinBox_numberSubplots_valueChanged(int arg1);
void linePropertiesChanged(linePropertiesT);
void on_tabWidget_subplot_currentChanged(int index);
void on_comboBox_serial_available_currentIndexChanged(const QString &arg1);
void on_comboBox_serial_baud_currentIndexChanged(const QString &arg1);
void on_pushButton_serial_start_clicked();
void on_pushButton_serial_stop_clicked();
void on_tabWidget_2_currentChanged(int index);
void processIncomingData(QByteArray incoming);
void processIncomingData2();
void on_pushButton_clearPlots_clicked();
void on_pushButton_clear_clicked();
void on_pushButton_refresh_serial_clicked();
void on_checkBox_xWindowLink_toggled(bool checked);
void on_horizontalSlider_xWindowLink_valueChanged(int value);
signals:
void newDataAvailable(QVector<QVector<double>>const &);
};
#endif // WIDGET_H