Mercurial > public > ostc_companion
diff HardwareOperations.h @ 11:6fba58c4964b
Minor changes done by automatic style checker
| author | Ideenmodellierer |
|---|---|
| date | Mon, 12 Jan 2026 13:57:24 +0000 |
| parents | 115cfa4a3239 |
| children |
line wrap: on
line diff
--- a/HardwareOperations.h Mon Jan 12 13:55:38 2026 +0000 +++ b/HardwareOperations.h Mon Jan 12 13:57:24 2026 +0000 @@ -45,15 +45,15 @@ #include <QDateTime> #include <QImage> +#include <QRegularExpression> +#include <QSize> #include <QString> #include <QStringList> -#include <QSize> -#include <QRegularExpression> #ifdef TEST_MODE -# include "test/SerialTest.h" +#include "test/SerialTest.h" #else -# include "Serial.h" +#include "Serial.h" #endif class HexFile; @@ -75,13 +75,13 @@ protected: #ifdef TEST_MODE /// \brief Fake communication port used for mockup operations. - SerialTest _serial; + SerialTest _serial; #else /// \brief Communication port used for all I/O operations. /// /// Note that in *emulation mode*, aka TEST_MODE, this is replaced by /// an instance of SerialTest. - Serial _serial; + Serial _serial; #endif public: @@ -104,7 +104,7 @@ //------------------------------------------------------------------------ /// \brief Gives access to serial port in use. /// Used for other high and low level operations, eg. in *OSTC Planner*. - inline Serial& serial() { return _serial; } + inline Serial &serial() { return _serial; } /// \} ////////////////////////////////////////////////////////////////////////// @@ -120,12 +120,12 @@ /// 8 bit mask. See HardwareDescriptor for known combinations. /// enum HardwareOption { - HW_CHARGEABLE_BATTERY= 0x01, ///< Recharge option. - HW_LIGHT_SENSOR = 0x02, ///< Detects light level, and tune screen. - HW_S8_COM = 0x04, ///< Analog connector to O2 cells. - HW_OPTICAL_COM = 0x08, ///< Digital connector to O2 cells. - HW_BLUETOOTH_COM = 0x10, ///< Bluetooth, hence no USB connection. - HW_DUALCORE = 0x20, ///< Dual core processor. + HW_CHARGEABLE_BATTERY = 0x01, ///< Recharge option. + HW_LIGHT_SENSOR = 0x02, ///< Detects light level, and tune screen. + HW_S8_COM = 0x04, ///< Analog connector to O2 cells. + HW_OPTICAL_COM = 0x08, ///< Digital connector to O2 cells. + HW_BLUETOOTH_COM = 0x10, ///< Bluetooth, hence no USB connection. + HW_DUALCORE = 0x20, ///< Dual core processor. }; ///----------------------------------------------------------------------- @@ -138,20 +138,20 @@ /// enum HardwareDescriptor { HW_UNKNOWN_OSTC = 0, - HW_Frog = HW_BLUETOOTH_COM, + HW_Frog = HW_BLUETOOTH_COM, HW_OSTCSport_a = HW_LIGHT_SENSOR | HW_BLUETOOTH_COM, HW_OSTCSport_b = HW_OSTCSport_a | HW_CHARGEABLE_BATTERY, - HW_OSTC2c = HW_CHARGEABLE_BATTERY, - HW_OSTC2_a = HW_CHARGEABLE_BATTERY | HW_BLUETOOTH_COM, - HW_OSTC2_b = HW_OSTCSport_b, - HW_OSTC2_c = HW_OSTC2_b | HW_OPTICAL_COM, - HW_OSTC3 = HW_LIGHT_SENSOR | HW_OPTICAL_COM, - HW_OSTC3p_a = HW_LIGHT_SENSOR | HW_OPTICAL_COM | HW_BLUETOOTH_COM, - HW_OSTC3p_b = HW_OSTCSport_b, - HW_OSTCcR_a = HW_CHARGEABLE_BATTERY | HW_S8_COM, - HW_OSTCcR_b = HW_OSTCcR_a | HW_LIGHT_SENSOR, - HW_OSTC4 = HW_DUALCORE|HW_BLUETOOTH_COM| - HW_OPTICAL_COM|HW_LIGHT_SENSOR|HW_CHARGEABLE_BATTERY + HW_OSTC2c = HW_CHARGEABLE_BATTERY, + HW_OSTC2_a = HW_CHARGEABLE_BATTERY | HW_BLUETOOTH_COM, + HW_OSTC2_b = HW_OSTCSport_b, + HW_OSTC2_c = HW_OSTC2_b | HW_OPTICAL_COM, + HW_OSTC3 = HW_LIGHT_SENSOR | HW_OPTICAL_COM, + HW_OSTC3p_a = HW_LIGHT_SENSOR | HW_OPTICAL_COM | HW_BLUETOOTH_COM, + HW_OSTC3p_b = HW_OSTCSport_b, + HW_OSTCcR_a = HW_CHARGEABLE_BATTERY | HW_S8_COM, + HW_OSTCcR_b = HW_OSTCcR_a | HW_LIGHT_SENSOR, + HW_OSTC4 = HW_DUALCORE | HW_BLUETOOTH_COM | HW_OPTICAL_COM | HW_LIGHT_SENSOR + | HW_CHARGEABLE_BATTERY }; //------------------------------------------------------------------------ @@ -167,17 +167,17 @@ /// what are the supported command. /// enum CompanionFeature { - PARAMETERS = (1<<0), ///< Download/Edit/Upload various parameters. - DATE = (1<<1), ///< Set date & time. - NAME = (1<<2), ///< Set custom text displayed on main screen. - ICON = (1<<3), ///< Set custom image displayed on main screen. - DUMPSCREEN = (1<<4), ///< Makes copy of current screen. - FIRMWARE = (1<<5), ///< Do firmware upgrades. - HELIUM_DIVE = (1<<6), ///< Computes deco stops for trimix dives. - CCR_DIVE = (1<<7), ///< Computes deco stops for rebreather dives. - BLUETOOTH = (1<<8), ///< Use Bluetooh communication (instead of USB) - VPM_MODEL = (1<<9), ///< Also propose VPM deco stops. - SIGNAL_CHECK = (1<<10) ///< Echo signal quality for bluetooth computer + PARAMETERS = (1 << 0), ///< Download/Edit/Upload various parameters. + DATE = (1 << 1), ///< Set date & time. + NAME = (1 << 2), ///< Set custom text displayed on main screen. + ICON = (1 << 3), ///< Set custom image displayed on main screen. + DUMPSCREEN = (1 << 4), ///< Makes copy of current screen. + FIRMWARE = (1 << 5), ///< Do firmware upgrades. + HELIUM_DIVE = (1 << 6), ///< Computes deco stops for trimix dives. + CCR_DIVE = (1 << 7), ///< Computes deco stops for rebreather dives. + BLUETOOTH = (1 << 8), ///< Use Bluetooh communication (instead of USB) + VPM_MODEL = (1 << 9), ///< Also propose VPM deco stops. + SIGNAL_CHECK = (1 << 10) ///< Echo signal quality for bluetooth computer }; Q_DECLARE_FLAGS(CompanionFeatures, CompanionFeature) /// \brief Tells what is supported for a given computer. @@ -205,7 +205,7 @@ /// different file formats (due to support tool, and/or need for /// encryption). /// So each driver have to implement its specific loader. - virtual void loadFirmware(HexFile&, const QString& fileName) const = 0; + virtual void loadFirmware(HexFile &, const QString &fileName) const = 0; //------------------------------------------------------------------------ /// \brief Regular expression to filter *USB* or *Bluetooth* port names. @@ -213,7 +213,7 @@ /// Used to propose only the list of ports that matches the serial ports /// compatible with USB/Bluetooth emulation and the connected dive /// computer. - // virtual QRegExp portTemplate() const = 0; + // virtual QRegExp portTemplate() const = 0; virtual QRegularExpression portTemplate() const = 0; /// \} ////////////////////////////////////////////////////////////////////////// @@ -252,15 +252,15 @@ /// Used on most devices to display commands as they are processed, /// so the user can see *OSTC Companion* is working properly, by seeing /// progress on the dive computer itself. - virtual void writeText(const QString& msg) = 0; + virtual void writeText(const QString &msg) = 0; //------------------------------------------------------------------------ /// \brief Set HW dive computer date and time. - virtual void setDate(const QDateTime& date) = 0; + virtual void setDate(const QDateTime &date) = 0; //------------------------------------------------------------------------ /// \brief Set HW dive computer user text. - virtual void setName(const QString& newName) = 0; + virtual void setName(const QString &newName) = 0; //------------------------------------------------------------------------ /// \brief Display signal quality at OSTC. @@ -268,26 +268,25 @@ //------------------------------------------------------------------------ /// \brief Read all header from OSTC - virtual void getAllHeader(unsigned char* pBuffer) = 0; + virtual void getAllHeader(unsigned char *pBuffer) = 0; //------------------------------------------------------------------------ /// \brief Write all header from OSTC - virtual void writeAllHeader(unsigned char* pBuffer) = 0; - + virtual void writeAllHeader(unsigned char *pBuffer) = 0; //------------------------------------------------------------------------ /// \brief Read all samples from OSTC - virtual void getAllSamples(unsigned char* pBuffer) = 0; + virtual void getAllSamples(unsigned char *pBuffer) = 0; //------------------------------------------------------------------------ /// \brief Write all samples to OSTC - virtual void writeAllSamples(unsigned char* pBuffer) = 0; + virtual void writeAllSamples(unsigned char *pBuffer) = 0; //------------------------------------------------------------------------ /// \brief Set HW dive computer icon set /// /// *Currently only supported by Frog dive computer*. - virtual void setIcons(const QString& fileName) = 0; + virtual void setIcons(const QString &fileName) = 0; //------------------------------------------------------------------------ /// \brief Take a snapshot of the connected computer's screen. @@ -300,7 +299,7 @@ /// /// \note needs service mode connection. /// \sa connectServiceMode(). - virtual void upgradeFW(const QString& fileName) = 0; + virtual void upgradeFW(const QString &fileName) = 0; //------------------------------------------------------------------------ /// \brief Close connection. @@ -338,9 +337,7 @@ /// \param [in] retries: Optional max number of retries. Default to 10. /// /// \returns the ack byte (if any), or 0xFF if never received. - static unsigned char retryCommand(Serial& serial, - unsigned char cmd, - int retries = 10); + static unsigned char retryCommand(Serial &serial, unsigned char cmd, int retries = 10); //------------------------------------------------------------------------ /// \brief Read and check connected dive computer identity. @@ -395,7 +392,6 @@ /// Ask *OS* for the list of USB serial emulation currently connected whose name /// matches the portTemplate() regular expression. QStringList listUSBPorts() const; - }; #endif // COMPUTEROPERATIONS_H
