EasyManuals Logo

Code CR1500 Programming Guide

Code CR1500
41 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #31 background imageLoading...
Page #31 background image
D028868 CR1500 CR1100 CR2700 JavaScript Programming Guide User Manual Page 31 of 41
The Code Corporation
12393 South Gateway Park Place, Suite 600, Draper, UT 84020
+1 (801) 495-2200
FAX +1 (801) 495-0280
This example shows the use of a regular expression that matches a specific pattern of
decode data, then the use of a JavaScript method to remove the last digit from the matched
decode data.
Example:
rules_onDecodes = function(decodes)
{
if(decodes[0].data.match(/^[0-9]{9}$/g)!= null)
decodes[0].data = decodes[0].data.substring(
0, decodes[0].data.length - 1);
return decode;
};
rules_onDecodeAttempt
The rules_onDecodeAttempt()function is run when a call to the default
reader.onDecodeAttempt()is made. rules_onDecodeAttempt()is passed the
length of the decodes array (Section 13.1.1).
rules_onDecode
The rules_onDecode()function is run when a call to the default
reader.onDecodes()is made. rules_onDecode()is passed an individual decode
object, and is called for each decode object contained in the decodes array.
The rules_onDecode()function must return either the decode object or the value
“false. Returning false will stop further action by the reader.onDecode() function.
rules_onEvent
rules_onEvent() will be called whenever a userEvent is utilized. The user event
numbers are restricted to event_user0 through event_user9. The most common use of this
will be to implement some logic, based on the press of a button or to send a read-failure
notification. Users can pre-handle any of the following events. Returning a “false lets the
firmware process the event, while returning a true tells the firmware that the event has
been handled and needs no further processing.
In the example below, the reader is first set to intercept a button press. The reader will then
send a codeXml enter keypress over the comm port. See the CR8200 CCD, Code Document
Number D026160 for more information.
Example:
var enter = "\x01X\x1ean//n\x04";
rules_onEvent = function(event)
{
if (event.type == buttonPress)
{
comm.sendPacket(enter);
return true; // tell the firmware that we handled the press
}
};

Table of Contents

Other manuals for Code CR1500

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Code CR1500 and is the answer not in the manual?

Code CR1500 Specifications

General IconGeneral
BrandCode
ModelCR1500
CategoryBarcode Reader
LanguageEnglish

Related product manuals