2018-09-29 09:19:44 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "nvhttp.h"
|
2021-07-03 04:34:54 +00:00
|
|
|
#include "nvaddress.h"
|
2018-09-29 09:19:44 +00:00
|
|
|
|
|
|
|
#include <QThread>
|
|
|
|
#include <QReadWriteLock>
|
|
|
|
#include <QSettings>
|
|
|
|
#include <QRunnable>
|
|
|
|
|
|
|
|
class NvComputer
|
|
|
|
{
|
|
|
|
friend class PcMonitorThread;
|
|
|
|
friend class ComputerManager;
|
|
|
|
friend class PendingQuitTask;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void sortAppList();
|
|
|
|
|
2020-08-02 04:06:01 +00:00
|
|
|
bool updateAppList(QVector<NvApp> newAppList);
|
|
|
|
|
2018-09-29 09:19:44 +00:00
|
|
|
bool pendingQuit;
|
|
|
|
|
|
|
|
public:
|
2021-07-02 22:14:48 +00:00
|
|
|
explicit NvComputer(NvHTTP& http, QString serverInfo);
|
2018-09-29 09:19:44 +00:00
|
|
|
|
|
|
|
explicit NvComputer(QSettings& settings);
|
|
|
|
|
2021-07-03 04:34:54 +00:00
|
|
|
void
|
|
|
|
setRemoteAddress(QHostAddress);
|
|
|
|
|
2018-09-29 09:19:44 +00:00
|
|
|
bool
|
|
|
|
update(NvComputer& that);
|
|
|
|
|
|
|
|
bool
|
|
|
|
wake();
|
|
|
|
|
2019-12-02 05:50:36 +00:00
|
|
|
bool
|
|
|
|
isReachableOverVpn();
|
|
|
|
|
2021-07-03 04:34:54 +00:00
|
|
|
QVector<NvAddress>
|
2020-02-25 01:44:21 +00:00
|
|
|
uniqueAddresses() const;
|
2018-09-29 09:19:44 +00:00
|
|
|
|
|
|
|
void
|
2020-02-25 01:44:21 +00:00
|
|
|
serialize(QSettings& settings) const;
|
2018-09-29 09:19:44 +00:00
|
|
|
|
|
|
|
enum PairState
|
|
|
|
{
|
|
|
|
PS_UNKNOWN,
|
|
|
|
PS_PAIRED,
|
|
|
|
PS_NOT_PAIRED
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ComputerState
|
|
|
|
{
|
|
|
|
CS_UNKNOWN,
|
|
|
|
CS_ONLINE,
|
|
|
|
CS_OFFLINE
|
|
|
|
};
|
|
|
|
|
|
|
|
// Ephemeral traits
|
|
|
|
ComputerState state;
|
|
|
|
PairState pairState;
|
2021-07-03 04:34:54 +00:00
|
|
|
NvAddress activeAddress;
|
2021-07-03 05:00:27 +00:00
|
|
|
uint16_t activeHttpsPort;
|
2018-09-29 09:19:44 +00:00
|
|
|
int currentGameId;
|
|
|
|
QString gfeVersion;
|
|
|
|
QString appVersion;
|
|
|
|
QVector<NvDisplayMode> displayModes;
|
|
|
|
int maxLumaPixelsHEVC;
|
|
|
|
int serverCodecModeSupport;
|
|
|
|
QString gpuModel;
|
2021-05-01 01:05:38 +00:00
|
|
|
bool isSupportedServerVersion;
|
2018-09-29 09:19:44 +00:00
|
|
|
|
|
|
|
// Persisted traits
|
2021-07-03 04:34:54 +00:00
|
|
|
NvAddress localAddress;
|
|
|
|
NvAddress remoteAddress;
|
|
|
|
NvAddress ipv6Address;
|
|
|
|
NvAddress manualAddress;
|
2018-09-29 09:19:44 +00:00
|
|
|
QByteArray macAddress;
|
|
|
|
QString name;
|
2020-05-02 01:34:15 +00:00
|
|
|
bool hasCustomName;
|
2018-09-29 09:19:44 +00:00
|
|
|
QString uuid;
|
2018-12-22 02:08:07 +00:00
|
|
|
QSslCertificate serverCert;
|
2018-09-29 09:19:44 +00:00
|
|
|
QVector<NvApp> appList;
|
|
|
|
|
|
|
|
// Synchronization
|
2020-02-25 01:44:21 +00:00
|
|
|
mutable QReadWriteLock lock;
|
2021-07-03 04:34:54 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
uint16_t externalPort;
|
2018-09-29 09:19:44 +00:00
|
|
|
};
|