调整设备控制相关的接口
This commit is contained in:
@@ -66,9 +66,8 @@ public class DeviceConfig {
|
||||
"SVAC编码配置:SVACEncodeConfig, " +
|
||||
"SVAC解码配置:SVACDecodeConfig。" +
|
||||
"可同时查询多个配置类型,各类型以“/”分隔,")
|
||||
@GetMapping("/query/{deviceId}/{configType}")
|
||||
public DeferredResult<WVPResult<Object>> configDownloadApi(@PathVariable String deviceId,
|
||||
@PathVariable String configType,
|
||||
@GetMapping("/query")
|
||||
public DeferredResult<WVPResult<Object>> configDownloadApi(String deviceId,String configType,
|
||||
@RequestParam(required = false) String channelId) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("设备配置查询请求API调用");
|
||||
|
||||
@@ -44,50 +44,44 @@ public class DeviceControl {
|
||||
deviceService.teleboot(device);
|
||||
}
|
||||
|
||||
/**
|
||||
* 录像控制命令API接口
|
||||
*
|
||||
* @param deviceId 设备ID
|
||||
* @param recordCmdStr Record:手动录像,StopRecord:停止手动录像
|
||||
* @param channelId 通道编码(可选)
|
||||
*/
|
||||
|
||||
@Operation(summary = "录像控制", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "recordCmdStr", description = "命令, 可选值:Record(手动录像),StopRecord(停止手动录像)", required = true)
|
||||
@GetMapping("/record/{deviceId}/{recordCmdStr}")
|
||||
public DeferredResult<WVPResult<String>> recordApi(@PathVariable String deviceId,
|
||||
@PathVariable String recordCmdStr, String channelId) {
|
||||
@GetMapping("/record")
|
||||
public DeferredResult<WVPResult<String>> recordApi(String deviceId, String recordCmdStr, String channelId) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("开始/停止录像API调用");
|
||||
}
|
||||
Device device = deviceService.getDeviceByDeviceId(deviceId);
|
||||
Assert.notNull(device, "设备不存在");
|
||||
DeferredResult<WVPResult<String>> result = deviceService.record(device, channelId, recordCmdStr);
|
||||
result.onTimeout(() -> {
|
||||
log.warn("[开始/停止录像] 操作超时, 设备未返回应答指令, {}", deviceId);
|
||||
result.setResult(WVPResult.fail(ErrorCode.ERROR100.getCode(), "操作超时, 设备未应答"));
|
||||
DeferredResult<WVPResult<String>> deferredResult = new DeferredResult<>();
|
||||
|
||||
deviceService.record(device, channelId, recordCmdStr, (code, msg, data) -> {
|
||||
deferredResult.setResult(new WVPResult<>(code, msg, data));
|
||||
});
|
||||
return result;
|
||||
deferredResult.onTimeout(() -> {
|
||||
log.warn("[开始/停止录像] 操作超时, 设备未返回应答指令, {}", deviceId);
|
||||
deferredResult.setResult(WVPResult.fail(ErrorCode.ERROR100.getCode(), "操作超时, 设备未应答"));
|
||||
});
|
||||
return deferredResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 报警布防/撤防命令API接口
|
||||
*
|
||||
* @param deviceId 设备ID
|
||||
* @param guardCmdStr SetGuard:布防,ResetGuard:撤防
|
||||
*/
|
||||
@Operation(summary = "布防/撤防命令", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Operation(summary = "布防/撤防", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "guardCmdStr", description = "命令, 可选值:SetGuard(布防),ResetGuard(撤防)", required = true)
|
||||
@GetMapping("/guard/{deviceId}/{guardCmdStr}")
|
||||
public DeferredResult<WVPResult<String>> guardApi(@PathVariable String deviceId, @PathVariable String guardCmdStr) {
|
||||
@GetMapping("/guard")
|
||||
public DeferredResult<WVPResult<String>> guardApi(String deviceId, String guardCmdStr) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("布防/撤防API调用");
|
||||
}
|
||||
Device device = deviceService.getDeviceByDeviceId(deviceId);
|
||||
Assert.notNull(device, "设备不存在");
|
||||
DeferredResult<WVPResult<String>> result = deviceService.guard(device, guardCmdStr);
|
||||
DeferredResult<WVPResult<String>> result = new DeferredResult<>();
|
||||
deviceService.guard(device, guardCmdStr, (code, msg, data) -> {
|
||||
result.setResult(new WVPResult<>(code, msg, data));
|
||||
});
|
||||
result.onTimeout(() -> {
|
||||
log.warn("[布防/撤防] 操作超时, 设备未返回应答指令, {}", deviceId);
|
||||
result.setResult(WVPResult.fail(ErrorCode.ERROR100.getCode(), "操作超时, 设备未应答"));
|
||||
@@ -95,20 +89,24 @@ public class DeviceControl {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 报警复位API接口
|
||||
*
|
||||
* @param deviceId 设备ID
|
||||
* @param alarmMethod 报警方式(可选)
|
||||
* @param alarmType 报警类型(可选)
|
||||
*/
|
||||
@Operation(summary = "报警复位", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "alarmMethod", description = "报警方式")
|
||||
@Parameter(name = "alarmType", description = "报警类型")
|
||||
@GetMapping("/reset_alarm/{deviceId}")
|
||||
public DeferredResult<WVPResult<String>> resetAlarmApi(@PathVariable String deviceId, String channelId,
|
||||
@Parameter(name = "alarmMethod", description = "报警方式, 报警方式条件(可选),取值0为全部,1为电话报警,2为设备报警,3为短信报警,4为\n" +
|
||||
"GPS报警,5为视频报警,6为设备故障报警,7其他报警;可以为直接组合如12为电话报警或设备报警")
|
||||
@Parameter(name = "alarmType", description = "报警类型, " +
|
||||
"报警类型。" +
|
||||
"报警方式为2时,不携带 AlarmType为默认的报警设备报警," +
|
||||
"携带 AlarmType取值及对应报警类型如下:" +
|
||||
"1-视频丢失报警;2-设备防拆报警;3-存储设备磁盘满报警;4-设备高温报警;5-设备低温报警。" +
|
||||
"报警方式为5时,取值如下:" +
|
||||
"1-人工视频报警;2-运动目标检测报警;3-遗留物检测报警;4-物体移除检测报警;5-绊线检测报警;" +
|
||||
"6-入侵检测报警;7-逆行检测报警;8-徘徊检测报警;9-流量统计报警;10-密度检测报警;" +
|
||||
"11-视频异常检测报警;12-快速移动报警。" +
|
||||
"报警方式为6时,取值如下:" +
|
||||
"1-存储设备磁盘故障报警;2-存储设备风扇故障报警")
|
||||
@GetMapping("/reset_alarm")
|
||||
public DeferredResult<WVPResult<String>> resetAlarm(String deviceId, String channelId,
|
||||
@RequestParam(required = false) String alarmMethod,
|
||||
@RequestParam(required = false) String alarmType) {
|
||||
if (log.isDebugEnabled()) {
|
||||
@@ -116,7 +114,10 @@ public class DeviceControl {
|
||||
}
|
||||
Device device = deviceService.getDeviceByDeviceId(deviceId);
|
||||
Assert.notNull(device, "设备不存在");
|
||||
DeferredResult<WVPResult<String>> result = deviceService.resetAlarm(device, channelId, alarmMethod, alarmType);
|
||||
DeferredResult<WVPResult<String>> result = new DeferredResult<>();
|
||||
deviceService.resetAlarm(device, channelId, alarmMethod, alarmType, (code, msg, data) -> {
|
||||
result.setResult(new WVPResult<>(code, msg, data));
|
||||
});
|
||||
result.onTimeout(() -> {
|
||||
log.warn("[布防/撤防] 操作超时, 设备未返回应答指令, {}", deviceId);
|
||||
result.setResult(WVPResult.fail(ErrorCode.ERROR100.getCode(), "操作超时, 设备未应答"));
|
||||
@@ -124,18 +125,11 @@ public class DeviceControl {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 强制关键帧API接口
|
||||
*
|
||||
* @param deviceId 设备ID
|
||||
* @param channelId 通道ID
|
||||
*/
|
||||
@Operation(summary = "强制关键帧", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号")
|
||||
@GetMapping("/i_frame/{deviceId}")
|
||||
public void iFrame(@PathVariable String deviceId,
|
||||
@RequestParam(required = false) String channelId) {
|
||||
@GetMapping("/i_frame")
|
||||
public void iFrame(String deviceId, @RequestParam(required = false) String channelId) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("强制关键帧API调用");
|
||||
}
|
||||
@@ -144,15 +138,6 @@ public class DeviceControl {
|
||||
deviceService.iFrame(device, channelId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 看守位控制命令API接口
|
||||
*
|
||||
* @param deviceId 设备ID
|
||||
* @param enabled 看守位使能1:开启,0:关闭
|
||||
* @param resetTime 自动归位时间间隔(可选)
|
||||
* @param presetIndex 调用预置位编号(可选)
|
||||
* @param channelId 通道编码(可选)
|
||||
*/
|
||||
@Operation(summary = "看守位控制", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@@ -168,7 +153,10 @@ public class DeviceControl {
|
||||
}
|
||||
Device device = deviceService.getDeviceByDeviceId(deviceId);
|
||||
Assert.notNull(device, "设备不存在");
|
||||
DeferredResult<WVPResult<String>> result = deviceService.homePosition(device, channelId, enabled, resetTime, presetIndex);
|
||||
DeferredResult<WVPResult<String>> result = new DeferredResult<>();
|
||||
deviceService.homePosition(device, channelId, enabled, resetTime, presetIndex, (code, msg, data) -> {
|
||||
result.setResult(new WVPResult<>(code, msg, data));
|
||||
});
|
||||
result.onTimeout(() -> {
|
||||
log.warn("[看守位控制] 操作超时, 设备未返回应答指令, {}", deviceId);
|
||||
result.setResult(WVPResult.fail(ErrorCode.ERROR100.getCode(), "操作超时, 设备未应答"));
|
||||
@@ -176,55 +164,39 @@ public class DeviceControl {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉框放大
|
||||
* @param deviceId 设备id
|
||||
* @param channelId 通道id
|
||||
* @param length 播放窗口长度像素值
|
||||
* @param width 播放窗口宽度像素值
|
||||
* @param midpointx 拉框中心的横轴坐标像素值
|
||||
* @param midpointy 拉框中心的纵轴坐标像素值
|
||||
* @param lengthx 拉框长度像素值
|
||||
* @param lengthy 拉框宽度像素值
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "拉框放大", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "length", description = "播放窗口长度像素值", required = true)
|
||||
@Parameter(name = "width", description = "播放窗口宽度像素值", required = true)
|
||||
@Parameter(name = "midpointx", description = "拉框中心的横轴坐标像素值", required = true)
|
||||
@Parameter(name = "midpointy", description = "拉框中心的纵轴坐标像素值", required = true)
|
||||
@Parameter(name = "lengthx", description = "拉框长度像素值", required = true)
|
||||
@Parameter(name = "lengthy", description = "lengthy", required = true)
|
||||
@Parameter(name = "lengthy", description = "拉框宽度像素值", required = true)
|
||||
@GetMapping("drag_zoom/zoom_in")
|
||||
public void dragZoomIn(@RequestParam String deviceId,
|
||||
@RequestParam(required = false) String channelId,
|
||||
public DeferredResult<WVPResult<String>> dragZoomIn(@RequestParam String deviceId, String channelId,
|
||||
@RequestParam int length,
|
||||
@RequestParam int width,
|
||||
@RequestParam int midpointx,
|
||||
@RequestParam int midpointy,
|
||||
@RequestParam int lengthx,
|
||||
@RequestParam int lengthy) throws RuntimeException {
|
||||
@RequestParam int lengthy) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(String.format("设备拉框放大 API调用,deviceId:%s ,channelId:%s ,length:%d ,width:%d ,midpointx:%d ,midpointy:%d ,lengthx:%d ,lengthy:%d",deviceId, channelId, length, width, midpointx, midpointy,lengthx, lengthy));
|
||||
}
|
||||
Device device = deviceService.getDeviceByDeviceId(deviceId);
|
||||
Assert.notNull(device, "设备不存在");
|
||||
deviceService.dragZoomIn(device, channelId, length, width, midpointx, midpointy, lengthx,lengthy);
|
||||
DeferredResult<WVPResult<String>> result = new DeferredResult<>();
|
||||
deviceService.dragZoomIn(device, channelId, length, width, midpointx, midpointy, lengthx,lengthy, (code, msg, data) -> {
|
||||
result.setResult(new WVPResult<>(code, msg, data));
|
||||
});
|
||||
result.onTimeout(() -> {
|
||||
log.warn("[设备拉框放大] 操作超时, 设备未返回应答指令, {}", deviceId);
|
||||
result.setResult(WVPResult.fail(ErrorCode.ERROR100.getCode(), "操作超时, 设备未应答"));
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉框缩小
|
||||
* @param deviceId 设备id
|
||||
* @param channelId 通道id
|
||||
* @param length 播放窗口长度像素值
|
||||
* @param width 播放窗口宽度像素值
|
||||
* @param midpointx 拉框中心的横轴坐标像素值
|
||||
* @param midpointy 拉框中心的纵轴坐标像素值
|
||||
* @param lengthx 拉框长度像素值
|
||||
* @param lengthy 拉框宽度像素值
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "拉框缩小", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号")
|
||||
@@ -235,7 +207,7 @@ public class DeviceControl {
|
||||
@Parameter(name = "lengthx", description = "拉框长度像素值", required = true)
|
||||
@Parameter(name = "lengthy", description = "拉框宽度像素值", required = true)
|
||||
@GetMapping("/drag_zoom/zoom_out")
|
||||
public void dragZoomOut(@RequestParam String deviceId,
|
||||
public DeferredResult<WVPResult<String>> dragZoomOut(@RequestParam String deviceId,
|
||||
@RequestParam(required = false) String channelId,
|
||||
@RequestParam int length,
|
||||
@RequestParam int width,
|
||||
@@ -249,6 +221,14 @@ public class DeviceControl {
|
||||
}
|
||||
Device device = deviceService.getDeviceByDeviceId(deviceId);
|
||||
Assert.notNull(device, "设备不存在");
|
||||
deviceService.dragZoomOut(device, channelId, length, width, midpointx, midpointy, lengthx,lengthy);
|
||||
DeferredResult<WVPResult<String>> result = new DeferredResult<>();
|
||||
deviceService.dragZoomOut(device, channelId, length, width, midpointx, midpointy, lengthx,lengthy, (code, msg, data) -> {
|
||||
result.setResult(new WVPResult<>(code, msg, data));
|
||||
});
|
||||
result.onTimeout(() -> {
|
||||
log.warn("[设备拉框放大] 操作超时, 设备未返回应答指令, {}", deviceId);
|
||||
result.setResult(WVPResult.fail(ErrorCode.ERROR100.getCode(), "操作超时, 设备未应答"));
|
||||
});
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,9 +14,6 @@ import com.genersoft.iot.vmp.gb28181.service.IInviteStreamService;
|
||||
import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask;
|
||||
import com.genersoft.iot.vmp.gb28181.task.impl.CatalogSubscribeTask;
|
||||
import com.genersoft.iot.vmp.gb28181.task.impl.MobilePositionSubscribeTask;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
||||
import com.genersoft.iot.vmp.service.redisMsg.IRedisRpcService;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
@@ -29,9 +26,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.compress.utils.IOUtils;
|
||||
import org.apache.ibatis.annotations.Options;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -39,17 +34,13 @@ import org.springframework.web.context.request.async.DeferredResult;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.sip.InvalidArgumentException;
|
||||
import javax.sip.SipException;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.text.ParseException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@Tag(name = "国标设备查询", description = "国标设备查询")
|
||||
@SuppressWarnings("rawtypes")
|
||||
@@ -63,12 +54,6 @@ public class DeviceQuery {
|
||||
|
||||
@Autowired
|
||||
private IInviteStreamService inviteStreamService;
|
||||
|
||||
@Autowired
|
||||
private SIPCommander cmder;
|
||||
|
||||
@Autowired
|
||||
private DeferredResultHolder resultHolder;
|
||||
|
||||
@Autowired
|
||||
private IDeviceService deviceService;
|
||||
@@ -318,8 +303,10 @@ public class DeviceQuery {
|
||||
}
|
||||
Device device = deviceService.getDeviceByDeviceId(deviceId);
|
||||
Assert.notNull(device, "设备不存在");
|
||||
|
||||
DeferredResult<WVPResult<String>> result = deviceService.deviceStatus(device);
|
||||
DeferredResult<WVPResult<String>> result = new DeferredResult<>();
|
||||
deviceService.deviceStatus(device, (code, msg, data) -> {
|
||||
result.setResult(new WVPResult<>(code, msg, data));
|
||||
});
|
||||
result.onTimeout(() -> {
|
||||
log.warn("[设备状态查询] 操作超时, 设备未返回应答指令, {}", deviceId);
|
||||
result.setResult(WVPResult.fail(ErrorCode.ERROR100.getCode(), "操作超时, 设备未应答"));
|
||||
@@ -359,8 +346,10 @@ public class DeviceQuery {
|
||||
}
|
||||
Device device = deviceService.getDeviceByDeviceId(deviceId);
|
||||
Assert.notNull(device, "设备不存在");
|
||||
|
||||
DeferredResult<WVPResult<String>> result = deviceService.deviceStatus(device);
|
||||
DeferredResult<WVPResult<String>> result = new DeferredResult<>();
|
||||
deviceService.deviceStatus(device, (code, msg, data) -> {
|
||||
result.setResult(new WVPResult<>(code, msg, data));
|
||||
});
|
||||
result.onTimeout(() -> {
|
||||
log.warn("[设备报警查询] 操作超时, 设备未返回应答指令, {}", deviceId);
|
||||
result.setResult(WVPResult.fail(ErrorCode.ERROR100.getCode(), "操作超时, 设备未应答"));
|
||||
|
||||
Reference in New Issue
Block a user