|  |  | 
 |  |  |       Object[] objs =  TcpSessionCache.getTcpProtocolNameVersion(rtuAddr) ; | 
 |  |  |       if(objs == null || objs.length == 0 || objs[0] == null){ | 
 |  |  |          //RTU未曾上线 | 
 |  |  |          /* 2024-11-02 增加了协议版本号,且一个协议可以有多个版本号,所以下面得到唯一协议驱动实现方式不可用了,因为确定不了版本号 | 
 |  |  |          int count = ProtocolCache.driverCount() ; | 
 |  |  |          if(count == 1){ | 
 |  |  |             //只有一个协议 | 
 |  |  |             dri = ProtocolCache.getFirstDriver() ; | 
 |  |  |          } | 
 |  |  |          */ | 
 |  |  |       }else{ | 
 |  |  |          String protocolName = (String)objs[0]; | 
 |  |  |          com.protocolVersion = (Short)objs[1]; | 
 |  |  |          dri = ProtocolCache.getDriver(protocolName) ; | 
 |  |  |          if(dri == null){ | 
 |  |  |             log.error("严重错误,未能得到协议" + protocolName + "驱动类实例!"); | 
 |  |  |          }else{ | 
 |  |  |             MidResult[] actions = dri.createCommand(ServerProperties.isLowPower, com)  ; | 
 |  |  |             log.info("下发远程命令" + com.getCode() + "由协议驱动构造完成"); | 
 |  |  |             if(actions != null){ | 
 |  |  |                for(MidResult act : actions){ | 
 |  |  |                   act.action(); | 
 |  |  |                } | 
 |  |  |          dri = ProtocolCache.getDriver(protocolName, com.protocolVersion) ; | 
 |  |  |       } | 
 |  |  |       if(dri == null){ | 
 |  |  |          log.error("严重错误,未能得到RTU(" + rtuAddr + ")驱动类实例!"); | 
 |  |  |       }else{ | 
 |  |  |          MidResult[] actions = dri.createCommand(ServerProperties.isLowPower, com)  ; | 
 |  |  |          log.info("下发远程命令" + com.getCode() + "由协议驱动构造完成"); | 
 |  |  |          if(actions != null){ | 
 |  |  |             for(MidResult act : actions){ | 
 |  |  |                act.action(); | 
 |  |  |             } | 
 |  |  |          } | 
 |  |  |       }	 | 
 |  |  |       } | 
 |  |  |    } | 
 |  |  |  | 
 |  |  | } |