EasyManua.ls Logo

Cognex DataMan - Page 61

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...
// Formatting helper function
function zero_prefix(num, size)
{
var s = "000000000" + num;
return s.substr(s.length - size);
}
function CommHandler()
{
// The current protocol state
var cmf400_status = CMF400_PROTOCOL_STATUS.STOPPED;
function _configTimedOut()
{
if (cmf400_status == CMF400_PROTOCOL_STATUS_CONFIGURING)
{
cmf400_status = CMF400_PROTOCOL_STATUS_STOPPED;
this.setTimer(30.0);
onTimer = _onSync;
}
}
function _onSync()
{
if (cmf400_status == CMF400_PROTOCOL_STATUS.SYNCRONIZING)
{
this.send(cmf400_protocol_stx + cmf400_gateway_init +
cmf400_protocol_etx);
this.setTimer(1.0);
onTimer = _onSync;
}
}
function _onTimer()
{
if (cmf400_status == CMF400_PROTOCOL_STATUS.STOPPED)
{
cmf400_status = CMF400_PROTOCOL_STATUS.SYNCRONIZING;
return;
}
}
return {
onConnect: function (peerName)
{
expectFramed("", cmf400_protocol_etx, 510); //
is 510 an arbitrary limit?
cmf400_status = CMF400_PROTOCOL_
STATUS.SYNCRONIZING;
this.onTimer = _onSync;
this.setTimer(0.0001);
return true;
61
DataMan Application Development

Table of Contents

Other manuals for Cognex DataMan

Related product manuals