--- /dev/null
+package de.dhbwloe.campusapp.nfcreader.MifareDESFire;
+
+import android.util.Log;
+
+import de.dhbwloe.campusapp.nfcreader.Hex;
+
+/**
+ * Created by stefan on 22.01.16.
+ */
+public class ValueFileSettings extends FileSettings {
+ private int lowerLimit;
+ private int upperLimit;
+ private int limitedCreditValue;
+ private boolean limitedCreditEnabled;
+
+ public ValueFileSettings(String fileType, String communicationSettings, String accessRights, int lowerLimit, int upperLimit, int limitedCreditValue, boolean limitedCreditEnabled) {
+ super(fileType, communicationSettings, accessRights);
+ this.lowerLimit = lowerLimit;
+ this.upperLimit = upperLimit;
+ this.limitedCreditValue = limitedCreditValue;
+ this.limitedCreditEnabled = limitedCreditEnabled;
+ }
+
+ public static ValueFileSettings createByRawData(Byte[] rawData) {
+ String fileType = Hex.hexToString(Hex.subByteArray(0, 1, rawData));
+ String communicationSettings = Hex.hexToString(Hex.subByteArray(1, 2, rawData));
+ String accessRights = Hex.hexToString(Hex.reverseByteOrder(Hex.subByteArray(2,4, rawData)));
+ int lowerLimit = Hex.hexToInteger(Hex.reverseByteOrder(Hex.subByteArray(4, 8, rawData)));
+ int upperLimit = Hex.hexToInteger(Hex.reverseByteOrder(Hex.subByteArray(8,12, rawData)));
+ int limitedCreditValue = Hex.hexToInteger(Hex.reverseByteOrder(Hex.subByteArray(12,16, rawData)));
+ //TODO: Fix this
+ boolean limitedCreditEnabled = true;
+
+ return new ValueFileSettings(fileType, communicationSettings, accessRights, lowerLimit, upperLimit, limitedCreditValue, limitedCreditEnabled);
+ }
+
+
+ /**
+ * Returns the lower limit of the value
+ * @return Lower limit
+ */
+ public int getLowerLimit() {
+ return lowerLimit;
+ }
+
+
+ /**
+ * Returns the upper limit of the value
+ * @return Upper limit
+ */
+ public int getUpperLimit() {
+ return upperLimit;
+ }
+
+
+ /**
+ * Returns the limited credit value
+ * @return Limited credit value
+ */
+ public int getLimitedCreditValue() {
+ return limitedCreditValue;
+ }
+
+
+ /**
+ * Returns if the limited credit feature is enabled on this value file
+ * DO NOT USE AT THE MOMENT!
+ * @return Is limited credit enabled?
+ */
+ public boolean getLimitedCreditEnabled() {
+ Log.e("ValueFileSettings", "Method not implemented, result is not valid");
+ return limitedCreditEnabled;
+ }
+}