diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTDeviceConnectionControl.java b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTDeviceConnectionControl.java index 0510048fa..167873c6a 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTDeviceConnectionControl.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTDeviceConnectionControl.java @@ -128,4 +128,19 @@ public class JTDeviceConnectionControl { public void setTimeLimit(Long timeLimit) { this.timeLimit = timeLimit; } + + @Override + public String toString() { + return "JTDeviceConnectionControl{" + + "switchOn=" + switchOn + + ", authentication='" + authentication + '\'' + + ", name='" + name + '\'' + + ", username='" + username + '\'' + + ", password='" + password + '\'' + + ", address='" + address + '\'' + + ", tcpPort=" + tcpPort + + ", udpPort=" + udpPort + + ", timeLimit=" + timeLimit + + '}'; + } } diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/controller/ConnectionControlParam.java b/src/main/java/com/genersoft/iot/vmp/jt1078/controller/ConnectionControlParam.java new file mode 100644 index 000000000..21cd7a6fa --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/controller/ConnectionControlParam.java @@ -0,0 +1,33 @@ +package com.genersoft.iot.vmp.jt1078.controller; + +import com.genersoft.iot.vmp.jt1078.bean.JTDeviceConnectionControl; + +public class ConnectionControlParam { + + private String deviceId; + private JTDeviceConnectionControl control; + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public JTDeviceConnectionControl getControl() { + return control; + } + + public void setControl(JTDeviceConnectionControl control) { + this.control = control; + } + + @Override + public String toString() { + return "ConnectionControlParam{" + + "deviceId='" + deviceId + '\'' + + ", control=" + control + + '}'; + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/controller/JT1078Controller.java b/src/main/java/com/genersoft/iot/vmp/jt1078/controller/JT1078Controller.java index c29319090..31c51b419 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/controller/JT1078Controller.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/controller/JT1078Controller.java @@ -5,6 +5,7 @@ import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.conf.security.JwtUtils; import com.genersoft.iot.vmp.jt1078.bean.JTDevice; import com.genersoft.iot.vmp.jt1078.bean.JTDeviceConfig; +import com.genersoft.iot.vmp.jt1078.bean.JTDeviceConnectionControl; import com.genersoft.iot.vmp.jt1078.proc.request.J1205; import com.genersoft.iot.vmp.jt1078.service.Ijt1078Service; import com.genersoft.iot.vmp.service.bean.InviteErrorCode; @@ -331,5 +332,14 @@ public class JT1078Controller { service.setConfig(config.getDeviceId(), config.getConfig()); } + @Operation(summary = "终端控制", security = @SecurityRequirement(name = JwtUtils.HEADER)) + @Parameter(name = "control", description = "终端控制参数", required = true) + @PostMapping("/control/connection") + public void connectionControl(@RequestBody ConnectionControlParam control){ + + logger.info("[1078-终端控制] 参数: {}", control.toString()); + service.connectionControl(, config.getConfig()); + } + } diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/proc/response/J8105.java b/src/main/java/com/genersoft/iot/vmp/jt1078/proc/response/J8105.java index 00c2354f5..d691c790c 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/proc/response/J8105.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/proc/response/J8105.java @@ -5,6 +5,7 @@ import com.genersoft.iot.vmp.jt1078.bean.JTDeviceConnectionControl; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; +import java.nio.charset.Charset; import java.util.Arrays; /** @@ -40,11 +41,17 @@ public class J8105 extends Rs { stringBuffer.append("1"); }else { stringBuffer.append("0"); - + stringBuffer.append(";" + connectionControl.getAuthentication()) + .append(";" + connectionControl.getName()) + .append(";" + connectionControl.getUsername()) + .append(";" + connectionControl.getPassword()) + .append(";" + connectionControl.getAddress()) + .append(";" + connectionControl.getTcpPort()) + .append(";" + connectionControl.getUdpPort()) + .append(";" + connectionControl.getTimeLimit()); } - } - stringBuffer.append() + byteBuf.writeCharSequence(stringBuffer.toString(), Charset.forName("GBK")); } return byteBuf; } @@ -75,8 +82,10 @@ public class J8105 extends Rs { @Override public String toString() { - return "J8106{" + - "params=" + Arrays.toString(params) + + return "J8105{" + + "connectionControl=" + connectionControl + + ", reset=" + reset + + ", factoryReset=" + factoryReset + '}'; } }