Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2019f533 authored by Martijn Coenen's avatar Martijn Coenen Committed by Android Git Automerger
Browse files

am fc5a3b6c: Changed transceive on all technologies to "raw", except for Mifare classes.

* commit 'fc5a3b6c':
  Changed transceive on all technologies to "raw", except for Mifare classes.
parents 25556f66 fc5a3b6c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ interface INfcTag
    byte[] getUid(int nativeHandle);
    boolean isNdef(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);

+2 −2
Original line number Diff line number Diff line
@@ -181,9 +181,9 @@ import android.util.Log;
     */
    public byte[] transceive(byte[] data) throws IOException {
        try {
            byte[] response = mTagService.transceive(mTag.getServiceHandle(), data);
            byte[] response = mTagService.transceive(mTag.getServiceHandle(), data, true);
            if (response == null) {
                throw new IOException("transcieve failed");
                throw new IOException("transceive failed");
            }
            return response;
        } catch (RemoteException e) {
+25 −0
Original line number Diff line number Diff line
@@ -285,5 +285,30 @@ public final class MifareClassic extends BasicTagTechnology {
    public void writeSectorAccessControl(int sector, int access);
    public void increment(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");
        }
    }
}
+25 −0
Original line number Diff line number Diff line
@@ -70,6 +70,31 @@ public final class MifareUltralight extends BasicTagTechnology {
        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
     */
+5 −0
Original line number Diff line number Diff line
@@ -195,4 +195,9 @@ public final class Ndef extends BasicTagTechnology {
    public void makeLowLevelReadonly() {
        throw new UnsupportedOperationException();
    }

    @Override
    public byte[] transceive(byte[] data) {
        throw new UnsupportedOperationException();
    }
}
Loading