2018-09-29 02:19:44 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "nvhttp.h"
|
2021-07-02 23:34:54 -05:00
|
|
|
#include "nvaddress.h"
|
2018-09-29 02:19:44 -07: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-01 21:06:01 -07:00
|
|
|
bool updateAppList(QVector<NvApp> newAppList);
|
|
|
|
|
2018-09-29 02:19:44 -07:00
|
|
|
bool pendingQuit;
|
|
|
|
|
|
|
|
public:
|
2021-07-02 17:14:48 -05:00
|
|
|
explicit NvComputer(NvHTTP& http, QString serverInfo);
|
2018-09-29 02:19:44 -07:00
|
|
|
|
|
|
|
explicit NvComputer(QSettings& settings);
|
|
|
|
|
2021-07-02 23:34:54 -05:00
|
|
|
void
|
|
|
|
setRemoteAddress(QHostAddress);
|
|
|
|
|
2018-09-29 02:19:44 -07:00
|
|
|
bool
|
|
|
|
update(NvComputer& that);
|
|
|
|
|
|
|
|
bool
|
|
|
|
wake();
|
|
|
|
|
2019-12-01 21:50:36 -08:00
|
|
|
bool
|
|
|
|
isReachableOverVpn();
|
|
|
|
|
2021-07-02 23:34:54 -05:00
|
|
|
QVector<NvAddress>
|
2020-02-24 17:44:21 -08:00
|
|
|
uniqueAddresses() const;
|
2018-09-29 02:19:44 -07:00
|
|
|
|
|
|
|
void
|
2020-02-24 17:44:21 -08:00
|
|
|
serialize(QSettings& settings) const;
|
2018-09-29 02:19:44 -07: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-02 23:34:54 -05:00
|
|
|
NvAddress activeAddress;
|
2021-07-03 00:00:27 -05:00
|
|
|
uint16_t activeHttpsPort;
|
2018-09-29 02:19:44 -07:00
|
|
|
int currentGameId;
|
|
|
|
QString gfeVersion;
|
|
|
|
QString appVersion;
|
|
|
|
QVector<NvDisplayMode> displayModes;
|
|
|
|
int maxLumaPixelsHEVC;
|
|
|
|
int serverCodecModeSupport;
|
|
|
|
QString gpuModel;
|
2021-04-30 20:05:38 -05:00
|
|
|
bool isSupportedServerVersion;
|
2018-09-29 02:19:44 -07:00
|
|
|
|
|
|
|
// Persisted traits
|
2021-07-02 23:34:54 -05:00
|
|
|
NvAddress localAddress;
|
|
|
|
NvAddress remoteAddress;
|
|
|
|
NvAddress ipv6Address;
|
|
|
|
NvAddress manualAddress;
|
2018-09-29 02:19:44 -07:00
|
|
|
QByteArray macAddress;
|
|
|
|
QString name;
|
2020-05-01 18:34:15 -07:00
|
|
|
bool hasCustomName;
|
2018-09-29 02:19:44 -07:00
|
|
|
QString uuid;
|
2018-12-21 18:08:07 -08:00
|
|
|
QSslCertificate serverCert;
|
2018-09-29 02:19:44 -07:00
|
|
|
QVector<NvApp> appList;
|
|
|
|
|
|
|
|
// Synchronization
|
2020-02-24 17:44:21 -08:00
|
|
|
mutable QReadWriteLock lock;
|
2021-07-02 23:34:54 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
uint16_t externalPort;
|
2018-09-29 02:19:44 -07:00
|
|
|
};
|