EasyManua.ls Logo

Cognex DataMan - Event Callback; Event Types

Cognex DataMan
76 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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:
o
eventid identifier for the event type to register for
o
callback function object to execute on event
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)
o
callback_handle handle returned by the registerHandler method.
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:
o
Input0:
o
Input1:
o
Input2:
o
Input3:
o
Input4:
o
Input5:
73
DataMan Application Development

Table of Contents

Other manuals for Cognex DataMan

Related product manuals