ResInsight/ApplicationCode/Commands/HoloLensCommands/RicHoloLensSession.h

78 lines
2.8 KiB
C++

/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RicHoloLensSessionObserver.h"
#include "RicHoloLensRestClient.h"
#include "VdePacketDirectory.h"
#include "VdeCachingHashedIdFactory.h"
#include <QString>
#include <QPointer>
#include <vector>
class RimGridView;
//==================================================================================================
//
//
//
//==================================================================================================
class RicHoloLensSession : public QObject, private RicHoloLensRestResponseHandler
{
public:
~RicHoloLensSession();
static RicHoloLensSession* createSession(const QString& serverUrl, const QString& sessionName, const QByteArray& sessionPinCode, RicHoloLensSessionObserver* sessionObserver);
static RicHoloLensSession* createDummyFileBackedSession();
void destroySession();
bool isSessionValid() const;
void updateSessionDataFromView(const RimGridView& activeView);
private:
RicHoloLensSession();
virtual void handleSuccessfulCreateSession() override;
virtual void handleFailedCreateSession() override;
virtual void handleSuccessfulSendMetaData(int metaDataSequenceNumber, const QByteArray& jsonServerResponseString) override;
virtual void handleError(const QString& errMsg, const QString& url, const QString& serverData) override;
static bool parseJsonIntegerArray(const QByteArray& jsonString, std::vector<int>* integerArr);
void notifyObserver(RicHoloLensSessionObserver::Notification notification);
private:
bool m_isSessionValid;
QPointer<RicHoloLensRestClient> m_restClient;
int m_lastExtractionMetaDataSequenceNumber;
std::vector<int> m_lastExtractionAllReferencedPacketIdsArr;
VdeCachingHashedIdFactory m_cachingIdFactory;
VdePacketDirectory m_packetDirectory;
RicHoloLensSessionObserver* m_sessionObserver;
bool m_dbgEnableFileExport;
};