2018-04-28 22:39:50 +00:00
|
|
|
#pragma once
|
|
|
|
|
2018-04-29 05:14:27 +00:00
|
|
|
#include "identitymanager.h"
|
|
|
|
|
2018-06-24 07:14:23 +00:00
|
|
|
#include <Limelight.h>
|
|
|
|
|
2018-04-28 22:39:50 +00:00
|
|
|
#include <QUrl>
|
|
|
|
#include <QtNetwork/QNetworkAccessManager>
|
|
|
|
|
2018-06-27 06:39:28 +00:00
|
|
|
class NvApp
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bool operator==(const NvApp& other) const
|
|
|
|
{
|
|
|
|
return id == other.id;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isInitialized()
|
|
|
|
{
|
|
|
|
return id != 0 && !name.isNull();
|
|
|
|
}
|
|
|
|
|
|
|
|
int id;
|
|
|
|
QString name;
|
|
|
|
bool hdrSupported;
|
|
|
|
};
|
|
|
|
|
2018-06-28 05:02:29 +00:00
|
|
|
Q_DECLARE_METATYPE(NvApp)
|
|
|
|
|
2018-07-09 03:53:24 +00:00
|
|
|
class NvDisplayMode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bool operator==(const NvDisplayMode& other) const
|
|
|
|
{
|
|
|
|
return width == other.width &&
|
|
|
|
height == other.height &&
|
|
|
|
refreshRate == other.refreshRate;
|
|
|
|
}
|
|
|
|
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
int refreshRate;
|
|
|
|
};
|
|
|
|
|
2018-04-29 00:08:05 +00:00
|
|
|
class GfeHttpResponseException : public std::exception
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GfeHttpResponseException(int statusCode, QString message) :
|
|
|
|
m_StatusCode(statusCode),
|
|
|
|
m_StatusMessage(message)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* what() const throw()
|
|
|
|
{
|
2018-04-29 05:14:27 +00:00
|
|
|
return m_StatusMessage.toLatin1();
|
2018-04-29 00:08:05 +00:00
|
|
|
}
|
|
|
|
|
2018-04-29 05:14:27 +00:00
|
|
|
const char* getStatusMessage() const
|
2018-04-29 00:08:05 +00:00
|
|
|
{
|
2018-04-29 05:14:27 +00:00
|
|
|
return m_StatusMessage.toLatin1();
|
2018-04-29 00:08:05 +00:00
|
|
|
}
|
|
|
|
|
2018-04-29 05:14:27 +00:00
|
|
|
int getStatusCode() const
|
2018-04-29 00:08:05 +00:00
|
|
|
{
|
|
|
|
return m_StatusCode;
|
|
|
|
}
|
|
|
|
|
2018-07-07 23:30:26 +00:00
|
|
|
QString toQString() const
|
|
|
|
{
|
|
|
|
return m_StatusMessage + " (Error " + QString::number(m_StatusCode) + ")";
|
|
|
|
}
|
|
|
|
|
2018-04-29 00:08:05 +00:00
|
|
|
private:
|
|
|
|
int m_StatusCode;
|
|
|
|
QString m_StatusMessage;
|
|
|
|
};
|
|
|
|
|
2018-04-28 22:39:50 +00:00
|
|
|
class NvHTTP
|
|
|
|
{
|
|
|
|
public:
|
2018-06-28 02:55:44 +00:00
|
|
|
explicit NvHTTP(QString address);
|
2018-04-28 22:39:50 +00:00
|
|
|
|
2018-06-27 04:47:01 +00:00
|
|
|
static
|
2018-04-29 00:08:05 +00:00
|
|
|
int
|
|
|
|
getCurrentGame(QString serverInfo);
|
|
|
|
|
|
|
|
QString
|
|
|
|
getServerInfo();
|
|
|
|
|
2018-06-27 04:47:01 +00:00
|
|
|
static
|
2018-04-29 00:08:05 +00:00
|
|
|
void
|
|
|
|
verifyResponseStatus(QString xml);
|
|
|
|
|
2018-06-27 04:47:01 +00:00
|
|
|
static
|
2018-04-29 00:08:05 +00:00
|
|
|
QString
|
|
|
|
getXmlString(QString xml,
|
|
|
|
QString tagName);
|
|
|
|
|
2018-06-27 04:47:01 +00:00
|
|
|
static
|
2018-04-29 08:48:41 +00:00
|
|
|
QByteArray
|
|
|
|
getXmlStringFromHex(QString xml,
|
|
|
|
QString tagName);
|
|
|
|
|
2018-04-29 00:08:05 +00:00
|
|
|
QString
|
|
|
|
openConnectionToString(QUrl baseUrl,
|
|
|
|
QString command,
|
|
|
|
QString arguments,
|
|
|
|
bool enableTimeout);
|
|
|
|
|
2018-06-27 04:47:01 +00:00
|
|
|
static
|
2018-04-29 02:01:00 +00:00
|
|
|
QVector<int>
|
2018-07-06 06:12:55 +00:00
|
|
|
parseQuad(QString quad);
|
2018-04-29 02:01:00 +00:00
|
|
|
|
2018-06-24 07:14:23 +00:00
|
|
|
void
|
|
|
|
quitApp();
|
|
|
|
|
|
|
|
void
|
|
|
|
resumeApp(PSTREAM_CONFIGURATION streamConfig);
|
|
|
|
|
|
|
|
void
|
|
|
|
launchApp(int appId,
|
|
|
|
PSTREAM_CONFIGURATION streamConfig,
|
|
|
|
bool sops,
|
|
|
|
bool localAudio,
|
|
|
|
int gamepadMask);
|
|
|
|
|
2018-06-27 06:39:28 +00:00
|
|
|
QVector<NvApp>
|
|
|
|
getAppList();
|
|
|
|
|
2018-06-27 06:49:44 +00:00
|
|
|
QImage
|
|
|
|
getBoxArt(int appId);
|
|
|
|
|
2018-07-09 03:53:24 +00:00
|
|
|
static
|
|
|
|
QVector<NvDisplayMode>
|
|
|
|
getDisplayModeList(QString serverInfo);
|
|
|
|
|
2018-04-28 22:39:50 +00:00
|
|
|
QUrl m_BaseUrlHttp;
|
|
|
|
QUrl m_BaseUrlHttps;
|
2018-04-29 05:14:27 +00:00
|
|
|
private:
|
|
|
|
QNetworkReply*
|
|
|
|
openConnection(QUrl baseUrl,
|
|
|
|
QString command,
|
|
|
|
QString arguments,
|
|
|
|
bool enableTimeout);
|
|
|
|
|
|
|
|
QString m_Address;
|
2018-04-28 22:39:50 +00:00
|
|
|
QNetworkAccessManager m_Nam;
|
|
|
|
};
|