Java Code Examples for android.nfc.Tag#getTechExtras()

The following examples show how to use android.nfc.Tag#getTechExtras() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MifareUltralight.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/** @hide */
public MifareUltralight(Tag tag) throws RemoteException {
    super(tag, TagTechnology.MIFARE_ULTRALIGHT);

    // Check if this could actually be a MIFARE
    NfcA a = NfcA.get(tag);

    mType = TYPE_UNKNOWN;

    if (a.getSak() == 0x00 && tag.getId()[0] == NXP_MANUFACTURER_ID) {
        Bundle extras = tag.getTechExtras(TagTechnology.MIFARE_ULTRALIGHT);
        if (extras.getBoolean(EXTRA_IS_UL_C)) {
            mType = TYPE_ULTRALIGHT_C;
        } else {
            mType = TYPE_ULTRALIGHT;
        }
    }
}
 
Example 2
Source File: NfcA.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/** @hide */
public NfcA(Tag tag) throws RemoteException {
    super(tag, TagTechnology.NFC_A);
    Bundle extras = tag.getTechExtras(TagTechnology.NFC_A);
    mSak = extras.getShort(EXTRA_SAK);
    mAtqa = extras.getByteArray(EXTRA_ATQA);
}
 
Example 3
Source File: NfcBarcode.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * Internal constructor, to be used by NfcAdapter
 * @hide
 */
public NfcBarcode(Tag tag) throws RemoteException {
    super(tag, TagTechnology.NFC_BARCODE);
    Bundle extras = tag.getTechExtras(TagTechnology.NFC_BARCODE);
    if (extras != null) {
        mType = extras.getInt(EXTRA_BARCODE_TYPE);
    } else {
        throw new NullPointerException("NfcBarcode tech extras are null.");
    }
}
 
Example 4
Source File: NfcB.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/** @hide */
public NfcB(Tag tag) throws RemoteException {
    super(tag, TagTechnology.NFC_B);
    Bundle extras = tag.getTechExtras(TagTechnology.NFC_B);
    mAppData = extras.getByteArray(EXTRA_APPDATA);
    mProtInfo = extras.getByteArray(EXTRA_PROTINFO);
}
 
Example 5
Source File: Ndef.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * Internal constructor, to be used by NfcAdapter
 * @hide
 */
public Ndef(Tag tag) throws RemoteException {
    super(tag, TagTechnology.NDEF);
    Bundle extras = tag.getTechExtras(TagTechnology.NDEF);
    if (extras != null) {
        mMaxNdefSize = extras.getInt(EXTRA_NDEF_MAXLENGTH);
        mCardState = extras.getInt(EXTRA_NDEF_CARDSTATE);
        mNdefMsg = extras.getParcelable(EXTRA_NDEF_MSG);
        mNdefType = extras.getInt(EXTRA_NDEF_TYPE);
    } else {
        throw new NullPointerException("NDEF tech extras are null.");
    }

}
 
Example 6
Source File: NfcV.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/** @hide */
public NfcV(Tag tag) throws RemoteException {
    super(tag, TagTechnology.NFC_V);
    Bundle extras = tag.getTechExtras(TagTechnology.NFC_V);
    mRespFlags = extras.getByte(EXTRA_RESP_FLAGS);
    mDsfId = extras.getByte(EXTRA_DSFID);
}
 
Example 7
Source File: IsoDep.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/** @hide */
public IsoDep(Tag tag)
        throws RemoteException {
    super(tag, TagTechnology.ISO_DEP);
    Bundle extras = tag.getTechExtras(TagTechnology.ISO_DEP);
    if (extras != null) {
        mHiLayerResponse = extras.getByteArray(EXTRA_HI_LAYER_RESP);
        mHistBytes = extras.getByteArray(EXTRA_HIST_BYTES);
    }
}
 
Example 8
Source File: NfcF.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/** @hide */
public NfcF(Tag tag) throws RemoteException {
    super(tag, TagTechnology.NFC_F);
    Bundle extras = tag.getTechExtras(TagTechnology.NFC_F);
    if (extras != null) {
        mSystemCode = extras.getByteArray(EXTRA_SC);
        mManufacturer = extras.getByteArray(EXTRA_PMM);
    }
}