huang
2025-10-22 78d73df2f8e0c6855d65eb1f2c6df08e0f99bab1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.mes.config;
 
import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType;
import com.github.xingshuangs.iot.protocol.s7.serializer.S7Serializer;
import com.github.xingshuangs.iot.protocol.s7.service.S7PLC;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
 
/**
 * @Author : zhoush
 * @Date: 2025/4/30 13:50
 * @Description:
 */
@Configuration
public class S7Config {
    @Bean(name = "s7SerializerSPOne")
    public S7Serializer s7SerializerSPOne() {
        S7PLC s7PLC = new S7PLC(EPlcType.S1200, "192.168.10.80");
//        S7PLC s7PLC = new S7PLC(EPlcType.S1200, "192.168.0.15");
        return S7Serializer.newInstance(s7PLC);
    }
 
//    @Bean(name = "s7SerializerSPTwo")
//    public S7Serializer s7SerializerSPTwo() {
//        S7PLC s7PLC = new S7PLC(EPlcType.S1200, "192.168.10.86");
////        S7PLC s7PLC = new S7PLC(EPlcType.S1500, "10.153.19.191");
//        return S7Serializer.newInstance(s7PLC);
//    }
}