1 the onbarcoderead event, Syntax, Example – Casio Naurtech CETerm Ver.5.5 Scripting Guide User Manual
Page 83

N
AURTECH
W
EB
B
ROWSER AND
T
ERMINAL
E
MULATION FOR
W
INDOWS
CE
AND
W
INDOWS
M
OBILE
CETerm Scripting Guide
Page 83
4.1
T
HE
O
N
B
ARCODE
R
EAD
E
VENT
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 );