Java examples for javax.smartcardio:CardChannel
Send NFC Command
//package com.java2s; import java.nio.ByteBuffer; import javax.smartcardio.CardChannel; import javax.smartcardio.CardException; public class Main { public static String SendCommand(byte[] cmd, CardChannel channel) { String response = ""; byte[] baResp = new byte[258]; ByteBuffer bufCmd = ByteBuffer.wrap(cmd); ByteBuffer bufResp = ByteBuffer.wrap(baResp); int output = 0; try {/*from ww w .j av a 2 s . c om*/ output = channel.transmit(bufCmd, bufResp); } catch (CardException ex) { ex.printStackTrace(); } for (int i = 0; i < output; i++) { response += String.format("%02X", baResp[i]); } return response; } }