Scripting Guide

NAURTECH WEB BROWSER AND TERMINAL EMULATION FOR WINDOWS CE AND WINDOWS MOBILE
CETerm Scripting Guide Page 83
4.1 THE ONBARCODEREAD EVENT
The OnBarcodeRead event is fired when a barcode is successfully read. The
handler can pre-process the data or check other conditions prior to passing it on
to a TE or browser session.
Syntax
function OnBarcodeRead ( session, data, source, type, date, time
)
session index of currently active session
data barcode data
source source of barcode. Typically a constant scanner name.
type labeltype of barcode. See Appendix 3 for values.
date date of barcode read.
time time of barcode read.
Example
Several samples for OnBarcodeRead were given in Section 2.5. Following is an
example that checks the RF connection before submitting the data to the host.
This notifies the user that the barcode was not received by the host and instructs
the user to return to RF coverage.
/* OnBarcodeRead */
function OnBarcodeRead ( session, data, source, type, date, time )
{
// Check RF status
var status = CETerm.GetProperty ( "device.rf.status" );
if (status <= 0)
{
OS.Alert( "No RF signal detected.\n" +
"Barcode discarded.\n" +
"Return to RF coverage." );
// Discard barcode
return 1;
}
// Send barcode to emulator
CETerm.SendText ( data, session );