iOS端如何启用ISO-DEP Keep Alive数据包避免NFC标签超时断开?
iOS端ISO-DEP保活数据包启用问题
我基于nfc_manager Flutter插件开发了支持Android和iOS的简单应用,用于通过ISO-DEP标签收发APDU数据包。测试中发现Android会自动发送空的ISO-DEP保活数据包,相关日志如下:
NFCRX: b2 67 c7 - 标签接收的内容,其中b2是消息,67c7是CRC NFCTX: a3 - 标签发送的内容(未包含CRC) NFCRX: b2 67 c7 NFCTX: a3 NFCRX: b2 67 c7 NFCTX: a3 NFCRX: b2 67 c7 NFCTX: a3 NFCRX: b2 67 c7 NFCTX: a3 NFCRX: b2 67 c7 NFCTX: a3 NFCRX: b2 67 c7 NFCTX: a3 NFCRX: b2 67 c7 NFCTX: a3 NFCRX: b2 67 c7 NFCTX: a3
Android端可以持续发送这类保活包,但iOS端不会主动发送,导致标签很快因超时断开连接。请问能否在iOS端启用这类保活数据包?我的iOS端代码如下:
if (Platform.isIOS) { NfcManager.instance.startSession( alertMessage: alertMessage, onDiscovered: (NfcTag tag) async { tech = Iso7816.from(tag); if (tech is Iso7816) { try{ //send a test APDU message Uint8List packet = Uint8List.fromList([0x00, 0xD0, 0x00 , 0x00, 0x02, 0x31, 0x00]); final resp = await Iso7816.from(tag)?.sendCommandRaw(packet); //using the delay to check if there will be the keepalive packets await Future.delayed(const Duration(seconds: 5), () {}); String resps = resp.toString(); } on PlatformException catch (err) {} catch (err) {} } } ); }
内容的提问来源于stack exchange,提问作者Vladimir T
相关产品推荐
相关产品推荐

