@waiting/idcard-reader-base
Version:
91 lines (90 loc) • 2.43 kB
TypeScript
/// <reference types="node" />
import { FModel as FM } from 'win32-def';
/** 初始化参数 */
export declare type Options = Partial<DeviceOpts> & Partial<CompositeOpts>;
export interface Config {
appDir: string;
tmpDir: string;
}
/** 设备配置参数 */
export interface DeviceOpts {
debug: boolean;
/** path of sdtapi.dll */
dllTxt: string;
/** path of wltrs.dll */
dllImage: string;
/** 找卡重试数量,间隔 1sec */
findCardRetryTimes: number;
/** 头像图片保存目录 空则使用 {系统临时目录}/idcard-reader */
imgSaveDir: string;
/** port number of com or usb. Default: 0 for auto search */
port: number;
/** search all available device , stop searching at first device found if false */
searchAll: boolean;
}
/**
* 合成图片参数
* 需要安装 ImageMagick 图像处理程序以及相关字体
* url: https://www.imagemagick.org/script/download.php
* fonts: fontHwxhei.ttf, fontOcrb.ttf, fontSimhei.ttf
*/
export interface CompositeOpts {
useComposite: boolean;
compositeDir: string;
compositeQuality: number;
compositeType: 'bmp' | 'gif' | 'jpg' | 'png' | 'webp';
textColor: string;
fontHwxhei: string;
fontOcrb: string;
fontSimhei: string;
}
/** 读卡原始结果 */
export interface RawData {
err: number;
code: number;
text: Buffer;
image: Buffer;
imagePath: string;
}
/** 二代证综合信息 */
export interface IDData {
compositePath: string;
base: DataBase | null;
imagePath: string;
}
/** 二代证信息 */
export interface DataBase {
/** 姓名 */
name: string;
/** 1男,2女 */
gender: number;
genderName: string;
/** 民族代码 */
nation: string;
/** 民族中文 */
nationName: string;
/** 出生日期 */
birth: string;
/** 住址 */
address: string;
/** 身份证号 */
idc: string;
/** 签发机关 */
regorg: string;
/** 有效期开始 */
startdate: string;
/** 有效期结束 日期或者'长期' */
enddate: string;
}
/** 设备配置参数 */
export interface Device {
apib: FM.DllFuncsModel;
apii?: FM.DllFuncsModel | null;
deviceOpts: DeviceOpts;
compositeOpts: CompositeOpts;
/** device in use */
inUse: boolean;
openPort: number;
/** device access mode usb or serial. some driver need this */
useUsb?: boolean;
}