SpeedataApp / IonicUHFDemo

ionic+cordova 超高频演示
7 stars 0 forks source link

How to get EPC tag values ? #1

Closed pierresh closed 4 years ago

pierresh commented 4 years ago

Hello,

I am trying to use that plugin with Ionic. How can I get the the EPC value of the scan RFID (something looking like: E20040748207009111709FCD) ?

With the code below I used (took from your example) , I just get the following object:

{ DataLen: 0, EPCLen: 0, RSS: 0, ReadData: [-1,8,10], Status: 8 }

    testRFID(){
        try {
            //掩码
            var jsonmask = [true, "BBBBFFFFEEEEFFFF99997777"];
            (<any>window).uhf.selectCard(null, null, jsonmask);
            //设置读卡区域,地址,块数,密码
            var jsonstr = [1, 2, 2, "00000000"];
            (<any>window).uhf.readArea(null, this.failInit, jsonstr);
            (<any>window).uhf.getReadAreaResult(this.readResult, this.readFail);
        } catch (err) {
            alert("Error: " + err)
        }
    }

    readResult = function (result) {
        alert("readResult: " + JSON.stringify(result));
    };

    readFail = function (error) {
        alert("readFail: " + JSON.stringify(error));
    };

    failInit = function (error) {
        alert("failed: " + JSON.stringify(error));
    };
pierresh commented 4 years ago

Actually, the function openDev() should be called first.