},
onInput0: function (inputs) {
this.send("call onInput0 for '" + this.peer + ", inputs=" + inputs +
"\r\n");
},
onInput1: function (inputs) {
this.send("call onInput1 for '" + this.peer + ", inputs=" + inputs +
"\r\n");
}
};
}
With the following event sequence: input1 on, input0 on, input0 off, input1 off, software trigger, switch on, switch off, we
get the following output on the terminal:
call onInput1 for 'COM1, inputs=2
call onTrigger: start trigger with index 9
call onInput0 for 'COM1, inputs=1
call onTrigger: end trigger with index 9
call onInput0 for 'COM1, inputs=0
NO-READ
call onInput1 for 'COM1, inputs=0
call onTrigger: start trigger with index 10
NO-READ
call onTrigger: end trigger with index 10
call onInput0 for 'COM1, inputs=4096
call onTrigger: start trigger with index 11
call onInput0 for 'COM1, inputs=0
call onTrigger: end trigger with index 11
NO-READ
The following example registers a handler on Input1 events and stores the state in a global variable. The state of the
input is output by the data formatting.
var ginputs = false;
registerHandler(Callback.onInput, onInput, ConstInput.Input1);
// Default script for data formatting
function onResult (decodeResults, readerProperties, output)
{
output.content = "Input: "+ginputs+" \r\n";
}
function onInput(inputs)
{
ginputs = (inputs & ConstInput.Input1) ? true : false;
}
DataMan Application Development
75
Need help?
Do you have a question about the DataMan and is the answer not in the manual?