2020-06-07 14:43:47 +02:00
|
|
|
/****************************************************************************
|
|
|
|
** ScStw Libraries
|
|
|
|
** Copyright (C) 2020 Itsblue development
|
|
|
|
**
|
|
|
|
** This program is free software: you can redistribute it and/or modify
|
|
|
|
** it under the terms of the GNU General Public License as published by
|
|
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
|
|
** (at your option) any later version.
|
|
|
|
**
|
|
|
|
** This program is distributed in the hope that it will be useful,
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
** GNU General Public License for more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
****************************************************************************/
|
|
|
|
|
2020-04-18 14:25:48 +02:00
|
|
|
#ifndef SCSTWREMOTEMONITORRACE_H
|
|
|
|
#define SCSTWREMOTEMONITORRACE_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include "scstwrace.h"
|
|
|
|
#include "scstwclient.h"
|
2020-10-02 19:56:08 +02:00
|
|
|
#include "scstwremotetimer.h"
|
2020-10-03 11:10:15 +02:00
|
|
|
#include "scstwsoundplayer.h"
|
2020-04-18 14:25:48 +02:00
|
|
|
|
2020-10-02 19:56:08 +02:00
|
|
|
class ScStwRemoteRace : public ScStwRace
|
2020-04-18 14:25:48 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2020-10-09 15:18:56 +02:00
|
|
|
Q_PROPERTY(ScStwClient* scStwClient READ getScStwClient WRITE setScStwClient NOTIFY scStwClientChanged)
|
|
|
|
|
2020-04-18 14:25:48 +02:00
|
|
|
public:
|
2020-10-09 15:18:56 +02:00
|
|
|
ScStwRemoteRace(QObject *parent = nullptr);
|
2020-10-03 15:15:49 +02:00
|
|
|
ScStwRemoteRace(ScStwClient *scStwClient, ScStwSettings *settings = nullptr, QObject *parent = nullptr);
|
2020-10-03 13:06:14 +02:00
|
|
|
|
|
|
|
enum RaceMode {
|
|
|
|
LOCAL,
|
|
|
|
REMOTE
|
|
|
|
};
|
2020-04-18 14:25:48 +02:00
|
|
|
|
|
|
|
protected:
|
2020-10-02 16:49:24 +02:00
|
|
|
double currentStartTotalDelay;
|
|
|
|
double currentStartDelayStartedAt;
|
2020-10-03 11:44:56 +02:00
|
|
|
double latestStartDelayProgress;
|
2020-10-03 11:10:15 +02:00
|
|
|
bool isReadyForNextState;
|
2020-10-03 13:06:14 +02:00
|
|
|
bool readySoundEnabled;
|
2020-04-18 14:25:48 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
ScStwClient *scStwClient;
|
2020-10-02 19:56:08 +02:00
|
|
|
QList<ScStwRemoteTimer*> remoteTimers;
|
2020-10-03 13:06:14 +02:00
|
|
|
QList<ScStwTimer*> localTimers;
|
2020-04-18 14:25:48 +02:00
|
|
|
|
|
|
|
public slots:
|
2020-10-03 13:06:14 +02:00
|
|
|
ScStw::StatusCode start(bool asyncronous = true);
|
2020-10-02 16:49:24 +02:00
|
|
|
ScStw::StatusCode cancel();
|
|
|
|
ScStw::StatusCode stop();
|
|
|
|
ScStw::StatusCode reset();
|
2020-10-06 14:00:22 +02:00
|
|
|
ScStw::StatusCode setTimerDisabled(int id, bool disabled);
|
2020-04-18 14:25:48 +02:00
|
|
|
bool addTimer(ScStwTimer *timer);
|
2020-10-03 11:44:56 +02:00
|
|
|
QVariantMap getCurrentStartDelay();
|
2020-10-03 11:10:15 +02:00
|
|
|
bool getIsReadyForNextState();
|
2020-10-03 13:06:14 +02:00
|
|
|
bool getReadySoundEnabled();
|
2020-04-18 14:25:48 +02:00
|
|
|
|
2020-10-09 15:18:56 +02:00
|
|
|
ScStwClient *getScStwClient();
|
|
|
|
void setScStwClient(ScStwClient *client);
|
|
|
|
|
2020-04-18 14:25:48 +02:00
|
|
|
private slots:
|
|
|
|
void handleBaseStationSignal(ScStw::SignalKey key, QVariant data);
|
2020-10-03 15:15:49 +02:00
|
|
|
|
2020-04-18 14:25:48 +02:00
|
|
|
bool refreshRemoteTimers(QVariantList remoteTimers);
|
2020-10-03 13:06:14 +02:00
|
|
|
void rebuildRemoteTimers(QVariantList remoteTimers);
|
2020-10-03 11:10:15 +02:00
|
|
|
void refreshDetails(QVariantMap details);
|
2020-10-03 13:06:14 +02:00
|
|
|
void handleClientStateChange();
|
2020-10-03 18:32:39 +02:00
|
|
|
|
|
|
|
void refreshCompetitionMode();
|
2020-10-03 13:06:14 +02:00
|
|
|
RaceMode getMode();
|
|
|
|
bool local();
|
2020-10-09 15:18:56 +02:00
|
|
|
|
2020-10-19 11:15:49 +02:00
|
|
|
void setTimers(QList<ScStwTimer*> timers, bool deleteOldTimers);
|
|
|
|
|
2020-10-09 15:18:56 +02:00
|
|
|
signals:
|
|
|
|
void scStwClientChanged();
|
2020-04-18 14:25:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SCSTWREMOTEMONITORRACE_H
|