Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need to read string from serial port for bar code app
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00651375
Message ID:
00651794
Views:
23
One of the other things to look at is FoxTools. There has been discussion here of using foxtools to open serial ports and dial a phone. I looked at some of the code being discussed and it looked as though it might work for giving you a filehandle.

Update: Look at thread #651009 for more on the activeX control. What Jim is sugessting might be the easier way.

>Matthew,
>
>This helps a lot! I will look into these API calls.
>
>The RF scanner doesn't have any programming/logic batching capabilities built in. It scans and sends the data in real time, that's it. The gun is a 'PowerScan' by PSC. I was not involved in the purchase or even hardware setup. I was just asked to write the code to process the scan data.
>
>>Are you using any sort of application in the scanner itself? What kind of scanner? I am testing an app from RioScan (ScanSeek) that for a batch scanner is not very useful, but for a RF scanner with realtime ODBC would work great. It is built for the Symbol SPT1700 scanner (Palm) but they have other products. I'm still getting started with scanning. I've converted our receiving and warehousing over to code39 using wedge input devices and batch devices. RF is a dream for the future at this time.
>>
>>Are you just pulling scan after scan to always go in the same field in a table?
>(Essentially, yes, there is more processing after that, and more logic, but the point is that there is no feedback or logic back to the person who scanned - and no display on the scanner. The most they get is a confirmation beep, that the data was scanned correctly, or different beep for a scan failure.)
>
>
>FOpen() is fine for DOS. Look to OpenComm() WinAPI function call to actually get a stream from the serial port. (This is easier in UNIX.) After that, using the other low-level file functions is pretty straight forward. I've seen this discussion here in the past. Do a search on OpenComm() or WinAPI, WAPI. You should find something to help. Ed Rauh can probably point you in the right direction.
>>
>>Update.
>>
>>I just returned from msdn where I found that OpenComm() has been deprecated for CreateFile(). Check out this page. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/hardware/commun_9ulh.asp
>>
>>>Mathew,
>>>
>>>I'm really looking to get away from the textbox entirely. Right now, the VFP bar code application has to be the active application, and the focus has to be in the text box. I don't think it would help to hide the textbox. I'd like to be able to start the application, and let it run minimized on the taskbar, and let a user do other things on the machine without interfering with the collection of bar code data. You need to understand that the data is being collected by a Radio Frequency (RF) bar code scanner out on the factory floor, not by a person who is sitting in front of the computer.
>>>
>>>>>I am developing a bar code application. The application does not have a user interface. Data comes in from an RF scanner to the serial port. There is a program called Portkey that converts the serial port data to keyboard input. So the recorded scan comes in as a string of characters with a carriage return. Right now the application has a single textbox on a vfp 6 form. The focus always stays in the text box. When a scan is recorded the textbox's valid fires, and the valid calls a method that processes the scan data.
>>>>>
>>>>>The problem is that this method relies on the focus staying in the textbox. If a user hits the keyboard, or clicks the mouse to another application, etc. the application obviously stops working.
>>>>>
>>>>>So, ideally I need a way to directly record the serial port data. The VFP help says that fgets() records bytes directly from a file or communication port opened with low-level file i/o. But I don't know the syntax for opening the port with fopen() - assuming that is what I am supposed to do.
>>>>>
>>>>>Can what I am trying to do be accomplished simply with fopen() and fgets(), or do I need some sort of communication library or control? How would I poll the port? Fgets() in a loop, or on a timer?
>>>>>
>>>>>TIA for any suggestions.
>>>>
>>>>Could the textbox be a hidden field? Is the scanner just reading barcodes as an item passes by on a line?
Opportunity is missed by most people beacuse it is dressed in overalls, and looks like work --- Thomas Edison
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform