Implementata lettura barcode in Accettazione
This commit is contained in:
1
barcode_base_library/.gitignore
vendored
Normal file
1
barcode_base_library/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
8
barcode_base_library/build.gradle
Normal file
8
barcode_base_library/build.gradle
Normal file
@@ -0,0 +1,8 @@
|
||||
apply plugin: 'java-library'
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
}
|
||||
|
||||
sourceCompatibility = "7"
|
||||
targetCompatibility = "7"
|
||||
@@ -0,0 +1,9 @@
|
||||
package it.integry.plugins.barcode_base_library.exception;
|
||||
|
||||
public class BarcodeAdapterNotFoundException extends Exception {
|
||||
|
||||
public BarcodeAdapterNotFoundException(String adapterName) {
|
||||
super("L'adapter " + adapterName + " non è stato rilevato sul dispositivo corrente");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package it.integry.plugins.barcode_base_library.extension;
|
||||
|
||||
public interface RunnableArgs<T> {
|
||||
|
||||
void run(T data);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package it.integry.plugins.barcode_base_library.interfaces;
|
||||
|
||||
import it.integry.plugins.barcode_base_library.extension.RunnableArgs;
|
||||
import it.integry.plugins.barcode_base_library.exception.BarcodeAdapterNotFoundException;
|
||||
import it.integry.plugins.barcode_base_library.model.BarcodeScanDTO;
|
||||
|
||||
public interface BarcodeReaderInterface {
|
||||
|
||||
boolean isRightAdapter();
|
||||
|
||||
void init() throws BarcodeAdapterNotFoundException;
|
||||
|
||||
void register(RunnableArgs<BarcodeScanDTO> onScanSuccessfull, RunnableArgs<Exception> onScanFailed);
|
||||
|
||||
String getAdapterName();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package it.integry.plugins.barcode_base_library.model;
|
||||
|
||||
public class BarcodeScanDTO {
|
||||
|
||||
private BarcodeType type;
|
||||
private String stringValue;
|
||||
private byte[] byteValue;
|
||||
private String name;
|
||||
private int decodingTime;
|
||||
|
||||
public BarcodeType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public BarcodeScanDTO setType(BarcodeType type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getStringValue() {
|
||||
return stringValue;
|
||||
}
|
||||
|
||||
public BarcodeScanDTO setStringValue(String stringValue) {
|
||||
this.stringValue = stringValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
public byte[] getByteValue() {
|
||||
return byteValue;
|
||||
}
|
||||
|
||||
public BarcodeScanDTO setByteValue(byte[] byteValue) {
|
||||
this.byteValue = byteValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public BarcodeScanDTO setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getDecodingTime() {
|
||||
return decodingTime;
|
||||
}
|
||||
|
||||
public BarcodeScanDTO setDecodingTime(int decodingTime) {
|
||||
this.decodingTime = decodingTime;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package it.integry.plugins.barcode_base_library.model;
|
||||
|
||||
public enum BarcodeType {
|
||||
|
||||
NIL(0),
|
||||
AIRLINE_2OF5_13_DIGIT(1),
|
||||
AIRLINE_2OF5_15_DIGIT(2),
|
||||
AZTEC(3),
|
||||
AUSTRALIAN_POSTAL(4),
|
||||
BOOKLAND_EAN(5),
|
||||
BPO(6),
|
||||
CANPOST(7),
|
||||
CHINAPOST(8),
|
||||
CHINESE_2OF5(9),
|
||||
CODABAR(10),
|
||||
CODABLOCK(11),
|
||||
CODE11(12),
|
||||
CODE128(13),
|
||||
CODE16K(14),
|
||||
CODE32(15),
|
||||
CODE39(16),
|
||||
CODE49(17),
|
||||
CODE93(18),
|
||||
COMPOSITE(19),
|
||||
COUPON_CODE(20),
|
||||
DATAMATRIX(21),
|
||||
DISCRETE_2OF5(22),
|
||||
DUTCH_POSTAL(23),
|
||||
EAN128(24),
|
||||
EAN13(25),
|
||||
EAN8(26),
|
||||
GS1_DATABAR_14(27),
|
||||
GS1_DATABAR_EXPANDED(28),
|
||||
GS1_DATABAR_LIMITED(29),
|
||||
HONGKONG_2OF5(30),
|
||||
IATA_2OF5(31),
|
||||
IDTAG(32),
|
||||
INTERLEAVED_2OF5(33),
|
||||
ISBT128(34),
|
||||
JAPANESE_POSTAL(35),
|
||||
KOREAN_POSTAL(36),
|
||||
MATRIX_2OF5(37),
|
||||
MAXICODE(38),
|
||||
MESA(39),
|
||||
MICRO_PDF417(40),
|
||||
MICRO_QR(41),
|
||||
MSI(42),
|
||||
NEC_2OF5(43),
|
||||
OCR(44),
|
||||
PDF417(45),
|
||||
PLESSEY(46),
|
||||
POSICODE(47),
|
||||
POST_US4(48),
|
||||
QR(49),
|
||||
STRAIGHT_2OF5(50),
|
||||
STANDARD_2OF5(51),
|
||||
TELEPEN(52),
|
||||
TLCODE39(53),
|
||||
TRIOPTIC(54),
|
||||
UK_POSTAL(55),
|
||||
UPCA(56),
|
||||
UPCE(57),
|
||||
UPCE1(58),
|
||||
US_PLANET(59),
|
||||
US_POSTNET(60),
|
||||
USPS_4CB(61),
|
||||
RSS(62),
|
||||
LABEL(63),
|
||||
HANXIN(64),
|
||||
GRIDMATRIX(65),
|
||||
INFO_MAIL(66),
|
||||
INTELLIGENT_MAIL(67),
|
||||
SWEDENPOST(68),
|
||||
LAST(69);
|
||||
|
||||
private Integer text;
|
||||
BarcodeType(Integer text) {
|
||||
this.text = text;
|
||||
}
|
||||
public Integer getValue() {
|
||||
return this.text;
|
||||
}
|
||||
|
||||
public static BarcodeType fromInt(Integer text) {
|
||||
for (BarcodeType b : BarcodeType.values()) {
|
||||
if (b.text.equals(text)) return b;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user