Converting raw data to human legible string

// Expert user has replied.
r roberto cottone 2 years 3 months ago
260 3 0

Zebra newbie here. I got the Linux SDK going with an MS4717 scanner, and working to adapt the console-app sample code to 1) enable the scanner, 2) capture a barcode (various flavors, e.g. UPC-A, GS1 Databar…) and then 3) disable the scanner until it's needed again.

Using OnBarcodeEvent, scanner output arrives as rawdata including a datalabel, and datatype. According to the SDK developer's guide , the latter (datatype) indicates the barcode type and that it correlates to a SNAPI or IBM Hand-held communication protocol.

I can’t figure out or find a reference on where, and/or how, to apply the communication protocol in order to process the raw data and produce the human legible value contained in the barcode.

Looks like OnBinaryEvent might have that transformation within, and could be another option, but I've not come across an example on how to use it in the sample code.

Bottom line, how do I convert raw data into a human legible string and/or is there a better way I ought to consider?

Thanks for the help. Hard to believe how much time I've spent on this already...

Luis

Please Register or Login to post a reply

3 Replies

R Riad Benallou

Hi Luis ,
Data type is basically barcode type .
Check full table starting from page 40 in following manual
https://www.zebra.com/content/dam/zebra_new_ia/en-us/manuals/software/s…

Data label is your decoded barcode content in hex format which you can convert into ascii .

Best regards
Riad

L Luis Melendez

Got it. Somehow had not come across anything that explains the data label is the decoded barcode in hex. Good to know. Thanks, Riad.

C Corneliu Zabolotnic

<datatype>11</datatype>
<datalabel>0x35 0x39 0x30 0x33 0x39 0x30 0x30 0x39 0x36 0x34 0x30 0x35 0x30</datalabel>
<rawdata>0x12 0x10 0x03 0x00 0x05 0x09 0x00 0x03 0x09 0x00 0x00 0x09 0x06 0x04 0x00 0x05 0x00 0x16</rawdata>

<datatype>3</datatype>
<datalabel>0x53 0x58 0x55 0x41 0x48 0x32 0x30 0x30 0x30 0x31</datalabel>
<rawdata>0x11 0x10 0x03 0x00 0x53 0x58 0x55 0x41 0x48 0x32 0x30 0x30 0x30 0x31 0x00 0x18 0x0B</rawdata>

 

This is 2 simple exemples of different types of codes, one code128 and other ean13. How can I know from the raw data which bytes correspond to the data type? Because from the 5th byte is the barcode data, but in some datatypes, you have to convert as simple decimal but in code128 you have to convert to ascii. How can we know wich bytes represent the datatypes?

CONTACT
Can’t find what you’re looking for?