Merge "Support for getTimeout() (API)."
This commit is contained in:
committed by
Android (Google) Code Review
commit
63fc01d044
@@ -44,5 +44,6 @@ interface INfcTag
|
||||
Tag rediscover(int nativehandle);
|
||||
|
||||
int setTimeout(int technology, int timeout);
|
||||
int getTimeout(int technology);
|
||||
void resetTimeouts();
|
||||
}
|
||||
|
||||
@@ -100,6 +100,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.
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user