
28
Programming Concepts
3.5.5
Ignore the Decode
You can ignore a particular format by exiting the function with a return value of false as
shown in the following code segment from the example.
else if (data matches format that is to be ignored)
{
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.
If your
reader.onDecode
function returns
false
, you should configure the handheld to
beep upon decode error.
3.5.6
Determine the Orientation of the Decode
You can determine the orientation of a code by using the bounds array. The bounds array
has four elements that can be used to give the coordinates of the four corners of the code
(the origin is the center of the decode field):
(decode.bounds[0].x, decode.bounds[0].y) = coordinates of top right corner
(decode.bounds[1].x, decode.bounds[1].y) = coordinates of top left corner
(decode.bounds[2].x, decode.bounds[2].y) = coordinates of bottom left corner
(decode.bounds[3].x, decode.bounds[3].y) = coordinates of bottom right corner
These designations (e.g. top left) refer to the corners of the symbol,
not
as it appears in a
particular image, but rather as it appears (most often) in its symbology specification. For
example, for Data Matrix, array element 2, which contains the coordinates of the bottom
left vertex of the symbol boundary, will
always
be proximate to the intersection of the two
lines which form the “∟” of the symbol, regardless of the actual orientation (or mirroring) of
the symbol in the image submitted to the decoder.
In normal orientation, we would expect the signs of the coordinates to be:
decode.bounds[0].x (-), decode.bounds[0].y (+)
decode.bounds[1].x (-), decode.bounds[1].y (-)
decode.bounds[2].x (+), decode.bounds[2].y (-)
decode.bounds[3].x (+), decode.bounds[3].y (+)