| | |
| | | } |
| | | |
| | | // 根据PLC类型创建不同的客户端 |
| | | if (plcType.startsWith("S7")) { |
| | | // 支持 S7_1200, S7_1500 等格式,也支持 S1200, S1500 等格式 |
| | | String normalizedPlcType = plcType.toUpperCase(); |
| | | if (normalizedPlcType.startsWith("S7") || |
| | | normalizedPlcType.startsWith("S1200") || |
| | | normalizedPlcType.startsWith("S1500") || |
| | | normalizedPlcType.startsWith("S200") || |
| | | normalizedPlcType.startsWith("S300") || |
| | | normalizedPlcType.startsWith("S400")) { |
| | | // S7协议客户端 |
| | | return createS7Client(device); |
| | | } else if (plcType.equals("MODBUS")) { |
| | | } else if (normalizedPlcType.equals("MODBUS")) { |
| | | // Modbus协议客户端 |
| | | return createModbusClient(device); |
| | | } else { |