Page 1 of 2

PB & Barcode Scanners

Posted: Fri Feb 13, 2009 8:32 pm
by Xombie
Has anyone worked with barcode scanners using PB? Can y'all recommend a library and scanner to use? I don't need anything complex and a hand held would work just fine. I believe the target computer will have a serial port but I'm not 100% certain.

Thanks!

Posted: Fri Feb 13, 2009 8:57 pm
by ricardo
As far as i know, Barcode scanner acts like a keyborad. PB will not know if its a barcode scanner or a keyboard (which is fine, its easy to use it. In practical uses, using tha barcode scanner will be the same for PB as is the user uses the keyboard to insert the prices on the gadgdet).

Also there are some PB libs on PureArea.Net that let some manage of barcode stuff.

Posted: Fri Feb 13, 2009 9:25 pm
by ColBoy
Some scanners like the Symbol LS2208 allow you to drive the scanner in a virtual serial mode. i.e. it converts the USB scanner to a serial scanner, where you can grab the barcode from the configured serial port. Otherwise text wedge mode is the same as typing the characters in yourself. Bare in mind, that the edit control will need focus, otherwise the barcode scanned will just vanish into the ether. All fairly painless with PureBasic.

Colin

Posted: Sat Feb 14, 2009 5:12 pm
by Rook Zimbabwe
The cheaper scanners only have 1 mode. USB scanners can mostly emulate the keyboard or a serial port. Older scanners used to have a keyboard passthrough plug setup. I don't see this as much nowadays.

The best thing to do would be to insist that the user use a USB scanner with keyboard emulation that can read the 3of9 barcodes.

Start and end each barcode with the "*" character in barcode format.

Viola you are managing inventory!

Posted: Wed Feb 18, 2009 12:24 am
by Xombie
Thanks - y'all were right. It treats it just as a keyboard type thing and sends as text + crlf. That works out well. Although, it'd be nicer if it distinguished in some way different than a keyboard so I could trap it better.

Posted: Wed Feb 18, 2009 8:48 am
by alokdube
it really should not matter, I mean why do you need to check the source of the input?
there are IP enabled barcode scanners too by the way...

Posted: Wed Feb 18, 2009 8:36 pm
by ColBoy
alokdube wrote:it really should not matter, I mean why do you need to check the source of the input?
there are IP enabled bar code scanners too by the way...
You might want to do this, when backtracking to determine whether the bar code was really scanned (accurate) or the user typed it in (liable to mistakes).

You can simulate this by using a different suffix character. It the user presses the bar code, then Enter, then it was keyboard entered, if it was scanned with say a tab as the suffix then it was scanned by scanner. It's never infallible though.

Colin

Posted: Wed Feb 18, 2009 9:07 pm
by ricardo
You may direct the barcode scanner to a gadget that is not visible, so nobody can type it there manually.
For manual usage use another gadget, so its easy to know which one was used.

Just one idea, never test it myself.

Posted: Thu Feb 19, 2009 10:17 am
by DarkDragon
Many barcode scanners have a second port for RS232 communication, next to USB (As HID-Keyboard). Maybe you also want to check this?

Posted: Thu Feb 19, 2009 3:43 pm
by ColBoy
ricardo wrote:You may direct the barcode scanner to a gadget that is not visible, so nobody can type it there manually.
For manual usage use another gadget, so its easy to know which one was used.

Just one idea, never test it myself.
That doesn't work, as you can't direct the barcode scanner if it is functioning as a wedge reader, as you have no way of knowing if the keys are coming from the wedge reader or the keyboard.

Posted: Thu Feb 19, 2009 4:29 pm
by Xombie
The only reason I'd like a way to detect whether it was the keyboard or scanner is because I would like to prevent the user scanning into a string gadget other than the very specific one.

I don't have control over the barcodes so I can't add in special identifiers to handle it in this way.

Mostly it was just an idle wish. If the user accidentally scans the barcode while in a different field, they'll have to back it out. It's for an internal app so I don't worry so much about that.

And the one I purchased is only USB so unfortunately no serial port or otherwise.

I appreciate all the discussion, though. Always good to see thoughts being passed around.

Posted: Thu Feb 19, 2009 4:45 pm
by ricardo
ColBoy wrote:
ricardo wrote:You may direct the barcode scanner to a gadget that is not visible, so nobody can type it there manually.
For manual usage use another gadget, so its easy to know which one was used.

Just one idea, never test it myself.
That doesn't work, as you can't direct the barcode scanner if it is functioning as a wedge reader, as you have no way of knowing if the keys are coming from the wedge reader or the keyboard.
Well, its possible.

per example if you let the user pick a radio button to change the gadget depending on if was manually or using the scanner. Yes, the user can cheat you, but i dont think we are talking about detectivesque code, just a way to make it easily to manage.
In the front GUI there could be a choice to choosee the option barcode scanner or keyboard.

Im sure there are a lot of other possibilities to achieve this.

Posted: Thu Feb 19, 2009 5:18 pm
by Rook Zimbabwe
Yep... put in a button titled BARCODE LOOKUP (or whatever your use would be) and use that to SETACTIVEGADGET() to the correct stringfield! :D

Scanner

Posted: Thu Feb 19, 2009 10:22 pm
by tbohon
Xombie:

Which scanner did you purchase? I'm looking for one myself ... :lol:

Tnx.

Tom

Posted: Fri Feb 20, 2009 12:13 am
by Xombie
It's a Metrologic MS9520. I can't give a recommendation except to say I plugged it in and it worked. Haven't really tested it much beyond that.