Package org.nfctools.spi.acs

Examples of org.nfctools.spi.acs.AcrMfClassicReaderWriter


  @Override
  public void handleTag(Tag tag) {
    MemoryLayout memoryLayout = tag.getTagType().equals(TagType.MIFARE_CLASSIC_1K) ? MemoryLayout.CLASSIC_1K
        : MemoryLayout.CLASSIC_4K;
    MfClassicReaderWriter readerWriter = new AcrMfClassicReaderWriter((ApduTag)tag, memoryLayout);
    try {
      doWithReaderWriter(readerWriter);
    }
    catch (IOException e) {
      log.error(e.getLocalizedMessage(), e);
View Full Code Here


  }

  protected MfClassicNdefOperations createNdefOperations(ApduTag tag, MemoryLayout memoryLayout) {
    boolean formatted = false;
    boolean writable = false;
    MfClassicReaderWriter readerWriter = new AcrMfClassicReaderWriter(tag, memoryLayout);
    TagInfo tagInfo = null;
    try {
      tagInfo = readerWriter.getTagInfo();
      if (readerWriter.hasApplicationDirectory()) {
        ApplicationDirectory applicationDirectory = readerWriter.getApplicationDirectory();
        if (applicationDirectory.hasApplication(MfConstants.NDEF_APP_ID)) {
          formatted = true;
          Application application = applicationDirectory.openApplication(MfConstants.NDEF_APP_ID);
          writable = ClassicHandler.isFormattedWritable(application, MfClassicConstants.NDEF_KEY);
        }
View Full Code Here

  public static AcrMfClassicReaderWriter createReadWriter(String fileName, MemoryLayout memoryLayout)
      throws IOException {
    MemoryMap memoryMap = FileMfClassicReader.loadCardFromFile(fileName);
    InMemoryTag tag = new InMemoryTag(memoryMap);
    AcrMfClassicReaderWriter readerWriter = new AcrMfClassicReaderWriter(tag, memoryLayout);
    return readerWriter;
  }
View Full Code Here

  protected MfClassicReaderWriter loadData(String fileName) {
    try {
      MemoryMap memoryMap = FileMfClassicReader.loadCardFromFile(fileName);
      InMemoryTag tag = new InMemoryTag(memoryMap);

      AcrMfClassicReaderWriter mfClassicReaderWriter = new AcrMfClassicReaderWriter(tag, memoryLayout);
      return mfClassicReaderWriter;
    }
    catch (IOException e) {
      throw new RuntimeException(e);
    }
View Full Code Here

      new Config("mfstd4k_formatted.txt", MemoryLayout.CLASSIC_4K, true, true, "mfstd4k_formatted_readonly.txt") };

  private void init(Config config) throws IOException {
    MemoryMap memoryMap = FileMfClassicReader.loadCardFromFile(config.fileName);
    tag = new InMemoryTag(memoryMap);
    readerWriter = new AcrMfClassicReaderWriter(tag, config.memoryLayout);
    ndefOperations = new MfClassicNdefOperations(readerWriter, readerWriter.getTagInfo(), config.formatted,
        config.writeable);
    if (config.expected != null && config.expected.startsWith("mfstd")) {
      expectedTag = new InMemoryTag(FileMfClassicReader.loadCardFromFile(config.expected));
    }
View Full Code Here

TOP

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

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.