},
onDisconnect: function ()
{
},
onExpectedData: function (inputData)
{
data = inputData.slice(1,inputData.length-1);
if (cmf400_status == CMF400_PROTOCOL_STATUS.SYNCRONIZING)
{
if (data == cmf400_gateway_ident_ok || data ==
cmf400_gateway_ident_no)
{
cmf400_status = CMF400_PROTOCOL_
STATUS.CONFIGURING;
var msg = cmf400_protocol_stx;
msg += "+GW S000 H000";
msg += " X" + zero_prefix(vt_param_
comif_com1_protocol, 3);
msg += " N" + zero_prefix(vt_param_
profibus_node_number, 3);
msg += " M" + zero_prefix(vt_param_
profibus_mode, 3);
msg += cmf400_protocol_etx;
this.send(msg);
this.onTimer = _configTimedOut;
this.setTimer(10.0);
}
}
if (data == cmf400_gateway_error)
{
cmf400_status = CMF400_PROTOCOL_
STATUS.STOPPED;
this.setTimer(30.0);
this.onTimer = _onTimer;
}
else if (data == cmf400_gateway_run) // missing check for
status, e.g. CMF400_PROTOCOL_STATUS.CONFIGURING?
{
cmf400_status = CMF400_PROTOCOL_STATUS.RUN;
this.setTimer(0);
this.onTimer = _onTimer;
}
return true;
},
onUnexpectedData: function (inputData)
{
// ignore all unexpected data
return true;
},
onTimer: _onSync
};
}
62
DataMan Application Development