1078-设置终端参数-添加接口

This commit is contained in:
648540858
2024-04-29 23:06:15 +08:00
parent 5a392372cb
commit 5b489d7c26
5 changed files with 56 additions and 2 deletions

View File

@@ -332,7 +332,7 @@ public class JT1078Controller {
service.setConfig(config.getDeviceId(), config.getConfig());
}
@Operation(summary = "终端控制", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "终端控制-连接", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "control", description = "终端控制参数", required = true)
@PostMapping("/control/connection")
public void connectionControl(@RequestBody ConnectionControlParam control){
@@ -341,5 +341,23 @@ public class JT1078Controller {
service.connectionControl(control.getDeviceId(), control.getControl());
}
@Operation(summary = "终端控制-复位", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "control", description = "终端控制参数", required = true)
@PostMapping("/control/reset")
public void resetControl(String deviceId){
logger.info("[1078-复位] deviceId: {}", deviceId);
service.resetControl(deviceId);
}
@Operation(summary = "终端控制-恢复出厂设置", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "control", description = "终端控制参数", required = true)
@PostMapping("/control/factory-reset")
public void factoryResetControl(String deviceId){
logger.info("[1078-恢复出厂设置] deviceId: {}", deviceId);
service.factoryResetControl(deviceId);
}
}

View File

@@ -98,7 +98,6 @@ public class J8103 extends Rs {
}catch (Exception e) {
log.error("[设置终端参数 ] 编码失败", e );
}
}
}
System.out.println(ByteBufUtil.hexDump(buffer));

View File

@@ -0,0 +1,19 @@
package com.genersoft.iot.vmp.jt1078.proc.response;
import com.genersoft.iot.vmp.jt1078.annotation.MsgId;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
/**
* 查询终端属性
*/
@MsgId(id = "8107")
public class J8107 extends Rs {
@Override
public ByteBuf encode() {
ByteBuf buffer = Unpooled.buffer();
return buffer;
}
}

View File

@@ -48,4 +48,8 @@ public interface Ijt1078Service {
void setConfig(String deviceId, JTDeviceConfig config);
void connectionControl(String deviceId, JTDeviceConnectionControl control);
void resetControl(String deviceId);
void factoryResetControl(String deviceId);
}

View File

@@ -534,4 +534,18 @@ public class jt1078ServiceImpl implements Ijt1078Service {
j8105.setConnectionControl(control);
jt1078Template.deviceControl(deviceId, j8105, 6);
}
@Override
public void resetControl(String deviceId) {
J8105 j8105 = new J8105();
j8105.setReset(true);
jt1078Template.deviceControl(deviceId, j8105, 6);
}
@Override
public void factoryResetControl(String deviceId) {
J8105 j8105 = new J8105();
j8105.setFactoryReset(true);
jt1078Template.deviceControl(deviceId, j8105, 6);
}
}