comparison OSTC4Operations.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 /// \file OSTC4Operations.h
3 /// \brief Implementing various operations for H&W OSTC4 dive computer
4 /// \author JD Gascuel.
5 /// \sa OSTC3Operations, HardwareOperations.h
6 ///
7 /// \copyright (c) 2016 JD Gascuel. All rights reserved.
8 /// $Id$
9 //////////////////////////////////////////////////////////////////////////////
10 //
11 // BSD 2-Clause License:
12 //
13 // Redistribution and use in source and binary forms, with or without
14 // modification, are permitted provided that the following conditions
15 // are met:
16 //
17 // 1. Redistributions of source code must retain the above copyright notice,
18 // this list of conditions and the following disclaimer.
19 //
20 // 2. Redistributions in binary form must reproduce the above copyright notice,
21 // this list of conditions and the following disclaimer in the documentation
22 // and/or other materials provided with the distribution.
23 //
24 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
28 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
34 // THE POSSIBILITY OF SUCH DAMAGE.
35 //
36 //////////////////////////////////////////////////////////////////////////////
37 // HISTORY
38 // 2015-09-28 jDG: Creation initial (RadioComm) version.
39 // 2016-04-25 jDG: Final H&W version.
40
41 #ifndef OSTC4_OPERATIONS_H
42 #define OSTC4_OPERATIONS_H
43
44 #include "OSTC3Operations.h"
45 #include <QRegularExpression>
46
47 #include "AES/Adler16.h"
48 #include "Export.h"
49 #include <QFile>
50
51 //////////////////////////////////////////////////////////////////////////////
52 /// \brief Implementing various operations for H&W OSTC4 dive computer
53 class OSTC4Operations
54 : public OSTC3Operations
55 {
56 //------------------------------------------------------------------------
57 /// \brief Custom text size (lines and columns).
58 EXPORT QSize nameSize() const override;
59
60 //------------------------------------------------------------------------
61 /// \brief Read OSTC4 computer firmware, serial and custom text.
62 /// Everything is formated for the description() string.
63 /// \throws if something goes wrong.
64 EXPORT void getIdentity() override;
65
66 EXPORT QString model() const override;
67
68 /// \brief Tells what is supported for a given computer.
69 EXPORT CompanionFeatures supported() const override;
70
71 struct FirmwareOSTC4 {
72 uint length;
73 uchar type, dummy5, dummy6, dummy7;
74 uint checksum;
75 struct {
76 unsigned char x, y, z, beta;
77 } version;
78 };
79
80 QFile _file;
81
82 /// \param[in] dryRun: If TRUE, do not upload FW, just check file structure.
83 void openFirmware(const QString& fileName, bool dryRun);
84
85 void loadFirmwarePart(FirmwareOSTC4& header,
86 QByteArray& bin, int part,
87 bool dryRun);
88
89 void getSignal() override;
90 void getAllHeader(unsigned char* pBuffer) override;
91 void writeAllHeader(unsigned char* pBuffer) override;
92 void getAllSamples(unsigned char* pBuffer) override;
93 void writeAllSamples(unsigned char* pBuffer) override;
94
95 EXPORT QString firmwareTemplate() const override;
96 // EXPORT QRegExp portTemplate() const override;
97 EXPORT QRegularExpression portTemplate() const override;
98 EXPORT QStringList listPorts() const override;
99 EXPORT void upgradeFW(const QString &fileName) override;
100
101 Adler32 fileChecksum;
102
103 public:
104 EXPORT OSTC4Operations();
105 };
106
107 #endif // OSTC4_OPERATIONS_H