Typescript 爱奥尼亚NFC如何向费利卡发送命令?

Typescript 爱奥尼亚NFC如何向费利卡发送命令?,typescript,ionic-framework,nfc,Typescript,Ionic Framework,Nfc,我试图从菲利卡(苏伊卡,帕斯莫)的卡片上读取信息 我正在使用 Ionic 6.13.1 我在Java上找到了Android的例子 private byte[] readWithoutEncryption(byte[] idm, int size, byte[] serviceCode) throws IOException { ByteArrayOutputStream bout = new ByteArrayOutputStream(100); bout.write(0);

我试图从菲利卡(苏伊卡,帕斯莫)的卡片上读取信息

我正在使用

Ionic 6.13.1

我在Java上找到了Android的例子

 private byte[] readWithoutEncryption(byte[] idm, int size, byte[] serviceCode) throws IOException {
    ByteArrayOutputStream bout = new ByteArrayOutputStream(100);

    bout.write(0);              // データ長バイトのダミー
    bout.write(0x06);           // コマンドコード
    bout.write(idm);            // IDm 8byte
    bout.write(1);              // サービス数の長さ(以下2バイトがこの数分繰り返す)

    // サービスコードの指定はリトルエンディアンなので、下位バイトから指定します。
    bout.write(serviceCode[1]); // サービスコード下位バイト
    bout.write(serviceCode[0]); // サービスコード上位バイト
    bout.write(size);           // ブロック数

    // ブロック番号の指定
    for (int i = 0; i < size; i++) {
        bout.write(0x80);       // ブロックエレメント上位バイト 「Felicaユーザマニュアル抜粋」の4.3項参照
        bout.write(i);          // ブロック番号
    }

    byte[] msg = bout.toByteArray();
    msg[0] = (byte) msg.length; // 先頭1バイトはデータ長
    return msg;
}
private byte[]readWithoutEncryption(byte[]idm,int size,byte[]serviceCode)引发IOException异常{
ByteArrayOutputStream bout=新的ByteArrayOutputStream(100);
写(0);//データ長バイトのダミー
about.write(0x06);//コマンドコード
about.write(idm);//idm 8byte
写(1);//サービス数の長さ(以下2バイトがこの数分繰り返す)
// サービスコードの指定はリトルエンディアンなので、下位バイトから指定します。
bout.write(服务代码[1]);//サービスコード下位バイト
bout.write(服务代码[0]);//サービスコード上位バイト
大约写(大小);//ブロック数
// ブロック番号の指定
对于(int i=0;i
对于测试,我尝试用TS进行解释

getQueryData(id: any[]): ArrayBuffer {
var buf = new ArrayBuffer(100);
var bufView = new Uint8Array(buf);
const query = [];
query.push(0); // data length. change after all byte set.
query.push(0x06); // Felica command, Read Without Encryption
for (
  let i = 0;
  i < id.length;
  i++ // TAG ID (8byte)
) {
  query.push(id[i]);
}
query.push(1); // service code length (2byte)

query.push(0x1a);
query.push(0x8b);
query.push(4);
for (let i = 0; i < 4; i++) {
  query.push(0x80); // Felica service code
  query.push(i);
}

query[0] = buf.byteLength;

for (let i = 0; i < query.length; i++) {
  bufView[i] = query[i];
}

return buf;
getQueryData(id:any[]):ArrayBuffer{
var buf=新阵列缓冲器(100);
var bufView=新的UINT8阵列(buf);
常量查询=[];
query.push(0);//数据长度。设置完所有字节后更改。
query.push(0x06);//Felica命令,不加密读取
为了(
设i=0;
i
}

但是,我有一个错误

遗失标签

我的理解是,我发送了错误的命令格式。但我不明白我到底做错了什么