Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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");
        }
Ejemplo n.º 3
0
        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
            {
            }
        }
Ejemplo n.º 4
0
        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)
            {
                //成功
            }
        }