|
|
#ifndef ImgCheckBase_H_
|
|
|
#define ImgCheckBase_H_
|
|
|
#include <string>
|
|
|
#include <memory>
|
|
|
#define INTERFACE_VERSION 3
|
|
|
|
|
|
// 检测库的状态
|
|
|
enum CHECK_THREAD_RUN_STATUS
|
|
|
{
|
|
|
CHECK_THREAD_STATUS_IDLE, // 空闲
|
|
|
CHECK_THREAD_STATUS_READY, // 准备好了
|
|
|
CHECK_THREAD_STATUS_BUSY, // 运行中
|
|
|
CHECK_THREAD_STATUS_COMPLETE, // 检测完成
|
|
|
CHECK_THREAD_STATUS_ERROR, // 运行错误
|
|
|
};
|
|
|
|
|
|
// 检测库 初始化参数
|
|
|
struct RunInfoST
|
|
|
{
|
|
|
int nRunType; // 库调用方式
|
|
|
int flag0; // 预留变量
|
|
|
int flag1; // 预留变量
|
|
|
|
|
|
std::string str_RunJson; // 运行基本参数json文件
|
|
|
std::string str_AIModelJson; // AI 模型 json文件
|
|
|
std::string str_ProcessNodeJson; // 过程节点 json文件
|
|
|
std::string str_0; // 预留
|
|
|
std::string str_1; // 预留
|
|
|
RunInfoST()
|
|
|
{
|
|
|
flag1 = 0;
|
|
|
flag0 = 0;
|
|
|
nRunType = 0;
|
|
|
|
|
|
str_RunJson = "";
|
|
|
str_AIModelJson = "";
|
|
|
str_ProcessNodeJson = "";
|
|
|
str_0 = "";
|
|
|
str_1 = "";
|
|
|
}
|
|
|
void copy(RunInfoST tem)
|
|
|
{
|
|
|
this->nRunType = tem.nRunType;
|
|
|
this->flag0 = tem.flag0;
|
|
|
this->flag1 = tem.flag1;
|
|
|
this->str_RunJson = tem.str_RunJson;
|
|
|
this->str_AIModelJson = tem.str_AIModelJson;
|
|
|
this->str_ProcessNodeJson = tem.str_ProcessNodeJson;
|
|
|
this->str_0 = tem.str_0;
|
|
|
this->str_1 = tem.str_1;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
struct shareImage;
|
|
|
struct CheckResult;
|
|
|
struct AI_Model_ConfigList;
|
|
|
struct CheckBaseConfig;
|
|
|
/*******************一般调用流程*************************************************************************************************************************/
|
|
|
/*******************1、初始化 UpdateConfig*************************************************************************************************************************/
|
|
|
/*******************2、初始化 Init 并开启 *************************************************************************************************************************/
|
|
|
/*******************3、GetStatus 获取状态 如果 =CHECK_THREAD_STATUS_IDLE 可以设置检测数据并开启检测 SetDataRun***************************************************/
|
|
|
/*******************4、GetStatus 获取状态 如果 =CHECK_THREAD_STATUS_COMPLETE 检测完成,可以获取检测结果 GetCheckReuslt 拷贝检测结果 自动把状态设为 CHECK_THREAD_STATUS_IDLE*****************************/
|
|
|
|
|
|
class ImgCheckBase
|
|
|
{
|
|
|
protected:
|
|
|
ImgCheckBase();
|
|
|
|
|
|
public:
|
|
|
// delete camera interface
|
|
|
virtual ~ImgCheckBase() {}
|
|
|
|
|
|
// 初始化参数 pconfig 参数指针 返回:0 成功 其他异常
|
|
|
virtual int RunStart(void *pconfig1 = NULL) = 0;
|
|
|
|
|
|
// 阻塞式检测
|
|
|
virtual int CheckImg(std::shared_ptr<shareImage> p, std::shared_ptr<CheckResult> &pResult) = 0;
|
|
|
|
|
|
// 更新参数 pconfig 参数指针,nConfigType 需要更新的参数类型 返回:0 成功 其他异常
|
|
|
virtual int UpdateConfig(void *pconfig, int nConfigType) = 0;
|
|
|
|
|
|
static std::shared_ptr<ImgCheckBase> GetInstance();
|
|
|
// 返回检测版本信息
|
|
|
std::string GetVersion();
|
|
|
|
|
|
// 返回错误信息
|
|
|
std::string GetErrorInfo();
|
|
|
|
|
|
bool LoadAIModelParm(std::string strAIModelPath, std::shared_ptr<AI_Model_ConfigList> &m_pconfig);
|
|
|
bool LoadCheckBaseConfig(std::string strCheckBaseConfigPath, std::shared_ptr<CheckBaseConfig> &m_pconfig);
|
|
|
|
|
|
public:
|
|
|
bool m_bInitSucc; // 初始化状态
|
|
|
std::string Base_StrVersion; // 版本号
|
|
|
int Base_nErrorCode; // 错误代码
|
|
|
std::string Base_StrError; // 错误信息
|
|
|
|
|
|
;
|
|
|
};
|
|
|
|
|
|
#endif |