comparison OSTC3pOperations.cpp @ 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 OSTC3pOperations.h
3 /// \brief Implementing various operations for new H&W OSTC3 (BLE) dive computer
4 /// \author JD Gascuel.
5 /// \sa OSTC3Operations.h
6 ///
7 /// \copyright (c) 2011-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
38 #include "OSTC3pOperations.h"
39 #include "Utils/Log.h"
40 #include <QRegularExpression>
41
42 //////////////////////////////////////////////////////////////////////////////
43
44 OSTC3pOperations::OSTC3pOperations()
45 {
46 emulatorName = "OSTC3p";
47 }
48
49 //////////////////////////////////////////////////////////////////////////////
50
51 QStringList OSTC3pOperations::listPorts() const
52 {
53 return listBluetoothPorts();
54 }
55
56 //////////////////////////////////////////////////////////////////////////////
57
58 void OSTC3pOperations::getIdentity()
59 {
60 descriptionString.clear();
61
62 LOG_TRACE("Getting model...");
63 HardwareDescriptor hw = hardwareDescriptor();
64
65 // if( hw != HW_OSTC3p_a && hw != HW_OSTC3p_b )
66 // LOG_THROW("Not an OSTC3+.");
67
68 LOG_TRACE("Getting identity...");
69 getCommonIdentity();
70
71 LOG_TRACE("Found " << descriptionString);
72 }
73
74 //////////////////////////////////////////////////////////////////////////////
75
76 QString OSTC3pOperations::model() const
77 {
78 return "OSTC hwOS (Bluetooth)";
79 }
80
81 QString OSTC3pOperations::firmwareTemplate() const
82 {
83 return "*_firmware.hex";
84 }
85
86 //////////////////////////////////////////////////////////////////////////////
87
88 HardwareOperations::CompanionFeatures OSTC3pOperations::supported() const
89 {
90 // No ICON, no DUMPSCREEN, no VPM
91 return CompanionFeatures(PARAMETERS|DATE|NAME|FIRMWARE
92 |HELIUM_DIVE|CCR_DIVE|BLUETOOTH);
93 }
94 #if 0
95 QRegExp OSTC3pOperations::portTemplate() const
96 {
97 #if defined(Q_OS_MAC)
98 return QRegExp("tty.OSTC[0-9][0-9]+.*", Qt::CaseInsensitive);
99 #elif defined(Q_OS_LINUX)
100 // Seems ok for debian, ubuntu, redhat, CentOS and SUSE (google dixit)
101 return QRegExp("ttyUSB.*", Qt::CaseSensitive);
102 #elif defined(Q_OS_WIN)
103 return QRegExp("COM.*", Qt::CaseSensitive);
104 #endif
105 }
106 #endif
107
108 #include <QRegularExpression>
109
110 QRegularExpression OSTC3pOperations::portTemplate() const
111 {
112 #if defined(Q_OS_MAC)
113 return QRegularExpression("tty.OSTC[0-9][0-9]+.*",
114 QRegularExpression::CaseInsensitiveOption);
115 #elif defined(Q_OS_LINUX)
116 // Debian, Ubuntu, RedHat, CentOS, SUSE
117 return QRegularExpression("ttyUSB.*"); // default: case-sensitive
118 #elif defined(Q_OS_WIN)
119 return QRegularExpression("COM.*"); // default: case-sensitive
120 #endif
121 }
122
123 void OSTC3pOperations::getSignal()
124 {
125 return;
126 }