#include "msutils.h"
Functions | |
int | MSOpenPort (char *devname) |
Open a serial port connection to Microscan barcode reader. | |
void | MSClosePort (int portFD) |
Close a barcode reader comm port. | |
int | MSReadPort (int portFD, char *buf, long timeout) |
Read data from a barcode reader (with timeout),. | |
int | MSSendQuery (int portFD, char *msqStr, char *msqVal, long timeout) |
Query the barcode reader and wait for a reply. | |
int | MSSendCommand (int portFD, char *cmdstr, char *errstr) |
Send a command to the barcode reader. | |
int | MSReadBarcode (int portFD, char *bcstr, long timeout) |
Read a barcode label and return the label text. | |
int | MSReset (int portFD, char *reply) |
Reset the barcode reader. |
Simple API for operating a Microscan MS-3 CCD barcode reader from within a C/C++ program. See www.microscan.com for basic information about Microscan barcode readers and documentation.
See the msutils.h header file for additional parameters.
|
Open a serial port connection to Microscan barcode reader.
For socket communications with a network serial port server, we use INET streams (SOCK_STREAM) with a persistent client connection. This is pretty much standard for most devices on the market. For a regular serial port, we set the attributes to as required by the Microscan MS-3 series barcode scanner's serial interface.
|
|
Close a barcode reader comm port.
|
|
Read data from a barcode reader (with timeout),.
The Microscan MS3 barcode reader must be configured to terminate messages with \r (ASCII 13 = Ctrl+M). Note, If select() is interrupted by Ctrl+C, the read is aborted. |
|
Query the barcode reader and wait for a reply.
|
|
Send a command to the barcode reader.
|
|
Read a barcode label and return the label text.
When the serial trigger character is received by the barcode reader, it turns on its laser/LEDs and scan for a barcode label in the beam. The scanning proceeds until either (a) it successfully decodes the label and it returns the label text or (b) the "no-decode timeout" interval expires and it returns a "NOREAD" message indicating it failed to successfully decode the label (or it could also mean no label was in the beam). As a failsafe, we wait for the communications timeout interval for a reply to the read request. This allows us to exit gracefully in the case of barcode reader malfunction or the reader not being powered on. In general timeout should be larger than the scanner's no-decode timeout, typically twice as long. The factory default no-decode timeout is 2 seconds, so a sensible application communications timeout interval would be 4 seconds.
|
|
Reset the barcode reader.
|