Add check recon connection and restart create recon record.
This commit is contained in:
@@ -2,12 +2,14 @@
|
||||
#include "ReconClient.h"
|
||||
#include "json/jsonobject.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include "QDebug"
|
||||
|
||||
namespace
|
||||
{
|
||||
const std::string CRT_FILE = "./cfgs/client.crt";
|
||||
const std::string KEY_FILE = "./cfgs/client.key";
|
||||
const int CHECK_RECON_CONNECTION_TIME = 30000;
|
||||
|
||||
std::string toReconServerAddress(const QString& aIp, const QString& aPort)
|
||||
{
|
||||
@@ -24,8 +26,12 @@ ReconManager* ReconManager::getInstance()
|
||||
ReconManager::ReconManager(QObject* aParent)
|
||||
: QObject(aParent)
|
||||
, mReconClient(new Recon::ReconClient(CRT_FILE, KEY_FILE))
|
||||
, mTimer(new QTimer(this))
|
||||
, mIsConnected(false)
|
||||
{
|
||||
init();
|
||||
connect(mTimer, &QTimer::timeout, this, &ReconManager::checkReconConnection);
|
||||
mTimer->start(CHECK_RECON_CONNECTION_TIME);
|
||||
}
|
||||
|
||||
ReconManager::~ReconManager()
|
||||
@@ -95,6 +101,20 @@ void ReconManager::queryReconStatus(const QStringList& aScanIDs)
|
||||
emit queryReconStateResponsed(true, QVariant::fromValue(result));
|
||||
}
|
||||
|
||||
void ReconManager::checkReconConnection()
|
||||
{
|
||||
auto response = mReconClient->CheckActive();
|
||||
if(mIsConnected != response.good())
|
||||
{
|
||||
emit checkReconConnectionResponsed(response.good());
|
||||
}
|
||||
if(mIsConnected == false && response.good())
|
||||
{
|
||||
emit restartCreatReconRecord();
|
||||
}
|
||||
mIsConnected = response.good();
|
||||
}
|
||||
|
||||
void ReconManager::setPacsSettings(const QString& aClientAETitle, const QString& aServerAETitle, const QString& aServerIP, int aServerPort)
|
||||
{
|
||||
PACSSetting settings = {aClientAETitle.toStdString(), aServerAETitle.toStdString(), aServerIP.toStdString(), aServerPort};
|
||||
@@ -109,3 +129,8 @@ void ReconManager::setPacsSettings(const QString& aClientAETitle, const QString&
|
||||
|
||||
emit setPacsSettingsResponsed(true, QVariant::fromValue(QString("Set PACS settings succeed.")));
|
||||
}
|
||||
|
||||
bool ReconManager::isConnected()
|
||||
{
|
||||
return mIsConnected;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user