EasyManua.ls Logo

Cognex DataMan - Page 58

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...
// Data Formatting:
var comm_handler = new Array(0);
// Converts read data to all upper case. Single code only.
function onResult (decodeResults, readerProperties, output) {
if (decodeResults[0].decoded) {
output.content = decodeResults[0].content+'\r\n';
for (var i = 0; i < comm_handler.length; i++)
{
comm_handler[i].resetHeartBeat();
}
}
}
// Communication:
// Heart beat example without disturbing the DMCC communication function CommHandler() {
var beat_timer = 10.0; // beat timer in sec
var peer_name;
return {
onConnect: function (peerName)
{
peer_name = peerName;
this.resetHeartBeat(); // initial timer
this.expectFramed("\0", "\0", 128); // some pattern
unlikely to happen
comm_handler.push(this); // register the handler for
results
// enable the handler for this connection:
return true;
},
onDisconnect: function ()
{
var index = comm_handler.indexOf(this)
comm_handler.splice(index, 1);
},
onError: function (errorMsg)
{
},
onExpectedData: function (inputString) {
return false;
},
onUnexpectedData: function (inputString) {
return false;
},
58
DataMan Application Development

Table of Contents

Other manuals for Cognex DataMan

Related product manuals