1 package de.dhbwloe.campusapp.nfcreader.MifareDESFire;
3 import android.util.Log;
5 import de.dhbwloe.campusapp.nfcreader.Hex;
8 * Created by stefan on 22.01.16.
10 public class ValueFileSettings extends FileSettings {
11 private int lowerLimit;
12 private int upperLimit;
13 private int limitedCreditValue;
14 private boolean limitedCreditEnabled;
16 public ValueFileSettings(String fileType, String communicationSettings, String accessRights, int lowerLimit, int upperLimit, int limitedCreditValue, boolean limitedCreditEnabled) {
17 super(fileType, communicationSettings, accessRights);
18 this.lowerLimit = lowerLimit;
19 this.upperLimit = upperLimit;
20 this.limitedCreditValue = limitedCreditValue;
21 this.limitedCreditEnabled = limitedCreditEnabled;
24 public static ValueFileSettings createByRawData(Byte[] rawData) {
25 String fileType = Hex.hexToString(Hex.subByteArray(0, 1, rawData));
26 String communicationSettings = Hex.hexToString(Hex.subByteArray(1, 2, rawData));
27 String accessRights = Hex.hexToString(Hex.reverseByteOrder(Hex.subByteArray(2,4, rawData)));
28 int lowerLimit = Hex.hexToInteger(Hex.reverseByteOrder(Hex.subByteArray(4, 8, rawData)));
29 int upperLimit = Hex.hexToInteger(Hex.reverseByteOrder(Hex.subByteArray(8,12, rawData)));
30 int limitedCreditValue = Hex.hexToInteger(Hex.reverseByteOrder(Hex.subByteArray(12,16, rawData)));
32 boolean limitedCreditEnabled = true;
34 return new ValueFileSettings(fileType, communicationSettings, accessRights, lowerLimit, upperLimit, limitedCreditValue, limitedCreditEnabled);
39 * Returns the lower limit of the value
42 public int getLowerLimit() {
48 * Returns the upper limit of the value
51 public int getUpperLimit() {
57 * Returns the limited credit value
58 * @return Limited credit value
60 public int getLimitedCreditValue() {
61 return limitedCreditValue;
66 * Returns if the limited credit feature is enabled on this value file
67 * DO NOT USE AT THE MOMENT!
68 * @return Is limited credit enabled?
70 public boolean getLimitedCreditEnabled() {
71 Log.e("ValueFileSettings", "Method not implemented, result is not valid");
72 return limitedCreditEnabled;