default:
throw("unknown state");
}
return true;
},
onUnexpectedData: function (inputString) {
this.expectFramed('\x02', '\x03', 203); // enable framing for the
next telegram
status = TelegramState.WAIT4CONTENT;
return true;
},
onTimer: function (inputString) {
this.sendTelegram(telegram_types.heartbeat);
this.setTimer(heartbeat_time_s);
}
};
}
Event Callback
The callback mechanism allows to register handler for trigger and input events. Handler for these events can be
registered by the registerHandler method:
callback_handle registerHandler(eventid, callback, ...)
The registerHandler function requires the following arguments:
eventid – identifier for the event type to register for
o
callback – function object to execute on event
o
Available events identifier are defined in a constant object named "Callback". Optional arguments can be used to
configure the event, e.g. to filter the sensitivity.
A handle is returned that must be used to de-register the callback. To de-register the handler use the deregisterHandler
function:
deregisterHandler(callback_handle)
callback_handle – handle returned by the registerHandler method.
o
It is possible to register the callback handler within the global scope, e.g. to be used in data formatting.
Event Types
Current available events that can be registered are "onInput" and "onTrigger" events.
onInput event: It calls the callback function on input signal and button changes. The optional third argument allows to set
filter for certain inputs. The object "ConstInput" defines masks for inputs:
Input0:
o
Input1:
o
Input2:
o
Input3:
o
Input4:
o
Input5:
o
DataMan Application Development
73
Need help?
Do you have a question about the DataMan and is the answer not in the manual?