#ifndef __I_CORE_CTRL_H #define __I_CORE_CTRL_H #include "baseStruct.h" #include #include class IAlgorithmResult { public: IAlgorithmResult(){} virtual ~IAlgorithmResult(){} virtual QVariantMap ToVariantMap() = 0; }; typedef std::function FuncCallBack_VarInt; typedef std::function FuncCallBack_VarMap; typedef std::function FuncCallBack_StrMap; typedef std::function FuncCallBack_StrImg; //interface for gui class ICoreCtrl { public: ICoreCtrl() {} virtual ~ICoreCtrl() {} virtual QList ICameraKeys() = 0; virtual QList IEnumAvailableCameras(emTpDeviceType camType = DEV_CAM_NONE) = 0; virtual void ISetTriggerMode(emTpDeviceTriggerMode triggerMode, long nFrameRate) = 0; virtual emTpDeviceTriggerMode IGetTriggerMode() = 0; virtual void ISnapImage(const QStringList& camKeys) = 0; virtual QMap IGetCamShowNames() = 0; virtual bool IGetCameraOption(const QString& strSerial, TP_CAMERA_OPTION& camOpt) = 0; virtual bool ISetCameraOption(const QString& strSerial, const TP_CAMERA_OPTION& camOpt) = 0; virtual void ISetCameraProperty(const QString& camera, TP_CAMERA_PROPERTY& property) = 0; virtual void IGetCameraProperty(const QString& camera, TP_CAMERA_PROPERTY& property) = 0; //operate camera virtual bool ICreateCamera(const QString& strSerial, int nType) = 0; virtual bool IOpenCamera(const QString& strSerial) = 0; virtual bool ICloseCamera(const QString& strSerial) = 0; virtual bool IStartCamera(const QString& strSerial) = 0; virtual bool IStopCamera(const QString& strSerial) = 0; virtual bool IDelCamera(const QString& strSerial) = 0; virtual bool IAddCamera(const QString& strName, const TP_CAMERA_OPTION& camOpt) = 0; virtual bool IRunAlg(const QString& strSerial, bool bRun) = 0; virtual bool IGetWidth(const QString& strSerial, int& width) = 0; virtual bool ISetWidth(const QString& strSerial, int& width) = 0; virtual bool IGetHeight(const QString& strSerial, int& height) = 0; virtual bool ISetHeight(const QString& strSerial, int& height) = 0; virtual bool IGetGain(const QString& strSerial, int& height) = 0; virtual bool ISetGain(const QString& strSerial, int& height) = 0; virtual bool IGetExposureTime(const QString& strSerial, int& height)=0; virtual bool ISetExposureTime(const QString& strSerial, int& height)=0; virtual bool IGetPixelFormat(const QString& strSerial) { return false; }; virtual bool ISetPixelFormat(const QString& strSerial) { return false; }; virtual bool IGetAcquisitionMode(const QString& strSerial) { return false; }; virtual bool ISetAcquisitionMode(const QString& strSerial) { return false; }; virtual bool IGetTriggerMode(const QString& strSerial) { return false; }; virtual bool ISetTriggerMode(const QString& strSerial) { return false; }; //更新json配置文件 virtual void loadConfig() = 0; virtual void saveConfig() = 0; virtual bool IRegisterGetVariant(FuncCallBack_VarInt callback) = 0; //向算法传递检测参数回调接口 virtual bool IRegisterImageCallBack(FuncCallBack_StrImg callback) = 0; //获取相机图像回调接口 virtual bool IRegisterResultCallBack(FuncCallBack_StrMap callback) = 0; //获取算法结果回调接口 public://private: //use private when the old main is discarded; virtual int IInitCore(class IDetectorEngine* pDE = NULL) = 0; virtual void IFreeCore() = 0; virtual void IStartImageProcess() = 0; virtual void IEndImageProcess() = 0; }; #ifdef TPCORECTRL_EXPORTS #define TPCORECTRL_API extern "C" __declspec(dllexport) #else #define TPCORECTRL_API extern "C" #endif extern "C" TPCORECTRL_API ICoreCtrl* Lib_CoreCtrl_Init(void); extern "C" TPCORECTRL_API void Lib_CoreCtrl_Free(ICoreCtrl* ptr); #endif