Files
eUi/src/Core/backendInterface.cpp
T

50 lines
1.5 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-31 16:51:18 +08:00
void init(SQLiteDB* db,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-08-31 16:51:18 +08:00
_detProcess = new detProcess(db,json, bridgeIn);
2025-03-28 18:33:43 +08:00
}
2025-08-31 16:51:18 +08:00
_detProcess->init();
2025-06-05 11:30:12 +08:00
bridge = bridgeIn;
emit bridge->loadingWindow_appendInitLog(u8"核心加载成功,正在初始化",QColor("white"));
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 {
if (_detProcess != nullptr){
delete _detProcess;
_detProcess = nullptr;
}
2025-03-28 18:33:43 +08:00
}
2025-06-01 16:36:42 +08:00
~Backend() {
if (_detProcess != nullptr) {
delete _detProcess;
_detProcess = nullptr;
}
2025-06-01 16:36:42 +08:00
}
2025-09-19 12:38:05 +08:00
bool excuteCliCommand(const QString& command) {
return _detProcess->_cliManager->cliCommand(command);
}
bool excuteCliCommandPreset(const QString& uuid) {
return _detProcess->_cliManager->excutePreset(uuid);
}
2025-03-28 18:33:43 +08:00
private:
bool initOnce = false;
detProcess* _detProcess = nullptr;
2025-06-05 11:30:12 +08:00
qtFuncBridge* bridge = nullptr;
};
extern "C" {
IBackend* CreateBackend() { return new Backend(); }
void ReleaseBackend(IBackend* backend) { delete backend; }
}