Index: device/nfc/android/java/src/org/chromium/device/nfc/NfcTagHandler.java |
diff --git a/device/nfc/android/java/src/org/chromium/device/nfc/NfcTagHandler.java b/device/nfc/android/java/src/org/chromium/device/nfc/NfcTagHandler.java |
index a7adab7047e2b3b879f0a905dbd9050c965f2433..4b95010645cf6a9cef710258bed597900c111b41 100644 |
--- a/device/nfc/android/java/src/org/chromium/device/nfc/NfcTagHandler.java |
+++ b/device/nfc/android/java/src/org/chromium/device/nfc/NfcTagHandler.java |
@@ -49,7 +49,7 @@ public final class NfcTagHandler { |
private interface TagTechnologyHandler { |
public void write(NdefMessage message) |
throws IOException, TagLostException, FormatException; |
- // TODO(crbug.com/625589): add read method for nfc.watch. |
+ public NdefMessage read() throws IOException, TagLostException, FormatException; |
} |
/** |
@@ -67,6 +67,10 @@ public final class NfcTagHandler { |
throws IOException, TagLostException, FormatException { |
mNdef.writeNdefMessage(message); |
} |
+ |
+ public NdefMessage read() throws IOException, TagLostException, FormatException { |
+ return mNdef.getNdefMessage(); |
+ } |
} |
/** |
@@ -84,6 +88,10 @@ public final class NfcTagHandler { |
throws IOException, TagLostException, FormatException { |
mNdefFormattable.format(message); |
} |
+ |
+ public NdefMessage read() throws IOException, TagLostException, FormatException { |
+ return NfcTypeConverter.emptyNdefMessage(); |
+ } |
} |
private NfcTagHandler(TagTechnology tech, TagTechnologyHandler handler) { |
@@ -102,6 +110,13 @@ public final class NfcTagHandler { |
} |
/** |
+ * Checks if NFC tag is connected. |
+ */ |
+ public boolean isConnected() { |
+ return mTech.isConnected(); |
+ } |
+ |
+ /** |
* Closes connection. |
*/ |
public void close() throws IOException { |
@@ -115,6 +130,10 @@ public final class NfcTagHandler { |
mTechHandler.write(message); |
} |
+ public NdefMessage read() throws IOException, TagLostException, FormatException { |
+ return mTechHandler.read(); |
+ } |
+ |
/** |
* If tag was previously connected and subsequent connection to the same tag fails, consider |
* tag to be out of range. |