Mercurial > public > ostc_companion
comparison OSTC2cOperations.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 OSTC2cOperations.h | |
| 3 /// \brief Implementing various operations for H&W OSTC2, mk2, 2n, 2c dive computer | |
| 4 /// \author JD Gascuel. | |
| 5 /// \sa ComputerOperations.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 // HISTORY | |
| 38 // 2013-10-26 : [jDG] Creation. | |
| 39 // 2015-03-16 : [jDG] Renamed OSTC2c | |
| 40 | |
| 41 #ifndef OSTC_2c_OPERATIONS_H | |
| 42 #define OSTC_2c_OPERATIONS_H | |
| 43 | |
| 44 #include "HardwareOperations.h" | |
| 45 | |
| 46 ////////////////////////////////////////////////////////////////////////////// | |
| 47 | |
| 48 class OSTC2cOperations | |
| 49 : public HardwareOperations | |
| 50 { | |
| 51 int _computerFirmware; | |
| 52 int _computerSerial; | |
| 53 QString _customText; | |
| 54 QString _description; | |
| 55 | |
| 56 typedef unsigned char byte; | |
| 57 | |
| 58 ////////////////////////////////////////////////////////////////////////// | |
| 59 /// \{ \section Low level OSTC2 operations. | |
| 60 | |
| 61 void readBank0(byte bank0[256]); | |
| 62 void readBank1(byte bank1[256]); | |
| 63 void writeBank0(const byte bank0[256]); | |
| 64 | |
| 65 void getIdentity() override; | |
| 66 | |
| 67 /// \brief The fw version found during the last getIdentty(). | |
| 68 int firmware() const override; | |
| 69 | |
| 70 /// \brief The serial number found during the last getIdentty(). | |
| 71 int serialNumber() const override; | |
| 72 | |
| 73 /// \brief The user-defined string found during the last getIdentty(). | |
| 74 QString customText() const override; | |
| 75 | |
| 76 /// \} | |
| 77 ////////////////////////////////////////////////////////////////////////// | |
| 78 /// \{ \section Configuration management. | |
| 79 | |
| 80 //QRegExp portTemplate() const override; | |
| 81 QRegularExpression portTemplate() const override; | |
| 82 QStringList listPorts() const override; | |
| 83 | |
| 84 QString model() const override; | |
| 85 QString description() override; | |
| 86 CompanionFeatures supported() const override; | |
| 87 | |
| 88 QString firmwareTemplate() const override; | |
| 89 | |
| 90 /// \} | |
| 91 ////////////////////////////////////////////////////////////////////////// | |
| 92 /// \{ \section OSTC2 high-level commands. | |
| 93 | |
| 94 bool connect() override; | |
| 95 void connectServiceMode() override; | |
| 96 void writeText(const QString &msg) override; | |
| 97 QSize nameSize() const override; | |
| 98 void setDate(const QDateTime& date) override; | |
| 99 void setName(const QString& newName) override; | |
| 100 void getSignal() override; | |
| 101 void getAllHeader(unsigned char* pBuffer) override; | |
| 102 void writeAllHeader(unsigned char* pBuffer) override; | |
| 103 void getAllSamples(unsigned char* pBuffer) override; | |
| 104 void writeAllSamples(unsigned char* pBuffer) override; | |
| 105 | |
| 106 void setIcons(const QString& fileName) override; | |
| 107 QImage dumpScreen() const override; | |
| 108 | |
| 109 void upgradeFW(const QString& fileName) override; | |
| 110 void loadFirmware(HexFile& hex, const QString& fileName) const override; | |
| 111 | |
| 112 bool disconnect(bool closing = false) override; | |
| 113 | |
| 114 /// \} | |
| 115 ////////////////////////////////////////////////////////////////////////// | |
| 116 | |
| 117 public: | |
| 118 OSTC2cOperations(); | |
| 119 }; | |
| 120 | |
| 121 #endif // OSTC_2c_OPERATIONS_H |
