Exemple #1
0
        private void FillData()
        {
            try
            {
                byte[] name = new byte[50]; int length = 50;
                //Cvrsdk.Get_PeopleName(ref name[0], ref length);
                Cvrsdk.Well_GetName(ref name[0], ref length);

                byte[] number = new byte[50]; length = 50;
                // Cvrsdk.GetPeopleIDCode(ref number[0], ref length);
                Cvrsdk.Well_GetIdCard(ref number[0], ref length);

                byte[] address = new byte[70]; length = 70;
                // Cvrsdk.GetPeopleAddress(ref address[0], ref length);
                Cvrsdk.Well_GetAddress(ref address[0], ref length);

                Info = new CvrInfo
                {
                    Name      = ByteToString(name),
                    Address   = ByteToString(address),
                    Number    = ByteToString(number),
                    PeopleImg = AppDomain.CurrentDomain.BaseDirectory + "pic.bmp",
                };
                OnGetNewDataEvent(Info);   //抛出事件读取成功
            }
            catch (Exception ex)
            {
                ex.ToSaveLog("FillData:读取CVR第二代身份证信息:!");
            }
        }
Exemple #2
0
 public bool Close()
 {
     try
     {
         Cvrsdk.Well_CloseComm().ToString().ToSaveLog("closeCommSVR:");
     }
     catch (Exception ex)
     {
         ex.ToSaveLog("close:CVR身份硬件关闭:");
     }
     return(false);
 }
Exemple #3
0
 /// <summary> 初始化CVR第二代身份证识别硬件 </summary>
 public bool Init()
 {
     try
     {
         var port = IrAdvanced.ReadInt("CvrCom");
         port.ToString().ToSaveLog("尝试打开二代身份证硬件连接端口:");
         _iRetPort = Cvrsdk.Well_InitComm(port);
         if (_iRetPort != 1)
         {
             "CVR串口打开失败".ToSaveLog();
         }
         return(_iRetPort == 1);    //返回是否初始化成功
     }
     catch (Exception ex)
     {
         ex.Message.ToSaveLog("初始化CVR第二代身份证识别硬件失败:");
     }
     return(false);
 }
Exemple #4
0
 /// <summary> 读取CVR第二代身份证信息 </summary>
 public void ReadData()
 {
     try
     {
         if (_iRetPort == 1)
         {
             int authenticate = Cvrsdk.Well_Authenticate();
             if (authenticate == 1)
             {
                 int readContent = Cvrsdk.Well_ReadContent();
                 if (readContent == 1)
                 {
                     FillData();
                     Info.Number.ToSaveLog("读取CVR第二代身份证信息成功:");
                 }
                 else
                 {
                     readContent.ToString().ToSaveLog("Well_ReadContent读第二代证失败:");
                 }
             }
             else
             {
                 if (authenticate != 2)
                 {
                     authenticate.ToString().ToSaveLog("Well_Authenticate卡认证失败:");
                 }
             }
         }
         else
         {
             "硬件CVR第二代身份证:初始化失败!".ToSaveLog();
         }
     }
     catch (Exception ex)
     {
         ex.ToSaveLog("ReadData:读取CVR第二代身份证信息:初始化失败!");
     }
 }