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

Commit bc7180bb authored by Martijn Coenen's avatar Martijn Coenen
Browse files

Implement historical bytes / attrib on IsoDep

Change-Id: Ic7afa29515d10fec72ac8f27adc411788ad6f68c
parent 438feb9b
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -38,21 +38,32 @@ import java.io.IOException;
 * permission.
 */
public final class IsoDep extends BasicTagTechnology {
    /** @hide */
    public static final String EXTRA_ATTRIB = "attrib";
    /** @hide */
    public static final String EXTRA_HIST_BYTES = "histbytes";

    private byte[] mAttrib = null;
    private byte[] mHistBytes = null;

    public IsoDep(NfcAdapter adapter, Tag tag, Bundle extras)
            throws RemoteException {
        super(adapter, tag, TagTechnology.ISO_DEP);
        if (extras != null) {
            mAttrib = extras.getByteArray(EXTRA_ATTRIB);
            mHistBytes = extras.getByteArray(EXTRA_HIST_BYTES);
        }
    }

    /**
     * 3A only
     */
    public byte[] getHistoricalBytes() { throw new UnsupportedOperationException(); }
    public byte[] getHistoricalBytes() { return mHistBytes; }

    /**
     * 3B only
     */
    public byte[] getAttrib() { throw new UnsupportedOperationException(); }
    public byte[] getAttrib() { return mAttrib; }

    /**
     * Attempts to select the given application on the tag. Note that this only works