1078-添加设备控制

This commit is contained in:
648540858
2024-04-29 22:12:27 +08:00
parent 516c5ce3d1
commit 8aa97ba695
4 changed files with 72 additions and 5 deletions

View File

@@ -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 +
'}';
}
}

View File

@@ -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 +
'}';
}
}

View File

@@ -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());
}
}

View File

@@ -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 +
'}';
}
}