ScStw class

The ScStw class provides some shared functions and enums for use in the ScStw project.

Public types

enum SignalKey { InvalidSignal = -1, RaceStateChanged = 9000, TimersChanged = 9001, ExtensionsChanged = 9002, CurrentStartDelayChanged = 9003, SettingChanged = 9004, RaceDetailsChanged = 9005 }
The SignalKey enum contains all signal keys a client can subscribe to.
enum SocketCommand { InvalidCommand = -1, InitializeSessionCommand = 1, StartRaceCommand = 1000, StopRaceCommand = 1001, ResetRaceCommand = 1002, CancelRaceCommand = 1003, SetTimerDisabledCommand = 1004, GetRaceStateCommand = 2000, GetRaceDetailsCommand = 2001, GetExtensionsCommand = 2006, GetTimersCommand = 2007, GetCurrentStartDelayCommand = 2009, WriteSettingCommand = 3000, ReadSettingCommand = 3001, LoginAthleteCommand = 4000, CreateAthleteCommand = 4001, DeleteAthleteCommand = 4002, GetAtheletesCommand = 4003, GetAthleteResultsCommand = 4004, UpdateFirmwareCommand = 5000, UpdateSystemTimeCommand = 5001, PairExtensionsCommand = 5002 }
The SocketCommand enum contains all commands the base station can handle.
enum StatusCode { Success = 200, FirmwareAlreadyUpToDateInfo = 304, AccessDeniedError = 401, UpdateSignatureInvalidError = 402, CurrentStateNotVaildForOperationError = 403, CommandNotFoundError = 404, RequiredParameterNotGivenError = 405, TimestampTooSmallError = 406, ClientSessionAlreadyActiveError = 407, NoSessionActiveError = 408, ItemNotFoundError = 409, LastTimerCannotBeDisabledError = 410, UpdateFailedError = 500, Error = 900, NotConnectedError = 910, TimeoutError = 911, SettingNotAccessibleError = 901, InternalError = 950, InternalErrorTimerOperationFailed = 951, ApiVersionNotSupportedError = 952, CompetitionModeProhibitsThisError = 953, FirmwareUpdateFormatInvalidError = 954, TimersNotReadyError = 501 }
The ErrorCode enum contains all error codes that can occur when sending a command to the basestation.
enum ExtensionType { StartPad, TopPad }
The ExtensionType enum contains all types of extensions.
enum ExtensionState { ExtensionDisconnected = 0, ExtensionConnecting = 1, ExtensionInitialising = 2, ExtensionConnected = 3 }
The ExtensionState enum contains all possible states of an extension.
enum ExtensionBatteryState { BatteryUnknown = -1, BatteryCritical = 0, BatteryWarning = 1, BatteryFine = 2, BatteryCharging = 3, BatteryNotCharging = 4 }
The ExtensionBatteryState enum contains all possible battery states of an extension.
enum PadState { PadNotPressed = 0, PadPressed = 1 }
The PadState enum contains whether a pad is currently pressed or not.

Public static variables

static const char* SOCKET_MESSAGE_START_KEY
SOCKET_MESSAGE_START_KEY contains the key, a message is supposed to start with.
static const char* SOCKET_MESSAGE_END_KEY
SOCKET_MESSAGE_END_KEY contains the key, a message is supposed to end with.

Public static functions

static auto signalKeyFromInt(int i) -> SignalKey
Function to convert an int to a SignalKey.
static auto socketCommandFromInt(int i) -> SocketCommand
Function to convert an int to a SocketCommand.
static auto extensionTypeToString(ExtensionType t) -> QString
Function to convert an ExtensionType to a string.
static auto firmwareCompare(QString a, QString b) -> int
Function to compare to string firmware versions in <major>.<minor>.<patch> formar.
template<typename Enum>
static auto toEnumValue(const int& value, bool* ok) -> Enum
Function to convert a value to an enum.

Enum documentation

enum ScStw::SignalKey

The SignalKey enum contains all signal keys a client can subscribe to.

enum ScStw::SocketCommand

The SocketCommand enum contains all commands the base station can handle.

Function documentation

static SignalKey ScStw::signalKeyFromInt(int i)

Function to convert an int to a SignalKey.

Parameters
i the int to convert
Returns a SignalKey

static SocketCommand ScStw::socketCommandFromInt(int i)

Function to convert an int to a SocketCommand.

Parameters
i the int to convert
Returns a SocketCommand

static QString ScStw::extensionTypeToString(ExtensionType t)

Function to convert an ExtensionType to a string.

Parameters
t the ExtensionType to convert
Returns String

static int ScStw::firmwareCompare(QString a, QString b)

Function to compare to string firmware versions in <major>.<minor>.<patch> formar.

Parameters
a version a
b version b
Returns -4: a is of invalid format -3: major of a is lower than b -2: minor of a is lower than b -1: patch of a is lower than b 0: a and b are identical 1: patch b is lower than a 2: minor of b is lower than a 3: major of b is lower than a 4: b is of invalid format