From f5acde704b9c14a6b221ecd91f5c9ab9bb8551f7 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Tue, 22 Sep 2020 15:53:44 +0200 Subject: [PATCH] - added ExtensionType and ExtensionState enums - added extensionTypeToString enum --- ScStwLibraries/headers/ScStw.hpp | 28 ++++++++++++++++++++++++++++ ScStwLibraries/sources/ScStw.cpp | 11 +++++++++++ 2 files changed, 39 insertions(+) diff --git a/ScStwLibraries/headers/ScStw.hpp b/ScStwLibraries/headers/ScStw.hpp index c353675..d977370 100644 --- a/ScStwLibraries/headers/ScStw.hpp +++ b/ScStwLibraries/headers/ScStw.hpp @@ -132,6 +132,25 @@ public: }; Q_ENUM(ScStw::StatusCode) + /*! + * \brief The ExtensionType enum contains all types of extensions + */ + enum ExtensionType { + StartPad, + TopPad + }; + Q_ENUM(ExtensionType); + + + enum ExtensionState { + Disconnected = 0, + Connecting = 1, + Initialising = 2, + Connected = 3 + }; + Q_ENUM(ExtensionState); + + /*! * \brief SOCKET_MESSAGE_START_KEY contains the key, a message is supposed to start with */ @@ -160,6 +179,15 @@ public: */ static SocketCommand socketCommandFromInt(int i); + /*! + * \brief Function to convert an ExtensionType to a string + * \param t the ExtensionType to convert + * \return String + * + * \see ScStwExtensionType + */ + static QString extensionTypeToStrin(ExtensionType t); + /*! * \brief Function to compare to string firmware versions in .. formar * \param a version a diff --git a/ScStwLibraries/sources/ScStw.cpp b/ScStwLibraries/sources/ScStw.cpp index 2cc19f0..dc3cdc3 100644 --- a/ScStwLibraries/sources/ScStw.cpp +++ b/ScStwLibraries/sources/ScStw.cpp @@ -39,6 +39,17 @@ ScStw::SocketCommand ScStw::socketCommandFromInt(int i) { return c; } +QString ScStw::extensionTypeToString(ExtensionType t) { + switch (t) { + case StartPad: + return "StartPad"; + case TopPad: + return "TopPad"; + default: + return "Invalid"; + } +} + int ScStw::firmwareCompare(QString a, QString b) { /* * * \return -3: major of a is lower than b