Mercurial > public > ostc_companion
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/editlogdialog.h Thu Nov 27 18:40:28 2025 +0100 @@ -0,0 +1,182 @@ +// +// BSD 2-Clause License: +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +// THE POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef EDITLOGDIALOG_H +#define EDITLOGDIALOG_H + +#define NUM_GAS (5) /* number of selectable gases */ + +typedef struct +{ + unsigned char profileLength[3]; + unsigned char samplingRate_seconds; + unsigned char numDivisors; + unsigned char tempType; + unsigned char tempLength; + unsigned char tempDivisor; + unsigned char deco_ndlType; + unsigned char deco_ndlLength; + unsigned char deco_ndlDivisor; + unsigned char gfType; + unsigned char gfLength; + unsigned char gfDivisor; + unsigned char ppo2Type; + unsigned char ppo2Length; + unsigned char ppo2Divisor; + unsigned char decoplanType; + unsigned char decoplanLength; + unsigned char decoplanDivisor; + unsigned char cnsType; + unsigned char cnsLength; + unsigned char cnsDivisor; + unsigned char tankType; + unsigned char tankLength; + unsigned char tankDivisor; +} SSmallHeader; + +typedef struct{ +unsigned char active:1; +unsigned char first:1; +unsigned char deco:1; +unsigned char travel:1; +unsigned char senderCode:4; +} gasubit8_t; + +typedef union{ +gasubit8_t ub; +unsigned char uw; +} gasbit8_Type; +typedef struct +{ + unsigned char setpoint_cbar; + unsigned char depth_meter; +} SSetpointLog; + +typedef struct +{ + unsigned char oxygen_percentage; + unsigned char helium_percentage; + unsigned char depth_meter; + gasbit8_Type note; +} SGasListLog; +//Logbook +typedef struct +{ + unsigned short diveHeaderStart; + unsigned char pBeginProfileData[3]; + unsigned char pEndProfileData[3]; + unsigned char profileLength[3]; + unsigned char logbookProfileVersion; + unsigned char dateYear; + unsigned char dateMonth; + unsigned char dateDay; + unsigned char timeHour; + unsigned char timeMinute; + unsigned char extraPagesWithData; /* from here on: changes in order with respect to OSTC3 */ + unsigned short maxDepth; + unsigned short diveTimeMinutes; + unsigned char diveTimeSeconds; + unsigned char samplingRate; + short minTemp; + unsigned short surfacePressure_mbar; + unsigned short desaturationTime; + SGasListLog gasordil[NUM_GAS]; + unsigned char firmwareVersionLow; + unsigned char firmwareVersionHigh; + unsigned short batteryVoltage; + unsigned short cnsAtBeginning; + unsigned char gfAtBeginning; + unsigned char gfAtEnd; + unsigned short personalDiveCount; + SSetpointLog setpoint[NUM_GAS]; + unsigned short maxCNS; + unsigned short averageDepth_mbar; + unsigned short total_diveTime_seconds; + unsigned char salinity; + unsigned char gfLow_or_Vpm_conservatism; + unsigned char gfHigh; + unsigned char decoModel; + float n2Compartments[16]; + float heCompartments[16]; + unsigned char n2CompartDesatTime_min[16]; + unsigned char heCompartDesatTime_min[16]; + unsigned short diveNumber; + unsigned char lastDecostop_m; + unsigned char CCRmode; + unsigned char diveMode; + unsigned char hwHudLastStatus; /* from here on identical to OSTC3 again */ + unsigned short hwHudBattery_mV; + unsigned char batteryGaugeRegisters[6]; + unsigned short diveHeaderEnd; +} SLogbookHeader; + + +namespace Ui { class editLogWnd; } + +#include <QDialog> +#include <QTableWidgetItem> + +class HardwareOperations; + + + +class EditLogDialog + : public QDialog +{ + Q_OBJECT + Ui::editLogWnd* _ui; + HardwareOperations* _op; + + unsigned char* HeaderBuffer; + unsigned char* SampleBuffer; + QTableWidgetItem* item[256]; + QTableWidgetItem* sampleitem[192]; + +public: + EditLogDialog(QWidget* parent, HardwareOperations *op); + ~EditLogDialog(); +private slots: + + void on_WriteAllHeader_clicked(); + void on_pushButton_clicked(); + void on_HeaderUsage_valueChanged(int value); + void on_ReadAllSamples_clicked(); + void on_pushButton_2_clicked(); + + void updateHeaderStatus(); + void updateSampleStatus(); + void on_LoadDump_clicked(); + void on_WriteAllSamples_clicked(); + void on_SectorView_cellClicked(int row, int column); + + + void on_SectorView_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn); + + void on_SampleView_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn); +}; + +#endif // EDITLOGDIALOG_H
