o
Input6:
o
InputAll
o
BnTrig
o
BnTune
The input mask can be combined. The input values are sampled with an accuracy of 1 ms. The callback function for the
onInput event has one argument for the new state of the input.
onTrigger event: It executes the callback function on trigger start and trigger end events. The callback function for the
onTrigger event has two arguments: The first argument is the trigger object, the second argument the boolean state of
the trigger, true for a trigger start and false for a trigger end.
Examples
The example defines three event handler:
l onInput0 – reacting on input0 signal and the switch button
l onInput1 – reacting on input1 signal
l onTrigger – reacting on trigger events
function CommHandler()
{
return {
onConnect: function (peerName)
{
this.peer = peerName;
this.input1 = registerHandler(Callback.onInput,
this.onInput0.bind(this),
ConstInput.Input0|ConstInput.BnTrig);
this.input2 = registerHandler(Callback.onInput,
this.onInput1.bind(this), ConstInput.Input1);
this.ontrigger = registerHandler(Callback.onTrigger,
this.onTrigger.bind(this));
return true;
},
onDisconnect: function ()
{
deregisterHandler(this.input1);
deregisterHandler(this.input2);
deregisterHandler(this.ontrigger);
},
onTrigger: function (trigger, state) {
if (state)
this.send("call onTrigger: started trigger with index " +
trigger.index + "\r\n");
else
this.send("call onTrigger: end trigger with index " +
trigger.index + "\r\n");
74
DataMan Application Development