| | |
| | | import com.dy.common.mw.protocol.MidResult; |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.mw.protocol.Driver; |
| | | import com.dy.common.mw.protocol.ProtocolCach; |
| | | import com.dy.common.mw.protocol.ProtocolCache; |
| | | import com.dy.aceMw.server.ServerProperties; |
| | | import com.dy.aceMw.server.forTcp.TcpSessionCach; |
| | | import com.dy.aceMw.server.forTcp.TcpSessionCache; |
| | | |
| | | /** |
| | | * 从web业务系统发向RTU的命令任务 |
| | |
| | | private static Logger log = LogManager.getLogger(RtuDownTask.class.getName()); |
| | | |
| | | @Override |
| | | public Integer excute() { |
| | | public Integer execute() { |
| | | Command com = (Command)this.data ; |
| | | try { |
| | | log.info("下发远程命令" + com.getCode() + "的核心任务开始执行"); |
| | |
| | | String rtuAddr = com.getRtuAddr() ; |
| | | //前面已经判断rtuAddr为空情况,至此其不为空 |
| | | Driver dri = null ; |
| | | String protocolName = TcpSessionCach.getTcpProtocolName(rtuAddr) ; |
| | | String protocolName = TcpSessionCache.getTcpProtocolName(rtuAddr) ; |
| | | if(protocolName == null){ |
| | | //RTU未曾上线 |
| | | int count = ProtocolCach.driverCount() ; |
| | | int count = ProtocolCache.driverCount() ; |
| | | if(count == 1){ |
| | | //只有一个协议 |
| | | dri = ProtocolCach.getFirstDriver() ; |
| | | dri = ProtocolCache.getFirstDriver() ; |
| | | } |
| | | }else{ |
| | | dri = ProtocolCach.getDriver(protocolName) ; |
| | | dri = ProtocolCache.getDriver(protocolName) ; |
| | | } |
| | | if(dri == null){ |
| | | log.error("严重错误,未能得到协议" + protocolName + "驱动类实例!"); |