This repository has been archived on 2024-06-03. You can view files and clone it, but cannot push or open issues or pull requests.
shared-libraries/ScStwLibraries/ScStw.hpp

105 lines
2.6 KiB
C++
Raw Normal View History

#ifndef SCSTW_HPP
#define SCSTW_HPP
#include <QObject>
2020-04-06 22:06:14 +02:00
#include <QMap>
2020-04-08 18:45:01 +02:00
/**
* @mainpage ScStw Libraries documentation
*
* @section intro_sec Introduction
*
2020-04-08 18:53:26 +02:00
* 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.
2020-04-08 18:45:01 +02:00
*
2020-04-08 18:53:26 +02:00
* @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
2020-04-08 18:45:01 +02:00
*/
/**
* @brief The ScStw class provides some shared functions and enums for use in the ScStw project.
*/
class ScStw : public QObject {
Q_OBJECT
public:
/**
* Some global enums
*/
enum RaceState { IDLE, STARTING, WAITING, RUNNING, STOPPED };
Q_ENUM(RaceState)
enum SignalKey {
2020-04-06 22:06:14 +02:00
InvalidSignal = -1,
RaceStateChanged = 9000,
TimersChanged = 9001,
ExtensionsChanged = 9002,
NextStartActionChanged = 9003 /*, ProfilesChanged*/
};
Q_ENUM(SignalKey)
enum NextStartAction { AtYourMarks, Ready, Start, None };
Q_ENUM(NextStartAction)
enum BaseStationSetting {
2020-04-06 22:06:14 +02:00
InvalidSetting = -1,
ReadySoundEnableSetting,
ReadySoundDelaySetting,
AtYourMarksSoundEnableSetting,
AtYourMarksSoundDelaySetting,
SoundVolumeSetting
};
Q_ENUM(BaseStationSetting)
enum ErrorCode {
Success = 200,
Error = 900,
NotConnectedError = 910,
TimeoutError = 911,
2020-04-07 16:35:58 +02:00
SettingNotAccessibleError = 901
};
Q_ENUM(ErrorCode)
static const char* SOCKET_MESSAGE_START_KEY;
static const char* SOCKET_MESSAGE_END_KEY;
2020-04-06 22:06:14 +02:00
static const QMap<QString, ScStw::BaseStationSetting> baseStationSettings;
static BaseStationSetting baseStationSettingfromInt(int i);
static BaseStationSetting baseStationSettingFromString(QString s);
static QString baseStationSettingToString(BaseStationSetting s);
static SignalKey signalKeyFromInt(int i);
private:
ScStw() : QObject(nullptr) {};
};
#endif // SCSTW_HPP