From 56d7ef36524c4b240f25377d158dc3d7eed406f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Thu, 19 Aug 2021 15:55:13 +0200 Subject: [PATCH] Add authorization required return value on reconnect --- lgsmarttv/integrationpluginlgsmarttv.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lgsmarttv/integrationpluginlgsmarttv.cpp b/lgsmarttv/integrationpluginlgsmarttv.cpp index 387c2a4d..fa8f6d64 100644 --- a/lgsmarttv/integrationpluginlgsmarttv.cpp +++ b/lgsmarttv/integrationpluginlgsmarttv.cpp @@ -413,7 +413,6 @@ void IntegrationPluginLgSmartTv::pairTvDevice(Thing *thing) qCDebug(dcLgSmartTv) << "Paired TV successfully."; tv->setPaired(true); loadAppList(thing); - refreshTv(thing); } }); @@ -450,8 +449,12 @@ void IntegrationPluginLgSmartTv::refreshTv(Thing *thing) connect(reply, &QNetworkReply::finished, this, [=](){ int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); if (status != 200) { - tv->setReachable(false); - qCWarning(dcLgSmartTv) << "Refresh tv information request error:" << status << reply->errorString(); + if (status == 401) { + pairTvDevice(thing); + } else { + tv->setReachable(false); + qCWarning(dcLgSmartTv) << "Refresh tv information request error:" << status << reply->errorString(); + } return; }