diff options
Diffstat (limited to 'core/java/android/nfc/tech')
-rw-r--r-- | core/java/android/nfc/tech/BasicTagTechnology.java | 33 | ||||
-rw-r--r-- | core/java/android/nfc/tech/Ndef.java | 2 | ||||
-rw-r--r-- | core/java/android/nfc/tech/TagTechnology.java | 6 |
3 files changed, 7 insertions, 34 deletions
diff --git a/core/java/android/nfc/tech/BasicTagTechnology.java b/core/java/android/nfc/tech/BasicTagTechnology.java index a909631..e635f21 100644 --- a/core/java/android/nfc/tech/BasicTagTechnology.java +++ b/core/java/android/nfc/tech/BasicTagTechnology.java @@ -36,28 +36,10 @@ import java.io.IOException; /*package*/ int mSelectedTechnology; BasicTagTechnology(Tag tag, int tech) throws RemoteException { - int[] techList = tag.getTechnologyList(); - int i; - - // Check target validity - for (i = 0; i < techList.length; i++) { - if (tech == techList[i]) { - break; - } - } - if (i >= techList.length) { - // Technology not found - throw new IllegalArgumentException("Technology " + tech + " not present on tag " + tag); - } - mTag = tag; mSelectedTechnology = tech; } - BasicTagTechnology(Tag tag) throws RemoteException { - this(tag, tag.getTechnologyList()[0]); - } - @Override public Tag getTag() { return mTag; @@ -65,17 +47,12 @@ import java.io.IOException; /** Internal helper to throw IllegalStateException if the technology isn't connected */ void checkConnected() { - if ((mTag.getConnectedTechnology() != getTechnologyId()) || + if ((mTag.getConnectedTechnology() != mSelectedTechnology) || (mTag.getConnectedTechnology() == -1)) { throw new IllegalStateException("Call connect() first!"); } } - @Override - public int getTechnologyId() { - return mSelectedTechnology; - } - /** * Helper to indicate if {@link #connect} has succeeded. * <p> @@ -101,11 +78,12 @@ import java.io.IOException; @Override public void connect() throws IOException { try { - int errorCode = mTag.getTagService().connect(mTag.getServiceHandle(), getTechnologyId()); + int errorCode = mTag.getTagService().connect(mTag.getServiceHandle(), + mSelectedTechnology); if (errorCode == ErrorCodes.SUCCESS) { // Store this in the tag object - mTag.setConnectedTechnology(getTechnologyId()); + mTag.setConnectedTechnology(mSelectedTechnology); mIsConnected = true; } else { throw new IOException(); @@ -158,7 +136,8 @@ import java.io.IOException; checkConnected(); try { - TransceiveResult result = mTag.getTagService().transceive(mTag.getServiceHandle(), data, raw); + TransceiveResult result = mTag.getTagService().transceive(mTag.getServiceHandle(), + data, raw); if (result == null) { throw new IOException("transceive failed"); } else { diff --git a/core/java/android/nfc/tech/Ndef.java b/core/java/android/nfc/tech/Ndef.java index 03f2184..c6804f9 100644 --- a/core/java/android/nfc/tech/Ndef.java +++ b/core/java/android/nfc/tech/Ndef.java @@ -31,7 +31,7 @@ import java.io.IOException; /** * A high-level connection to a {@link Tag} using one of the NFC type 1, 2, 3, or 4 technologies * to interact with NDEF data. MiFare Classic cards that present NDEF data may also be used - * via this class. To determine the exact technology being used call {@link #getTechnologyId()} + * via this class. To determine the exact technology being used call {@link #getType()} * * <p>You can acquire this kind of connection with {@link #get}. * diff --git a/core/java/android/nfc/tech/TagTechnology.java b/core/java/android/nfc/tech/TagTechnology.java index 1331bae..aebb3e8 100644 --- a/core/java/android/nfc/tech/TagTechnology.java +++ b/core/java/android/nfc/tech/TagTechnology.java @@ -89,12 +89,6 @@ public interface TagTechnology { public static final int MIFARE_ULTRALIGHT = 9; /** - * Returns the technology type for this tag connection. - * @hide - */ - public int getTechnologyId(); - - /** * Get the {@link Tag} object this technology came from. */ public Tag getTag(); |