Code128, GS1-128, human readable interpretation (HRI), brackets, FNC1

Feb 2, 2015 at 2:08 PM
Edited Feb 2, 2015 at 2:26 PM
Hello everyone,

I am trying to incorporate the library into a test project that decodes 1D barcodes. The standard I am using is GS1 and Code_128.

Everything works as expected (good work) but there is something I want to add.
In code128 there is a format called the human readable interpretation (HRI). The HRI puts application identifiers into brackets for better readability.

Let's assume we have a bitmap b1 that contains a barcode, a string s1 that holds the scan results of b1 and a string h1 that holds the human readable interpretation of b1.

What I get is:
s1 = 10L5652117009300005010 ;

This is pretty good. However, the human readable interpretation (what I want) is :
h1 = (10)L565211700(93)00005010 ;

Explanation:
GS1-128 always starts with an application code followed by a data part. The "10" in the beginning indicates the application code "batch/lot number". It is put into brackets. The code 128 standard describes that this code is followed by up to 20 characters so it has a variable length up to 20. A FNC1 code in b1 terminates this application code and starts a new application code "93" that stands for "company internal information" and is followed by the rest. The application code "93" is put into brackets too.

The problem now is that s1 does not contain the information b1 has had. The FNC1 code is lost in s1. With s1 only there is no way to tell that the data part of application code "10" has to terminate after only 10 characters. I cannot get to h1.

My question is:
How do I get from b1 to h1? Is there something in the library that could give me something like
s1' = 10L565211700<FNC1>9300005010 or even directly h2?

What do I have to do to get all the lost metadata in s1 so I can display h1?

EDIT: Here is a pic containing the barcode. Image
Coordinator
Feb 2, 2015 at 9:11 PM
First you have to set the following decoding hint: DecodeHintType.ASSUME_GS1
The FNC1 at the very first position will be returned as "]C1".
All others can be found as ascii 29 within the result string.
Feb 3, 2015 at 9:53 AM
Edited Feb 3, 2015 at 9:55 AM
Thank you for the fast reply!

ASCI29 is a group seperator (GS) = "^]". I assume with the DecodeHintType.ASSUME_GS1 the result string will look like this:

"]C110L565211700^]9300005010" . Is this correct?

Have a nice day.
Coordinator
Feb 3, 2015 at 7:25 PM
It's not fully correct. If you put the result string in a text box or visualize the string in the debugger you won't see the group separator as "^]".
In most cases it should be invisible. But you can check for the GS if you iterate over the characters for example.
Feb 4, 2015 at 7:25 AM
Iterating over the characters is a good idea.

Thanks.
Feb 28, 2015 at 3:09 AM
Hi griaffeboy/micjahn,

Have you tried decoding GS1 128 barcode from Windows phone 8.1.

We are looking for solution if not with Zxing.net but if we have service in Zxing.org which can be accessed online and convert GS1 128 barcode. The code we followed was the sample code given for Zxing.net library.

Please help!!
Coordinator
Mar 5, 2015 at 7:29 PM
Not sure what you exactly mean.
As I wrote above: use the decoding hint DecodeHintType.ASSUME_GS1 and you will find the special characters for the FNC1 of an GS1 barcode
inside the result string.
Mar 12, 2015 at 12:53 PM
Edited Mar 12, 2015 at 12:58 PM
Hello,

I just wanted to confirm that it works perfectly! Assuming that Reader is a BarcodeReader the following code makes it decode correctly.
var newhint = new System.Collections.Generic.KeyValuePair<DecodeHintType,object>(DecodeHintType.ASSUME_GS1, new Object());
_reader.Options.Hints.Add(newhint);
Later in the program i see the results:
var result = _reader.Decode(_luminance);
byte[] utfbytes= Encoding.UTF8.GetBytes(result.Text);
In this array I find the FNC1 at both positions. At the the beginning and before the "93".

Excellent!

May I ask why the DecodingHintTypes are KeyValuePairs with generic type <DecodeHintType,object>? Why Object?


Thank you very much.
Coordinator
Mar 12, 2015 at 4:38 PM
Thanks for you feedback.

The different DecodeHintType can have values with different types, f.e. CHARACTER_SET uses a string value like "UTF-8" or "ISO8859-1", NEED_RESULT_POINT_CALLBACK uses a delegate of ResultPointCallback and so on.
I wrote a wrapper class DecodingOptions which provides strongly typed properties for most of the DecodeHintType.
ASSUME_GS1 is missing. I will add it in the next version.