ScannerPower

Availability All terminals
Description This function controls the power of the scan engine in 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 scanner 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.
SCAN_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 and "time*20" ms hasn't elapsed.
SCAN_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().
SCAN_MULTIPLE Almost the same as SCAN_SINGLE, however the scan engine is not switched off after a successful read by ReadBarcode(), allowing the user to read another barcode. However, the same barcode can only be read when the scan engine has been moved away from the label first. The scan time specified by time is reset after a successful read.
SCAN_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().

The following combinations are also supported
SCAN_TRIGGER | SCAN_SINGLE Same as SCAN_SINGLE, but the scan engine is also turned off when the trigger is released.
SCAN_TRIGGER | SCAN_MULTIPLE Same as MULITPLE, but the scan engine is also turned off when the trigger is released.
SCAN_TRIGGER | SCAN_CONTINUOUS Same as SCAN_CONTINUOUS, but the scan engine is also turned off when the trigger is released.

int time
The time parameter 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.
time = 0 is interpreted as zero time. The scan engine is not switched on in this case.
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; otherwise it is off.
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(SCAN_SINGLE, 100);        // Single read, 2 seconds

    for(;;)
    {
        if(ReadBarcode(&code) == OK)
        {
             GoodReadLed(GREEN, 10);
             Sound( TSTANDARD, VHIGH, SMEDIUM, SHIGH, 0);
             printf("%*s\r", code.length, code.text);
        }

        Idle();
    }
}