|
|
|
|
|
#include "CDllDetectorEngine.h"
|
|
|
|
|
|
#include "iCoreCtrl.h"
|
|
|
|
|
|
|
|
|
|
|
|
CDllDetectorEngine::CDllDetectorEngine()
|
|
|
|
|
|
{
|
|
|
|
|
|
m_pDE = NULL;
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
|
m_lib.setFileName("lpbengined.dll");
|
|
|
|
|
|
#else
|
|
|
|
|
|
m_lib.setFileName("lpbengine.dll");
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if (!m_lib.load())
|
|
|
|
|
|
{
|
|
|
|
|
|
qWarning("failed to load lpbengine");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FnLpNewEngineInstance pfnLpNewInstance = (FnLpNewEngineInstance)m_lib.resolve("LpNewEngineInstance");
|
|
|
|
|
|
if (pfnLpNewInstance)
|
|
|
|
|
|
pfnLpNewInstance(&m_pDE, NULL);
|
|
|
|
|
|
|
|
|
|
|
|
if (!m_pDE)
|
|
|
|
|
|
{
|
|
|
|
|
|
qWarning("failed to get instance from lpbengine");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CDllDetectorEngine::~CDllDetectorEngine()
|
|
|
|
|
|
{
|
|
|
|
|
|
Quit();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CDllDetectorEngine::Initialize(class ICoreCtrl* pCoreCtrl)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (m_pDE && pCoreCtrl)
|
|
|
|
|
|
{
|
|
|
|
|
|
void* p = NULL;
|
|
|
|
|
|
m_pDE->GetDataInterface(DEVICEMGR, &p);
|
|
|
|
|
|
IDetectorDeviceMgr* pDeviceMgr = (IDetectorDeviceMgr*)p;
|
|
|
|
|
|
if (pDeviceMgr)
|
|
|
|
|
|
{
|
|
|
|
|
|
pDeviceMgr->RegisterCoreCtrl(pCoreCtrl);
|
|
|
|
|
|
QList<QString> strCameraKeys = pCoreCtrl->ICameraKeys();
|
|
|
|
|
|
for (int i = 0; i < strCameraKeys.size(); i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
IDetectorCameraDevice* pCamera = (IDetectorCameraDevice*)pDeviceMgr->AddDevice(CAMERA);
|
|
|
|
|
|
if (pCamera)
|
|
|
|
|
|
{
|
|
|
|
|
|
TP_CAMERA_OPTION option;
|
|
|
|
|
|
pCoreCtrl->IGetCameraOption(strCameraKeys.at(i), option);
|
|
|
|
|
|
pCamera->SetName(strCameraKeys.at(i));
|
|
|
|
|
|
pCamera->SetID(option.id);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
m_pDE->GetDataInterface(SHAREAPARAM, &p);
|
|
|
|
|
|
IAlgorithmShare* pAlgoShare = (IAlgorithmShare*)p;
|
|
|
|
|
|
if (pAlgoShare)
|
|
|
|
|
|
{
|
|
|
|
|
|
pAlgoShare->RegisterCoreCtrl(pCoreCtrl);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CDllDetectorEngine::Quit()
|
|
|
|
|
|
{
|
|
|
|
|
|
FnLpDeleteEngineInstance pfnLpDeleteInstance = (FnLpDeleteEngineInstance)m_lib.resolve("LpDeleteEngineInstance");
|
|
|
|
|
|
if (pfnLpDeleteInstance)
|
|
|
|
|
|
pfnLpDeleteInstance();
|
|
|
|
|
|
|
|
|
|
|
|
if (m_lib.isLoaded())
|
|
|
|
|
|
m_lib.unload();
|
|
|
|
|
|
}
|