123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- #pragma once
- //平台层的交互接口
- #include <string>
- #include <Windows.h>
- 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);
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="pImageData"></param>
- /// <param name="nWidth"></param>
- /// <param name="nHeight"></param>
- /// <param name="nFrameNum"></param>
- /// <param name="nDepth"></param>
- /// <param name="pPraamData"></param>
- /// <param name="ParamLen"></param>
- /// <param name="pOutput"></param>
- /// <param name="nOutputLen"></param>
- /// <param name="szParamDesc"></param>
- /// <param name="nPramNum"></param>
- /// <param name="szOutPutDesc"></param>
- /// <param name="nOutPutParamNum"></param>
- /// <returns> </returns>
- /// <summary>
- /// 算法描述,必须声明输出参数的最大长度,由调用者预先分配
- /// </summary>
- /// <param name="pImageData">图像数据,BYTE指针,可以自行转成WORD/DOWRD指针</param>
- /// <param name="nWidth">图像宽度</param>
- /// <param name="nHeigh">图像高度</param>
- /// <param name="nDepth">图像像素深度bit</param>
- /// <param name="nFrameNum">图像帧数</param>
- /// <param name="pPraamData">附加参数结构指针</param>
- /// <param name="ParamLen">附加参数结构长度</param>
- /// <param name="pOutput">输出参数结构指针</param>
- /// <param name="nOutputLen">输出参数结构长度</param>
- /// <param name="szParamDesc">输入参数描述</param>
- /// <param name="nPramNum">输入参数数量</param>
- /// <param name="szOutPutDesc">输出参数描述</param>
- /// <param name="nOutPutParamNum">输出参数数量</param>
- /// <returns>>=0成功,<0 错误码, >0和小于0 的解释由算法定义</returns>
- 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)
- {
- }
- };
|