#ifndef SCSTW_HPP #define SCSTW_HPP #include #include /*! * \mainpage ScStw Libraries documentation * * \section intro_sec Introduction * * This library is meant for usage with the Speed climbing stopwatch project. * It contains some helper classes to build a client application for the ScStw basestation with Qt. * * \section section Installation * \code{.sh} * cd yourRepo * git submodule add https://git.itsblue.de/ScStw/shared-libraries/ * git submodule update --init --recursive * \endcode * * Add to the list of libraries for the Qt-Secret assembly. For an example you can create Main.Pro in which connect Qt-Secret and your project.pro files as subprojects. * * Main.pro: * \code{.pro} * TEMPLATE = subdirs * CONFIG += ordered * * SUBDIRS += \ * ScStwLibraries \ * MyProject * * ScStwLibraries.file = shared-libraries/ScStwLibraries/ScStwLibraries.pro * \endcode * * And in your MyProject.pro include the .pri file: * \code{.pro} * include($$PWD/../shared-libraries/ScStwLibraries/ScStwLibraries.pri) * \endcode */ /*! * \brief The ScStw class provides some shared functions and enums for use in the ScStw project. */ class ScStw : public QObject { Q_OBJECT public: /*! * \brief The SignalKey enum contains all signal keys a client can subscribe to * * \see ScStw::signalKeyFromInt() */ enum SignalKey { InvalidSignal = -1, RaceStateChanged = 9000, TimersChanged = 9001, ExtensionsChanged = 9002, NextStartActionChanged = 9003 /*, ProfilesChanged*/ }; Q_ENUM(SignalKey) /*! * \brief The BaseStationSetting enum contains all settings of the base station that can be changed by a client * * \see ScStw::baseStationSettingFromInt() * \see ScStw::baseStationSettingToString() * \see ScStw::baseStationSettingFromString() * \see ScStw::baseStationSettings */ enum BaseStationSetting { InvalidSetting = -1, ReadySoundEnableSetting, ReadySoundDelaySetting, AtYourMarksSoundEnableSetting, AtYourMarksSoundDelaySetting, SoundVolumeSetting }; Q_ENUM(BaseStationSetting) /*! * \brief The ErrorCode enum contains all error codes that can occur when sending a command to the basestation */ enum ErrorCode { Success = 200, Error = 900, NotConnectedError = 910, TimeoutError = 911, SettingNotAccessibleError = 901 }; Q_ENUM(ErrorCode) /*! * \brief SOCKET_MESSAGE_START_KEY contains the key, a message is supposed to start with */ static const char* SOCKET_MESSAGE_START_KEY; /*! * \brief SOCKET_MESSAGE_END_KEY contains the key, a message is supposed to end with */ static const char* SOCKET_MESSAGE_END_KEY; /*! * \brief baseStationSettings contains a string with reference to all BaseStationSetting values * * \see ScStw::BaseStationSetting * \see ScStw::baseStationSettingToString() * \see ScStw::baseStationSettingFromString() */ static const QMap baseStationSettings; /*! * \brief Function to convert an int to a BaseStationSetting * \param i the int to convert * \return a BaseStationSetting * * \see ScStw::BaseStationSetting */ static BaseStationSetting baseStationSettingfromInt(int i); /*! * \brief Function to convert a QString to a BaseStationSetting * \param s the string to convert * \return a BaseStationSetting * * \see ScStw::BaseStationSetting * \see ScStw::baseStationSettingToString() */ static BaseStationSetting baseStationSettingFromString(QString s); /*! * \brief Function to convert BaseStationSetting to a QString * \param s the BaseStationSetting to convert * \return a QString * * \see ScStw::BaseStationSetting * \see ScStw::baseStationSettingFromString() */ static QString baseStationSettingToString(BaseStationSetting s); /*! * \brief Function to convert an int to a SignalKey * \param i the int to convert * \return a SignalKey * * \see ScStw::SignalKey */ static SignalKey signalKeyFromInt(int i); private: ScStw() : QObject(nullptr) {}; }; #endif // SCSTW_HPP