Example usage for android.nfc.tech NfcV transceive

List of usage examples for android.nfc.tech NfcV transceive

Introduction

In this page you can find the example usage for android.nfc.tech NfcV transceive.

Prototype

public byte[] transceive(byte[] data) throws IOException 

Source Link

Document

Send raw NFC-V commands to the tag and receive the response.

Usage

From source file:Main.java

public static byte[] executeCommand(NfcV tech, byte[] cmd) {
    byte response[];
    try {//w  ww .ja v a 2  s.  c om
        response = tech.transceive(cmd);
    } catch (IOException e1) {
        e1.printStackTrace();
        return null;
    }
    return response;
}

From source file:Main.java

public static byte[] getRT(NfcV tech) {
    byte[] getRTCmd = new byte[3];
    getRTCmd[0] = (byte) 0x12; // flag
    getRTCmd[1] = (byte) 0xb0; // command
    getRTCmd[2] = (byte) 0x81; // command
    byte rsp[] = null;
    try {//from  w w  w  .j a v  a 2  s  .  c o m
        rsp = tech.transceive(getRTCmd);
    } catch (IOException e1) {
        e1.printStackTrace();
        return null;
    }
    byte temp;
    for (int i = 0; i < 2; i++) {
        temp = rsp[i + 1];
        rsp[i + 1] = rsp[4 - i];
        rsp[4 - i] = temp;
    }
    return rsp;
}