package com.platform.iec; import com.platform.iec.master.MasterSysDataHandler; import com.ydl.iec.iec104.config.Iec104Config; import com.ydl.iec.iec104.server.Iec104MasterFactory; import com.ydl.iec.util.Iec104Util; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.core.annotation.Order; import org.springframework.scheduling.annotation.EnableScheduling; import java.util.TimeZone; /** * @Description * @Author chenli * @Date 2019/7/22 * @Version Copyright (c) 2019,北京乾元坤和科技有限公司 All rights reserved. */ @SpringBootApplication @EnableScheduling @Order(1) @Slf4j public class IecApplication implements CommandLineRunner { public static void main(String[] args) { TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai")); SpringApplication.run(IecApplication.class, args); } @Override public void run(String... args) throws Exception { log.info("启动主服务,监听iec……………………………………"); Iec104Config iec104Config = new Iec104Config(); iec104Config.setFrameAmountMax((short) 1); iec104Config.setTerminnalAddress((short) 1); Iec104MasterFactory.createTcpClientMaster(Iec104Util.host, Iec104Util.port).setDataHandler(new MasterSysDataHandler()).setConfig(iec104Config).run(); Thread.sleep(1000000); } }