Skip to content

Commit

Permalink
add GSRN-P implementation and fix SGTIN
Browse files Browse the repository at this point in the history
  • Loading branch information
jlcout committed Dec 6, 2020
1 parent aab073a commit 2a1aa84
Show file tree
Hide file tree
Showing 11 changed files with 504 additions and 24 deletions.
2 changes: 1 addition & 1 deletion epctagcoder/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.epctagcoder</groupId>
<artifactId>epctagcoder</artifactId>
<version>0.0.6-SNAPSHOT</version>
<version>0.0.7-SNAPSHOT</version>
<packaging>jar</packaging>

<name>epctagcoder</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package org.epctagcoder.option.GSRNP;

import java.util.LinkedHashMap;
import java.util.Map;

public enum GSRNPFilterValue {
ALL_OTHERS_0(0),
RESERVED_1(1),
RESERVED_2(2),
RESERVED_3(3),
RESERVED_4(4),
RESERVED_5(5),
RESERVED_6(6),
RESERVED_7(7);

private int value;

private GSRNPFilterValue(int value) {
this.value = value;
}

public int getValue() {
return value;
}

private static final Map<Integer, GSRNPFilterValue> BY_CODE_MAP = new LinkedHashMap<>();
static {
for (GSRNPFilterValue rae : GSRNPFilterValue.values()) {
BY_CODE_MAP.put(rae.value, rae);
}
}

public static GSRNPFilterValue forCode(int code) {
return BY_CODE_MAP.get(code);
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.epctagcoder.option.GSRNP;

import java.util.LinkedHashMap;
import java.util.Map;

public enum GSRNPHeader {
HEADER_00101110("00101110") {
public Integer getTagSize() {
return 96;
}
};

private String value;
public abstract Integer getTagSize();


private GSRNPHeader(String value) {
this.value = value;
}

public String getValue() {
return value;
}

private static final Map<String, GSRNPHeader> BY_CODE_MAP = new LinkedHashMap<>();
static {
for (GSRNPHeader rae : GSRNPHeader.values()) {
BY_CODE_MAP.put(rae.value, rae);
}
}

public static GSRNPHeader forCode(String code) {
return BY_CODE_MAP.get(code);
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.epctagcoder.option.GSRNP;

import java.util.LinkedHashMap;
import java.util.Map;

public enum GSRNPTagSize {
BITS_96(96) {
public Integer getHeader() {
return 46;
}
};

private int value;
public abstract Integer getHeader();

private GSRNPTagSize(int value) {
this.value = value;
}

public int getValue() {
return value;
}

private static final Map<Integer, GSRNPTagSize> BY_CODE_MAP = new LinkedHashMap<>();
static {
for (GSRNPTagSize rae : GSRNPTagSize.values()) {
BY_CODE_MAP.put(rae.value, rae);
}
}

public static GSRNPTagSize forCode(int code) {
return BY_CODE_MAP.get(code);
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package org.epctagcoder.option.GSRNP.partitionTable;

import java.util.ArrayList;
import java.util.List;

import org.epctagcoder.option.TableItem;


public class GSRNPPartitionTableList {
static final private List<TableItem> list = new ArrayList<TableItem>();

static {
list.add( new TableItem(0, 40, 12, 18, 5) );
list.add( new TableItem(1, 37, 11, 21, 6) );
list.add( new TableItem(2, 34, 10, 24, 7) );
list.add( new TableItem(3, 30, 9, 28, 8) );
list.add( new TableItem(4, 27, 8, 31, 9) );
list.add( new TableItem(5, 24, 7, 34, 10) );
list.add( new TableItem(6, 20, 6, 38, 11) );
}

public GSRNPPartitionTableList() {

}

public TableItem getPartitionByL(Integer index) {
TableItem tableItem = null;
for (TableItem item : list) {
if (item.getL()==index) {
tableItem = item;
break;
}
}
return tableItem;
}

public TableItem getPartitionByValue(Integer index) {
TableItem tableItem = null;
for (TableItem item : list) {
if (item.getPartitionValue()==index) {
tableItem = item;
break;
}
}
return tableItem;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ public TableItem getPartitionByL(Integer index) {
}

public TableItem getPartitionByValue(Integer index) {
TableItem tableItem = null;
for (TableItem item : list) {
if (item.getPartitionValue()==index) {
tableItem = item;
break;
}
}
return tableItem;
// TableItem tableItem = null;
return list.get(index);
// for (TableItem item : list) {
// if (item.getPartitionValue()==index) {
// tableItem = item;
// break;
// }
// }
// return tableItem;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public static interface componentPartReferenceStep {
}

public static interface serialStep {
TagSizeStep withserial(String serial);
TagSizeStep withSerial(String serial);
}

public static interface TagSizeStep {
Expand Down Expand Up @@ -322,7 +322,7 @@ public FilterValueStep withTagSize(CPITagSize tagSize) {
}

@Override
public TagSizeStep withserial(String serial) {
public TagSizeStep withSerial(String serial) {
this.serial = serial;
return this;
}
Expand Down
Loading

0 comments on commit 2a1aa84

Please sign in to comment.