summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Martijn Coenen <maco@google.com> 2011-07-21 00:32:11 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2011-07-21 00:32:11 -0700
commit63fc01d044e43d7b7399ff75f55ce91ef75cb64a (patch)
treee22e5ea67a7f9d7e49c97409c243c638435009bd
parent33ef62e5c651e6fb824440f0f054db84ce883186 (diff)
parent20e62c9f1466ace5771e244f03a995dc0939b11b (diff)
Merge "Support for getTimeout() (API)."
-rw-r--r--core/java/android/nfc/INfcTag.aidl1
-rw-r--r--core/java/android/nfc/tech/IsoDep.java18
-rw-r--r--core/java/android/nfc/tech/MifareClassic.java18
-rw-r--r--core/java/android/nfc/tech/MifareUltralight.java18
-rw-r--r--core/java/android/nfc/tech/NfcA.java18
-rw-r--r--core/java/android/nfc/tech/NfcF.java18
6 files changed, 91 insertions, 0 deletions
diff --git a/core/java/android/nfc/INfcTag.aidl b/core/java/android/nfc/INfcTag.aidl
index aa5937ee9deb..7bdefe7b0eb7 100644
--- a/core/java/android/nfc/INfcTag.aidl
+++ b/core/java/android/nfc/INfcTag.aidl
@@ -44,5 +44,6 @@ interface INfcTag
Tag rediscover(int nativehandle);
int setTimeout(int technology, int timeout);
+ int getTimeout(int technology);
void resetTimeouts();
}
diff --git a/core/java/android/nfc/tech/IsoDep.java b/core/java/android/nfc/tech/IsoDep.java
index d02086ffcf1f..0672a4eba281 100644
--- a/core/java/android/nfc/tech/IsoDep.java
+++ b/core/java/android/nfc/tech/IsoDep.java
@@ -101,6 +101,24 @@ public final class IsoDep extends BasicTagTechnology {
}
/**
+ * Gets the currently set timeout of {@link #transceive} in milliseconds.
+ *
+ * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission.
+ *
+ * @return timeout value in milliseconds
+ * @hide
+ */
+ // TODO Unhide for ICS
+ public int getTimeout() {
+ try {
+ return mTag.getTagService().getTimeout(TagTechnology.ISO_DEP);
+ } catch (RemoteException e) {
+ Log.e(TAG, "NFC service dead", e);
+ return 0;
+ }
+ }
+
+ /**
* Return the ISO-DEP historical bytes for {@link NfcA} tags.
* <p>Does not cause any RF activity and does not block.
* <p>The historical bytes can be used to help identify a tag. They are present
diff --git a/core/java/android/nfc/tech/MifareClassic.java b/core/java/android/nfc/tech/MifareClassic.java
index 5cafe5ba6126..93e7cbddec94 100644
--- a/core/java/android/nfc/tech/MifareClassic.java
+++ b/core/java/android/nfc/tech/MifareClassic.java
@@ -597,6 +597,24 @@ public final class MifareClassic extends BasicTagTechnology {
}
}
+ /**
+ * Gets the currently set timeout of {@link #transceive} in milliseconds.
+ *
+ * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission.
+ *
+ * @return timeout value in milliseconds
+ * @hide
+ */
+ // TODO Unhide for ICS
+ public int getTimeout() {
+ try {
+ return mTag.getTagService().getTimeout(TagTechnology.MIFARE_CLASSIC);
+ } catch (RemoteException e) {
+ Log.e(TAG, "NFC service dead", e);
+ return 0;
+ }
+ }
+
private static void validateSector(int sector) {
// Do not be too strict on upper bounds checking, since some cards
// have more addressable memory than they report. For example,
diff --git a/core/java/android/nfc/tech/MifareUltralight.java b/core/java/android/nfc/tech/MifareUltralight.java
index 3d4cdd1a8dff..ca74ebe521c9 100644
--- a/core/java/android/nfc/tech/MifareUltralight.java
+++ b/core/java/android/nfc/tech/MifareUltralight.java
@@ -238,6 +238,24 @@ public final class MifareUltralight extends BasicTagTechnology {
}
}
+ /**
+ * Gets the currently set timeout of {@link #transceive} in milliseconds.
+ *
+ * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission.
+ *
+ * @return timeout value in milliseconds
+ * @hide
+ */
+ // TODO Unhide for ICS
+ public int getTimeout() {
+ try {
+ return mTag.getTagService().getTimeout(TagTechnology.MIFARE_ULTRALIGHT);
+ } catch (RemoteException e) {
+ Log.e(TAG, "NFC service dead", e);
+ return 0;
+ }
+ }
+
private static void validatePageIndex(int pageIndex) {
// Do not be too strict on upper bounds checking, since some cards
// may have more addressable memory than they report.
diff --git a/core/java/android/nfc/tech/NfcA.java b/core/java/android/nfc/tech/NfcA.java
index 08095e6cb163..bd1f95af63ec 100644
--- a/core/java/android/nfc/tech/NfcA.java
+++ b/core/java/android/nfc/tech/NfcA.java
@@ -141,4 +141,22 @@ public final class NfcA extends BasicTagTechnology {
Log.e(TAG, "NFC service dead", e);
}
}
+
+ /**
+ * Gets the currently set timeout of {@link #transceive} in milliseconds.
+ *
+ * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission.
+ *
+ * @return timeout value in milliseconds
+ * @hide
+ */
+ // TODO Unhide for ICS
+ public int getTimeout() {
+ try {
+ return mTag.getTagService().getTimeout(TagTechnology.NFC_A);
+ } catch (RemoteException e) {
+ Log.e(TAG, "NFC service dead", e);
+ return 0;
+ }
+ }
}
diff --git a/core/java/android/nfc/tech/NfcF.java b/core/java/android/nfc/tech/NfcF.java
index 85abf89e6dfd..7b25a72231b9 100644
--- a/core/java/android/nfc/tech/NfcF.java
+++ b/core/java/android/nfc/tech/NfcF.java
@@ -140,4 +140,22 @@ public final class NfcF extends BasicTagTechnology {
Log.e(TAG, "NFC service dead", e);
}
}
+
+ /**
+ * Gets the currently set timeout of {@link #transceive} in milliseconds.
+ *
+ * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission.
+ *
+ * @return timeout value in milliseconds
+ * @hide
+ */
+ // TODO Unhide for ICS
+ public int getTimeout() {
+ try {
+ return mTag.getTagService().getTimeout(TagTechnology.NFC_F);
+ } catch (RemoteException e) {
+ Log.e(TAG, "NFC service dead", e);
+ return 0;
+ }
+ }
}