DONSEE东信智能 - 身份证社保卡读卡智能终端应用服务商

eastcoms@qq.com
400-6722-705
首页 > 服务支持专区 > 产品支持 > SDK开发包和软件下载

乌班图(ubuntu )Linux系统身份证阅读器开发包(含libwlt2bmp.so身份证相片解码)

来源:www.eastcoms.com   标签:ubuntu linux 开发包 相片解码 libwlt2bmp   发布时间: 2018-10-18 17:07:11

Ubuntu(友帮拓、优般图、乌班图)是一个以桌面应用为主的开源GNU/Linux操作系统,Ubuntu 是基于Debian GNU/Linux,支持x86、amd64(即x64)和ppc架构,由全球化的专业开发团队(Canonical Ltd)打造的。 

注意:

此Linux版本是我公司最新的采用USB接口通讯的开发包,更新了最新的libwlt2bmp.so相片解码库,完美支持Linux系统,涵盖了身份证、M1、CPU、IC等多种卡片的Linux系统应用示例,包括了身份证相片解码。

乌班图(ubuntu )Linux系统身份证阅读器开发包

广东东信智能科技有限公司身份证阅读器模组模块,支持身份证、社保卡、CPU卡、M1卡、IC卡、医保卡、磁条卡、银行卡等多种卡片识别读取,提供完善的接口SDK二次开发技术支持,可提供Linux、单片机、ARM的通讯协议以及Android、Windows等系统二次开发包,可以适用于市场上的闸机、门禁、人脸识别考勤机、机器人终端、通道闸等产品使用。

身份证阅读器Linux系统开发包

版本:V2018.09.25(USB版本)

应用产品:门禁系统、道闸、考勤系统以及人脸识别系统、自助终端、机器人系统等。

Linux身份证阅读器部分开发代码:

#include "../inc/est100.h"

#include <string.h>

#include <stdio.h>

static long handle;

//print a line of characters

static void printchar(char ch, int len)

{

while(len--)

{

printf("%c", ch);

}

printf("\n");

}

static void printchar_txt(char ch, char *pText)

{

printf("%c\t%s\n", ch, pText);

}

static void printByteArray(char *Tag, unsigned char *pSrc, int ilen)

{

inti = 0;

printf( "%s", Tag );

while( i<ilen )

{

printf( "%02X ", pSrc[i] );

i++;

}

printf( "\n" );

}

static void ShowToEdit(const char* tag, const char* msg)

{

printf( "%s\t%s\n", tag, msg );

}

static void CertCard_Test()

{

intnRt, i;

char pName[70]={0};

char pSex[10]={0};

char pNation[10]={0};

char pBirth[50]={0};

char pAddress[100]={0};

char pCertNo[50]={0};

char pDepartment[100]={0};

char pEffectData[50]={0};

char pExpire[20]={0};

char pErrMsg[50]={0};

char pEnName[150] = { 0 };

char pEnNation[50] = { 0 };

char pAuthorCode[150] = { 0 };

char pCardVersion[150] = { 0 };

char pTXZHM[50] = { 0 };

char pTXZQFCS[10] = { 0 };

nRt = PICC_ReadIDCard(handle);

if ( nRt != 0 )

{

printf( "ReadCertCard fail! nRet=%d\n", nRt );

return;

}

if(GetCardType() == 0)

{

GetName(pName);

GetSex(pSex);

GetNation(pNation);

GetBirth(pBirth);

GetAddress(pAddress);

GetCertNo(pCertNo);

GetDepartemt(pDepartment);

GetEffectDate(pEffectData);

GetExpireDate(pExpire);

ShowToEdit( "姓名:", (pName));

ShowToEdit( "性别:", (pSex));

ShowToEdit( "民族:", (pNation));

ShowToEdit( "出生日期:", (pBirth));

ShowToEdit( "地址:", (pAddress));

ShowToEdit( "身份证号:", (pCertNo));

ShowToEdit( "签发机关:", (pDepartment));

ShowToEdit( "有效起始日期:", (pEffectData));

ShowToEdit( "有效截止日期:", (pExpire));

}

if(GetCardType() == 1)

{

GetName(pName);

GetEnName(pEnName);

GetSex(pSex);

GetNationalityCode(pEnNation);

GetBirth(pBirth);

GetCertNo(pCertNo);

GetEffectDate(pEffectData);

GetExpireDate(pExpire);

GetCardVersion(pCardVersion);

ShowToEdit( "中文姓名:", (pName));

ShowToEdit( "英文姓名:", (pEnName));

ShowToEdit( "性别:", (pSex));

ShowToEdit( "国籍代码:", (pEnNation));

ShowToEdit( "永久居留证号码:", (pCertNo));

ShowToEdit( "出生日期:", (pBirth));

ShowToEdit( "证件签发日期:", (pEffectData));

ShowToEdit( "证件终止日期:", (pExpire));

ShowToEdit( "证件版本:", (pCardVersion));

}

if(GetCardType() == 2)

{

GetName(pName);

GetSex(pSex);

GetBirth(pBirth);

GetAddress(pAddress);

GetCertNo(pCertNo);

GetDepartemt(pDepartment);

GetEffectDate(pEffectData);

GetExpireDate(pExpire);

GetTXZHM(pTXZHM);

GetTXZQFCS(pTXZQFCS);

ShowToEdit( "姓名:", (pName));

ShowToEdit( "性别:", (pSex));

ShowToEdit( "出生日期:", (pBirth));

ShowToEdit( "地址:", (pAddress));

ShowToEdit( "身份证号:", (pCertNo));

ShowToEdit( "签发机关:", (pDepartment));

ShowToEdit( "有效起始日期:", (pEffectData));

ShowToEdit( "有效截止日期:", (pExpire));

ShowToEdit( "通行证号码:", (pTXZHM));

ShowToEdit( "通行证签发次数:", (pTXZQFCS));

}

char szPhotoPath[255] = { 0 };

sprintf(szPhotoPath, "../list/%s.bmp", pCertNo);

GetBmpFile("../lib/libwltdecode.so", szPhotoPath);

}

static void ICC_CPUCard_Test()

{

intnRt, i;

unsigned char slot = 0x01;

unsigned char cmd[255] = { 0 };

unsigned charresp[255]= { 0 };

unsigned charATR[60] = { 0 };

intlenth_of_cmd;

// Get 8 byte Random

cmd[0] = 0x00;

cmd[1] = 0x84;

cmd[2] = 0x00;

cmd[3] = 0x00;

cmd[4] = 0x08;

lenth_of_cmd = 5;

//CPU Card PowerOn

nRt = ICC_Reader_pre_PowerOn( handle, slot, resp );

if( nRt < 0 )

{

printf( "CPU Card PowerOn fail! ret=%d\n", nRt );

return;

}

printByteArray( "ATR: ", resp, nRt );

printByteArray( "CMD: ", cmd, lenth_of_cmd );

//Send APDU CMD

memset( resp, 0, 250 );

nRt = ICC_Reader_Application( handle, slot, lenth_of_cmd, cmd, resp );

if( nRt < 0 )

{

printf( "send APDU CMD fail! ret=%d\n", nRt );

return;

}

printByteArray( "Resp: ", resp, nRt );

}

static void PICC_CPUCard_Test()

{

int             nRt, i;

unsigned char   uid[15]  = { 0 };

unsigned char   cmd[255] = { 0 };

unsigned char   resp[255]= { 0 };

unsigned char   ATR[60]  = { 0 };

int             lenth_of_cmd;

// Get 8 byte Random

cmd[0] = 0x00;

cmd[1] = 0x84;

cmd[2] = 0x00;

cmd[3] = 0x00;

cmd[4] = 0x08;

lenth_of_cmd = 5;

//CPU Card PowerOn

if( PICC_Reader_SetTypeA( handle ) != 0 )

{

printf( "PICC_Reader_SetTypeA fail! ret=%d\n", nRt );

return;

}

if( PICC_Reader_Request( handle ) != 0 )

{

printf( "PICC_Reader_Request fail! ret=%d\n", nRt );

return;

}

if( PICC_Reader_anticoll( handle, uid ) != 0 )

{

printf( "PICC_Reader_anticoll fail! ret=%d\n", nRt );

return;

}

if( PICC_Reader_Select( handle, 0x41 ) != 0 )

{

printf( "PICC_Reader_Select fail! ret=%d\n", nRt );

return;

}

nRt = PICC_Reader_PowerOnTypeA( handle, resp );

if( nRt < 0 )

{

printf( "TypeA CPU Card PowerOn fail! ret=%d\n", nRt );

return;

}

printByteArray( "ATR: ", resp, nRt );

printByteArray( "CMD: ", cmd, lenth_of_cmd );

memset( resp, 0, 250 );

nRt = PICC_Reader_Application( handle, lenth_of_cmd, cmd, resp );

if( nRt < 0 )

{

printf( "send APDU CMD fail! ret=%d\n", nRt );

return;

}

printByteArray( "Resp: ", resp, nRt );

}

static void M1Card_Test()

{

int             nRt, i;

unsigned char   uid[15]= { 0 };

unsigned char   password[7] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 };

unsigned char   resp[255]= { 0 };

unsigned charaddr= 0x04;

unsigned charsncr= 0x01;

unsigned charmode= 0x61;

//CPU Card PowerOn

if( PICC_Reader_SetTypeA( handle ) != 0 )

{

printf( "PICC_Reader_SetTypeA fail! ret=%d\n", nRt );

return;

}

if( PICC_Reader_Request( handle ) != 0 )

{

printf( "PICC_Reader_Request fail! ret=%d\n", nRt );

return;

}

if( PICC_Reader_anticoll( handle, uid ) != 0 )

{

printf( "PICC_Reader_anticoll fail! ret=%d\n", nRt );

return;

}

if( PICC_Reader_Select( handle, 0x41 ) != 0 )

{

printf( "PICC_Reader_Select fail! ret=%d\n", nRt );

return;

}

printByteArray( "UID: ", uid, 4 );

nRt = PICC_Reader_Authentication_Pass( handle, mode, sncr, password );

if ( nRt != 0 )

{

printf( "PICC_Reader_Authentication_Pass fail! ret=%d\n", nRt );

return;

}

nRt = PICC_Reader_Read( handle, addr, resp );

if( nRt != 0 )

{

printf( "PICC_Reader_Read fail! ret=%d\n", nRt );

return;

}

printByteArray( "Data: ", resp, 16 );

}

int main(void)

{

long nRt;

intnval;

handle = ICC_Reader_Open( "USB1" );

if( handle < 0 )

{

printf( "open fail! \n" );

return 0;

}

printchar( '#', 80 );

printchar_txt( '#', "please choose the action you want:" );

printchar_txt( '#', "1.Select ICC CPU Card." );

printchar_txt( '#', "2.Select PICC CPU(A) Card." );

printchar_txt( '#', "3.Select M1 Card." );

printchar_txt( '#', "4.Select CertCard." );

printchar( '#', 80 );

scanf( "%d", &nval );

switch( nval )

{

case 1:

{

printf( "\tICC_CPU_CARD.\n" );

ICC_CPUCard_Test();

}

break;

case 2:

{

printf( "\tPICC_CPU(A)_CARD.\n" );

PICC_CPUCard_Test();

}

break;

case 3:

{

printf( "\tM1_CARD.\n" );

M1Card_Test();

}

break;

case 4:

{

printf( "\tCertCard.\n" );

CertCard_Test();

}

break;

default:

printf( "enter err!\n" );

break;

}

ICC_PosBeep( handle, 10 );

ICC_Reader_Close(handle);

return 0;

}


 

 
QQ在线咨询