Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5bb9e621 authored by Scott Main's avatar Scott Main Committed by Android Git Automerger
Browse files

am 20856f71: am c9f7890a: Revise some javadocs for NFC; add package description

Merge commit '20856f71'

* commit '20856f71':
  Revise some javadocs for NFC; add package description
parents 246d8b7d 20856f71
Loading
Loading
Loading
Loading
+6 −4
Original line number Original line Diff line number Diff line
@@ -21,10 +21,12 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable;


/**
/**
 * NDEF Message data.
 * Represents an NDEF (NFC Data Exchange Format) data message that contains one or more {@link
 * <p>
 * NdefRecord}s.
 * Immutable data class. An NDEF message always contains zero or more NDEF
 * <p>An NDEF message includes "records" that can contain different sets of data, such as
 * records.
 * MIME-type media, a URI, or one of the supported RTD types (see {@link NdefRecord}). An NDEF
 * message always contains zero or more NDEF records.</p>
 * <p>This is an immutable data class.
 */
 */
public class NdefMessage implements Parcelable {
public class NdefMessage implements Parcelable {
    private static final byte FLAG_MB = (byte) 0x80;
    private static final byte FLAG_MB = (byte) 0x80;
+8 −10
Original line number Original line Diff line number Diff line
@@ -22,20 +22,18 @@ import android.os.Parcelable;
import java.lang.UnsupportedOperationException;
import java.lang.UnsupportedOperationException;


/**
/**
 * NDEF Record data.
 * Represents a logical (unchunked) NDEF (NFC Data Exchange Format) record.
 * <p>
 * <p>An NDEF record always contains:
 * Immutable data class. An NDEF record always contains
 * <ul>
 * <ul>
 * <li>3-bit TNF field
 * <li>3-bit TNF (Type Name Format) field: Indicates how to interpret the type field
 * <li>Variable length type
 * <li>Variable length type: Describes the record format
 * <li>Variable length ID
 * <li>Variable length ID: A unique identifier for the record
 * <li>Variable length payload
 * <li>Variable length payload: The actual data payload
 * </ul>
 * </ul>
 * The TNF (Type Name Format) field indicates how to interpret the type field.
 * <p>The underlying record
 * <p>
 * This class represents a logical (unchunked) NDEF record. The underlying
 * representation may be chunked across several NDEF records when the payload is
 * representation may be chunked across several NDEF records when the payload is
 * large.
 * large.
 * <p>This is an immutable data class.
 */
 */
public class NdefRecord implements Parcelable {
public class NdefRecord implements Parcelable {
    /**
    /**
+11 −13
Original line number Original line Diff line number Diff line
@@ -20,20 +20,18 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable;


/**
/**
 * NdefTag is a Tag that has NDEF messages or can store NDEF messages.
 * Represents a discovered tag that contains {@link NdefMessage}s (or a tag that can store them).
 * In practice, a tag is a thing that an NFC-enabled device can communicate with. This
 * class is a representation of such a tag and can contain the NDEF messages shared by the tag.
 * <p>An NDEF tag can contain zero or more NDEF messages (represented by {@link NdefMessage}
 * objects) in addition to the basic tag properties of UID and Type.
 * <p>
 * <p>
 * NDEF Tag's contain zero or more NDEF Messages in addition to the basic
 * {@link NdefTag}s that have been initialized will usually contain a single {@link NdefMessage}
 * Tag properties of UID and Type.
 * (and that Message can contain multiple {@link NdefRecord}s). However it
 * <p>
 * is possible for {@link NdefTag}s to contain multiple {@link NdefMessage}s.
 * NDEF Tag's that have been initialized will usually contain a single NDEF
 * <p>{@link NfcAdapter#createNdefTagConnection createNdefTagConnection()} can be used to modify the
 * Message (and that Message can contain multiple NDEF Records). However it
 * contents of some tags.
 * is possible for NDEF Tag's to contain multiple NDEF Messages.
 * <p>This is an immutable data class.
 * <p>
 * This class is a immutable data class that contains the contents of the NDEF
 * Message(s) as read at Tag discovery time.
 * <p>
 * NfcAdapter.createNdefTagConnection() can be used to modify the contents of
 * some NDEF Tag's.
 */
 */
public class NdefTag extends Tag implements Parcelable {
public class NdefTag extends Tag implements Parcelable {
    private final NdefMessage[] mMessages;
    private final NdefMessage[] mMessages;
+8 −6
Original line number Original line Diff line number Diff line
@@ -22,7 +22,9 @@ import android.os.RemoteException;
import android.util.Log;
import android.util.Log;


/**
/**
 * NdefTagConnection is a connection to an NDEF target on an NDEF tag.
 * A connection to an NDEF target on an {@link NdefTag}.
 * <p>You can acquire this kind of connection with {@link NfcAdapter#createNdefTagConnection
 * createNdefTagConnection()}. Use the connection to read or write {@link NdefMessage}s.
 */
 */
public class NdefTagConnection extends RawTagConnection {
public class NdefTagConnection extends RawTagConnection {
    public static final int NDEF_MODE_READ_ONCE = 1;
    public static final int NDEF_MODE_READ_ONCE = 1;
@@ -44,7 +46,7 @@ public class NdefTagConnection extends RawTagConnection {
    /**
    /**
     * Read NDEF message(s).
     * Read NDEF message(s).
     * This will always return the most up to date payload, and can block.
     * This will always return the most up to date payload, and can block.
     * It can be canceled with close().
     * It can be canceled with {@link RawTagConnection#close}.
     * Most NDEF tags will contain just one NDEF message.
     * Most NDEF tags will contain just one NDEF message.
     * <p>
     * <p>
     * @throws FormatException if the tag is not NDEF formatted
     * @throws FormatException if the tag is not NDEF formatted
@@ -79,12 +81,12 @@ public class NdefTagConnection extends RawTagConnection {
    /**
    /**
     * Attempt to write an NDEF message to a tag.
     * Attempt to write an NDEF message to a tag.
     * This method will block until the data is written. It can be canceled
     * This method will block until the data is written. It can be canceled
     * with close().
     * with {@link RawTagConnection#close}.
     * Many tags are write-once, so use this method carefully.
     * Many tags are write-once, so use this method carefully.
     * Specification allows for multiple NDEF messages per NDEF tag, but it is
     * Specification allows for multiple NDEF messages per NDEF tag, but it is
     * encourage to only write one message, this so API only takes a single
     * encourage to only write one message, this so API only takes a single
     * message. Use NdefRecord to write several records to a single tag.
     * message. Use {@link NdefRecord} to write several records to a single tag.
     * For write-many tags, use makeReadOnly() after this method to attempt
     * For write-many tags, use {@link #makeReadOnly} after this method to attempt
     * to prevent further modification. For write-once tags this is not
     * to prevent further modification. For write-once tags this is not
     * neccesary.
     * neccesary.
     * Requires NFC_WRITE permission.
     * Requires NFC_WRITE permission.
@@ -114,7 +116,7 @@ public class NdefTagConnection extends RawTagConnection {
    /**
    /**
     * Attempts to make the NDEF data in this tag read-only.
     * Attempts to make the NDEF data in this tag read-only.
     * This method will block until the action is complete. It can be canceled
     * This method will block until the action is complete. It can be canceled
     * with close().
     * with {@link RawTagConnection#close}.
     * Requires NFC_WRITE permission.
     * Requires NFC_WRITE permission.
     * @return true if the tag is now read-only
     * @return true if the tag is now read-only
     * @throws IOException if the target is lost, or connection closed
     * @throws IOException if the target is lost, or connection closed
+1 −1
Original line number Original line Diff line number Diff line
@@ -24,7 +24,7 @@ import android.util.Log;


//TODO(npelly) permission {@link android.Manifest.permission#NFC_MODIFY}
//TODO(npelly) permission {@link android.Manifest.permission#NFC_MODIFY}
/**
/**
 * Represents a local NFC Adapter.
 * Represents the device's local NFC adapter.
 * <p>
 * <p>
 * Use the static {@link #getDefaultAdapter} method to get the default NFC
 * Use the static {@link #getDefaultAdapter} method to get the default NFC
 * Adapter for this Android device. Most Android devices will have only one NFC
 * Adapter for this Android device. Most Android devices will have only one NFC
Loading