Android NFC leer etiqueta ISO15693 RFID
Estoy tratando de leer una etiqueta RFID ISO15693 con la biblioteca nfc android:
Aquí hay más información sobre la etiqueta: http://img42.com/gw07d+
- ¿Es posible bloquear una etiqueta NFC y más tarde desbloquear y escribir datos de nuevo?
- Comenzar con el nexus s NFC / RFID
- Etiquetas RFID pasivas de larga distancia compatibles con teléfonos Android con NFC?
- ¿Puede un Smartphone leer etiquetas RFID desde una distancia de pocos pies (NO NFC)?
- ¿Puede un teléfono NFC actuar como una etiqueta RFID, que se puede leer a distancias superiores a 4 pulgadas?
El Tag ID se lee correctamente, pero los datos de la etiqueta no lo son.
onCreate
Método:
// initialize NFC nfcAdapter = NfcAdapter.getDefaultAdapter(this); nfcPendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, this.getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
onNewIntent
método:
if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(intent.getAction()) || NfcAdapter.ACTION_TECH_DISCOVERED.equals(intent.getAction())) { currentTag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG); byte[] id = currentTag.getId(); Tag_data_TextDisplay.setText("TagId:" + Common.getHexString(id)); for (String tech : currentTag.getTechList()) { if (tech.equals(NfcV.class.getName())) { NfcV nfcvTag = NfcV.get(currentTag); try { nfcvTag.connect(); txtType.setText("Hello NFC!"); } catch (IOException e) { Toast.makeText(getApplicationContext(), "Could not open a connection!", Toast.LENGTH_SHORT).show(); return; } try { byte[] cmd = new byte[]{ (byte) 0x00, // Flags (byte) 0x23, // Command: Read multiple blocks (byte) 0x00, // First block (offset) (byte) 0x04 // Number of blocks }; byte[] userdata = nfcvTag.transceive(cmd); userdata = Arrays.copyOfRange(userdata, 0, 32); txtWrite.setText("DATA:" + Common.getHexString(userdata)); } catch (IOException e) { Toast.makeText(getApplicationContext(), "An error occurred while reading!", Toast.LENGTH_SHORT).show(); return; } } } }
userdata
es contiene un byte único con el valor 0x02
( { 0x02 }
) justo después de que el método transceive terminó.
- Tarjeta Emulate Mifare con Android 4.4
- Lector RFID para dispositivos móviles
- Cómo implementar las funciones RFID en nuestra aplicación Android
- Preguntas y respuestas sobre el desarrollo móvil Android y Symbian NFC (FAQ)
- Android: Autenticación con NXP MiFare Ultralight C
- HF-RFID vs. NFC - ¿Puede un teléfono móvil con capacidad NFC leer etiquetas RFID de alta frecuencia?
- Las etiquetas NFC pueden ser leídas por lector RFID?
- Cómo obtener ayuda para el lector Emulación de tarjeta basada en host
Por lo tanto, recibirá un valor de { 0x02 }
del método de transceive
. Como se encuentra en este subproceso, esto puede ocurrir cuando se utilizan comandos no direccionados. Por lo tanto, siempre debe enviar comandos dirigidos a través de NfcV
(ya que parece ser compatible con todos los chipsets NFC en dispositivos Android). En su caso, podría utilizar algo como esto para generar un comando dirigido READ BLOCOS MÚLTIPLES:
int offset = 0; // offset of first block to read int blocks = 1; // number of blocks to read byte[] cmd = new byte[]{ (byte)0x60, // flags: addressed (= UID field present) (byte)0x23, // command: READ MULTIPLE BLOCKS (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, // placeholder for tag UID (byte)(offset & 0x0ff), // first block number (byte)((blocks - 1) & 0x0ff) // number of blocks (-1 as 0x00 means one block) }; System.arraycopy(id, 0, cmd, 2, 8); byte[] response = nfcvTag.transceive(cmd);
- Elementos de DOM de control de la aplicación de Android
- Ninguna actividad encontrada para manejar Intent, Android