001/* 002 * =========================================================================================== 003 * = COPYRIGHT 004 * PAX Computer Technology (Shenzhen) Co., Ltd. PROPRIETARY INFORMATION 005 * This software is supplied under the terms of a license agreement or nondisclosure 006 * agreement with PAX Computer Technology (Shenzhen) Co., Ltd. and may not be copied or 007 * disclosed except in accordance with the terms in that agreement. 008 * Copyright (C) 2017-2023 PAX Computer Technology (Shenzhen) Co., Ltd. All rights reserved. 009 * Description: // Detail description about the function of this module, 010 * // interfaces with the other modules, and dependencies. 011 * Revision History: 012 * Date Author Action 013 * 2017/04/01 PAX Create/Add/Modify/Delete 014 * =========================================================================================== 015 */ 016 017package com.pax.dal; 018 019import com.pax.dal.entity.ApduRespInfo; 020import com.pax.dal.entity.ApduSendInfo; 021import com.pax.dal.entity.EDetectMode; 022import com.pax.dal.entity.EM1KeyType; 023import com.pax.dal.entity.EM1OperateType; 024import com.pax.dal.entity.EPiccRemoveMode; 025import com.pax.dal.entity.EUartPort; 026import com.pax.dal.entity.PiccCardInfo; 027import com.pax.dal.entity.PiccPara; 028import com.pax.dal.exceptions.PiccDevException; 029 030/** 031 * <div class="zh">关于 POS PICC的API。 如果开启权限检查,需在AndroidManifest下添加权限:"com.pax.permission.PICC"</div> 032 * <div class="en">API for POS PICC. If permission check is enabled, you need to add permission under AndroidManifest: "com.pax.permission.PICC".</div> 033 */ 034public interface IPicc { 035 /** 036 * <div class="zh"> 对非接触卡模块上电并复位,检查复位后模块初始状态是否正常 </div> <div class="en"> Power on and reset contactless module, and 037 * check whether initial status of the module is normal. </div> 038 * 039 * @throws PiccDevException 040 */ 041 public void open() throws PiccDevException; 042 043 /** 044 * <div class="zh"> 读取非接读卡器参数 045 * <ul> 046 * <li>该接口只有在{@link IPicc#open()}函数之后,PiccDetect()及piccInitFelica函数之前调用才有效</li> 047 * <li>{@link IPicc#open()}函数调用之后,所有参数将恢复成默认值。</li> 048 * </ul> 049 * </div> <div class="en"> Read Contactless Card Reader parameters. 050 * <ul> 051 * <li>Calling this interface is valid only between tht time after {@link IPicc#open()} function and before 052 * PiccDetect() function.</li> 053 * <li>All the parameter will return to default value when calling {@link IPicc#open()} function.</li> 054 * </ul> 055 * </div> 056 * 057 * @return {@link PiccPara} 058 * @throws PiccDevException 059 */ 060 public PiccPara readParam() throws PiccDevException; 061 062 /** 063 * <div class="zh"> 设置非接读卡器参数 064 * <ul> 065 * <li>{@link IPicc#open()}函数调用之后,所有参数将恢复成默认值。</li> 066 * </ul> 067 * </div> <div class="en"> Contactless Card Reader parameters setting. 068 * <ul> 069 * <li>All the parameter will return to default value when calling {@link IPicc#open()} function.</li> 070 * </ul> 071 * </div> 072 * 073 * @param para 074 * {@link PiccPara} 075 * @throws PiccDevException 076 */ 077 public void setParam(PiccPara para) throws PiccDevException; 078 079 /** 080 * <div class="zh"> 设置felica卡的超时时间 081 * 082 * <ul> 083 * <li>该接口只有在{@link IPicc#open()}函数之后,PiccDetect()及piccInitFelica函数之前调用才有效</li> 084 * <li>{@link IPicc#open()}函数调用之后,所有参数将恢复成默认值。</li> 085 * </ul> 086 * </div> <div class="en"> set felica timeout 087 * <ul> 088 * <li>This interface is only valid when calling after {@link IPicc#open()} function and before PiccDetect() 089 * function.</li> 090 * <li>All the parameter will return to default value when calling {@link IPicc#open()} function.</li> 091 * </ul> 092 * </div> 093 * 094 * @param timeOut 095 * <div class="zh"> 以ETU为单位,1ETU= 9.44微秒,如 设置超时时间10000(*9.44微秒),大约为94.4ms </div> <div class="en"> unit:ETU, 096 * 1ETU= 9.44μs,if the timeout time is 10000(*9.44 microseconds), it is about 94.4 milliseconds. </div> 097 * 098 * @throws PiccDevException 099 */ 100 public void setFelicaTimeOut(long timeOut) throws PiccDevException; 101 102 /** 103 * <div class="zh"> 按指定的模式搜寻PICC卡片;搜到卡片后,将其选中并激活。 感应区内不允许多卡存在 </div> <div class="en"> Detect PICC card according to 104 * appointed mode; when find the card,choose and activate it. </div> 105 * 106 * @param mode 107 * {@link EDetectMode} 108 * @return {@link PiccCardInfo} 109 * @throws PiccDevException 110 */ 111 public PiccCardInfo detect(EDetectMode mode) throws PiccDevException; 112 113 /** 114 * <div class="zh"> 按指定的模式搜寻PICC卡片;搜到卡片后,将其选中并激活。 感应区内不允许多卡存在 </div> <div class="en"> Detect PICC card according to 115 * appointed mode; when find the card,choose and activate it. </div> 116 * 117 * @param mode 118 * <div class="zh"> 119 * <ul> 120 * <li>0x00:搜寻A型卡和B型卡一次, 此模式适用于需要增强多卡检测功能的场合。 该模式是符合ISO14443规范的寻卡模式</li> 121 * <li>0x01:搜寻A型卡和B型卡一次;此模式为EMV寻卡模式,通常使用该模式;</li> 122 * <li>'a'或 'A':只搜寻A型卡一次;</li> 123 * <li>'b'或'B':只搜寻B型卡一次;</li> 124 * <li>'m'或'M':只搜寻M1卡一次;</li> 125 * <li>'u'或'U':搜寻A型卡、B型卡和M卡一次;</li> 126 * <li>0x10:VAS_OR_PAYMENT_MODE</li> 127 * <li>0x11:VAS_AND_PAYMENT_MODE</li> 128 * <li>0x12:VAS_MODE</li> 129 * <li>0x13:PAYMENT_MODE</li> 130 * </ul> 131 * </div> <div class="en"> 132 * <ul> 133 * <li>0x00:Detect type A card once, and detect type B card once; it is not permitted to find more than 1 134 * card in inductive area (includeing type A and type B card).This mode is the PICC card detecting mode 135 * conforming the regulation of VISA WAVE, Master PayPass and China Union Pay.</li> 136 * <li>0x01:Detect type A card once, and detect type B card once;This mode is the EMV detecting 137 * mode,usually use this mode.</li> 138 * <li>'a'or'A':Only detect type A card once; it is not permitted to find more than 1 type A card in 139 * inductive area</li> 140 * <li>'b'or'B':Only detect type B card once; it is not permitted to find more than 1 type B card in 141 * inductive area</li> 142 * <li>'m'or'M':Only detect type M1 card once; it is not permitted to find more than 1 type M1 card in 143 * inductive area</li> 144 * <li>'u' or 'U': Search for A-type card, B-type card and M card once</li> 145 * <li>0x10:VAS_OR_PAYMENT_MODE</li> 146 * <li>0x11:VAS_AND_PAYMENT_MODE</li> 147 * <li>0x12:VAS_MODE</li> 148 * <li>0x13:PAYMENT_MODE</li> 149 * </ul> 150 * </div> 151 * 152 * @return {@link PiccCardInfo} 153 * @throws PiccDevException 154 * @since V2.00.03 155 */ 156 public PiccCardInfo detect(byte mode) throws PiccDevException; 157 158 /** 159 * <div class="zh"> 在指定的通道上,向卡片发送APDU格式的数据,并接收响应。 </div> <div class="en"> In specific channel, send data of APDU 160 * format to card and receive response. </div> 161 * 162 * @param cid 163 * <div class="zh"> 用于指定卡片逻辑通道号;该通道号由 detect()的CID参数项输出,其取值范围为 0~14,目前取值均为0 </div> <div class="en"> Used 164 * to appoint card logical channel number which is output by CID of detect(); Its range is 0~14 and its 165 * current value is 0. </div> 166 * 167 * @param send 168 * <div class="zh"> 发送的IC卡命令数据(command, lc, dataIn, le) </div> <div class="en"> Data structure of command 169 * sent to IC card.(command, lc, dataIn, le) </div> 170 * 171 * @return <div class="zh"> 接收的IC命令数据(byte[] DataOut; byte SWA; byte SWB;) </div> <div class="en"> Data structure returned from IC card.(byte[] DataOut; byte SWA; byte SWB;) </div> 172 * 173 * @throws PiccDevException 174 */ 175 public byte[] isoCommand(byte cid, byte[] send) throws PiccDevException; 176 177 /** 178 * <div class="zh"> 依据指定的模式,向卡片发送停机指令;或者发送停活指令;或者复位载波,并判断卡片是否已经移开感应区。 </div> <div class="en"> Send stop command to 179 * card according to specific mode, or send halt command,or reset carrier, judge whether card is removed from 180 * inductive area in addition. </div> 181 * 182 * @param mode 183 * {@link EPiccRemoveMode} <div class="zh"> 184 * 185 * </div> <div class="en"> 186 * <ul> 187 * <li>EMV - Comply with the remove card mode of EMV 188 * non-connected standard Reset carrier, and execute card removed detection.</li> 189 * </ul> 190 * </div> 191 * 192 * @param cid 193 * <div class="zh"> detect()调用中返回的卡片逻辑通道号,目前均为0 </div> <div class="en"> Logical channel number returned 194 * from calling detect(), all 0 at present. </div> 195 * 196 * @throws PiccDevException 197 */ 198 public void remove(EPiccRemoveMode mode, byte cid) throws PiccDevException; 199 200 /** 201 * <div class="zh"> 关闭PICC模块,使该模块处于下电状态。 </div> <div class="en"> Close PICC module, and make it in power off status. 202 * </div> 203 * 204 * @throws PiccDevException 205 */ 206 public void close() throws PiccDevException; 207 208 /** 209 * <div class="zh"> 验证m1卡访问时读写相应块需要提交的A密码或B密码。 </div> <div class="en"> Verify password A or B that should be 210 * submitted when reading/writing correspoding block of M1 card. </div> 211 * 212 * @param type 213 * {@link EM1KeyType} <div class="zh"> 214 * 215 * </div> <div class="en"> 216 * <ul> 217 * <li>TYPE_A</li> 218 * <li>TYPE_B</li> 219 * </ul> 220 * </div> 221 * 222 * @param blkNo 223 * <div class="zh"> 用于指定访问的块号 </div> <div class="en"> Used to specify visiting block number. </div> 224 * 225 * @param pwd 226 * <div class="zh"> 指向提交的密码缓冲区 </div> <div class="en"> Points to password buffer. </div> 227 * 228 * @param serialNo 229 * <div class="zh"> 指向存放卡片序列号的缓冲区;存放 detect()调用返回的序列号信息SerialInfo 中的序列号部分,即SerialInfo+1 </div> <div 230 * class="en"> Points to first address of buffer storing card serial number; should point to serial 231 * number part of SerialInfo returned after calling detect(), that is SerialInfo+1 </div> 232 * 233 * @throws PiccDevException 234 */ 235 public void m1Auth(EM1KeyType type, byte blkNo, byte[] pwd, byte[] serialNo) throws PiccDevException; 236 237 /** 238 * <div class="zh"> 读取m1卡指定块的内容(共16字节) </div> <div class="en"> Read content of block specified by M1 card (totally 239 * 16 bytes). </div> 240 * 241 * @param blkNo 242 * <div class="zh"> 用于指定访问的块号 </div> <div class="en"> Used to appoint visiting block number. </div> 243 * @return <div class="zh"> 返回指定块的内容 </div> <div class="en"> return the specified block content. </div> 244 * 245 * @throws PiccDevException 246 */ 247 public byte[] m1Read(byte blkNo) throws PiccDevException; 248 249 /** 250 * <div class="zh"> 向m1卡指定块写入指定的内容(共16字节) </div> <div class="en"> Write specified content to specified block of M1 251 * card (totally 16 bytes). </div> 252 * 253 * @param blkNo 254 * <div class="zh"> 用于指定访问的块号 </div> <div class="en"> Used to appoint visiting block number. </div> 255 * 256 * @param blkValue 257 * <div class="zh"> 指向待存取块内容的缓冲区;该缓冲区至少应分 配16字节 </div> <div class="en"> Points to first address of buffer 258 * waiting for storing block content; this buffer should be allocated at least 16 bytes. </div> 259 * 260 * @throws PiccDevException 261 */ 262 public void m1Write(byte blkNo, byte[] blkValue) throws PiccDevException; 263 264 /** 265 * <div class="zh">对M1卡钱包进行充值或减值操作,并最终更新主钱包或备用钱包。 对m1卡的指定数据块BlkNo进行充/减值/备份操作,将操作后的值更新到另一个指定的数据块UpdateBlkNo。 266 * <p> 267 * 说明: 268 * </p> 269 * <ul> 270 * <li>若BlkNo与UpdateBlkNo块号相同时,若进行{@link EM1OperateType#DECREMENT}或{@link EM1OperateType#INCREMENT}操作,则对该块号进行增值或减值</li> 271 * <li>若BlkNo与UpdateBlkNo块号不同时,若进行{@link EM1OperateType#DECREMENT}或{@link EM1OperateType#INCREMENT} 272 * 操作,则BlkNo内存储的金额不变,UpdateBlkNo的金额等于BlkNo的金额进行相应的增值或减值</li> 273 * <li>若进行{@link EM1OperateType#BACKUP}操作,则Value不起作用,将BlkNo内的金额存储到UpdateNo中</li> 274 * </ul> 275 * <p> 276 * 此函数涉及的块号必须是数值块,同时BlkNo与UpdateBlkNo必须在同一个扇区中 277 * </p> 278 * </div> <div class="en"> Do increase or decrease or backup to the specified data block BlkNo , get the result,and 279 * updates the result to another specified data block UpdateBlkNo. 280 * <p> 281 * introduction: 282 * </p> 283 * <ul> 284 * <li>If the block numbers of BlkNo and UpdateBlkNo are the same , use "INCREMENT" or"DECREMENT" to increase or 285 * decrease the value of block number.</li> 286 * <li>If the block numbers are different,when use "INCREMENT" or "DECREMENT" , the value stored in BlkNo will have 287 * no change, and the value of UpdateBlkNo block is equal to the corresponding increased or decreased value of 288 * BlkNo.</li> 289 * <li>If doing the "BACKUP" operation, the value is invalid,then store the value of BlkNo into UpdateNo.</li> 290 * </ul> 291 * <p> 292 * The block numbers which refered in this function must be Chunk, BlkNo and UpdateBlkNo must be in the same sector. 293 * </p> 294 * </div> 295 * 296 * @param type 297 * {@link EM1OperateType} 298 * @param blkNo 299 * <div class="zh"> 用于指定访问的块号 </div> <div class="en"> Use to specify the visiting block number. </div> 300 * 301 * @param blkValue 302 * <div class="zh"> 待充值或减值的金额数缓冲区;金额数共4 字节,低字节在前 </div> <div class="en"> Points to the first address of 303 * amount buffer waiting for increasing or decreasing value; amount is 4 bytes, and lower bytes ahead. 304 * </div> 305 * 306 * @param updateBlkNo 307 * <div class="zh"> 指定操作结果最终写入到的块号。M1卡通常都有两个钱包:主钱包和备用钱包。 为了在对主钱包进行操作时,可以从出现的异常错误中恢复, 主钱包的操作结果通常会写入备用钱包。</div> 308 * <div class="en">Specifies the block number to which the operation result is ultimately written. M1 cards usually have two wallets: the main wallet and the spare wallet. In order to recover from exceptional errors when operating the main wallet, the operation results of the main wallet are usually written to the standby wallet. 309 * </div> 310 * 311 * @throws PiccDevException 312 */ 313 public void m1Operate(EM1OperateType type, byte blkNo, byte[] blkValue, byte updateBlkNo) throws PiccDevException; 314 315 /** 316 * <div class="zh"> 初始化射频卡接口芯片为FeliCa调制编码方式。 </div> <div class="en"> Initializing Radio Frequency Card interface 317 * chip as FeliCa modulate coding function. </div> 318 * 319 * @param rate 320 * <div class="zh"> 设置与卡片交互的传输速率。 321 * <ul> 322 * <li>0-212Kbps</li> 323 * <li>1-424Kbps</li> 324 * </ul> 325 * </div> <div class="en"> Setting transmission speed with card. 326 * <ul> 327 * <li>0-212Kbps</li> 328 * <li>1-424Kbps</li> 329 * </ul> 330 * </div> 331 * 332 * @param pol 333 * <div class="zh"> 设置FeliCa调制方式 334 * <ul> 335 * <li>0-为正向调制输出</li> 336 * <li>1-为反向调制输出</li> 337 * </ul> 338 * </div> <div class="en"> Setting FeliCa modulate function. 339 * <ul> 340 * <li>0 -forward modulate output.</li> 341 * <li>1 -reverse modulate output.</li> 342 * </ul> 343 * </div> 344 * 345 * @throws PiccDevException 346 */ 347 public void initFelica(byte rate, byte pol) throws PiccDevException; 348 349 /** 350 * <div class="zh"> led:亮灯控制 </div> <div class="en"> led:Light Control </div> 351 * 352 * 353 * @param led 354 * <div class="zh"> 355 * <ul> 356 * <li>标志位为0表示灯灭</li> 357 * <li>标志位为1表示灯亮</li> 358 * <li>0x01 – 红灯标志位</li> 359 * <li>0x02 – 绿灯标志位</li> 360 * <li>0x04 – 黄灯标志位</li> 361 * <li>0x08 – 蓝灯标志位</li> 362 * <li>0x0f – 全亮</li> 363 * <li>0x00 – 全灭</li> 364 * </ul> 365 * </div> <div class="en"> 366 * <ul> 367 * <li>0x01 - Red Light</li> 368 * <li>0x02 - Green Light</li> 369 * <li>0x04 - Yellow Light</li> 370 * <li>0x08 - Blue Light</li> 371 * <li>0x0f - All on</li> 372 * <li>0x00 - All off</li> 373 * </ul> 374 * </div> 375 * 376 * @throws PiccDevException 377 */ 378 public void setLed(byte led) throws PiccDevException; 379 380 /** 381 * <div class="zh"> IC卡操作函数。该函数支持IC卡通用接口协议(T=0及T=1) </div> <div class="en"> IC card operation function. This 382 * function supports IC card universal interface protocol (T=0 and T=1). </div> 383 * 384 * @param cid 385 * <div class="zh"> 用于指定卡片逻辑通道号;该通道号由 detect()的CID参数项输出,其取值范围为 0~14,目前取值均为0 </div> <div class="en"> Used 386 * to appoint card logical channel number which is output by CID of detect(); Its range is 0~14 and its 387 * current value is 0. </div> 388 * 389 * @param apduSendInfo 390 * {@link ApduSendInfo} <div class="zh"> 391 * <ul> 392 * <li>command -CLA, INS, P1, P2.</li> 393 * <li>dataIn -发送给ICC的数据</li> 394 * <li>lc -发送的数据的长度</li> 395 * <li>le -期望接收到的数据长度</li> 396 * </ul> 397 * 注意:底层通过传入le的值为256的方式来表示发送给卡片的APDU le为0,而传入le为0表示APDU不包含le </div> <div class="en"> Note: set 398 * apduSendInfo.le value to 256 to make LE 0 in the command(i.e. expect response data as much as 399 * possible) ; setting apduSendInfo.le value to 0 means no response data expected. 400 * <ul> 401 * <li>dataOut -Returned data pointer from PICC.</li> 402 * <li>lenOut -The actual returned data length.</li> 403 * <li>swA -PICC status 1.</li> 404 * <li>swB -PICC status 2.</li> 405 * </ul> 406 * </div> 407 * 408 * @return {@link ApduRespInfo} 409 * @throws PiccDevException 410 */ 411 public ApduRespInfo isoCommandByApdu(byte cid, ApduSendInfo apduSendInfo) throws PiccDevException; 412 413 /** 414 * <div class="zh"> 与卡片进行APDU数据交互,终端将paucInData中的数据直接发送给卡片,并接收卡片的应答数据。 </div> <div class="en"> Processing APDU data 415 * interaction with card. Sending data of paucInData to the card directly,and receive the returned data. </div> 416 * 417 * @param dataIn 418 * <div class="zh"> 待发送的命令数据 </div> <div class="en"> Command data which are waiting to sent. </div> 419 * 420 * @param recvLen 421 * <div class="zh"> 该参数作废,可传任意值 </div> <div class="en"> This parameter is invalid and can be passed to any value. </div> 422 * 423 * @return <div class="zh"> 接收到的卡片数据 </div> <div class="en"> paucOutData Data of received card. </div> 424 * 425 * @throws PiccDevException 426 * @since V2.00.01 427 */ 428 public byte[] cmdExchange(byte[] dataIn, int recvLen) throws PiccDevException; 429 430 /** 431 * <div class="zh"> 设置外置非接触卡模块的连接端口</div> <div class="en"> Set connection port of the external PICC</div> 432 * 433 * @param port 434 * {@link EUartPort} 435 * @since V3.02.00 436 */ 437 void setPort(EUartPort port); 438 439 /** 440 * <div class="zh"> 设置felica卡的超时时间。 441 * 442 * <ul> 443 * <li>该接口只有在{@link IPicc#open()}函数之后,PiccDetect()及piccInitFelica函数之前调用才有效</li> 444 * <li>{@link IPicc#open()}函数调用之后,所有参数将恢复成默认值。</li> 445 * </ul> 446 * </div> <div class="en"> set felica timeout. 447 * <ul> 448 * <li>This interface is only valid when calling after {@link IPicc#open()} function and before PiccDetect() 449 * function.</li> 450 * <li>All the parameter will return to default value when calling {@link IPicc#open()} function.</li> 451 * </ul> 452 * </div> 453 * 454 * @param timeout 455 * <div class="zh"> 超时时间。单位:毫秒。 </div> <div class="en"> Timeout. unit:milliseconds.</div> 456 * 457 * @throws PiccDevException 458 */ 459 public void setFelicaTimeout(int timeout) throws PiccDevException; 460 461 462 /** 463 * <div class="zh"> 按指定的模式搜寻PICC卡片;搜到卡片后,将其选中并激活。 感应区内不允许多卡存在 </div> <div class="en"> Detect PICC card according to 464 * appointed mode; when find the card,choose and activate it. </div> 465 * 466 * @param mode <div class="zh"> 467 * <ul> 468 * <li>0x00:搜寻A型卡和B型卡一次, 此模式适用于需要增强多卡检测功能的场合。 该模式是符合ISO14443规范的寻卡模式</li> 469 * <li>0x01:搜寻A型卡和B型卡一次;此模式为EMV寻卡模式,通常使用该模式;</li> 470 * <li>'a'或 'A':只搜寻A型卡一次;</li> 471 * <li>'b'或'B':只搜寻B型卡一次;</li> 472 * <li>'m'或'M':只搜寻M1卡一次;</li> 473 * <li>0x10:VAS_OR_PAYMENT_MODE</li> 474 * <li>0x11:VAS_AND_PAYMENT_MODE</li> 475 * <li>0x12:VAS_MODE</li> 476 * <li>0x13:PAYMENT_MODE</li> 477 * <li>'v'或'V':支持Apple ECP2.0。</li> 478 * </ul> 479 * </div> <div class="en"> 480 * <ul> 481 * <li>0x00:Detect type A card once, and detect type B card once; it is not permitted to find more than 1 482 * card in inductive area (includeing type A and type B card).This mode is the PICC card detecting mode 483 * conforming the regulation of VISA WAVE, Master PayPass and China Union Pay.</li> 484 * <li>0x01:Detect type A card once, and detect type B card once;This mode is the EMV detecting 485 * mode,usually use this mode.</li> 486 * <li>'a'or'A':Only detect type A card once; it is not permitted to find more than 1 type A card in 487 * inductive area</li> 488 * <li>'b'or'B':Only detect type B card once; it is not permitted to find more than 1 type B card in 489 * inductive area</li> 490 * <li>'m'or'M':Only detect type M1 card once; it is not permitted to find more than 1 type M1 card in 491 * inductive area</li> 492 * <li>0x10:VAS_OR_PAYMENT_MODE</li> 493 * <li>0x11:VAS_AND_PAYMENT_MODE</li> 494 * <li>0x12:VAS_MODE</li> 495 * <li>0x13:PAYMENT_MODE</li> 496 * <li>'v'or'V':Support Apple ECP2.0</li> 497 * </ul> 498 * </div> 499 * @param other <div class="zh"> 500 * <ul> 501 * <li>当mode是'v'或'V'模式时,other参数可做为输入发送的命令。 502 * <ul> 503 * <li>首字节为0x01时,输入固定四字节长度。</li> 504 * <li>首字节为0x02时,输入变长字节,第二字节的低半字节X表示Terminal Data长度:"\x02\x8X\x00\x00"+X字节Terminal Data。</li> 505 * </ul> 506 * </li> 507 * <li>当mode是其它值时,other可直接为NULL,此时同{@link #detect(byte)}。</li> 508 * </ul></div> 509 * <div class="en"> 510 * <ul> 511 * <li>When mode is 'v' or 'v' mode, the other parameter can be sent as input. 512 * <ul> 513 * <li>When the first byte is 0x01, input a fixed four-byte length.</li> 514 * <li>When the first byte is 0x02, input variable length byte, and the low half byte X of the second byte represents Terminal Data length: "\x02\x8X\x00\x00"+X byte Terminal Data.</li> 515 * </ul> 516 * </li> 517 * <li>When mode is something else, other can be NULL, which is the same as {@link #detect(byte)}.</li> 518 * </ul></div> 519 * @return {@link PiccCardInfo} 520 * @throws PiccDevException 521 * @since V3.13.00 522 */ 523 PiccCardInfo detect(byte mode, byte[] other) throws PiccDevException; 524 /** 525 * <div class="zh">设置模拟卡片的参数。</div> <div class="en">Set the parameters of the emulate card.</div> 526 * 527 * @param sensRes <div class="zh">传入2字节的ATQA。ATQA为WUPA/REQA的应答。如果传入NULL,则使用默认的0x04, 0x00。</div> 528 * <div class="en">Pass in 2 bytes of ATQA. ATQA is responses of WUPA/REQA. If NULL is passed, the default 0x04, 0x00 is used.</div> 529 * 530 * @param nfcId1 <div class="zh">传入3个字节的UID,为UID的第2,3,4字节,第1字节为硬件码,由非接芯片生成。如果传入NULL,则使用默认的0xA1, 0xA2, 0xA3。</div> 531 * <div class="en">The UID of 3 bytes is passed in, which is the 2nd, 3rd, 4th byte of UID, and the 1st byte is the hardware code, 532 * which is generated by contractless card chip.If NULL is passed, the default 0xA1, 0xA2, 0xA3 is used.</div> 533 * 534 * @param sleRes <div class="zh">传入1字节的SAK。如果传入NULL,则使用默认的0x00。</div> 535 * <div class="en">The SAK of 1-byte is passed in. If NULL is passed in, the default 0x00 is used.</div> 536 * 537 * @param pollingResp <div class="zh">暂未启用,传入NULL。</div> <div class="en">Not enabled, pass NULL.</div> 538 * 539 * @throws PiccDevException 540 * @since V3.17.00 541 */ 542 void cardEmulateSetListenPara(byte[] sensRes, byte[] nfcId1, byte[] sleRes, byte[] pollingResp) throws PiccDevException; 543 544 /** 545 * <div class="zh">启动模拟对应类型的卡片,并监听是否有被读卡器成功寻卡。</div> 546 * <div class="en">Start the simulation of the corresponding type of card and listen for the reader to find the card successfully.</div> 547 * 548 * @param mode <div class="zh">0x01:表示模拟A类型的卡片。</div> <div class="en">0x01:Simulate a card of type A.</div> 549 * 550 * @param recvMaxSize <div class="zh">接收的最大长度。</div> <div class="en">The maximum length of reception.</div> 551 * 552 * @param waitTimeMs <div class="zh">等下被读卡器寻卡的等待时间,单位:毫秒。</div> <div class="en">The waiting time for the card reader to find the card. Units: milliseconds.</div> 553 * 554 * @return <div class="zh">对A类型卡,表示在防冲突完成之后,收到来自读卡器的第一条指令内容。</div> 555 * <div class="en">For type A CARDS, the first instruction from the card reader is received after the conflict prevention is completed.</div> 556 * 557 * @throws PiccDevException 558 * @since V3.17.00 559 */ 560 byte[] cardEmulateListen(byte mode, int recvMaxSize, int waitTimeMs) throws PiccDevException; 561 562 /** 563 * <div class="zh">卡端发送指令给读卡器。需在被读卡器成功寻卡之后调用。</div> 564 * <div class="en">The card side sends instructions to the card reader.To be called after the card reader has successfully found the card.</div> 565 * 566 * @param buffer <div class="zh">卡端发送指令的内容。</div> <div class="en">The card side sends the contents of the instruction.</div> 567 * 568 * @throws PiccDevException 569 * @since V3.17.00 570 */ 571 void cardEmulateSend(byte[] buffer) throws PiccDevException; 572 573 /** 574 * <div class="zh">卡端接收指令。</div> <div class="en">The card side receives instructions.</div> 575 * 576 * @param recvMaxSize <div class="zh">接收的最大字节数。</div> <div class="en">Maximum number of bytes received.</div> 577 * 578 * @param waitTimeMs <div class="zh">接收的等待时间。单位:毫秒。</div> <div class="en">Waiting time to receive. Units: milliseconds.</div> 579 * 580 * @return <div class="zh">接收的内容 。</div> <div class="en">Received content.</div> 581 * 582 * @throws PiccDevException 583 * @since V3.17.00 584 */ 585 byte[] cardEmulateReceive(int recvMaxSize, int waitTimeMs) throws PiccDevException; 586 587 /** 588 * <div class="zh">更改外置密码键盘通信波特率。</div> 589 * <div class="en">Change the external PINPAD communication Baud rate.</div> 590 * 591 * @param bps <div class="zh">波特率。 592 * <ul> 593 * <li>9600</li> 594 * <li>115200</li> 595 * </ul> 596 * </div> 597 * <div class="en">Baud rate. 598 * <ul> 599 * <li>9600</li> 600 * <li>115200</li> 601 * </ul> 602 * </div> 603 * @throws PiccDevException 604 * @since V3.18.00 605 */ 606 void changeBaudRate(int bps) throws PiccDevException; 607 608 /** 609 * <div class="zh">重置载波,快速复位。</div> 610 * <div class="en">Reset the carrier and quickly reset.</div> 611 * 612 * @throws PiccDevException PiccDevException 613 * @since V3.26.00 614 */ 615 void resetCarrier() throws PiccDevException; 616 617 /** 618 * <div class="zh">非接扩展功能,比如通过命令模拟 NFC URL TAG功能。</div> 619 * <div class="en">Contactless extension functions, such as simulating the NFC URL TAG function through commands.</div> 620 * 621 * @param data <div class="zh">输入的数据。</div> <div class="en">Input data.</div> 622 * 623 * @return <div class="zh">接收的数据。</div> <div class="en">Received data.</div> 624 * @throws PiccDevException PiccDevException 625 * @since V3.27.00 626 */ 627 byte[] extendFunction(byte[] data) throws PiccDevException; 628 629 /** 630 * <div class="zh">对ISO15693卡进行初始化配置 [目前仅支持X5]。</div> 631 * <div class="en">Initialize the ISO15693 card (currently only X5 is supported).</div> 632 * 633 * @param codeMode <div class="zh">设置与卡片交互的传输速率:<br/>0: 26.48 kbits/s <br/>其它值: 暂不支持 </div> 634 * <div class="en">Set the transmission rate for interacting with the card :<br/> 0:26.48 kbits/s <br/> Other values: not supported</div> 635 * @throws PiccDevException PiccDevException 636 * @since V3.33.00 637 */ 638 void initIso15693(byte codeMode) throws PiccDevException; 639 640}