前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >身份证读卡设备-华视电子

身份证读卡设备-华视电子

作者头像
用户1637609
发布2021-04-12 16:53:37
4780
发布2021-04-12 16:53:37
举报
文章被收录于专栏:马洪彪马洪彪

操作顺序:

  • 打开设备
  • 卡认证
  • 读卡

调用sdk的方法读卡等。

读卡

while (true)// 
{
    if (bgw.CancellationPending)//
    {
        e.Cancel = true; //
        return;
    }
    int authenticate = CVRSDK.CVR_Authenticate();
    if (authenticate == 1)
    { 
        int readContent = CVRSDK.CVR_Read_FPContent();  
        if (readContent != 1)
        { 
            bgw.ReportProgress(100, "读卡失败");
            Thread.Sleep(TimeSpan.FromSeconds(1));//
            continue;
        } 
    }
    else
    {
        Thread.Sleep(TimeSpan.FromSeconds(1));//
        continue;
    } 
 
    int length = 0; 
    byte[] name = new byte[128];
    length = 128;
    CVRSDK.GetPeopleName(ref name[0], ref length);//姓名
    string nameStr = Encoding.GetEncoding("GB2312").GetString(name);
    //
    byte[] number = new byte[128];
    length = 128;
    CVRSDK.GetPeopleIDCode(ref number[0], ref length);//身份证号码
    string cardNoStr = Encoding.GetEncoding("GB2312").GetString(number);
    //
    string IsReadCardAddress = mesh.common.SystemSetting.GetSetting("IsReadCardAddress"); 
    byte[] address = new byte[128];
    length = 128;
    CVRSDK.GetPeopleAddress(ref address[0], ref length);//地址
    string addressStr = Encoding.GetEncoding("GB2312").GetString(address); 
    //
    bgw.ReportProgress(50, new object[] { nameStr, addressStr, cardNoStr });
    Thread.Sleep(TimeSpan.FromSeconds(3)); //
}
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2021-04-08 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 读卡
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档