Click here to Skip to main content
15,909,437 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all ,

I need to know if there is any way we can parse byte array from any bar code scanner in hid mode to a string in c# .

when the bar code is in hid mode , we will be receiving raw input from the device which we need to parse manually but if the device is in keyboard mode we can directly write data to cursor . but i want to use hid mode but at the same time i need to parse byte array.

is there generic way of doing this regardless of which scanner i plug in.


Thanks in advance .

What I have tried:

currently i am parsing the byte array based on scanner , but now there is a need write this independent of which scanner i plug in .
Posted
Updated 10-Jun-18 21:53pm

1 solution

A scanner in HID (Human Interface Device) mode doesn't generate a "byte array" - it pretends to be a keyboard and sends the data as if it was typed on a "genuine" QWERTY device: Key Down, Key Up; Key Down, Key Up; ... and you cannot tell if the data your app receives came from a "real" keyboard or a scanner, because the system does not record the source device anywhere with the actual data - all you get is "a key went down", "a key went up", "a key was pressed".

If you want to detect scanner input in HID mode then y67ou need to configure the scanner to provide a leading and trailing sequence which identifies the data as "scan start" "data" "scan end" and look for those sequences in your code. Most scanners can be configured for this, but exactly how depends on the scanner itself - consult your manual or the manufacturer for details.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900