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