am fc5a3b6c
: Changed transceive on all technologies to "raw", except for Mifare classes.
* commit 'fc5a3b6cfb85679e82a39730c7154b55b0711a0c': Changed transceive on all technologies to "raw", except for Mifare classes.
This commit is contained in:
@ -29,7 +29,7 @@ interface INfcTag
|
|||||||
byte[] getUid(int nativeHandle);
|
byte[] getUid(int nativeHandle);
|
||||||
boolean isNdef(int nativeHandle);
|
boolean isNdef(int nativeHandle);
|
||||||
boolean isPresent(int nativeHandle);
|
boolean isPresent(int nativeHandle);
|
||||||
byte[] transceive(int nativeHandle, in byte[] data);
|
byte[] transceive(int nativeHandle, in byte[] data, boolean raw);
|
||||||
|
|
||||||
int getLastError(int nativeHandle);
|
int getLastError(int nativeHandle);
|
||||||
|
|
||||||
|
@ -181,9 +181,9 @@ import android.util.Log;
|
|||||||
*/
|
*/
|
||||||
public byte[] transceive(byte[] data) throws IOException {
|
public byte[] transceive(byte[] data) throws IOException {
|
||||||
try {
|
try {
|
||||||
byte[] response = mTagService.transceive(mTag.getServiceHandle(), data);
|
byte[] response = mTagService.transceive(mTag.getServiceHandle(), data, true);
|
||||||
if (response == null) {
|
if (response == null) {
|
||||||
throw new IOException("transcieve failed");
|
throw new IOException("transceive failed");
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
@ -285,5 +285,30 @@ public final class MifareClassic extends BasicTagTechnology {
|
|||||||
public void writeSectorAccessControl(int sector, int access);
|
public void writeSectorAccessControl(int sector, int access);
|
||||||
public void increment(int block);
|
public void increment(int block);
|
||||||
public void decrement(int block);
|
public void decrement(int block);
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
/**
|
||||||
|
* Send data to a tag and receive the response.
|
||||||
|
* <p>
|
||||||
|
* This method will block until the response is received. It can be canceled
|
||||||
|
* with {@link #close}.
|
||||||
|
* <p>Requires {@link android.Manifest.permission#NFC} permission.
|
||||||
|
*
|
||||||
|
* @param data bytes to send
|
||||||
|
* @return bytes received in response
|
||||||
|
* @throws IOException if the target is lost or connection closed
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public byte[] transceive(byte[] data) throws IOException {
|
||||||
|
try {
|
||||||
|
byte[] response = mTagService.transceive(mTag.getServiceHandle(), data, false);
|
||||||
|
if (response == null) {
|
||||||
|
throw new IOException("transceive failed");
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
attemptDeadServiceRecovery(e);
|
||||||
|
throw new IOException("NFC service died");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,31 @@ public final class MifareUltralight extends BasicTagTechnology {
|
|||||||
return transceive(blockread_cmd);
|
return transceive(blockread_cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send data to a tag and receive the response.
|
||||||
|
* <p>
|
||||||
|
* This method will block until the response is received. It can be canceled
|
||||||
|
* with {@link #close}.
|
||||||
|
* <p>Requires {@link android.Manifest.permission#NFC} permission.
|
||||||
|
*
|
||||||
|
* @param data bytes to send
|
||||||
|
* @return bytes received in response
|
||||||
|
* @throws IOException if the target is lost or connection closed
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public byte[] transceive(byte[] data) throws IOException {
|
||||||
|
try {
|
||||||
|
byte[] response = mTagService.transceive(mTag.getServiceHandle(), data, false);
|
||||||
|
if (response == null) {
|
||||||
|
throw new IOException("transceive failed");
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
attemptDeadServiceRecovery(e);
|
||||||
|
throw new IOException("NFC service died");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
|
@ -195,4 +195,9 @@ public final class Ndef extends BasicTagTechnology {
|
|||||||
public void makeLowLevelReadonly() {
|
public void makeLowLevelReadonly() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] transceive(byte[] data) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,4 +89,9 @@ public final class NdefFormatable extends BasicTagTechnology {
|
|||||||
attemptDeadServiceRecovery(e);
|
attemptDeadServiceRecovery(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] transceive(byte[] data) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user