You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
4.0 KiB
C

5 years ago
#ifndef __I_CORE_CTRL_H
#define __I_CORE_CTRL_H
#include "baseStruct.h"
#include <QtCore/QString>
#include <QtGui/QImage>
class IAlgorithmResult
{
public:
IAlgorithmResult(){}
virtual ~IAlgorithmResult(){}
virtual QVariantMap ToVariantMap() = 0;
};
typedef std::function<QVariant(int)> FuncCallBack_VarInt;
typedef std::function<void(const QVariantMap&)> FuncCallBack_VarMap;
typedef std::function<void(const QString&, const QVariantMap&)> FuncCallBack_StrMap;
typedef std::function<void(const QString&, QImage)> FuncCallBack_StrImg;
typedef std::function<void(const QString&, emTpCameraStatus, bool)> FuncCallBack_StrInt;
//interface for gui
class ICoreCtrl
{
public:
ICoreCtrl() {}
virtual ~ICoreCtrl() {}
virtual QList<QString> ICameraKeys() = 0;
virtual QList<QString> 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<QString, QString> 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& gain) = 0;
virtual bool ISetGain(const QString& strSerial, int& gain) = 0;
virtual bool IGetExposureTime(const QString& strSerial, int& exposure)=0;
virtual bool ISetExposureTime(const QString& strSerial, int& exposure)=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; //注册算法结果回调函数 可获取算法检测结果
virtual bool IRegisterCamEventCallBack(FuncCallBack_StrInt callback) = 0;//注册相机事件回调函数 可获取相机打开关闭等相关事件
public://private: //use private when the old main is discarded;
virtual int IInitCore() = 0;
5 years ago
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