Example |
#include <stdio.h>
#include "lib.h"
void main( void )
{
char bcr_buf[42] = {0};
struct barcode code = {0};
int result;
code.min = 1;
code.max = 41;
code.text = bcr_buf;
if(SystemSettingsMemorizing(ON) < 0)
{
SystemSetting("C01");
}
SystemSetting("YC");
ScannerPower(TRIGGER | SINGLE, 250);
for(;;)
{
if(ReadBarcode(&code) == OK)
{
result = 0;
if(code.id == MENU_CODE)
{
ScannerPower(ON, -1);
while(result != EXITING_MENU_MODE && result != ERROR)
{
if(result == 0 || ReadBarcode(&code) == OK)
{
switch( (result=ExecuteMenuLabel(&code)) )
{
case ENTERING_MENU_MODE:
Sound(TSTANDARD, VHIGH, SHIGH, SMEDIUM, SHIGH, 0);
break;
case EXITING_MENU_MODE:
ScannerPower(OFF, 0);
Sound(TSTANDARD,VHIGH, SHIGH, SMEDIUM, SHIGH, 0);
Delay(TSTANDARD * 4);
SystemSetting("Z2");
while(TriggerPressed())
Idle();
ScannerPower(TRIGGER | SINGLE, 250);
break;
case INVALID_OPTION_READ:
Sound(TLONG, VHIGH, SLOW, 0);
break;
case VALID_OPTION_READ:
Sound(TSTANDARD, VHIGH, SHIGH, SMEDIUM, SHIGH,0);
break;
case LABEL_IGNORED:
break;
case ERROR:
ScannerPower(OFF, 0);
while(TriggerPressed())
Idle();
ScannerPower(TRIGGER | SINGLE, 250);
break;
}
}
}
}
else if (code.id == MENU_CODE_PDF || code.id == MENU_CODE_C128 || code.id == MENU_CODE_QR || code.id == MENU_CODE_AZTEC) // Check for Code-128 / PDF417 / QR / Aztec menu labels)
{
switch ((result = ExecuteMenuLabel(&code)))
{
case INVALID_OPTION_READ:
Sound(TLONG, VHIGH, SLOW, 0);
break;
case VALID_OPTION_READ:
Sound(TSTANDARD, VHIGH, SMEDIUM, SHIGH, SMEDIUM, SHIGH, 0);
Delay(TSTANDARD * 4);
SystemSetting("Z2");
break;
default:
break;
}
}
else
{
GoodReadLed(GREEN, 10);
Sound( TSTANDARD, VHIGH, SMEDIUM, SHIGH, 0);
PutString(code.text);
}
}
Idle();
}
}
|