C Language Development Kit/Functions/ScannerPower

From OptiWiki

Jump to: navigation, search
Description This function controls the power of the scan-engine of the handheld terminal.

The scan-engine can be switched on continuously, switched on only when the user presses the trigger key, or switched off. The selected power mode remains active, even when a barcode is read and the laser is switched off. The next trigger press will re-enable the scan-engine. Call this function with OFF, to completely disable the scan-engine.

Syntax
void scannerpower(int mode, int time);
Arguments
int mode
mode can have one of the following values:
OFF The scan-engine is switched off immediately.
ON The scan-engine is switched on immediately, and switched off when "time*20" ms has elapsed.
TRIGGER The scan-engine is switched on when the user presses a trigger key. The scan-engine stays powered for as long as the user presses the trigger key, however never longer then "time*20" ms.
SINGLE The scan-engine is switched on when the user presses a trigger key. The scan-engine stays powered regardless of the state of the trigger key, and is only switched off when "time*20" ms has elapsed, or when a successful read has been made by readbarcode().
MULTIPLE Almost the same as SINGLE, however the scan-engine is not switched off after a successful read by readbarcode(), allowing the user to read another barcode. The same barcode can only be read though when the laser beam has been moved away from the label first. The scan time specified by time is reset after a successful read. (This option is not supported by the DWT7133)
CONTINUOUS The scan-engine is switched on when the user presses a trigger key. The scan-engine stays powered regardless of the state of the trigger key, and is only switched off when "time*20" ms has elapsed without a successful read made by readbarcode(). (This option is only supported by the OPH100x)
int time
time specifies the time that the scan-engine is on in steps of 20 milliseconds.

Example: time = 100 specifies that the scan-engine is on for 20*100 ms = 2 seconds.

The DWT7133 interprets time = 0 as infinite time.

The other devices interpret time = 0 as zero time. The scan engine is not switched on.

Returns None
Remarks The scan-engine is the part of the terminal that emits the laser beam or

LED light and that processes variations in reflected light. When the laser beam is visible or the LED is emitting, the scan-engine is on, else it is off.

Example
// The following example shows how to implement 'continuous read' mode.
 
#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;
 
    gotoxy( 0, 0);
    cursor( BLINKING );
 
    for(;;)
    {
        if( !scanneroff())
        {
            resetkey();
            if( readbarcode(  ) == OK )
            {
                goodreadled( GREEN, 10);
                sound( TSTANDARD, VHIGH, SMEDIUM, SHIGH, 0);
                scannerpower( ON, 250);
                gotoxy( 0, 0);
                printf("%s", code.text);
            }
        }
        else
            scannerpower( ON, 250);
    }
}


Views
Personal tools