收藏
回答

小程序NFC写入指令报13017错误?

const app = getApp()


Page({
    data: {
        wxnfcnull
    },
    onLoad() {


    },
    onTaoNFC() {
        const wxnfc= wx.getNFCAdapter()
        wxnfc.startDiscovery({
            success(data) {
                console.log(JSON.stringify(data), 111)
            },
            fail(data) {
                console.log(JSON.stringify(data), 222)
            }
        })


        const NFCA = wxnfc.getNfcA();
        wxnfc.onDiscovered((rs) => {
            const { techs } = rs;
            const NFC = techs[0];
            console.log('找到了', NFC)
            NFCA.connect({
                success(res) {
                    console.log('连接成功', NFC)
                    const buffer = new Int8Array([0x100x010x52]).buffer;
                    NFCA.transceive({
                        data: buffer,
                        success(data) {
                            console.log(JSON.stringify(data), 222);
                            NFCA.transceive({
                                databuffer,
                                success(data) {
                                    console.log(JSON.stringify(data), 222);
                                    NFCA.close();
                                },
                                fail({ errMsg, errCode }) {
                                    console.log(errMsg, NFC, errCode);
                                    NFCA.close();
                                }
                            });
                            // NFCA.close();
                            NFCA.getSak({
                                data: buffer,
                                success(data) {
                                    console.log(JSON.stringify(data), 222);
                                    NFCA.close();
                                },
                                fail({ errMsg, errCode }) {
                                    console.log(errMsg, NFC, errCode);
                                    NFCA.close();
                                }
                            });
                            NFCA.getAtqa({
                                data: buffer,
                                success(data) {
                                    console.log(JSON.stringify(data), 222);
                                    NFCA.close();
                                },
                                fail({ errMsg, errCode }) {
                                    console.log(errMsg, NFC, errCode);
                                    NFCA.close();
                                }
                            });
                        },
                        fail({ errMsg, errCode }) {
                            console.log(errMsg, NFC, errCode);
                            NFCA.close();
                        }
                    });


                },
                fail(data) {
                    console.log(JSON.stringify(data), 111)
                }
            });
        });
    }
})
下发的指令是对的还是失败
回答关注问题邀请回答
收藏

1 个回答

  • Demons
    Demons
    2023-02-09

    13017是系统抛回来的错误,可能是卡没贴紧,指令不对等情况,也可以检查下是否是系统的NFC的固件版本导致

    2023-02-09
    有用
    回复 1
    • 阿白
      阿白
      2023-02-16
      系统的NFC的固件版本是指什么?是手机NFC的版本还是卡的固件版本
      2023-02-16
      回复
登录 后发表内容