mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-09-18 08:22:33 +02:00
Fix missing appID
This commit is contained in:
parent
9fcae64806
commit
8ba7c62f1b
@ -99,5 +99,4 @@ private:
|
|||||||
|
|
||||||
QString m_appID;
|
QString m_appID;
|
||||||
QTimer m_pingAliveTimer;
|
QTimer m_pingAliveTimer;
|
||||||
QTimer m_firstConnectionTimer;
|
|
||||||
};
|
};
|
||||||
|
@ -29,14 +29,15 @@ void ScreenPlaySDK::start()
|
|||||||
global_sdkPtr = this;
|
global_sdkPtr = this;
|
||||||
qInstallMessageHandler(ScreenPlaySDK::redirectMessageOutputToMainWindow);
|
qInstallMessageHandler(ScreenPlaySDK::redirectMessageOutputToMainWindow);
|
||||||
|
|
||||||
m_socket.setServerName("ScreenPlay");
|
|
||||||
connect(&m_socket, &QLocalSocket::connected, this, &ScreenPlaySDK::connected);
|
connect(&m_socket, &QLocalSocket::connected, this, &ScreenPlaySDK::connected);
|
||||||
connect(&m_socket, &QLocalSocket::disconnected, this, &ScreenPlaySDK::disconnected);
|
connect(&m_socket, &QLocalSocket::disconnected, this, &ScreenPlaySDK::disconnected);
|
||||||
connect(&m_socket, &QLocalSocket::readyRead, this, &ScreenPlaySDK::readyRead);
|
connect(&m_socket, &QLocalSocket::readyRead, this, &ScreenPlaySDK::readyRead);
|
||||||
connect(&m_firstConnectionTimer, &QTimer::timeout, this, &ScreenPlaySDK::disconnected);
|
|
||||||
// When we do not establish a connection in the first 5 seconds we abort.
|
m_socket.connectToServer("ScreenPlay");
|
||||||
m_firstConnectionTimer.start(5000);
|
if (!m_socket.waitForConnected(1000)){
|
||||||
m_socket.connectToServer();
|
emit disconnected();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenPlaySDK::~ScreenPlaySDK()
|
ScreenPlaySDK::~ScreenPlaySDK()
|
||||||
@ -53,14 +54,14 @@ void ScreenPlaySDK::sendMessage(const QJsonObject& obj)
|
|||||||
|
|
||||||
void ScreenPlaySDK::connected()
|
void ScreenPlaySDK::connected()
|
||||||
{
|
{
|
||||||
m_firstConnectionTimer.stop();
|
|
||||||
if (m_appID.isEmpty() || m_type.isEmpty()) {
|
if (m_appID.isEmpty() || m_type.isEmpty()) {
|
||||||
qCritical() << "Unable to connect with empyt: " << m_appID << m_type;
|
qCritical() << "Unable to connect with empyt: " << m_appID << m_type;
|
||||||
emit disconnected();
|
emit disconnected();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray welcomeMessage = QString(m_appID + "," + m_type).toUtf8();
|
QByteArray welcomeMessage = QString("appID="+m_appID + "," + m_type).toUtf8();
|
||||||
m_socket.write(welcomeMessage);
|
m_socket.write(welcomeMessage);
|
||||||
if (!m_socket.waitForBytesWritten()) {
|
if (!m_socket.waitForBytesWritten()) {
|
||||||
disconnected();
|
disconnected();
|
||||||
|
Loading…
Reference in New Issue
Block a user