Examples of canWriteDataBlock()


Examples of org.nfctools.mf.block.TrailerBlock.canWriteDataBlock()

  public static boolean isFormattedWritable(Application application, KeyValue keyValue) throws IOException {
    try {
      TrailerBlock trailerBlock = application.readTrailer(keyValue);
      for (int dataArea = 0; dataArea < 3; dataArea++) {
        if (!trailerBlock.canWriteDataBlock(keyValue.getKey(), dataArea))
          return false;
      }
      if (NfcUtils.getLeastSignificantNibble(trailerBlock.getGeneralPurposeByte()) != 0)
        return false;
      return true;
View Full Code Here

Examples of org.nfctools.mf.block.TrailerBlock.canWriteDataBlock()

    int dataArea = (int)(mfAccess.getCard().getBlocksPerSector(mfAccess.getSector()) > 3 ? Math
        .floor((double)mfAccess.getCard().getBlocksPerSector(mfAccess.getSector()) / 5.0) : blockId);

    if ((blockId == trailerBlockId && !trailerBlock.canWriteTrailerBlock(mfAccess.getKey()))
        || (blockId != trailerBlockId && !trailerBlock.canWriteDataBlock(mfAccess.getKey(), dataArea))) {
      throw new MfLoginException("Write Access Denied. Sector: " + mfAccess.getSector() + ", Block: " + blockId
          + " Key: " + mfAccess.getKey().name());

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.