- added ExtensionType and ExtensionState enums

- added extensionTypeToString enum
This commit is contained in:
Dorian Zedler 2020-09-22 15:53:44 +02:00
parent d210a75d51
commit f5acde704b
Signed by: dorian
GPG key ID: D3B255CB8BC7CD37
2 changed files with 39 additions and 0 deletions

View file

@ -132,6 +132,25 @@ public:
}; };
Q_ENUM(ScStw::StatusCode) 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 * \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); 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 <major>.<minor>.<patch> formar * \brief Function to compare to string firmware versions in <major>.<minor>.<patch> formar
* \param a version a * \param a version a

View file

@ -39,6 +39,17 @@ ScStw::SocketCommand ScStw::socketCommandFromInt(int i) {
return c; 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) { int ScStw::firmwareCompare(QString a, QString b) {
/* /*
* * \return -3: major of a is lower than b * * \return -3: major of a is lower than b