Closed prlwtz closed 3 years ago
Hello prlwtz!
I fixed the compilation problem. Please test and report.
Soon, I will study the SGCN specification and implement it
Hi José,
I replaced the whole 'org' source folder in my project and it compiled without any issues. Thanks.
With regards to SGCN, I don't have an immediate need for it at the moment, I just noticed the missing APIs while implementing the library into my RFID parser.
With regards to that parsing, I now have an iterating loop trying parse through the various objects.
private enum EPC {
SGTIN,
SSCC,
SGLN,
GRAI,
GIAI,
GSRN,
GSRNP,
GDTI,
CPI
};
String data = "";
for (int i = 0 ; i<EPC.values().length && data.length()==0 ; i++) {
EPC epc = EPC.values()[i];
switch (epc) {
case SGTIN:
// SGTIN - Serialized Global Trade Item Number
// urn:epc:id:sgtin:CompanyPrefix.ItemRefAndIndicator.SerialNumber
try {
ParseSGTIN parseSGTIN = ParseSGTIN.Builder().withRFIDTag(hex_data).build();
SGTIN sgtin = parseSGTIN.getSGTIN();
data = sgtin.getEpcPureIdentityURI();
} catch (Exception parse_e) {
}
break;
case SSCC:
// SSCC - Serial Shipping Container Code
// urn:epc:id:sscc:CompanyPrefix.SerialReference
try {
ParseSSCC parseSSCC = ParseSSCC.Builder().withRFIDTag(hex_data).build();
SSCC sscc = parseSSCC.getSSCC();
data = sscc.getEpcPureIdentityURI();
} catch (Exception parse_e) {
}
break;
etc etc
Is there an better way of simply parsing the hex data and just get an object with the appropriate contents? Or is this just the way it currently is?
Kind regards, Eize
I'm glad it worked.
There is no other way to parse hexadecimal data. Each class is specific to resolve certain hexadecimal. Your loop is perfect and I don't see any other way.
The readme claims support for SGCN - Serialized Global Coupon Number but these classes seem missing from the source (0.0.8) ?
Also, when recompiling the source, it seems missing the EPCParseException exception class. I created the following locally. I don't know if there was more to it?
Also, there were a few compile issues due to the lack of some "throws Exception" declarations at some parse/Builder declarations.