
29
Programming Concepts
A code that is not “right side up” could be rejected by exiting the function with a return
value of false as shown in the following example.
if (decode.bounds[0].x > 0 && decode.bounds[0].y < 0 &&
decode.bounds[1].x > 0 && decode.bounds[1].y > 0 &&
decode.bounds[2].x < 0 && decode.bounds[2].y > 0 &&
decode.bounds[3].x < 0 && decode.bounds[3].y < 0)
{
return false; // invalidate the decode
}
Note!
Normally, the handheld will sound a good-decode beep at the end of decode processing. If
you do not want invalidated decodes to cause the usual good-decode beep in the handheld
firmware; you must configure the reader to process the decodes via JavaScript
before
beeping. Then the handheld will only beep if there is at least one decode that is not invalidated.
For more information, refer to the Interface Configuration Document.
3.6
Host Communication
The handheld application development environment defines a host communication
comm
object (section 4.4.2.3) to support communications with a host resident application. For
example, Vision Configurator (section 1.4) is a host resident utility that communicates with
the handheld reader for downloading files to the handheld.
From the host computer’s view, the handheld is a serial device accessible through a serial
or USB port, or through Bluetooth Radio Frequency (RF) communications. Handheld
configuration settings define the active host communications port.
The handheld host communications implementation supports two basic styles of
communication: raw text and packets. It also supports a set of native protocols.
The application program transfers data to the host by writing to the handheld host
communications port using methods defined by the hendheld reader
comm
object (section
4.4.2.3). Applications gain access to data sent by the host by implementing
onCommand
(and optionally
onCommandFinish
) event handlers defined by the handheld's
reader
object properties (section 4.3) and parsing the “|” command.