예제 #1
0
        public string openDevice()
        {
            try
            {
                Int32   tmphdev = 0;
                Int32[] devs    = new Int32[100];
                int     i       = 0;
                do
                {
                    tmphdev = E7Lib.fw_init(100, 0);
                    if (tmphdev > 0)
                    {
                        devs[i] = tmphdev;
                    }
                    else
                    {
                        //TODO:写入程序通知,让用户插入设备
                        //等待设备 1*100秒
                        Thread.Sleep(100);
                    }
                    i++;
                }while (i < 25 && tmphdev < 0);

                iDevice = devs[i - 1];
                //打开LCD
                setLCDBright(true);
                //配置卡类型
                int state     = E7Lib.fw_config_card(iDevice, 0x41);
                int stateAuth = E7Lib.fw_authentication(iDevice, 0, sectorNumber);
                //E7Lib.fw_beep(iDevice, 10);
                return(iDevice.ToString());
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }