feat: Add Recon State read to ReconManager
This commit is contained in:
@@ -39,7 +39,7 @@ RequestResult ReconClient::CheckActive()
|
|||||||
auto resp = mRequest.post(mHost + STATE_URL, content, mHeaders);
|
auto resp = mRequest.post(mHost + STATE_URL, content, mHeaders);
|
||||||
if (resp.httpCode() == 200)
|
if (resp.httpCode() == 200)
|
||||||
{
|
{
|
||||||
return RequestResult::Success();
|
return RequestResult::Success(resp.getContent());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include "QDebug"
|
#include "QDebug"
|
||||||
|
#include "json/cJSON.h"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
@@ -100,6 +101,11 @@ void ReconManager::queryReconStatus(const QStringList& aScanIDs)
|
|||||||
void ReconManager::checkReconConnection()
|
void ReconManager::checkReconConnection()
|
||||||
{
|
{
|
||||||
auto response = mReconClient->CheckActive();
|
auto response = mReconClient->CheckActive();
|
||||||
|
cJSON* json = cJSON_Parse(response.message().data());
|
||||||
|
cJSON* stateProperty = cJSON_GetObjectItem(json, "State");
|
||||||
|
int state = stateProperty->valueint;
|
||||||
|
cJSON_Delete(json);
|
||||||
|
qDebug()<<"Recon State:"<<state;
|
||||||
if(mIsConnected != response.good())
|
if(mIsConnected != response.good())
|
||||||
{
|
{
|
||||||
emit checkReconConnectionResponsed(response.good());
|
emit checkReconConnectionResponsed(response.good());
|
||||||
|
|||||||
Reference in New Issue
Block a user