1

I'm trying to read data form a USB hand held barcode scanner using Javax package,and USB util in java. I'm able to detect the device,and able to read the barcode.

However the result is a byte array which is in below format. It is showing one number less than the original required in the 3rd byte array position. I suffixed the carriage return also. Its returning 40 for carriage return - instead of 13 (as per the ASCII Standard).

I'm using HOneywell Handheld scanner xenon 1900

Please let me know what the issues is?
For example, The required output is 20131503000140300 and the output received was

[0, 0, 31, 0, 0, 0, 0, 0]
[0, 0, 39, 0, 0, 0, 0, 0]
[0, 0, 30, 0, 0, 0, 0, 0]
[0, 0, 32, 0, 0, 0, 0, 0]
[0, 0, 30, 0, 0, 0, 0, 0]
[0, 0, 34, 0, 0, 0, 0, 0]
[0, 0, 39, 0, 0, 0, 0, 0]
[0, 0, 32, 0, 0, 0, 0, 0]
[0, 0, 39, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 39, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 39, 0, 0, 0, 0, 0]
[0, 0, 30, 0, 0, 0, 0, 0]
[0, 0, 33, 0, 0, 0, 0, 0]
[0, 0, 39, 0, 0, 0, 0, 0]
[0, 0, 32, 0, 0, 0, 0, 0]
[0, 0, 39, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 39, 0, 0, 0, 0, 0]
[0, 0, 40, 0, 0, 0, 0, 0]

Scanned

Sample code used

 while (running) {

     try {
              length = usbPipe.syncSubmit(buffer);
         } catch (UsbException uE) { }

         for (int i = 0; i < length; i++) {
              long scannedDigit = UsbUtil.unsignedLong(buffer[i]);
               System.out.print(".long." + scannedDigit);

            }
}
Siva Munipalli
  • 31
  • 1
  • 1
  • 5
  • So, what is the correct binary output so that we can see the difference? And the code you've specified matches the output provided. – Buhake Sindi Mar 24 '15 at 13:42
  • [0, 0, 32, 0, 0, 0, 0, 0] [0, 0, 40, 0, 0, 0, 0, 0] [0, 0, 31, 0, 0, 0, 0, 0] [0, 0, 33, 0, 0, 0, 0, 0] [0, 0, 31, 0, 0, 0, 0, 0] [0, 0, 35, 0, 0, 0, 0, 0] [0, 0, 40, 0, 0, 0, 0, 0] [0, 0, 33, 0, 0, 0, 0, 0] [0, 0, 40, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0, 0, 0] [0, 0, 40, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0, 0, 0] [0, 0, 40, 0, 0, 0, 0, 0] [0, 0, 31, 0, 0, 0, 0, 0] [0, 0, 34, 0, 0, 0, 0, 0] [0, 0, 40, 0, 0, 0, 0, 0] [0, 0, 33, 0, 0, 0, 0, 0] [0, 0, 40, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0, 0, 0] [0, 0, 40, 0, 0, 0, 0, 0] [0, 0, 13, 0, 0, 0, 0, 0] – Siva Munipalli Mar 25 '15 at 05:14
  • This is the output what we should get – Siva Munipalli Mar 25 '15 at 05:15
  • I expected you to amend your question. Besides, the code, does it produce the actual matrix you posted? – Buhake Sindi Mar 25 '15 at 16:09

0 Answers0