| 
									
										
										
										
											2025-04-10 10:41:03 +08:00
										 |  |  |  | /* | 
					
						
							|  |  |  |  |  * Copyright (c) 2022-2023 Achermind Device Co., Ltd. | 
					
						
							|  |  |  |  |  * Licensed under the Apache License, Version 2.0 (the "License"); | 
					
						
							|  |  |  |  |  * you may not use this file except in compliance with the License. | 
					
						
							|  |  |  |  |  * You may obtain a copy of the License at | 
					
						
							|  |  |  |  |  * | 
					
						
							|  |  |  |  |  *     http://www.apache.org/licenses/LICENSE-2.0
 | 
					
						
							|  |  |  |  |  * | 
					
						
							|  |  |  |  |  * Unless required by applicable law or agreed to in writing, software | 
					
						
							|  |  |  |  |  * distributed under the License is distributed on an "AS IS" BASIS, | 
					
						
							|  |  |  |  |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
					
						
							|  |  |  |  |  * See the License for the specific language governing permissions and | 
					
						
							|  |  |  |  |  * limitations under the License. | 
					
						
							|  |  |  |  |  */ | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  | /** | 
					
						
							|  |  |  |  |  * This module provides the capability to ID card reading. | 
					
						
							|  |  |  |  |  * | 
					
						
							|  |  |  |  |  * @since 7 | 
					
						
							|  |  |  |  |  * @syscap SystemCapability.Account.AppAccount | 
					
						
							|  |  |  |  |  */ | 
					
						
							|  |  |  |  | declare namespace IDCardSDK { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	/** | 
					
						
							|  |  |  |  |      * 身份证数据信息 | 
					
						
							|  |  |  |  |      */ | 
					
						
							|  |  |  |  |     export interface IDCardInfo { | 
					
						
							| 
									
										
										
										
											2025-04-10 10:45:43 +08:00
										 |  |  |  | 		status: number; // status = 1 为读到身份证信息; status = 0 为身份证离开读卡器
 | 
					
						
							| 
									
										
										
										
											2025-04-10 10:41:03 +08:00
										 |  |  |  | 		baseInfo: string; // 身份证数据信息字符串,不同的字段之间用"|"分隔
 | 
					
						
							|  |  |  |  | 		photo: ArrayBuffer // 身份证照片数据
 | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	/** | 
					
						
							|  |  |  |  |      * 自动读卡的回调接口,专用于StartReadCard()方法的入参 | 
					
						
							|  |  |  |  |      *  | 
					
						
							|  |  |  |  |      * @param ret 从读卡器读取到的设备信息 | 
					
						
							|  |  |  |  |      */ | 
					
						
							|  |  |  |  |     function OnReadCardCallback(ret: IDCardInfo): void; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /** | 
					
						
							|  |  |  |  |      * 打开读卡器设备 | 
					
						
							|  |  |  |  |      *  | 
					
						
							|  |  |  |  |      * @return 执行结果,0表示成功,其它表示打开设备失败 | 
					
						
							|  |  |  |  |      */ | 
					
						
							|  |  |  |  |     function OpenDevice(): number; | 
					
						
							|  |  |  |  | 	 | 
					
						
							|  |  |  |  | 	/** | 
					
						
							|  |  |  |  |      * 启动自动读卡功能,身份证靠近读卡器后自动上报数据给应用 | 
					
						
							|  |  |  |  |      *  | 
					
						
							|  |  |  |  |      * @param callback 数据回调方法 | 
					
						
							|  |  |  |  |      */ | 
					
						
							|  |  |  |  |     function StartReadCard(callback: typeof OnReadCardCallback): void; | 
					
						
							|  |  |  |  | 	 | 
					
						
							|  |  |  |  | 	/** | 
					
						
							|  |  |  |  |      * 停止自动读卡功能 | 
					
						
							|  |  |  |  |      *  | 
					
						
							|  |  |  |  |      */ | 
					
						
							|  |  |  |  |     function StopReadCard(): void; | 
					
						
							|  |  |  |  | 	 | 
					
						
							|  |  |  |  | 	/** | 
					
						
							|  |  |  |  |      * 关闭读卡器设备 | 
					
						
							|  |  |  |  |      *  | 
					
						
							|  |  |  |  |      * @return 执行结果,0表示成功,其它表示关闭设备失败 | 
					
						
							|  |  |  |  |      */ | 
					
						
							|  |  |  |  |     function CloseDevice(): number; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | export default IDCardSDK; |