From ddbb2c997b8462d7242b50ea1689a53122d4fce4 Mon Sep 17 00:00:00 2001 From: Nick Pelly Date: Tue, 4 Jan 2011 17:29:14 +1100 Subject: Tweak Ndef.getType() API. Rename constants, expand javadoc. Change-Id: I9d2c83411411fea4ef46bb7c30ebdbcd9ee3e7d8 --- core/java/android/nfc/technology/Ndef.java | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'core/java') diff --git a/core/java/android/nfc/technology/Ndef.java b/core/java/android/nfc/technology/Ndef.java index 04f0797..05872fe 100644 --- a/core/java/android/nfc/technology/Ndef.java +++ b/core/java/android/nfc/technology/Ndef.java @@ -57,12 +57,14 @@ public final class Ndef extends BasicTagTechnology { /** @hide */ public static final String EXTRA_NDEF_TYPE = "ndeftype"; - public static final int UNKNOWN_TAG = 0; - public static final int TYPE1_TAG = 1; - public static final int TYPE2_TAG = 2; - public static final int TYPE3_TAG = 3; - public static final int TYPE4_TAG = 4; - public static final int MIFARE_CLASSIC_TAG = 5; + //TODO: consider removing OTHER entirely - and not allowing Ndef to + // enumerate for tag types outside of (NFC Forum 1-4, MifareClassic) + public static final int OTHER = -1; + public static final int NFC_FORUM_TYPE_1 = 1; + public static final int NFC_FORUM_TYPE_2 = 2; + public static final int NFC_FORUM_TYPE_3 = 3; + public static final int NFC_FORUM_TYPE_4 = 4; + public static final int MIFARE_CLASSIC = 105; private final int mMaxNdefSize; private final int mCardState; @@ -104,7 +106,18 @@ public final class Ndef extends BasicTagTechnology { } /** - * Get NDEF card type + * Get NDEF tag type. + *

Returns one of {@link #NFC_FORUM_TYPE_1}, {@link #NFC_FORUM_TYPE_2}, + * {@link #NFC_FORUM_TYPE_3}, {@link #NFC_FORUM_TYPE_4}, + * {@link #MIFARE_CLASSIC} or {@link #OTHER}. + *

Platforms of this API revision will always return one of the above + * values. Platforms at future API revisions may return other values, which + * can be treated as {@link #OTHER} by applications targeting this API. + *

Android devices with NFC support must always correctly enumerate + * NFC Forum tag types, and may optionally enumerate + * {@link #MIFARE_CLASSIC} since it requires proprietary technology. + * Devices that cannot enumerate {@link #MIFARE_CLASSIC} will use + * {@link #OTHER} instead. */ public int getType() { return mNdefType; -- cgit v1.1