"use strict";module.exports=function(t){require("source-map-support").install();var n=require("./modbus-basics"),i=require("debug")("contribModbus:flex:connector");t.nodes.registerType("modbus-flex-connector",function(e){t.nodes.createNode(this,e),this.name=e.name,this.maxReconnectsPerMinute=e.maxReconnectsPerMinute||4,this.emptyQueue=e.emptyQueue,this.showStatusActivities=e.showStatusActivities,this.showErrors=e.showErrors,this.connection=null,this.internalDebugLog=i,this.verboseLogging=t.settings.verbose;var o=this,s=(n.setNodeStatusTo("waiting",o),t.nodes.getNode(e.server));s&&(s.registerForModbus(o),n.initModbusClientEvents(o,s),o.onConfigDone=function(e){o.showStatusActivities&&n.setNodeStatusTo("config done",o),e.config_change="emitted",o.send(e)},o.onConfigError=function(e,t){i(e.message),o.showErrors&&o.error(e,t),e&&e.message?t.error=e:t.error=new Error(e),t.error.nodeStatus=o.statusText,o.emptyMsgOnFail&&(t.payload=""),o.send(t)},o.on("input",function(e){var t;n.invalidPayloadIn(e)||s.client&&(o.showStatusActivities&&n.setNodeStatusTo(s.actualServiceState,o),e.payload.connectorType?(i("dynamicReconnect: "+JSON.stringify(e.payload)),e.payload.emptyQueue=o.emptyQueue,s.emit("dynamicReconnect",e,o.onConfigDone,o.onConfigError)):(t=new Error("Payload Not Valid - Connector Type"),o.error(t,e),o.send(e)))}),o.showStatusActivities||n.setNodeDefaultStatus(o))})};
//# sourceMappingURL=maps/modbus-flex-connector.js.map
