// This program reads and displays a barcode. After each successful barcode reading,
// it gives a good read signal on the LED, a buzzer signal.
//
// Note that an extra check is made on the minimum length when the barcode symbology
// is one of the 2 of 5 codes, or Codabar. This is done because of the poor
// specifications of these symbologies.
// Note the use of a loop, repeatedly invoking readbarcode().
#include "lib.h"
#include <stdio.h>
void main( void )
{
char bcr_buf[42];
struct barcode code;
code.min = 1;
code.max = 41;
code.text = bcr_buf;
for(;;)
{
if( !scanneroff())
{
if( readbarcode( ) == OK)
{
if( (code.id != CODABAR) &&
( code.id != I2OF5) &&
( code.id != D2OF5) ||
( code.length > 5))
{
goodreadled( RED, 10);
sound( TSTANDARD, VHIGH, SMEDIUM, SHIGH, 0);
scannerpower( OFF, 0);
printf("%s\n",code.text);
}
}
}
else
{
delay( 50 );
scannerpower( ON, 250);
}
idle();
}
}