OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
StudioConnector.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <QtNetwork/qlocalserver.h>
6#include <QtNetwork/qlocalsocket.h>
7#include <QtCore/qobject.h>
8#include <QtCore/qprocess.h>
9
10#include <string>
11#include <atomic>
12#include <chrono>
13
15{
16public:
19
20 std::string searchProjectAndExtractData(const std::string& fileName, const std::string& projectRoot, bool includeResults, bool includeParametricResults);
21 std::string closeProject(const std::string& fileName);
22 std::string openProject(const std::string& fileName);
23
24private:
25 void startSubprocess();
26 std::string findSubprocessPath();
27 void initiateProcess();
28 void runSubprocess();
29 bool startProcess();
30 void connectWithSubprocess();
31 ot::ReturnMessage executeCommand(const std::string& command);
32 ot::ReturnMessage send(const std::string& message);
33 bool checkSubprocessResponsive(std::string& errorMessage);
34 void closeSubprocess();
35 bool waitForResponse();
36 void getProcessErrorOccured(std::string& message);
37 void getSocketErrorOccured(std::string& message);
38
39 void determineStudioSuiteInstallation(int& version, std::string& studioPath);
40 std::list<long long> getRunningDesignEnvironmentProcesses();
41 std::string generateExtractScript(const std::string& studioPath, std::string fileName, std::string exportFolder, std::list<long long> studioPidList, bool includeResults, bool includeParametricResults);
42 std::string generateOpenScript(const std::string& studioPath, std::string fileName);
43 std::string generateCloseScript(const std::string& studioPath, std::string fileName, std::list<long long> studioPidList);
44
45 bool m_subProcessRunning = false;
46 std::string m_serverName;
47 const std::string m_executableName = "PythonExecution.exe";
48 std::string m_subprocessPath;
49 std::string m_pythonModulePath;
50
51 const int m_numberOfRetries = 3;
52 const int m_timeoutSubprocessStart = 50000;//5 seconds
53 const int m_timeoutServerConnect = m_timeoutSubprocessStart;
54 const int m_timeoutSendingMessage = m_timeoutSubprocessStart;
55 const int m_heartBeat = m_timeoutSubprocessStart;
56
57 QProcess m_subProcess;
58 QLocalServer m_server;
59 QLocalSocket* m_socket = nullptr;
60};
Definition StudioConnector.h:15
StudioConnector()
Definition StudioConnector.h:17
~StudioConnector()
Definition StudioConnector.cpp:123
std::string closeProject(const std::string &fileName)
Definition StudioConnector.cpp:61
std::string openProject(const std::string &fileName)
Definition StudioConnector.cpp:94
std::string searchProjectAndExtractData(const std::string &fileName, const std::string &projectRoot, bool includeResults, bool includeParametricResults)
Definition StudioConnector.cpp:22
Definition ReturnMessage.h:14