comparison editlogdialog.h @ 1:0b3630a29ad8

Initial version based on previous repository. Project was ported to QT6 and in now cmake based.
author Ideenmodellierer <tiefenrauscher@web.de>
date Thu, 27 Nov 2025 18:40:28 +0100
parents
children
comparison
equal deleted inserted replaced
0:76ccd6ce50c0 1:0b3630a29ad8
1 //
2 // BSD 2-Clause License:
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions
6 // are met:
7 //
8 // 1. Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 //
11 // 2. Redistributions in binary form must reproduce the above copyright notice,
12 // this list of conditions and the following disclaimer in the documentation
13 // and/or other materials provided with the distribution.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
25 // THE POSSIBILITY OF SUCH DAMAGE.
26 //
27
28 #ifndef EDITLOGDIALOG_H
29 #define EDITLOGDIALOG_H
30
31 #define NUM_GAS (5) /* number of selectable gases */
32
33 typedef struct
34 {
35 unsigned char profileLength[3];
36 unsigned char samplingRate_seconds;
37 unsigned char numDivisors;
38 unsigned char tempType;
39 unsigned char tempLength;
40 unsigned char tempDivisor;
41 unsigned char deco_ndlType;
42 unsigned char deco_ndlLength;
43 unsigned char deco_ndlDivisor;
44 unsigned char gfType;
45 unsigned char gfLength;
46 unsigned char gfDivisor;
47 unsigned char ppo2Type;
48 unsigned char ppo2Length;
49 unsigned char ppo2Divisor;
50 unsigned char decoplanType;
51 unsigned char decoplanLength;
52 unsigned char decoplanDivisor;
53 unsigned char cnsType;
54 unsigned char cnsLength;
55 unsigned char cnsDivisor;
56 unsigned char tankType;
57 unsigned char tankLength;
58 unsigned char tankDivisor;
59 } SSmallHeader;
60
61 typedef struct{
62 unsigned char active:1;
63 unsigned char first:1;
64 unsigned char deco:1;
65 unsigned char travel:1;
66 unsigned char senderCode:4;
67 } gasubit8_t;
68
69 typedef union{
70 gasubit8_t ub;
71 unsigned char uw;
72 } gasbit8_Type;
73 typedef struct
74 {
75 unsigned char setpoint_cbar;
76 unsigned char depth_meter;
77 } SSetpointLog;
78
79 typedef struct
80 {
81 unsigned char oxygen_percentage;
82 unsigned char helium_percentage;
83 unsigned char depth_meter;
84 gasbit8_Type note;
85 } SGasListLog;
86 //Logbook
87 typedef struct
88 {
89 unsigned short diveHeaderStart;
90 unsigned char pBeginProfileData[3];
91 unsigned char pEndProfileData[3];
92 unsigned char profileLength[3];
93 unsigned char logbookProfileVersion;
94 unsigned char dateYear;
95 unsigned char dateMonth;
96 unsigned char dateDay;
97 unsigned char timeHour;
98 unsigned char timeMinute;
99 unsigned char extraPagesWithData; /* from here on: changes in order with respect to OSTC3 */
100 unsigned short maxDepth;
101 unsigned short diveTimeMinutes;
102 unsigned char diveTimeSeconds;
103 unsigned char samplingRate;
104 short minTemp;
105 unsigned short surfacePressure_mbar;
106 unsigned short desaturationTime;
107 SGasListLog gasordil[NUM_GAS];
108 unsigned char firmwareVersionLow;
109 unsigned char firmwareVersionHigh;
110 unsigned short batteryVoltage;
111 unsigned short cnsAtBeginning;
112 unsigned char gfAtBeginning;
113 unsigned char gfAtEnd;
114 unsigned short personalDiveCount;
115 SSetpointLog setpoint[NUM_GAS];
116 unsigned short maxCNS;
117 unsigned short averageDepth_mbar;
118 unsigned short total_diveTime_seconds;
119 unsigned char salinity;
120 unsigned char gfLow_or_Vpm_conservatism;
121 unsigned char gfHigh;
122 unsigned char decoModel;
123 float n2Compartments[16];
124 float heCompartments[16];
125 unsigned char n2CompartDesatTime_min[16];
126 unsigned char heCompartDesatTime_min[16];
127 unsigned short diveNumber;
128 unsigned char lastDecostop_m;
129 unsigned char CCRmode;
130 unsigned char diveMode;
131 unsigned char hwHudLastStatus; /* from here on identical to OSTC3 again */
132 unsigned short hwHudBattery_mV;
133 unsigned char batteryGaugeRegisters[6];
134 unsigned short diveHeaderEnd;
135 } SLogbookHeader;
136
137
138 namespace Ui { class editLogWnd; }
139
140 #include <QDialog>
141 #include <QTableWidgetItem>
142
143 class HardwareOperations;
144
145
146
147 class EditLogDialog
148 : public QDialog
149 {
150 Q_OBJECT
151 Ui::editLogWnd* _ui;
152 HardwareOperations* _op;
153
154 unsigned char* HeaderBuffer;
155 unsigned char* SampleBuffer;
156 QTableWidgetItem* item[256];
157 QTableWidgetItem* sampleitem[192];
158
159 public:
160 EditLogDialog(QWidget* parent, HardwareOperations *op);
161 ~EditLogDialog();
162 private slots:
163
164 void on_WriteAllHeader_clicked();
165 void on_pushButton_clicked();
166 void on_HeaderUsage_valueChanged(int value);
167 void on_ReadAllSamples_clicked();
168 void on_pushButton_2_clicked();
169
170 void updateHeaderStatus();
171 void updateSampleStatus();
172 void on_LoadDump_clicked();
173 void on_WriteAllSamples_clicked();
174 void on_SectorView_cellClicked(int row, int column);
175
176
177 void on_SectorView_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn);
178
179 void on_SampleView_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn);
180 };
181
182 #endif // EDITLOGDIALOG_H