优化架构,获取设备注册时的设备相关信息

This commit is contained in:
648540858
2024-03-12 17:32:10 +08:00
parent 79dc7e79d2
commit 9494b6dc85
15 changed files with 209 additions and 6 deletions

View File

@@ -2,8 +2,10 @@ package com.genersoft.iot.vmp.jt1078.config;
import com.genersoft.iot.vmp.jt1078.cmd.JT1078Template;
import com.genersoft.iot.vmp.jt1078.codec.netty.TcpServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
@@ -18,9 +20,12 @@ import org.springframework.core.annotation.Order;
@ConditionalOnProperty(value = "jt1078.enable", havingValue = "true")
public class JT1078AutoConfiguration {
@Autowired
private ApplicationEventPublisher applicationEventPublisher;
@Bean(initMethod = "start", destroyMethod = "stop")
public TcpServer jt1078Server(@Value("${jt1078.port}") Integer port) {
return new TcpServer(port);
return new TcpServer(port, applicationEventPublisher);
}
@Bean

View File

@@ -33,7 +33,7 @@ public class JT1078Controller {
public WVPResult<?> startLive(@PathVariable String deviceId, @PathVariable String channelId) {
J9101 j9101 = new J9101();
j9101.setChannel(Integer.valueOf(channelId));
j9101.setIp("192.168.1.1");
j9101.setIp("192.168.1.3");
j9101.setRate(1);
j9101.setTcpPort(7618);
j9101.setUdpPort(7618);