Loading core/java/android/nfc/tech/MifareClassic.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -250,6 +250,7 @@ public final class MifareClassic extends BasicTagTechnology { * Return the total number of MIFARE Classic blocks. * Return the total number of MIFARE Classic blocks. * <p>Does not cause any RF activity and does not block. * <p>Does not cause any RF activity and does not block. * @return total number of blocks * @return total number of blocks */ public int getBlockCount() { public int getBlockCount() { return mSize / BLOCK_SIZE; return mSize / BLOCK_SIZE; } } Loading core/java/android/nfc/tech/MifareUltralight.java +8 −8 Original line number Original line Diff line number Diff line Loading @@ -136,16 +136,16 @@ public final class MifareUltralight extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * @param pageIndex index of first page to read, starting from 0 * @param pageOffset index of first page to read, starting from 0 * @return 4 pages (16 bytes) * @return 4 pages (16 bytes) * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field * @throws IOException if there is an I/O failure, or the operation is canceled * @throws IOException if there is an I/O failure, or the operation is canceled */ */ public byte[] readPages(int pageIndex) throws IOException { public byte[] readPages(int pageOffset) throws IOException { validatePageIndex(pageIndex); validatePageIndex(pageOffset); checkConnected(); checkConnected(); byte[] cmd = { 0x30, (byte) pageIndex}; byte[] cmd = { 0x30, (byte) pageOffset}; return transceive(cmd, false); return transceive(cmd, false); } } Loading @@ -159,18 +159,18 @@ public final class MifareUltralight extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * @param pageIndex index of page to write, starting from 0 * @param pageOffset index of page to write, starting from 0 * @param data 4 bytes to write * @param data 4 bytes to write * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field * @throws IOException if there is an I/O failure, or the operation is canceled * @throws IOException if there is an I/O failure, or the operation is canceled */ */ public void writePage(int pageIndex, byte[] data) throws IOException { public void writePage(int pageOffset, byte[] data) throws IOException { validatePageIndex(pageIndex); validatePageIndex(pageOffset); checkConnected(); checkConnected(); byte[] cmd = new byte[data.length + 2]; byte[] cmd = new byte[data.length + 2]; cmd[0] = (byte) 0xA2; cmd[0] = (byte) 0xA2; cmd[1] = (byte) pageIndex; cmd[1] = (byte) pageOffset; System.arraycopy(data, 0, cmd, 2, data.length); System.arraycopy(data, 0, cmd, 2, data.length); transceive(cmd, false); transceive(cmd, false); Loading core/java/android/nfc/tech/NdefFormatable.java +6 −6 Original line number Original line Diff line number Diff line Loading @@ -85,13 +85,13 @@ public final class NdefFormatable extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * @param msg the NDEF message to write after formatting * @param firstMessage the NDEF message to write after formatting * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field * @throws IOException if there is an I/O failure, or the operation is canceled * @throws IOException if there is an I/O failure, or the operation is canceled * @throws FormatException if the NDEF Message to write is malformed * @throws FormatException if the NDEF Message to write is malformed */ */ public void format(NdefMessage msg) throws IOException, FormatException { public void format(NdefMessage firstMessage) throws IOException, FormatException { format(msg, false); format(firstMessage, false); } } /** /** Loading @@ -105,13 +105,13 @@ public final class NdefFormatable extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * @param msg the NDEF message to write after formatting * @param firstMessage the NDEF message to write after formatting * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field * @throws IOException if there is an I/O failure, or the operation is canceled * @throws IOException if there is an I/O failure, or the operation is canceled * @throws FormatException if the NDEF Message to write is malformed * @throws FormatException if the NDEF Message to write is malformed */ */ public void formatReadOnly(NdefMessage msg) throws IOException, FormatException { public void formatReadOnly(NdefMessage firstMessage) throws IOException, FormatException { format(msg, true); format(firstMessage, true); } } /*package*/ void format(NdefMessage firstMessage, boolean makeReadOnly) throws IOException, /*package*/ void format(NdefMessage firstMessage, boolean makeReadOnly) throws IOException, Loading Loading
core/java/android/nfc/tech/MifareClassic.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -250,6 +250,7 @@ public final class MifareClassic extends BasicTagTechnology { * Return the total number of MIFARE Classic blocks. * Return the total number of MIFARE Classic blocks. * <p>Does not cause any RF activity and does not block. * <p>Does not cause any RF activity and does not block. * @return total number of blocks * @return total number of blocks */ public int getBlockCount() { public int getBlockCount() { return mSize / BLOCK_SIZE; return mSize / BLOCK_SIZE; } } Loading
core/java/android/nfc/tech/MifareUltralight.java +8 −8 Original line number Original line Diff line number Diff line Loading @@ -136,16 +136,16 @@ public final class MifareUltralight extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * @param pageIndex index of first page to read, starting from 0 * @param pageOffset index of first page to read, starting from 0 * @return 4 pages (16 bytes) * @return 4 pages (16 bytes) * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field * @throws IOException if there is an I/O failure, or the operation is canceled * @throws IOException if there is an I/O failure, or the operation is canceled */ */ public byte[] readPages(int pageIndex) throws IOException { public byte[] readPages(int pageOffset) throws IOException { validatePageIndex(pageIndex); validatePageIndex(pageOffset); checkConnected(); checkConnected(); byte[] cmd = { 0x30, (byte) pageIndex}; byte[] cmd = { 0x30, (byte) pageOffset}; return transceive(cmd, false); return transceive(cmd, false); } } Loading @@ -159,18 +159,18 @@ public final class MifareUltralight extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * @param pageIndex index of page to write, starting from 0 * @param pageOffset index of page to write, starting from 0 * @param data 4 bytes to write * @param data 4 bytes to write * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field * @throws IOException if there is an I/O failure, or the operation is canceled * @throws IOException if there is an I/O failure, or the operation is canceled */ */ public void writePage(int pageIndex, byte[] data) throws IOException { public void writePage(int pageOffset, byte[] data) throws IOException { validatePageIndex(pageIndex); validatePageIndex(pageOffset); checkConnected(); checkConnected(); byte[] cmd = new byte[data.length + 2]; byte[] cmd = new byte[data.length + 2]; cmd[0] = (byte) 0xA2; cmd[0] = (byte) 0xA2; cmd[1] = (byte) pageIndex; cmd[1] = (byte) pageOffset; System.arraycopy(data, 0, cmd, 2, data.length); System.arraycopy(data, 0, cmd, 2, data.length); transceive(cmd, false); transceive(cmd, false); Loading
core/java/android/nfc/tech/NdefFormatable.java +6 −6 Original line number Original line Diff line number Diff line Loading @@ -85,13 +85,13 @@ public final class NdefFormatable extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * @param msg the NDEF message to write after formatting * @param firstMessage the NDEF message to write after formatting * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field * @throws IOException if there is an I/O failure, or the operation is canceled * @throws IOException if there is an I/O failure, or the operation is canceled * @throws FormatException if the NDEF Message to write is malformed * @throws FormatException if the NDEF Message to write is malformed */ */ public void format(NdefMessage msg) throws IOException, FormatException { public void format(NdefMessage firstMessage) throws IOException, FormatException { format(msg, false); format(firstMessage, false); } } /** /** Loading @@ -105,13 +105,13 @@ public final class NdefFormatable extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * @param msg the NDEF message to write after formatting * @param firstMessage the NDEF message to write after formatting * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field * @throws IOException if there is an I/O failure, or the operation is canceled * @throws IOException if there is an I/O failure, or the operation is canceled * @throws FormatException if the NDEF Message to write is malformed * @throws FormatException if the NDEF Message to write is malformed */ */ public void formatReadOnly(NdefMessage msg) throws IOException, FormatException { public void formatReadOnly(NdefMessage firstMessage) throws IOException, FormatException { format(msg, true); format(firstMessage, true); } } /*package*/ void format(NdefMessage firstMessage, boolean makeReadOnly) throws IOException, /*package*/ void format(NdefMessage firstMessage, boolean makeReadOnly) throws IOException, Loading