131 lines
3.8 KiB
C++
131 lines
3.8 KiB
C++
![]() |
#include "LibapiProcessThread.h"
|
||
|
#include "LibapiQueue.h"
|
||
|
#include "LibapiQueues.h"
|
||
|
#include "MsgBase.h"
|
||
|
#include <memory>
|
||
|
#include <chrono>
|
||
|
#include <opencv2/opencv.hpp>
|
||
|
#include <iostream>
|
||
|
#include <locale>
|
||
|
#include <codecvt>
|
||
|
#include <string>
|
||
|
#include <fstream>
|
||
|
#include "PlguinConfig.h"
|
||
|
|
||
|
#include "Libapi.h"
|
||
|
#include "IniHelper.h"
|
||
|
#include "Log.h"
|
||
|
#include "Yolov5For928.h"
|
||
|
|
||
|
// for ext
|
||
|
int main()
|
||
|
{
|
||
|
int ret = 0;
|
||
|
|
||
|
// init config
|
||
|
GINIT();
|
||
|
|
||
|
// init yolo for 928
|
||
|
ret = CYolov5For928::Get()->Init();
|
||
|
if (ret != 0) return ret;
|
||
|
|
||
|
// init task
|
||
|
PlguinConfig::getInstance()->LibapiInitCameraProcessing(nullptr);
|
||
|
PlguinConfig::getInstance()->LibapiInitLidarProcessing(nullptr);
|
||
|
PlguinConfig::getInstance()->LibapiInitRoiProcessing(nullptr);
|
||
|
LibapiThread::delay_second(2);
|
||
|
|
||
|
MsgBase* pMsgCamera = nullptr;
|
||
|
MsgBase* pMsgLidar = nullptr;
|
||
|
char msg_type[32] = "MsgBase";
|
||
|
|
||
|
while (true)
|
||
|
{
|
||
|
char msg_type[32] = "MsgBase";
|
||
|
pMsgCamera = nullptr;
|
||
|
pMsgLidar = nullptr;
|
||
|
libapi_create_MsgBase(msg_type, (void**)&pMsgCamera);
|
||
|
libapi_create_MsgBase(msg_type, (void**)&pMsgLidar);
|
||
|
ret = libapi_push_to_queue((char*)"_t_PluginCameraPro", pMsgCamera);
|
||
|
ret = libapi_push_to_queue((char*)"_t_PlguinLidarPro", pMsgLidar);
|
||
|
LibapiThread::delay_second(2);
|
||
|
LibapiThread::delay_second(5);
|
||
|
|
||
|
//#define CLIENT_MSG_CONTINUE 1
|
||
|
//#define CLIENT_MSG_RESTART_DETECTION 2
|
||
|
//#define CLIENT_MSG_STOP_DETECTION 3
|
||
|
MsgBase::SetWaitInt(MsgBase::iClinetMsg, CLIENT_MSG_CONTINUE);
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
// for dll
|
||
|
#ifdef _WIN32
|
||
|
#include <windows.h>
|
||
|
#endif // _WIN32
|
||
|
|
||
|
typedef int (*DLLLibapiInit)(int, char*, void*);
|
||
|
typedef int (*DLLLLibapiStartDetection)();
|
||
|
typedef int (*DLLLibapiContinuetDetection)();
|
||
|
typedef int (*DLLLibapRestartConnerDetection)();
|
||
|
typedef int (*DLLLibapStopDetectiont)();
|
||
|
static const char* dllName = "./image_framework.dll";
|
||
|
|
||
|
//static const char* DLLLibapiInit_name = "LibapiInit";
|
||
|
//static const char* DLLLLibapiStartDetection_name = "LibapiStartDetection";
|
||
|
//static const char* DLLLibapiContinuetDetection_name = "LibapiContinuetDetection";
|
||
|
//static const char* DLLLibapRestartConnerDetection_name = "LibapRestartConnerDetection";
|
||
|
//static const char* DLLLibapStopDetectiont_name = "LibapStopDetectiont";
|
||
|
|
||
|
//static wchar_t* char2wchar(const char* c)
|
||
|
//{
|
||
|
// int bufferSize = MultiByteToWideChar(CP_UTF8, 0, c, -1, NULL, 0);
|
||
|
// wchar_t* wideString = new wchar_t[bufferSize];
|
||
|
// MultiByteToWideChar(CP_UTF8, 0, c, -1, wideString, bufferSize);
|
||
|
// return wideString;
|
||
|
//}
|
||
|
//int main()
|
||
|
//{
|
||
|
// wchar_t* ws = char2wchar(dllName);
|
||
|
//
|
||
|
// HINSTANCE hinst = LoadLibrary(ws);
|
||
|
// if (hinst == NULL)
|
||
|
// {
|
||
|
// DWORD error = GetLastError();
|
||
|
// if (error == ERROR_MOD_NOT_FOUND)
|
||
|
// {
|
||
|
// // 处理DLL找不到的情况
|
||
|
// std::cout << "DLL找不到的情况" << std::endl;
|
||
|
// return 0;
|
||
|
// }
|
||
|
// else if (error == ERROR_PROC_NOT_FOUND)
|
||
|
// {
|
||
|
// // 处理DLL中的特定函数找不到的情况
|
||
|
// std::cout << "DLL中的特定函数找不到的情况" << std::endl;
|
||
|
// return 0;
|
||
|
// }
|
||
|
// // 其他错误处理...
|
||
|
// }
|
||
|
// DLLLibapiInit funcDLLLibapiInit =
|
||
|
// (DLLLibapiInit)GetProcAddress(hinst, "LibapiInit");
|
||
|
// DLLLLibapiStartDetection funcDLLLLibapiStartDetection =
|
||
|
// (DLLLLibapiStartDetection)GetProcAddress(hinst, "LibapiStartDetection");
|
||
|
// DLLLibapiContinuetDetection funcDLLLibapiContinuetDetection =
|
||
|
// (DLLLibapiContinuetDetection)GetProcAddress(hinst, "LibapiContinuetDetection");
|
||
|
// DLLLibapRestartConnerDetection funcDLLLibapRestartConnerDetection =
|
||
|
// (DLLLibapRestartConnerDetection)GetProcAddress(hinst, "LibapRestartConnerDetection");
|
||
|
// DLLLibapStopDetectiont funcDLLLibapStopDetectiont =
|
||
|
// (DLLLibapStopDetectiont)GetProcAddress(hinst, "LibapStopDetection");
|
||
|
//
|
||
|
// char c[256] = "1111";
|
||
|
// funcDLLLibapiInit(1, c, nullptr);
|
||
|
// while (true)
|
||
|
// {
|
||
|
// funcDLLLLibapiStartDetection();
|
||
|
//
|
||
|
// LibapiThread::delay_second(10);
|
||
|
//
|
||
|
// funcDLLLibapiContinuetDetection();
|
||
|
// }
|
||
|
//}
|