title: NfcA
sidebar_label: NfcA
NfcA 标签
支持情况:
.default})
参考文档
方法
close
断开连接
支持情况:
.default})
参考文档
(option?: Option) => Promise<TaroGeneral.NFCError>
connect
连接 NFC 标签
支持情况:
.default})
参考文档
(option?: Option) => Promise<TaroGeneral.NFCError>
getAtqa
获取 ATQA 信息
支持情况:
.default})
参考文档
(option?: Option) => Promise<TaroGeneral.NFCError>
getMaxTransceiveLength
获取最大传输长度
支持情况:
.default})
参考文档
(option?: Option) => Promise<TaroGeneral.NFCError>
getSak
获取 SAK 信息
支持情况:
.default})
参考文档
(option?: Option) => Promise<TaroGeneral.NFCError>
isConnected
检查是否已连接
支持情况:
.default})
参考文档
(option?: Option) => Promise<TaroGeneral.NFCError>
setTimeout
设置超时时间
支持情况:
.default})
参考文档
(option?: Option) => Promise<TaroGeneral.NFCError>
transceive
发送数据
支持情况:
.default})
参考文档
(option?: Option) => Promise<TaroGeneral.NFCError>
参数
close
Option
参数 |
类型 |
必填 |
说明 |
complete |
(res: TaroGeneral.NFCError) => void |
否 |
接口调用结束的回调函数(调用成功、失败都会执行) |
fail |
(res: TaroGeneral.NFCError) => void |
否 |
接口调用失败的回调函数 |
success |
(res: TaroGeneral.NFCError) => void |
否 |
接口调用成功的回调函数 |
connect
Option
参数 |
类型 |
必填 |
说明 |
complete |
(res: TaroGeneral.NFCError) => void |
否 |
接口调用结束的回调函数(调用成功、失败都会执行) |
fail |
(res: TaroGeneral.NFCError) => void |
否 |
接口调用失败的回调函数 |
success |
(res: TaroGeneral.NFCError) => void |
否 |
接口调用成功的回调函数 |
getAtqa
Option
参数 |
类型 |
必填 |
说明 |
complete |
(res: TaroGeneral.NFCError) => void |
否 |
接口调用结束的回调函数(调用成功、失败都会执行) |
fail |
(res: TaroGeneral.NFCError) => void |
否 |
接口调用失败的回调函数 |
success |
(result: SuccessCallbackResult) => void |
否 |
接口调用成功的回调函数 |
SuccessCallbackResult
参数 |
类型 |
说明 |
atqa |
ArrayBuffer |
返回 ATQA/SENS_RES 数据 |
getMaxTransceiveLength
Option
参数 |
类型 |
必填 |
说明 |
complete |
(res: TaroGeneral.NFCError) => void |
否 |
接口调用结束的回调函数(调用成功、失败都会执行) |
fail |
(res: TaroGeneral.NFCError) => void |
否 |
接口调用失败的回调函数 |
success |
(result: SuccessCallbackResult) => void |
否 |
接口调用成功的回调函数 |
SuccessCallbackResult
参数 |
类型 |
说明 |
length |
number |
最大传输长度 |
getSak
Option
参数 |
类型 |
必填 |
说明 |
complete |
(res: TaroGeneral.NFCError) => void |
否 |
接口调用结束的回调函数(调用成功、失败都会执行) |
fail |
(res: TaroGeneral.NFCError) => void |
否 |
接口调用失败的回调函数 |
success |
(result: SuccessCallbackResult) => void |
否 |
接口调用成功的回调函数 |
SuccessCallbackResult
参数 |
类型 |
说明 |
sak |
number |
返回 SAK/SEL_RES 数据 |
isConnected
Option
参数 |
类型 |
必填 |
说明 |
complete |
(res: TaroGeneral.NFCError) => void |
否 |
接口调用结束的回调函数(调用成功、失败都会执行) |
fail |
(res: TaroGeneral.NFCError) => void |
否 |
接口调用失败的回调函数 |
success |
(res: TaroGeneral.NFCError) => void |
否 |
接口调用成功的回调函数 |
setTimeout
Option
参数 |
类型 |
必填 |
说明 |
timeout |
number |
是 |
设置超时时间 (ms) |
complete |
(res: TaroGeneral.NFCError) => void |
否 |
接口调用结束的回调函数(调用成功、失败都会执行) |
fail |
(res: TaroGeneral.NFCError) => void |
否 |
接口调用失败的回调函数 |
success |
(res: TaroGeneral.NFCError) => void |
否 |
接口调用成功的回调函数 |
transceive
Option
参数 |
类型 |
必填 |
说明 |
transceive |
ArrayBuffer |
是 |
需要传递的二进制数据 |
complete |
(res: TaroGeneral.NFCError) => void |
否 |
接口调用结束的回调函数(调用成功、失败都会执行) |
fail |
(res: TaroGeneral.NFCError) => void |
否 |
接口调用失败的回调函数 |
success |
(result: SuccessCallbackResult) => void |
否 |
接口调用成功的回调函数 |
SuccessCallbackResult
API 支持度
API |
微信小程序 |
字节跳动小程序 |
H5 |
React Native |
NfcA |
✔️ |
✔️ |
|
|
NfcA.close |
✔️ |
✔️ |
|
|
NfcA.connect |
✔️ |
✔️ |
|
|
NfcA.getAtqa |
✔️ |
✔️ |
|
|
NfcA.getMaxTransceiveLength |
✔️ |
✔️ |
|
|
NfcA.getSak |
✔️ |
✔️ |
|
|
NfcA.isConnected |
✔️ |
✔️ |
|
|
NfcA.setTimeout |
✔️ |
✔️ |
|
|
NfcA.transceive |
✔️ |
✔️ |
|
|