2025-03-27 18:36:54 +08:00
|
|
|
#include "interface.h"
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <detProcess.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-06-11 10:00:09 +08:00
|
|
|
void init(qtFuncBridge* bridgeIn) 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-11 10:00:09 +08:00
|
|
|
nlohmann::json json = readJsonFromPath("./config/backend.json");
|
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-27 18:36:54 +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-03-28 18:33:43 +08:00
|
|
|
private:
|
|
|
|
|
bool initOnce = false;
|
|
|
|
|
detProcess* _detProcess;
|
2025-06-05 11:30:12 +08:00
|
|
|
qtFuncBridge* bridge = nullptr;
|
2025-03-27 18:36:54 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
IBackend* CreateBackend() { return new Backend(); }
|
|
|
|
|
void ReleaseBackend(IBackend* backend) { delete backend; }
|
|
|
|
|
}
|