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);
}
}