C Language Development Kit/Snippets/Input/ScanBarcodeSymbol

From OptiWiki

Jump to: navigation, search
Description Inputs a string of data by scanning a barcode, returns the barcode type id.
Syntax
int ScanBarcodeSymbol( char *string, int min_length, int max_length, int *nCodeId);
Arguments
char *string

Holds the scanned barcode.

int min_length

The minimal length the scanned barcode at least needs to have.

int max_length

The maximum length the scanned barcode may have.

int *nCodeId

The scanned barcode id, when succesfully scanned a barcode.

Returns
OK On success.
ERROR Aborted by pressing another key then the TRIGGER key.
Remarks Look in the "lib.h" header file to see to what kind of barcode id the scanned barcode matches. These code id's are different for OPL97xx/DCL153x and PHL series
Example
#include "lib.h"
#include <stdio.h>
#include "input.h"  //Holds the input functions
 
void main( void )
{
    char string[ 40+1 ];
    int codeId;
    for(;;)
    {
        printf("\fScan barcode..\n");
        while( ScanBarcodeSymbol( string, 1, 40, &codeId ) != OK )
            continue;
 
        //See "lib.h" to see to what barcode type the scanned code id matches
        printf("\fscanned:\n%s\ncode id=%d\npress a key", string, codeId);
        WaitForKey();
    }
}


Views
Personal tools