コード例 #1
0
 public int readNfcV(Tag tag) throws Exception {
   if (tag == null) {
     callbackContext.error("NULL");
   }
   byte[] response = new byte[4];
   NfcV nfcv = NfcV.get(tag);
   if (nfcv != null) {
     try {
       nfcv.connect();
       byte[] request =
           new byte[] {
             (byte) 0x00, // flag
             (byte) 0x20, // command: READ ONE BLOCK
             (byte) block // IMMER im gleichen Block
           };
       response = nfcv.transceive(request);
     } catch (IOException e) {
       callbackContext.error(nfcv.toString());
     } finally {
       try {
         nfcv.close();
       } catch (IOException e) {
       }
     }
   }
   // 1. Byte: Block locking status
   byte[] value = new byte[] {response[1], response[2], response[3], response[4]};
   return ByteBuffer.wrap(value).order(java.nio.ByteOrder.BIG_ENDIAN).getInt();
 }