50 lines
1.5 KiB
C++
50 lines
1.5 KiB
C++
#include "interface.h"
|
|
#include <iostream>
|
|
#include <detProcess.hpp>
|
|
#include <generalJsonParsing.hpp>
|
|
#include <opencv2/core/utils/logger.hpp>
|
|
|
|
class Backend : public IBackend {
|
|
public:
|
|
//appCore _core;
|
|
void test() override { std::cout << "Hello from Backend!" << std::endl; }
|
|
void init(SQLiteDB* db,qtFuncBridge* bridgeIn, nlohmann::ordered_json& json) override {
|
|
if (initOnce == false) {
|
|
cv::utils::logging::setLogLevel(cv::utils::logging::LOG_LEVEL_ERROR);
|
|
_detProcess = new detProcess(db,json, bridgeIn);
|
|
}
|
|
_detProcess->init();
|
|
bridge = bridgeIn;
|
|
emit bridge->loadingWindow_appendInitLog(u8"核心加载成功,正在初始化",QColor("white"));
|
|
_detProcess->start();
|
|
|
|
}
|
|
void cleanup() override {
|
|
if (_detProcess != nullptr){
|
|
delete _detProcess;
|
|
_detProcess = nullptr;
|
|
}
|
|
}
|
|
~Backend() {
|
|
if (_detProcess != nullptr) {
|
|
delete _detProcess;
|
|
_detProcess = nullptr;
|
|
}
|
|
}
|
|
bool excuteCliCommand(const QString& command) {
|
|
return _detProcess->_cliManager->cliCommand(command);
|
|
}
|
|
bool excuteCliCommandPreset(const QString& uuid) {
|
|
return _detProcess->_cliManager->excutePreset(uuid);
|
|
}
|
|
private:
|
|
bool initOnce = false;
|
|
detProcess* _detProcess = nullptr;
|
|
qtFuncBridge* bridge = nullptr;
|
|
};
|
|
|
|
extern "C" {
|
|
IBackend* CreateBackend() { return new Backend(); }
|
|
void ReleaseBackend(IBackend* backend) { delete backend; }
|
|
}
|