Availability | All terminals | ||||||||||||
Description | This function tries to fetch a barcode from the scanner. | ||||||||||||
Syntax | unsigned int ReadBarcode( struct barcode *barcodep ); | ||||||||||||
Arguments |
struct barcode *barcodepThe structure barcode is defined as follows:struct barcode { char *text; int length; int id; int min; int max; };
|
||||||||||||
Returns |
|
||||||||||||
Remarks |
ReadBarcode() tries to find a barcode in the OS buffer that is filled with decoded barcode data. If ReadBarcode() finds a barcode in the buffer, it fills the barcode structure, and returns. If no barcode was read, ReadBarcode() calls Idle() and returns. Use the SystemSetting() function to select which barcode symbologies must be read. |
||||||||||||
Example |
// This program reads and displays a barcode. After each successful barcode reading, // it gives a good read signal on the LED and a buzzer signal. #include <stdio.h> #include "lib.h" void main( void ) { char bcr_buf[42] = {0}; struct barcode code = {0}; code.min = 3; code.max = 41; code.text = bcr_buf; ScannerPower(SINGLE|TRIGGER, 100); // Single read, trigger mode, 2 sec for(;;) { if(ReadBarcode(&code) == OK) { GoodReadLed(GREEN, 10); Sound( TSTANDARD, VHIGH, SMEDIUM, SHIGH, 0); printf("%*s\r", code.length, code.text); } Idle(); } } |