1 package de.dhbwloe.campusapp.nfcreader.MifareDESFire;
3 import java.io.ByteArrayInputStream;
5 import de.dhbwloe.campusapp.nfcreader.Hex;
8 * Created by pk910 on 27.01.2016.
10 public class DesfireManufacturingData {
11 public final int hwVendorID;
12 public final int hwType;
13 public final int hwSubType;
14 public final int hwMajorVersion;
15 public final int hwMinorVersion;
16 public final int hwStorageSize;
17 public final int hwProtocol;
19 public final int swVendorID;
20 public final int swType;
21 public final int swSubType;
22 public final int swMajorVersion;
23 public final int swMinorVersion;
24 public final int swStorageSize;
25 public final int swProtocol;
28 public final int batchNo;
29 public final int weekProd;
30 public final int yearProd;
32 public DesfireManufacturingData (byte[] data) {
33 ByteArrayInputStream stream = new ByteArrayInputStream(data);
34 hwVendorID = stream.read();
35 hwType = stream.read();
36 hwSubType = stream.read();
37 hwMajorVersion = stream.read();
38 hwMinorVersion = stream.read();
39 hwStorageSize = stream.read();
40 hwProtocol = stream.read();
42 swVendorID = stream.read();
43 swType = stream.read();
44 swSubType = stream.read();
45 swMajorVersion = stream.read();
46 swMinorVersion = stream.read();
47 swStorageSize = stream.read();
48 swProtocol = stream.read();
50 // FIXME: This has fewer digits than what's contained in EXTRA_ID, why?
51 byte[] buf = new byte[7];
52 stream.read(buf, 0, buf.length);
53 uid = Hex.byteArrayToInt(buf);
55 // FIXME: This is returning a negative number. Probably is unsigned.
57 stream.read(buf, 0, buf.length);
58 batchNo = Hex.byteArrayToInt(buf);
60 // FIXME: These numbers aren't making sense.
61 weekProd = stream.read();
62 yearProd = stream.read();