Files
eUi/src/Core/backendInterface.cpp
T

44 lines
1.3 KiB
C++
Raw Normal View History

#include "interface.h"
#include <iostream>
#include <detProcess.hpp>
2025-06-15 03:06:01 +08:00
#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; }
2025-08-15 16:36:54 +08:00
void init(qtFuncBridge* bridgeIn, nlohmann::ordered_json& json) override {
2025-03-28 18:33:43 +08:00
if (initOnce == false) {
cv::utils::logging::setLogLevel(cv::utils::logging::LOG_LEVEL_ERROR);
2025-06-01 16:36:42 +08:00
_detProcess = new detProcess();
2025-03-28 18:33:43 +08:00
}
2025-06-05 11:30:12 +08:00
bridge = bridgeIn;
2025-06-11 10:00:09 +08:00
emit bridge->loadingWindow_appendLog(u8"核心加载成功,正在初始化",QColor("white"));
2025-06-05 11:30:12 +08:00
_detProcess->initConfig(json, bridgeIn);
2025-06-01 16:36:42 +08:00
_detProcess->start();
2025-06-05 11:30:12 +08:00
}
2025-03-28 18:33:43 +08:00
void cleanup() override {
}
2025-06-01 16:36:42 +08:00
~Backend() {
delete _detProcess;
}
2025-07-25 00:29:52 +08:00
SQLiteDB* getDatabase() {
return _detProcess->dataBase;
}
bool excuteCliCommandPreset(const QString& uuid) {
return _detProcess->_cliManager->excutePreset(uuid);
}
2025-03-28 18:33:43 +08:00
private:
bool initOnce = false;
detProcess* _detProcess;
2025-06-05 11:30:12 +08:00
qtFuncBridge* bridge = nullptr;
};
extern "C" {
IBackend* CreateBackend() { return new Backend(); }
void ReleaseBackend(IBackend* backend) { delete backend; }
}