Package org.nfctools.spi.acs

Examples of org.nfctools.spi.acs.AcrMfUlReaderWriter


public class TagInputStreamTest {

  @Test
  public void testAvailable() throws Exception {
    InMemoryTag tag = new InMemoryTag(FileMfUlReader.loadCardFromFile("mful_formatted.txt"));
    MfUlReaderWriter readerWriter = new AcrMfUlReaderWriter(tag);

    TagInputStream in = new TagInputStream(MemoryLayout.ULTRALIGHT, readerWriter);

    for (int x = 0; x < 48; x++) {
      assertEquals(48 - x, in.available());
View Full Code Here


      new Config("mfulc_formatted.txt", MemoryLayout.ULTRALIGHT_C, true, true, null) };

  private void init(Config config) {
    try {
      tag = new InMemoryTag(FileMfUlReader.loadCardFromFile(config.fileName));
      readerWriter = new AcrMfUlReaderWriter(tag);
      ndefOperations = new Type2NdefOperations(config.memoryLayout, readerWriter, readerWriter.getTagInfo(),
          config.formatted, config.writeable);
      if (config.expectedFileName != null)
        expectedTag = new InMemoryTag(FileMfUlReader.loadCardFromFile(config.expectedFileName));
    }
View Full Code Here

  }

  public static Type2NdefOperations getType2BlankTag(String fileName, boolean formatted, boolean writable) {
    try {
      InMemoryTag tag = new InMemoryTag(FileMfUlReader.loadCardFromFile(fileName));
      AcrMfUlReaderWriter readerWriter = new AcrMfUlReaderWriter(tag);
      return new Type2NdefOperations(fileName.startsWith("mful_") ? MemoryLayout.ULTRALIGHT
          : MemoryLayout.ULTRALIGHT_C, readerWriter, readerWriter.getTagInfo(), formatted, writable);
    }
    catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

    if (ndefListener != null)
      ndefListener.onNdefOperations(ndefOperations);
  }

  protected Type2NdefOperations createNdefOperations(ApduTag tag) {
    MfUlReaderWriter readerWriter = new AcrMfUlReaderWriter(tag);
    MemoryLayout memoryLayout = null;
    boolean formatted = false;
    boolean writable = false;
    TagInfo tagInfo = null;
    try {
      tagInfo = readerWriter.getTagInfo();
      MfBlock[] initBlocks = readerWriter.readBlock(0, 5);
      CapabilityBlock capabilityBlock = new CapabilityBlock(initBlocks[3].getData());
      if (UltralightHandler.isBlank(initBlocks)) {
        if (UltralightHandler.isUltralight(initBlocks[4].getData())) {
          memoryLayout = MemoryLayout.ULTRALIGHT;
        }
View Full Code Here

TOP

Related Classes of org.nfctools.spi.acs.AcrMfUlReaderWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.