Windows身份证云解码SDK开发包开发说明
<p>> 注意:测试使用的 appid 不可以用于商用(否则后果自负)。
商用的 appid 请务必联系我司商务进行分配。</p>
<h2>一、支持的读卡器类型</h2>
<p>本开发包支持USB免驱型、串口型这2种类型的读卡器,支持读取二代居民身份证、M1和CPU卡等。
提供动态连接库dll,提供C++(MFC)和C#下的演示程序执行文件和示例源码。</p>
<h2>二、动态库文件说明</h2>
<p><strong>sdtapi.dll</strong>:公安部二代证模块通信标准函数。实现USB读二代证和M1卡等功能。
<strong>hidapi.dll</strong>:HID动态库,<strong>sdtapi.dll</strong>需要用到此动态库。
<strong>conf.yaml</strong>:配置文件设置。
<strong>license.dat</strong>:二代证照片解码库的授权文件。
<strong>WltRS.dll</strong>:二代证照片解码库,需配合<strong>license.dat</strong>文件使用。
<strong>DLL_File.dll</strong>:二代证照片解码库,需配合<strong>license.dat</strong>文件使用。</p>
<p><strong>本开发包适用于直接调用dll的本地应用开发。</strong></p>
<h2>三、SDK函数说明</h2>
<p><strong>1.<code>Syn_StartFindIDCard</code></strong></p>
<p><strong>开始找卡。</strong></p>
<pre><code>int Syn_StartFindIDCard(
int iPort,
unsigned char * pucIIN,
int iIfOpen
);</code></pre>
<p><strong>参数说明:</strong></p>
<pre><code>iPort
[in] 整数,表示端口号。
pucIIN
[out] 无符号字符指针,指向读到的IIN。
iIfOpen
[in] 整数。</code></pre>
<p><strong>返回值:</strong></p>
<pre><code>0x9f 找卡成功
0x80 找卡失败</code></pre>
<p><strong>2.<code>Syn_SelectIDCard</code></strong></p>
<p><strong>选卡。</strong></p>
<pre><code>int Syn_SelectIDCard(
int iPort,
unsigned char * pucSN,
int iIfOpen
);</code></pre>
<p><strong>参数说明:</strong></p>
<pre><code>iPort
[in] 整数,表示端口号。
pucSN
[out] 无符号字符指针,指向读到的SN。
iIfOpen
[in] 整数。</code></pre>
<p><strong>返回值:</strong></p>
<pre><code>0x90 选卡成功
0x81 选卡失败</code></pre>
<p><strong>3.<code>Syn_ReadBaseMsg</code></strong></p>
<p><strong>读取身份证内基本信息区域信息。</strong></p>
<pre><code>int Syn_ReadBaseMsg(
int iPort,
unsigned char * pucCHMsg,
unsigned int * puiCHMsgLen,
unsigned char * pucPHMsg,
unsigned int * puiPHMsgLen,
int iIfOpen
);</code></pre>
<p><strong>参数说明:</strong></p>
<pre><code>iPort
[in] 整数,表示端口号。
pucCHMsg
[out] 无符号字符指针,指向读到的文字信息。
puiCHMsgLen
[out] 无符号整型数指针,指向读到的文字信息长度。
pucPHMsg
[out] 无符号字符指针,指向读到的照片信息。
puiPHMsgLen
[out] 无符号整型数指针,指向读到的照片信息长度。
iIfOpen
[in] 整数。</code></pre>
<p><strong>返回值:</strong></p>
<pre><code>0x90 读基本信息成功
0x41 读基本信息失败</code></pre>
<p><strong>4.<code>Syn_ReadBaseMsgToFile</code>与<code>Syn_ReadBaseMsg</code>函数</strong></p>
<p><strong>类似读取ID卡内基本信息区域信息,并将读到的基本信息写进输入参数所指定的文件中。</strong></p>
<pre><code>int Syn_ReadBaseMsgToFile(
int iPortID,
char * pcCHMsgFileName,
unsigned int * puiCHMsgFileLen,
char * pcPHMsgFileName,
unsigned int * puiPHMsgFileLen,
int iIfOpen
);</code></pre>
<p><strong>参数说明:</strong></p>
<pre><code>iPort
[in] 整数,表示端口号。
pcCHMsgFileName
[in] 读取到的ID卡内文字信息,需要写入文件,此为由用户指定的文件名。
puiCHMsgFileLen
[out] 存储文字信息的文件的长度。
pcCHMsgFileName
[in] 读取到的ID卡内照片信息,需要写入文件,此为由用户指定的文件名。
puiCHMsgFileLen
[out] 存储照片信息的文件的长度。
iIfOpen
[in] 整数。</code></pre>
<p><strong>返回值:</strong></p>
<pre><code>0x90 读基本信息成功
0x41 读基本信息失败</code></pre>
<p><strong>5.<code>Syn_ReadBaseFPMsg</code></strong></p>
<p><strong>读取身份证内机读文字信息、相片信息和指纹信息。</strong></p>
<pre><code>int Syn_ReadBaseFPMsg(
int iPort,
unsigned char * pucCHMsg,
unsigned int * puiCHMsgLen,
unsigned char * pucPHMsg,
unsigned int * puiPHMsgLen,
unsigned char * pucFPMsg,
unsigned int * puiFPMsgLen,
int iIfOpen
);</code></pre>
<p><strong>参数说明:</strong></p>
<pre><code>iPort
[in] 整数,表示端口号。
pucCHMsg
[out] 无符号字符指针,指向读到的文字信息。
puiCHMsgLen
[out] 无符号整型数指针,指向读到的文字信息长度。
pucPHMsg
[out] 无符号字符指针,指向读到的照片信息。
puiPHMsgLen
[out] 无符号整型数指针,指向读到的照片信息长度。
pucFPMsg
[out] 无符号字符型指针,指向读到的指纹信息,其长度由puiFPMsgLen参数输出。
该指针指向的存储空间由调用者分配,不得小于1024字节。
puiFPMsgLen
[out] 无符号整型数指针,指向读到的指纹信息长度,最长1024字节。
iIfOpen
[in] 整数。</code></pre>
<p><strong>返回值:</strong></p>
<pre><code>0x90 读基本信息成功
0x41 读基本信息失败</code></pre>
<p><strong>6.<code>Syn_ReadBaseFPMsgToFile</code>与<code>Syn_ReadBaseFPMsg</code>函数</strong></p>
<p><strong>类似,读取身份证内基本信息、照片信息和指纹信息,并将读到的信息写进输入参数所指定的文件中。</strong></p>
<pre><code>int Syn_ReadBaseMsgToFile(
int iPortID,
char * pcCHMsgFileName,
unsigned int * puiCHMsgFileLen,
char * pcPHMsgFileName,
unsigned int * puiPHMsgFileLen,
char * pcFPMsgFileName,
unsigned int * puiFPMsgFileLen,
int iIfOpen
);</code></pre>
<p><strong>参数说明:</strong></p>
<pre><code>iPort
[in] 整数,表示端口号。
pcCHMsgFileName
[in] 读取到的ID卡内文字信息,需要写入文件,此为由用户指定的文件名。
puiCHMsgFileLen
[out] 存储文字信息的文件的长度。
pcCHMsgFileName
[in] 读取到的ID卡内照片信息,需要写入文件,此为由用户指定的文件名。
puiCHMsgFileLen
[out] 存储照片信息的文件的长度。
puiFPMsgFileName
[in] 由用户指定的文件名,将读取到的居民身份证指纹信息写入该文件。
puiFPMsgFileLen
[out] 无符号整型数指针,文件的长度。
iIfOpen
[in] 整数。</code></pre>
<p><strong>返回值:</strong></p>
<pre><code>0x90 读基本信息成功
0x41 读基本信息失败</code></pre>
<p><strong>7.<code>Syn_ReadFPMsg</code></strong></p>
<p><strong>本函数用于读取身份证中的基本信息和照片信息,并按设置转化信息和照片。</strong></p>
<pre><code>int Syn_ReadFPMsg(
int iPortID,
unsigned char * pucFPMsg,
unsigned int * puiFPMsgLen,
int iIfOpen
);</code></pre>
<p><strong>8.<code>readCardLog</code></strong></p>
<p><strong>是否开启本地日志记录,模拟关闭日志记录。</strong></p>
<pre><code>void readCardLog(
int iRecord
);</code></pre>
<p><strong>参数说明:</strong></p>
<pre><code>iRecord
[in] 整数。0:关闭日志,1:开启日志</code></pre>
<p><strong>返回值:</strong></p>
<pre><code>无</code></pre>
<p><strong>9.<code>readCardBeep</code></strong></p>
<p><strong>是否开启蜂鸣器,默认开启蜂鸣器。</strong></p>
<pre><code>void readCardBeep(
int iBeep
);</code></pre>
<p><strong>参数说明:</strong></p>
<pre><code>iBeep
[in]整数。0:关闭蜂鸣器,1:打开蜂鸣器(如果使用的读卡器没有蜂鸣器,则设置无效)</code></pre>
<p><strong>返回值:</strong></p>
<pre><code>无</code></pre>
<p><strong>10.<code>readCardGetCardType</code></strong></p>
<p><strong>获取卡片类型。</strong></p>
<pre><code>int readCardGetCardType(
);</code></pre>
<p><strong>参数说明:</strong></p>
<pre><code>无</code></pre>
<p><strong>返回值:</strong></p>
<pre><code>0x04 ID卡
0x10 身份证
其他 未知错误</code></pre>
<p><strong>11.<code>readCardGetUID</code></strong></p>
<p><strong>获取UID。</strong></p>
<pre><code>char * readCardGetUID(
int iMode
);</code></pre>
<p><strong>参数说明:</strong></p>
<pre><code>iMode
[in] 整数。0:未知,1:身份证,2:IC卡,3:自动寻卡模式,在找到卡之后获取UID。</code></pre>
<p><strong>返回值:</strong></p>
<pre><code>char * UID</code></pre>
<p><strong>12.<code>readCardGetVersionCode</code></strong></p>
<p><strong>获取读卡器的版本号。</strong></p>
<pre><code>char * readCardGetVersionCode(
);</code></pre>
<p><strong>参数说明:</strong></p>
<pre><code>无</code></pre>
<p><strong>返回值:</strong></p>
<pre><code>char * VersionCode</code></pre>
<p><strong>13.<code>readCardGetAuthorizeCode</code></strong></p>
<p><strong>获取读卡器的授权码。</strong></p>
<pre><code>char * readCardGetAuthorizeCode(
);</code></pre>
<p><strong>参数说明:</strong></p>
<pre><code>无</code></pre>
<p><strong>返回值:</strong></p>
<pre><code>char * AuthorizeCode</code></pre>
<p><strong>14.<code>readCardGetHostDeviceCode</code></strong></p>
<p><strong>获取设备码。</strong></p>
<pre><code>char * readCardGetHostDeviceCode(
);</code></pre>
<p><strong>参数说明:</strong></p>
<pre><code>无</code></pre>
<p><strong>返回值:</strong></p>
<pre><code>char * HostDeviceCode</code></pre>
<p><strong>15.<code>readCardGetSdkVersion</code></strong></p>
<p><strong>获取SDK的版本号。</strong></p>
<pre><code>char * readCardGetSdkVersion(
);</code></pre>
<p><strong>参数说明:</strong></p>
<pre><code>无</code></pre>
<p><strong>返回值:</strong></p>
<pre><code>char * SdkVersion</code></pre>
<p><strong>16.<code>readCardGetLastError</code></strong></p>
<p><strong>获取最后一次错误信息。</strong></p>
<pre><code>char * readCardGetLastError(
);</code></pre>
<p><strong>参数说明:</strong></p>
<pre><code>无</code></pre>
<p><strong>返回值:</strong></p>
<pre><code>char * LastError</code></pre>
<h2>四、返回值列表</h2>
<table>
<thead>
<tr>
<th style="text-align: left;">返回值</th>
<th>意义</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">0x90</td>
<td>操作成功</td>
</tr>
<tr>
<td style="text-align: left;">0x91</td>
<td>居民身份证中无此项内容</td>
</tr>
<tr>
<td style="text-align: left;">0x9F</td>
<td>寻找居民身份证成功</td>
</tr>
<tr>
<td style="text-align: left;">0x80</td>
<td>寻找居民身份证失败</td>
</tr>
<tr>
<td style="text-align: left;">0x81</td>
<td>选取居民身份证失败</td>
</tr>
<tr>
<td style="text-align: left;">0x41</td>
<td>读居民身份证操作失败</td>
</tr>
<tr>
<td style="text-align: left;">0x04</td>
<td>ID卡类型</td>
</tr>
<tr>
<td style="text-align: left;">0x10</td>
<td>身份证卡类型</td>
</tr>
</tbody>
</table>