Enable presence check at application level using

RawTagConnection.isConnected() method.

Also needs packages/apps/Nfc to be updated.

Change-Id: I726e88853e2c4b348f3b87b7574bc6eded7f5b7c
Signed-off-by: Nick Pelly <npelly@google.com>
This commit is contained in:
Sylvain Fonteneau
2010-10-18 17:19:45 -07:00
committed by Nick Pelly
parent 7ea5c45e8d
commit a71354d766
2 changed files with 11 additions and 4 deletions

View File

@ -28,6 +28,7 @@ interface INfcTag
String getType(int nativeHandle); String getType(int nativeHandle);
byte[] getUid(int nativeHandle); byte[] getUid(int nativeHandle);
boolean isNdef(int nativeHandle); boolean isNdef(int nativeHandle);
boolean isPresent(int nativeHandle);
byte[] transceive(int nativeHandle, in byte[] data); byte[] transceive(int nativeHandle, in byte[] data);
int getLastError(int nativeHandle); int getLastError(int nativeHandle);

View File

@ -95,10 +95,16 @@ public class RawTagConnection {
* returns true. * returns true.
*/ */
public boolean isConnected() { public boolean isConnected() {
// TODO(nxp): update mIsConnected when tag goes out of range - if (!mIsConnected) {
// but do not do an active prescence check in return false;
// isConnected() }
return mIsConnected;
try {
return mTagService.isPresent(mTag.mNativeHandle);
} catch (RemoteException e) {
Log.e(TAG, "NFC service died", e);
return false;
}
} }
/** /**