#pragma once //平台层的交互接口 #include #include using namespace std; #ifdef _WIN64 #ifdef _DEBUG #define CDPC_DLL_NANE "ContainerDPCX64D.dll" #else #define CDPC_DLL_NANE "ContainerDPCX64.dll" #endif #else #ifdef _DEBUG #define CDPC_DLL_NANE "ContainerDPCD.dll" #else #define CDPC_DLL_NANE "ContainerDPC.dll" #endif #endif //typedef _declspec(dllimport) CDInterface* (_cdecl* GetCDInterface)(); typedef _declspec(dllimport) void (*DeviceLogFunc) (int LogLevel, string Context, string DevicePath); typedef _declspec(dllimport) void (*DIOSSystemLogFunc) (int cmd, string Code, string Context, string DevicePath); typedef _declspec(dllimport) void (*DIOSNotifyCallBackEntryFunc)(int cmdType, string keyType, string Context, string DevicePath); typedef _declspec(dllimport) void (*RawDataNotifyCallBackEntryFunc)(int cmdType, string keyType, string Context, string Head, char* pRawData, int DataLength, string DevicePath); typedef _declspec(dllimport) void (*NotifyCallBackSetBlockSizeFunc)(string QueName, unsigned int BlockSize, unsigned int FulBlockCount, unsigned int PrevBlockSize, unsigned int PrevBlockCount); class PlatformInterface { PlatformInterface() { }; static HMODULE CheckAndLoad() { static HMODULE __hModule = NULL; if(__hModule == 0) __hModule = LoadLibrary(CDPC_DLL_NANE); if (__hModule == NULL) return NULL; return __hModule; //GetCDInterface func = 0; //func = (GetCDInterface)GetProcAddress(hCDI, "GetCDI"); } public: virtual ~PlatformInterface() {}; static void DeviceLog(int LogLevel, string Context, string DevicePath) { static DeviceLogFunc func = 0; if (func == 0) func = (DeviceLogFunc)GetProcAddress(CheckAndLoad(), "DeviceLog"); if (func != 0) func(LogLevel, Context, DevicePath); } static void DIOSSystemLog(int cmd, string Code, string Context, string DevicePath) { static DIOSSystemLogFunc func = 0; if (func == 0) func = (DIOSSystemLogFunc)GetProcAddress(CheckAndLoad(), "DIOSSystemLog"); if (func != 0) func(cmd, Code, Context, DevicePath); } static void DIOSNotifyCallBackEntry(int cmdType, string keyType, string Context, string DevicePath) { static DIOSNotifyCallBackEntryFunc func = 0; if (func == 0) func = (DIOSNotifyCallBackEntryFunc)GetProcAddress(CheckAndLoad(), "DIOSNotifyCallBackEntry"); if (func != 0) func(cmdType, keyType, Context, DevicePath); } static void RawDataNotifyCallBackEntry(int cmdType, string keyType, string Context, string Head, char* pRawData, int DataLength, string DevicePath) { static RawDataNotifyCallBackEntryFunc func = 0; if (func == 0) func = (RawDataNotifyCallBackEntryFunc)GetProcAddress(CheckAndLoad(), "RawDataNotifyCallBackEntry"); if (func != 0) func(cmdType, keyType, Context, Head, pRawData, DataLength, DevicePath); } static void NotifyCallBackSetBlockSize(string QueName, unsigned int BlockSize, unsigned int FulBlockCount, unsigned int PrevBlockSize, unsigned int PrevBlockCount) { static NotifyCallBackSetBlockSizeFunc func = 0; if (func == 0) func = (NotifyCallBackSetBlockSizeFunc)GetProcAddress(CheckAndLoad(), "NotifyCallBackSetBlockSize"); if (func != 0) func(QueName, BlockSize, FulBlockCount, PrevBlockSize, PrevBlockCount); } /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// 算法描述,必须声明输出参数的最大长度,由调用者预先分配 /// /// 图像数据,BYTE指针,可以自行转成WORD/DOWRD指针 /// 图像宽度 /// 图像高度 /// 图像像素深度bit /// 图像帧数 /// 附加参数结构指针 /// 附加参数结构长度 /// 输出参数结构指针 /// 输出参数结构长度 /// 输入参数描述 /// 输入参数数量 /// 输出参数描述 /// 输出参数数量 /// >=0成功,<0 错误码, >0和小于0 的解释由算法定义 static int ImageProcess(BYTE* pImageData, int nWidth, int nHeigh, int nDepth, int nFrameNum, void* pPraamData, int ParamLen, void* pOutput, int nOutputLen, char szParamDesc[][16], int nPramNum, char szOutPutDesc[][16], int nOutPutParamNum) { } };