80 lines
1.8 KiB
C++
80 lines
1.8 KiB
C++
#ifndef SCSTW_HPP
|
|
#define SCSTW_HPP
|
|
|
|
#include <QObject>
|
|
#include <QMap>
|
|
|
|
/**
|
|
* @mainpage ScStw Libraries documentation
|
|
*
|
|
* @section intro_sec Introduction
|
|
*
|
|
* This is the Introduction
|
|
*
|
|
* @section section install_sec Installation
|
|
* @subsection step1 Step 1: Opening the box
|
|
*/
|
|
|
|
/**
|
|
* @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 {
|
|
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 {
|
|
InvalidSetting = -1,
|
|
ReadySoundEnableSetting,
|
|
ReadySoundDelaySetting,
|
|
AtYourMarksSoundEnableSetting,
|
|
AtYourMarksSoundDelaySetting,
|
|
SoundVolumeSetting
|
|
};
|
|
Q_ENUM(BaseStationSetting)
|
|
|
|
enum ErrorCode {
|
|
Success = 200,
|
|
|
|
Error = 900,
|
|
NotConnectedError = 910,
|
|
TimeoutError = 911,
|
|
SettingNotAccessibleError = 901
|
|
};
|
|
Q_ENUM(ErrorCode)
|
|
|
|
static const char* SOCKET_MESSAGE_START_KEY;
|
|
static const char* SOCKET_MESSAGE_END_KEY;
|
|
|
|
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
|