Working with COM Ports

PLEASE READ THE UPDATES PLEASE READ THE UPDATES
PLEASE READ THE UPDATES PLEASE READ THE UPDATES

Hi Experts. Are you ready for your stupid question of the week?

I've never worked with COM Ports before.
I have a barcode scanner that is actually USB, and after installing a driver and following some instructions I have enabled a 'Virtual COM Port'. It shows up under Device Manager as 'Symbol USB COM Port Emulation' under 'Human Interface Devices'.

Anybody have a clue as to how to talk to this COM Port? I want to receive any barcode data it is receiving.

======================
UPDATE: This blurb from the Readme might help:
Custom serial communication applications can be developed to work over the
virtual COM port, like the normal PC serial port. Driver supports Win32 serial
communication APIs and applications that use these APIs will work over the
virtual port subject to the limitations listed in Section 9.

======================
UPDATE:
I downloaded the ComPort library from SourceForge:
http://sourceforge.net/projects/comport/
And got it to connect on COM1.
My problem now is, when I deploy my application, will it always be COM1? What if the user has put another serial device which is using COM1 (Please keep in mind that COM1 is being virtualised by some software)?
LVL 13
rfwoolfAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JohnjcesCommented:
Just out of curiosity, what make/model of scanner are you using?

We use bar code scanners all the time where I work. All of the USB scanners we have are HID type devices that emulate an added keyboard.  So when you scan a bar code, it is just like typing it into a keyboard. No fuss, no muss, no hassles. No com port programming etc.

If you can, I would look at a different make/model of scanner that works as above.

Look at http://www.posguys.com/barcode-scanner_3/

Lastly, USB to serial devices usually add a virtual type com port above the standard com1 and com2 found on PCs. It is unusual that it is set as COM1. But on another user's PC the USB com port could be be anything especially if they have a modem or serial ports on their PC which are already set as COM1 and/or COM2.

You would need a setup in your application that the user would set the com port setting that was assigned to the scanner after it was installed.

John
0
rfwoolfAuthor Commented:
Thanks John. This is the Symbol (now Motorola) DS6707. It is the USB version which works exactly like Keyboard input. But this is a problem in my application because how do I detect Keyboard Input separate from Barcode Scanner input? This is important for me. I opened a question about how to create a keyboard listener which would detect a PREFIX and SUFFIX string of 'START' and 'END' respectively and ThievingSix helped me write one but it came out with some problems, so I decided the best bet was to use a COM port instead.
Based on your experience developing applications for barcode scanners, do you have any advice for me? I will gladly open a new question if you ask me to.
0
rfwoolfAuthor Commented:
COM Port question
(Assuming I stick with COM Port and JohnJces doesn't have a brilliant idea on how to detect keyboard and scanner input separately):
===
The COMPort component comes with a nice Comport Terminal which works perfectly: I scan a barcode and it appears in the terminal.
Any idea on how to call an event once it has scanned something?
0
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

JohnjcesCommented:
The only advice I can give is from the my experience in writting a couple apps that use keyboard type BC scanners. In those apps there would be specific fields that the user would jump to or enter into for bar code input. For multiple scans, like inventory, I did a start button and set the scanner to send a carriage return and line feed at the end of each scan that would in essence be like hitting the enter key. This would loop until the user clicked finished. Single entries would have to be when in a specific field. If they were on a name field and scanned a label, we would have bad data and I checked for numeric or numeric AND alpha data in such fields and would reject such... clear the bad text and set focus again on that edit.

It is tough and IMHO pretty impossible to distinguish real keyboard input from BC scanner input so I do understand the use of the COM port devices. But other users may need to have it set to any com port from 1 - XXX, so you would just need to add a com port setting in your app.

John

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JohnjcesCommented:
Sorry..no brilliant ideas!

One question... can you design the labels being read? Or are they like UPC codes that are fixed.

John
0
rfwoolfAuthor Commented:
Yes we are designing the labels being read. They are 2D barcodes using the PDF417 symbology.
0
rfwoolfAuthor Commented:
Thanks for the advice John, I'm still saving up to come visit your Casino ;)
Here's some boring (probably) and irrelevant news about my local casinos:
-One of my local casinos sends me about 4 SMSs a week about their "equal chance" draws that they hold regularly and other similar promotions. Trouble is, word gets around and everyone is getting these SMSs.
-I spoke for about an hour to a croupier at a Casino and they say they get paid about the same as a "banker" but with a lot more perks. By "banker" I assume they mean bank teller or bank salesperson, as opposed to the multi-millionaire investment banker stereotype.
0
JohnjcesCommented:
Most all of the 'floor' positions are minimum wage or even less due to tips. Tips or tokes is what a lot of their income is based upon. Not sure what tellers make... depending upon the season here they can do pretty good. But it is not consistent.

Back to labels... we use a prefix on ours but I guess that was sort of like the start and stop you tried earlier. Maybe just do a Start, like with the characters BC or BC9 then a carriage return line feed after the BC read might do you.

Anyway... again, no brilliant ideas!

John
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.