public HighMeter() { IntPtr = Win32ApiInvoker.LoadLibrary(Path.Combine(Application.StartupPath, "peripheral", "aoto", "HighMeterLib", "CmCapture.dll")); IntPtr api = Win32ApiInvoker.GetProcAddress(IntPtr, "camInitCameraLib"); intit = (camInitCameraLib)Marshal.GetDelegateForFunctionPointer(api, typeof(camInitCameraLib)); api = Win32ApiInvoker.GetProcAddress(IntPtr, "camGetDevCount"); getCount = (camGetDevCount)Marshal.GetDelegateForFunctionPointer(api, typeof(camGetDevCount)); api = Win32ApiInvoker.GetProcAddress(IntPtr, "camGetDevName"); getName = (camGetDevName)Marshal.GetDelegateForFunctionPointer(api, typeof(camGetDevName)); api = Win32ApiInvoker.GetProcAddress(IntPtr, "camOpenDev"); open = (camOpenDev)Marshal.GetDelegateForFunctionPointer(api, typeof(camOpenDev)); api = Win32ApiInvoker.GetProcAddress(IntPtr, "camSetPreviewWindow"); set = (camSetPreviewWindow)Marshal.GetDelegateForFunctionPointer(api, typeof(camSetPreviewWindow)); api = Win32ApiInvoker.GetProcAddress(IntPtr, "camCaptureImageFile"); image = (camCaptureImageFile)Marshal.GetDelegateForFunctionPointer(api, typeof(camCaptureImageFile)); api = Win32ApiInvoker.GetProcAddress(IntPtr, "camCloseDev"); close = (camCloseDev)Marshal.GetDelegateForFunctionPointer(api, typeof(camCloseDev)); api = Win32ApiInvoker.GetProcAddress(IntPtr, "camUnInitCameraLib"); uninit = (camUnInitCameraLib)Marshal.GetDelegateForFunctionPointer(api, typeof(camUnInitCameraLib)); api = Win32ApiInvoker.GetProcAddress(IntPtr, "camSetImageFillBorder"); fillBorder = (camSetImageFillBorder)Marshal.GetDelegateForFunctionPointer(api, typeof(camSetImageFillBorder)); api = Win32ApiInvoker.GetProcAddress(IntPtr, "camSetImageAutoCrop"); autoCrop = (camSetImageAutoCrop)Marshal.GetDelegateForFunctionPointer(api, typeof(camSetImageAutoCrop)); }
public void Initialize() { log.Debug("begin"); if (!enabled) { return; } string dllPath = Path.Combine(Config.PeripheralAbsolutePath, PeripheralManager.Dir, dll); if (!File.Exists(dllPath)) { dllPath = Path.Combine(Config.PeripheralAbsolutePath, PeripheralManager.Dir, "readQRCodeLib", dll); } intPtr = Win32ApiInvoker.LoadLibrary(dllPath); log.InfoFormat("LoadLibrary: dllPath = {0}, ptr = {1}", dllPath, intPtr); uint idcoed = Win32ApiInvoker.GetLastError(); openApi = Win32ApiInvoker.GetProcAddress(intPtr, "open_hid_ex"); open_Hid_Ex = (open_hid_ex)Marshal.GetDelegateForFunctionPointer(openApi, typeof(open_hid_ex)); CcloseApi = Win32ApiInvoker.GetProcAddress(intPtr, "close_hid"); close_Hid = (close_hid)Marshal.GetDelegateForFunctionPointer(CcloseApi, typeof(close_hid)); //IntPtr ptr = Marshal.AllocHGlobal(125); open_Hid_Ex(callback, null); }
public void Dispose() { //关闭指纹 fpiCance(); //卸载dll Win32ApiInvoker.FreeLibrary(intPtr); }
public void Initialize() { log.Debug("begin"); if (!enabled) { return; } string dllPath = Path.Combine(Config.PeripheralAbsolutePath, PeripheralManager.Dir, dll); if (!File.Exists(dllPath)) { dllPath = Path.Combine(Config.PeripheralAbsolutePath, PeripheralManager.Dir, "MoveCardLib", dll); } intPtr = Win32ApiInvoker.LoadLibrary(dllPath); log.InfoFormat("LoadLibrary: dllPath = {0}, ptr = {1}", dllPath, intPtr); IntPtr api = Win32ApiInvoker.GetProcAddress(intPtr, "CommOpen"); commOpen = (CommOpen)Marshal.GetDelegateForFunctionPointer(api, typeof(CommOpen)); api = Win32ApiInvoker.GetProcAddress(intPtr, "CommClose"); commClose = (CommClose)Marshal.GetDelegateForFunctionPointer(api, typeof(CommClose)); api = Win32ApiInvoker.GetProcAddress(intPtr, "CRT310_MovePosition"); cRT310_MovePosition = (CRT310_MovePosition)Marshal.GetDelegateForFunctionPointer(api, typeof(CRT310_MovePosition)); api = Win32ApiInvoker.GetProcAddress(intPtr, "CRT310_GetStatus"); cRT310_GetStatus = (CRT310_GetStatus)Marshal.GetDelegateForFunctionPointer(api, typeof(CRT310_GetStatus)); api = Win32ApiInvoker.GetProcAddress(intPtr, "MC_ReadTrack"); mC_ReadTrack = (MC_ReadTrack)Marshal.GetDelegateForFunctionPointer(api, typeof(MC_ReadTrack)); api = Win32ApiInvoker.GetProcAddress(intPtr, "RF_DetectCard"); rF_DetectCard = (RF_DetectCard)Marshal.GetDelegateForFunctionPointer(api, typeof(RF_DetectCard)); api = Win32ApiInvoker.GetProcAddress(intPtr, "RF_ReadBlock"); rF_ReadBlock = (RF_ReadBlock)Marshal.GetDelegateForFunctionPointer(api, typeof(RF_ReadBlock)); api = Win32ApiInvoker.GetProcAddress(intPtr, "CPU_ColdReset"); cPU_ColdReset = (CPU_ColdReset)Marshal.GetDelegateForFunctionPointer(api, typeof(CPU_ColdReset)); api = Win32ApiInvoker.GetProcAddress(intPtr, "CPU_T0_C_APDU"); cPU_T0_C_APDU = (CPU_T0_C_APDU)Marshal.GetDelegateForFunctionPointer(api, typeof(CPU_T0_C_APDU)); api = Win32ApiInvoker.GetProcAddress(intPtr, "CPU_T1_C_APDU"); cPU_T1_C_APDU = (CPU_T1_C_APDU)Marshal.GetDelegateForFunctionPointer(api, typeof(CPU_T1_C_APDU)); api = Win32ApiInvoker.GetProcAddress(intPtr, "CRT_IC_CardClose"); cRT_IC_CardClose = (CRT_IC_CardClose)Marshal.GetDelegateForFunctionPointer(api, typeof(CRT_IC_CardClose)); Hdle = commOpen("COM5"); }
public void Initialize() { log.Debug("begin"); if (!enabled) { return; } string dllPath = Path.Combine(Config.PeripheralAbsolutePath, PeripheralManager.Dir, dll); if (!File.Exists(dllPath)) { dllPath = Path.Combine(Config.PeripheralAbsolutePath, PeripheralManager.Dir, "FingerLib", dll); } intPtr = Win32ApiInvoker.LoadLibrary(dllPath); log.InfoFormat("LoadLibrary: dllPath = {0}, ptr = {1}", dllPath, intPtr); uint idcoed = Win32ApiInvoker.GetLastError(); IntPtr api = Win32ApiInvoker.GetProcAddress(intPtr, "FPIDevDetect"); fpiDevDetect = (FPIDevDetect)Marshal.GetDelegateForFunctionPointer(api, typeof(FPIDevDetect)); api = Win32ApiInvoker.GetProcAddress(intPtr, "FPIGetFeature"); fpiGetFeature = (FPIGetFeature)Marshal.GetDelegateForFunctionPointer(api, typeof(FPIGetFeature)); api = Win32ApiInvoker.GetProcAddress(intPtr, "FPIGetImageData"); fpiGetImageData = (FPIGetImageData)Marshal.GetDelegateForFunctionPointer(api, typeof(FPIGetImageData)); api = Win32ApiInvoker.GetProcAddress(intPtr, "FPIFpMatch"); fpiFpMatch = (FPIFpMatch)Marshal.GetDelegateForFunctionPointer(api, typeof(FPIFpMatch)); api = Win32ApiInvoker.GetProcAddress(intPtr, "FPIFeatureToTemplate"); fpiFeatureToTemplate = (FPIFeatureToTemplate)Marshal.GetDelegateForFunctionPointer(api, typeof(FPIFeatureToTemplate)); api = Win32ApiInvoker.GetProcAddress(intPtr, "FPIGetVersion"); fpiGetVersion = (FPIGetVersion)Marshal.GetDelegateForFunctionPointer(api, typeof(FPIGetVersion)); api = Win32ApiInvoker.GetProcAddress(intPtr, "FPIGetTemplate"); fpiGetTemplate = (FPIGetTemplate)Marshal.GetDelegateForFunctionPointer(api, typeof(FPIGetTemplate)); api = Win32ApiInvoker.GetProcAddress(intPtr, "FPIDetectFinger"); fpiDetectFinger = (FPIDetectFinger)Marshal.GetDelegateForFunctionPointer(api, typeof(FPIDetectFinger)); api = Win32ApiInvoker.GetProcAddress(intPtr, "FPICancel"); fpiCance = (FPICancel)Marshal.GetDelegateForFunctionPointer(api, typeof(FPICancel)); int re = fpiDevDetect(0); log.DebugFormat("GetProcAddress: ptr = {0}, entryPoint = PPL398_InitialDevice", intPtr); log.Debug("end"); }
public void Initialize() { tagList = new List <string>(); string dllPath = Path.Combine(Config.PeripheralAbsolutePath, PeripheralManager.Dir, dll); if (!File.Exists(dllPath)) { dllPath = Path.Combine(Config.PeripheralAbsolutePath, PeripheralManager.Dir, "RFIDLib", dll); } intPtr = Win32ApiInvoker.LoadLibrary(dllPath); log.InfoFormat("LoadLibrary: dllPath = {0}, ptr = {1}", dllPath, intPtr); uint idcoed = Win32ApiInvoker.GetLastError(); IntPtr api = Win32ApiInvoker.GetProcAddress(intPtr, "OpenDevice"); openDevice = (OpenDevice)Marshal.GetDelegateForFunctionPointer(api, typeof(OpenDevice)); api = Win32ApiInvoker.GetProcAddress(intPtr, "OneFindTags"); oneFindTags = (OneFindTags)Marshal.GetDelegateForFunctionPointer(api, typeof(OneFindTags)); api = Win32ApiInvoker.GetProcAddress(intPtr, "GetHardwareVersionNumber"); getHardwareVersionNumber = (GetHardwareVersionNumber)Marshal.GetDelegateForFunctionPointer(api, typeof(GetHardwareVersionNumber)); api = Win32ApiInvoker.GetProcAddress(intPtr, "GetFirmwareVersion"); getFirmwareVersion = (GetFirmwareVersion)Marshal.GetDelegateForFunctionPointer(api, typeof(GetFirmwareVersion)); api = Win32ApiInvoker.GetProcAddress(intPtr, "GetUniqueID"); getUniqueID = (GetUniqueID)Marshal.GetDelegateForFunctionPointer(api, typeof(GetUniqueID)); api = Win32ApiInvoker.GetProcAddress(intPtr, "SendHeartbeat"); sendHeartbeat = (SendHeartbeat)Marshal.GetDelegateForFunctionPointer(api, typeof(SendHeartbeat)); api = Win32ApiInvoker.GetProcAddress(intPtr, "ConstantFindTags"); constantFindTags = (ConstantFindTags)Marshal.GetDelegateForFunctionPointer(api, typeof(ConstantFindTags)); api = Win32ApiInvoker.GetProcAddress(intPtr, "StopFindTags"); stopFindTags = (StopFindTags)Marshal.GetDelegateForFunctionPointer(api, typeof(StopFindTags)); api = Win32ApiInvoker.GetProcAddress(intPtr, "OnlyRead"); onlyRead = (OnlyRead)Marshal.GetDelegateForFunctionPointer(api, typeof(OnlyRead)); int ret = openDevice(); if (0 == ret) { list = new List <string>(); } else { } }
public void Initialize() { log.Debug("begin"); if (!enabled) { return; } string dllPath = Path.Combine(Config.PeripheralAbsolutePath, PeripheralManager.Dir, dll); if (!File.Exists(dllPath)) { dllPath = Path.Combine(Config.PeripheralAbsolutePath, PeripheralManager.Dir, "IDCardlib", dll); } ptr = Win32ApiInvoker.LoadLibrary(dllPath); log.InfoFormat("LoadLibrary: dllPath = {0}, ptr = {1}", dllPath, ptr); IntPtr api = Win32ApiInvoker.GetProcAddress(ptr, "IDCR_Initialize"); idcrInitialize = (IDCR_Initialize)Marshal.GetDelegateForFunctionPointer(api, typeof(IDCR_Initialize)); log.InfoFormat("GetProcAddress: ptr = {0}, entryPoint = IDCR_Initialize", ptr); api = Win32ApiInvoker.GetProcAddress(ptr, "IDCR_BeginRead"); idcrBeginRead = (IDCR_BeginRead)Marshal.GetDelegateForFunctionPointer(api, typeof(IDCR_BeginRead)); log.InfoFormat("GetProcAddress: ptr = {0}, entryPoint = IDCR_BeginRead", ptr); api = Win32ApiInvoker.GetProcAddress(ptr, "IDCR_DataAvailable"); idcrDataAvailable = (IDCR_DataAvailable)Marshal.GetDelegateForFunctionPointer(api, typeof(IDCR_DataAvailable)); log.InfoFormat("GetProcAddress: ptr = {0}, entryPoint = IDCR_DataAvailable", ptr); api = Win32ApiInvoker.GetProcAddress(ptr, "IDCR_ReadData"); idcrReadData = (IDCR_ReadData)Marshal.GetDelegateForFunctionPointer(api, typeof(IDCR_ReadData)); log.InfoFormat("GetProcAddress: ptr = {0}, entryPoint = IDCR_ReadData", ptr); api = Win32ApiInvoker.GetProcAddress(ptr, "IDCR_CancelRead"); idcrCancelRead = (IDCR_CancelRead)Marshal.GetDelegateForFunctionPointer(api, typeof(IDCR_CancelRead)); log.InfoFormat("GetProcAddress: ptr = {0}, entryPoint = IDCR_CancelRead", ptr); api = Win32ApiInvoker.GetProcAddress(ptr, "IDCR_GetStatus"); idcrGetstatus = (IDCR_GetStatus)Marshal.GetDelegateForFunctionPointer(api, typeof(IDCR_GetStatus)); log.InfoFormat("GetProcAddress: ptr = {0}, entryPoint = IDCR_GetStatus", ptr); string xml = "<?xml version =\"1.0\" encoding=\"utf-8\"?><Device> <DeviceId>IDCard001</DeviceId> <LogLevel>3</LogLevel></Device>"; int code = idcrInitialize(xml); log.InfoFormat("invoke {0} -> IDCR_Initialize, args: xml = {1}, return = {2}", dll, xml, code); log.Debug("end"); }
public void Dispose() { log.Debug("begin"); if (!enabled) { return; } if (IntPtr.Zero != ptr) { Win32ApiInvoker.FreeLibrary(ptr); log.InfoFormat("FreeLibrary: ptr = {0}", ptr); } log.Debug("end"); }
public void Initialize() { string dllPath = Path.Combine(Application.StartupPath, "peripheral", "aoto", "YPBoxLib", "YPGDriver.dll"); intPtr = Win32ApiInvoker.LoadLibrary(dllPath); IntPtr api = Win32ApiInvoker.GetProcAddress(intPtr, "OpenDevice"); openDevice = (OpenDevice)Marshal.GetDelegateForFunctionPointer(api, typeof(OpenDevice)); api = Win32ApiInvoker.GetProcAddress(intPtr, "GetSerialNumber"); getSerialNumber = (GetSerialNumber)Marshal.GetDelegateForFunctionPointer(api, typeof(GetSerialNumber)); api = Win32ApiInvoker.GetProcAddress(intPtr, "MotorRun"); motorRun = (MotorRun)Marshal.GetDelegateForFunctionPointer(api, typeof(MotorRun)); api = Win32ApiInvoker.GetProcAddress(intPtr, "MotorPoll"); motorPoll = (MotorPoll)Marshal.GetDelegateForFunctionPointer(api, typeof(MotorPoll)); api = Win32ApiInvoker.GetProcAddress(intPtr, "CloseDevice"); closeDevice = (CloseDevice)Marshal.GetDelegateForFunctionPointer(api, typeof(CloseDevice)); int ret = openDevice(ComNumber); }
public void Initialize() { log.Debug("begin"); if (!enabled) { return; } string dllPath = Path.Combine(Config.PeripheralAbsolutePath, PeripheralManager.Dir, dll); if (!File.Exists(dllPath)) { dllPath = Path.Combine(Config.PeripheralAbsolutePath, PeripheralManager.Dir, "KeyBoardLib", dll); } intPtr = Win32ApiInvoker.LoadLibrary(dllPath); log.InfoFormat("LoadLibrary: dllPath = {0}, ptr = {1}", dllPath, intPtr); uint idcoed = Win32ApiInvoker.GetLastError(); IntPtr api = Win32ApiInvoker.GetProcAddress(intPtr, "SUNSON_OpenCom"); sUNSON_OpenCom = (SUNSON_OpenCom)Marshal.GetDelegateForFunctionPointer(api, typeof(SUNSON_OpenCom)); api = Win32ApiInvoker.GetProcAddress(intPtr, "SUNSON_UseEppPlainTextMode"); sUNSON_UseEppPlainTextMode = (SUNSON_UseEppPlainTextMode)Marshal.GetDelegateForFunctionPointer(api, typeof(SUNSON_UseEppPlainTextMode)); api = Win32ApiInvoker.GetProcAddress(intPtr, "SUNSON_GetPin"); sUNSON_GetPin = (SUNSON_GetPin)Marshal.GetDelegateForFunctionPointer(api, typeof(SUNSON_GetPin)); api = Win32ApiInvoker.GetProcAddress(intPtr, "SUNSON_ScanKeyPress"); sUNSON_ScanKeyPress = (SUNSON_ScanKeyPress)Marshal.GetDelegateForFunctionPointer(api, typeof(SUNSON_ScanKeyPress)); api = Win32ApiInvoker.GetProcAddress(intPtr, "SUNSON_GetVersionNo"); sUNSON_GetVersionNo = (SUNSON_GetVersionNo)Marshal.GetDelegateForFunctionPointer(api, typeof(SUNSON_GetVersionNo)); api = Win32ApiInvoker.GetProcAddress(intPtr, "SUNSON_CloseCom"); sUNSON_CloseCom = (SUNSON_CloseCom)Marshal.GetDelegateForFunctionPointer(api, typeof(SUNSON_CloseCom)); api = Win32ApiInvoker.GetProcAddress(intPtr, "SUNSON_ResetEpp"); sUNSON_ResetEpp = (SUNSON_ResetEpp)Marshal.GetDelegateForFunctionPointer(api, typeof(SUNSON_ResetEpp)); api = Win32ApiInvoker.GetProcAddress(intPtr, "SUNSON_LoadUserKey"); sUNSON_LoadUserKey = (SUNSON_LoadUserKey)Marshal.GetDelegateForFunctionPointer(api, typeof(SUNSON_LoadUserKey)); api = Win32ApiInvoker.GetProcAddress(intPtr, "SUNSON_CloseEppPlainTextMode"); sUNSON_CloseEppPlainTextMode = (SUNSON_CloseEppPlainTextMode)Marshal.GetDelegateForFunctionPointer(api, typeof(SUNSON_CloseEppPlainTextMode)); api = Win32ApiInvoker.GetProcAddress(intPtr, "SUNSON_GetPinBlock"); sUNSON_GetPinBlock = (SUNSON_GetPinBlock)Marshal.GetDelegateForFunctionPointer(api, typeof(SUNSON_GetPinBlock)); api = Win32ApiInvoker.GetProcAddress(intPtr, "SUNSON_DataCompute"); sUNSON_DataCompute = (SUNSON_DataCompute)Marshal.GetDelegateForFunctionPointer(api, typeof(SUNSON_DataCompute)); //先判断,关闭 if (nOpend > 0) { sUNSON_CloseCom(); } //打开串口 nOpend = sUNSON_OpenCom(ComNumber, 9600); StringBuilder ReturnInfo = new StringBuilder(100); int ret = 0; if (ret > 0) { //成功 } }
public int InitCamera(IntPtr dvrHandle) { string logPath = Path.Combine(Application.StartupPath, "peripheral", "aoto", "FaceCamLib", "SdkLog"); string dllPath = Path.Combine(Application.StartupPath, "peripheral", "aoto", "FaceCamLib", "HCNetSDK.dll"); intPtr = Win32ApiInvoker.LoadLibrary(dllPath); IntPtr api = Win32ApiInvoker.GetProcAddress(intPtr, "NET_DVR_Init"); init = (NET_DVR_Init)Marshal.GetDelegateForFunctionPointer(api, typeof(NET_DVR_Init)); api = Win32ApiInvoker.GetProcAddress(intPtr, "NET_DVR_Login_V30"); login = (NET_DVR_Login_V30)Marshal.GetDelegateForFunctionPointer(api, typeof(NET_DVR_Login_V30)); api = Win32ApiInvoker.GetProcAddress(intPtr, "NET_DVR_GetLastError"); lastError = (NET_DVR_GetLastError)Marshal.GetDelegateForFunctionPointer(api, typeof(NET_DVR_GetLastError)); api = Win32ApiInvoker.GetProcAddress(intPtr, "NET_DVR_SetLogToFile"); setLog = (NET_DVR_SetLogToFile)Marshal.GetDelegateForFunctionPointer(api, typeof(NET_DVR_SetLogToFile)); api = Win32ApiInvoker.GetProcAddress(intPtr, "NET_DVR_RealPlay_V40"); realPlay = (NET_DVR_RealPlay_V40)Marshal.GetDelegateForFunctionPointer(api, typeof(NET_DVR_RealPlay_V40)); api = Win32ApiInvoker.GetProcAddress(intPtr, "NET_DVR_StopRealPlay"); stopPlay = (NET_DVR_StopRealPlay)Marshal.GetDelegateForFunctionPointer(api, typeof(NET_DVR_StopRealPlay)); api = Win32ApiInvoker.GetProcAddress(intPtr, "NET_DVR_CapturePicture"); capturePicture = (NET_DVR_CapturePicture)Marshal.GetDelegateForFunctionPointer(api, typeof(NET_DVR_CapturePicture)); api = Win32ApiInvoker.GetProcAddress(intPtr, "NET_DVR_MakeKeyFrame"); makeKeyFrame = (NET_DVR_MakeKeyFrame)Marshal.GetDelegateForFunctionPointer(api, typeof(NET_DVR_MakeKeyFrame)); api = Win32ApiInvoker.GetProcAddress(intPtr, "NET_DVR_SaveRealData"); saveReallData = (NET_DVR_SaveRealData)Marshal.GetDelegateForFunctionPointer(api, typeof(NET_DVR_SaveRealData)); api = Win32ApiInvoker.GetProcAddress(intPtr, "NET_DVR_StopSaveRealData"); stopRealData = (NET_DVR_StopSaveRealData)Marshal.GetDelegateForFunctionPointer(api, typeof(NET_DVR_StopSaveRealData)); //初始化SDK m_bInitSDK = init(); if (m_bInitSDK == false) { //MessageBox.Show("NET_DVR_Init error!"); } else { //初始化日志 setLog(3, logPath, true); } //初始化摄像机 if (m_UserID < 0) { m_UserID = login(dvrIPAddress2, dvrPortNumber, dvrUserName, dvrPassword, ref deviceInfo); iLastErr = lastError(); if (m_UserID == 0) { dvrPtr = dvrHandle; } } else { } return(m_UserID); }