mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-20 12:27:49 +08:00
Merge branch 'master' into 重构/1078
# Conflicts: # src/main/java/com/genersoft/iot/vmp/common/enums/ChannelDataType.java # src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelPlayService.java # src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelPlayServiceImpl.java
This commit is contained in:
commit
333965255f
@ -4,20 +4,18 @@ package com.genersoft.iot.vmp.common.enums;
|
||||
* 支持的通道数据类型
|
||||
*/
|
||||
|
||||
public enum ChannelDataType {
|
||||
public class ChannelDataType {
|
||||
|
||||
GB28181(1,"国标28181"),
|
||||
STREAM_PUSH(2,"推流设备"),
|
||||
STREAM_PROXY(3,"拉流代理"),
|
||||
JT_1078(200,"部标设备"),
|
||||
;
|
||||
public final static int GB28181 = 1;
|
||||
public final static int STREAM_PUSH = 2;
|
||||
public final static int STREAM_PROXY = 3;
|
||||
public final static int JT_1078 = 200;
|
||||
|
||||
public final static String PLAY_SERVICE = "sourceChannelPlayService";
|
||||
public final static String PLAYBACK_SERVICE = "sourceChannelPlaybackService";
|
||||
public final static String DOWNLOAD_SERVICE = "sourceChannelDownloadService";
|
||||
public final static String PTZ_SERVICE = "sourceChannelPTZService";
|
||||
|
||||
public final int value;
|
||||
|
||||
public final String desc;
|
||||
|
||||
ChannelDataType(Integer value, String desc) {
|
||||
this.value = value;
|
||||
this.desc = desc;
|
||||
}
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ public class DeviceChannel extends CommonGBChannel {
|
||||
@Schema(description = "通道类型, 默认0, 0: 普通通道,1 行政区划 2 业务分组/虚拟组织")
|
||||
private int channelType;
|
||||
|
||||
private Integer dataType = ChannelDataType.GB28181.value;
|
||||
private Integer dataType = ChannelDataType.GB28181;
|
||||
|
||||
public void setPtzType(int ptzType) {
|
||||
this.ptzType = ptzType;
|
||||
@ -255,7 +255,7 @@ public class DeviceChannel extends CommonGBChannel {
|
||||
commonGBChannel.setGbId(id);
|
||||
commonGBChannel.setGbDeviceId(deviceId);
|
||||
commonGBChannel.setGbName(name);
|
||||
commonGBChannel.setDataType(ChannelDataType.GB28181.value);
|
||||
commonGBChannel.setDataType(ChannelDataType.GB28181);
|
||||
commonGBChannel.setDataDeviceId(getDataDeviceId());
|
||||
return commonGBChannel;
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ public class FrontEndControlCodeForAuxiliary implements IFrontEndControlCode {
|
||||
}
|
||||
|
||||
/**
|
||||
* 辅助开关控制指令: 1为开, 2为关, 3为设置自动扫描右边界, 4为设置自动扫描速度
|
||||
* 辅助开关控制指令: 1为开, 2为关
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
@ -27,6 +27,13 @@ public class FrontEndControlCodeForPreset implements IFrontEndControlCode {
|
||||
@Setter
|
||||
private Integer presetId;
|
||||
|
||||
/**
|
||||
* 预置位名称
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
private String presetName;
|
||||
|
||||
|
||||
@Override
|
||||
public String encode() {
|
||||
|
||||
@ -14,7 +14,7 @@ public class FrontEndControlCodeForScan implements IFrontEndControlCode {
|
||||
}
|
||||
|
||||
/**
|
||||
* 预置位指令: 1为开始自动扫描, 2为设置自动扫描左边界, 3为设置自动扫描右边界, 4为设置自动扫描速度
|
||||
* 预置位指令: 1为开始自动扫描, 2为设置自动扫描左边界, 3为设置自动扫描右边界, 4为设置自动扫描速度, 5为停止自动扫描
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
@ -14,7 +14,7 @@ public class FrontEndControlCodeForTour implements IFrontEndControlCode {
|
||||
}
|
||||
|
||||
/**
|
||||
* 巡航指令: 1为加入巡航点, 2为删除一个巡航点, 3为设置巡航速度, 4为设置巡航停留时间, 5为开始巡航
|
||||
* 巡航指令: 1为加入巡航点, 2为删除一个巡航点, 3为设置巡航速度, 4为设置巡航停留时间, 5为开始巡航, 6为停止巡航
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
package com.genersoft.iot.vmp.gb28181.bean;
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
public class FrontEndControlCodeForWiper implements IFrontEndControlCode {
|
||||
|
||||
private final FrontEndControlType type = FrontEndControlType.AUXILIARY;
|
||||
|
||||
@Override
|
||||
public FrontEndControlType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 辅助开关控制指令: 1为开, 2为关
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
private Integer code;
|
||||
|
||||
@Override
|
||||
public String encode() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@ -41,7 +41,7 @@ import java.util.List;
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping(value = "/api/common/channel")
|
||||
public class CommonChannelController {
|
||||
public class ChannelController {
|
||||
|
||||
@Autowired
|
||||
private IRedisCatchStorage redisCatchStorage;
|
||||
@ -0,0 +1,601 @@
|
||||
package com.genersoft.iot.vmp.gb28181.controller;
|
||||
|
||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IGbChannelControlService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.context.request.async.DeferredResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Tag(name = "全局通道前端控制")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping(value = "/api/common/channel/front-end")
|
||||
public class ChannelFrontEndController {
|
||||
|
||||
@Autowired
|
||||
private IGbChannelService channelService;
|
||||
|
||||
@Autowired
|
||||
private IGbChannelControlService channelControlService;
|
||||
|
||||
|
||||
@Operation(summary = "云台控制", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "channelId", description = "通道ID", required = true)
|
||||
@Parameter(name = "command", description = "控制指令,允许值: left, right, up, down, upleft, upright, downleft, downright, zoomin, zoomout, stop", required = true)
|
||||
@Parameter(name = "panSpeed", description = "水平速度(0-100)", required = true)
|
||||
@Parameter(name = "tiltSpeed", description = "垂直速度(0-100)", required = true)
|
||||
@Parameter(name = "zoomSpeed", description = "缩放速度(0-100)", required = true)
|
||||
@GetMapping("/ptz")
|
||||
public DeferredResult<WVPResult<String>> ptz(Integer channelId, String command, Integer panSpeed, Integer tiltSpeed, Integer zoomSpeed){
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("[通用通道]云台控制 API调用,channelId:{} ,command:{} ,panSpeed:{} ,tiltSpeed:{} ,zoomSpeed:{}",channelId, command, panSpeed, tiltSpeed, zoomSpeed);
|
||||
}
|
||||
|
||||
CommonGBChannel channel = channelService.getOne(channelId);
|
||||
Assert.notNull(channel, "通道不存在");
|
||||
|
||||
if (panSpeed == null) {
|
||||
panSpeed = 50;
|
||||
}else if (panSpeed < 0 || panSpeed > 100) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "panSpeed 为 0-100的数字");
|
||||
}
|
||||
if (tiltSpeed == null) {
|
||||
tiltSpeed = 50;
|
||||
}else if (tiltSpeed < 0 || tiltSpeed > 100) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "tiltSpeed 为 0-100的数字");
|
||||
}
|
||||
if (zoomSpeed == null) {
|
||||
zoomSpeed = 50;
|
||||
}else if (zoomSpeed < 0 || zoomSpeed > 100) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "zoomSpeed 为 0-100的数字");
|
||||
}
|
||||
|
||||
FrontEndControlCodeForPTZ controlCode = new FrontEndControlCodeForPTZ();
|
||||
controlCode.setPanSpeed(panSpeed);
|
||||
controlCode.setTiltSpeed(tiltSpeed);
|
||||
controlCode.setZoomSpeed(zoomSpeed);
|
||||
switch (command){
|
||||
case "left":
|
||||
controlCode.setPan(0);
|
||||
break;
|
||||
case "right":
|
||||
controlCode.setPan(1);
|
||||
break;
|
||||
case "up":
|
||||
controlCode.setTilt(0);
|
||||
break;
|
||||
case "down":
|
||||
controlCode.setTilt(1);
|
||||
break;
|
||||
case "upleft":
|
||||
controlCode.setPan(0);
|
||||
controlCode.setTilt(0);
|
||||
break;
|
||||
case "upright":
|
||||
controlCode.setTilt(0);
|
||||
controlCode.setPan(1);
|
||||
break;
|
||||
case "downleft":
|
||||
controlCode.setPan(0);
|
||||
controlCode.setTilt(1);
|
||||
break;
|
||||
case "downright":
|
||||
controlCode.setTilt(1);
|
||||
controlCode.setPan(1);
|
||||
break;
|
||||
case "zoomin":
|
||||
controlCode.setZoom(1);
|
||||
break;
|
||||
case "zoomout":
|
||||
controlCode.setZoom(0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
DeferredResult<WVPResult<String>> result = new DeferredResult<>();
|
||||
|
||||
result.onTimeout(()->{
|
||||
WVPResult<String> wvpResult = WVPResult.fail(ErrorCode.ERROR100.getCode(), "请求超时");
|
||||
result.setResult(wvpResult);
|
||||
});
|
||||
|
||||
channelControlService.ptz(channel, controlCode, (code, msg, data) -> {
|
||||
WVPResult<String> wvpResult = new WVPResult<>();
|
||||
wvpResult.setCode(code);
|
||||
wvpResult.setMsg(msg);
|
||||
wvpResult.setData(data);
|
||||
result.setResult(wvpResult);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "光圈控制", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "command", description = "控制指令,允许值: in, out, stop", required = true)
|
||||
@Parameter(name = "speed", description = "光圈速度(0-100)", required = true)
|
||||
@GetMapping("/fi/iris")
|
||||
public DeferredResult<WVPResult<String>> iris(Integer channelId, String command, Integer speed){
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("[通用通道]光圈控制 API调用,channelId:{} ,command:{} ,speed:{} ",channelId, command, speed);
|
||||
}
|
||||
|
||||
CommonGBChannel channel = channelService.getOne(channelId);
|
||||
Assert.notNull(channel, "通道不存在");
|
||||
|
||||
if (speed == null) {
|
||||
speed = 50;
|
||||
}else if (speed < 0 || speed > 100) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "speed 为 0-100的数字");
|
||||
}
|
||||
|
||||
FrontEndControlCodeForFI controlCode = new FrontEndControlCodeForFI();
|
||||
controlCode.setIrisSpeed(speed);
|
||||
|
||||
switch (command){
|
||||
case "in":
|
||||
controlCode.setIris(1);
|
||||
break;
|
||||
case "out":
|
||||
controlCode.setIris(0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
DeferredResult<WVPResult<String>> result = new DeferredResult<>();
|
||||
|
||||
result.onTimeout(()->{
|
||||
WVPResult<String> wvpResult = WVPResult.fail(ErrorCode.ERROR100.getCode(), "请求超时");
|
||||
result.setResult(wvpResult);
|
||||
});
|
||||
|
||||
ErrorCallback<String> callback = (code, msg, data) -> {
|
||||
WVPResult<String> wvpResult = new WVPResult<>();
|
||||
wvpResult.setCode(code);
|
||||
wvpResult.setMsg(msg);
|
||||
wvpResult.setData(data);
|
||||
result.setResult(wvpResult);
|
||||
};
|
||||
|
||||
channelControlService.fi(channel, controlCode, callback);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Operation(summary = "聚焦控制", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "command", description = "控制指令,允许值: near, far, stop", required = true)
|
||||
@Parameter(name = "speed", description = "聚焦速度(0-100)", required = true)
|
||||
@GetMapping("/fi/focus")
|
||||
public DeferredResult<WVPResult<String>> focus(Integer channelId, String command, Integer speed){
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("[通用通道]聚焦控制 API调用,channelId:{} ,command:{} ,speed:{} ", channelId, command, speed);
|
||||
}
|
||||
|
||||
if (speed == null) {
|
||||
speed = 50;
|
||||
}else if (speed < 0 || speed > 100) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "speed 为 0-100的数字");
|
||||
}
|
||||
|
||||
CommonGBChannel channel = channelService.getOne(channelId);
|
||||
Assert.notNull(channel, "通道不存在");
|
||||
|
||||
FrontEndControlCodeForFI controlCode = new FrontEndControlCodeForFI();
|
||||
controlCode.setFocusSpeed(speed);
|
||||
switch (command){
|
||||
case "near":
|
||||
controlCode.setFocus(0);
|
||||
break;
|
||||
case "far":
|
||||
controlCode.setFocus(1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
DeferredResult<WVPResult<String>> result = new DeferredResult<>();
|
||||
|
||||
result.onTimeout(()->{
|
||||
WVPResult<String> wvpResult = WVPResult.fail(ErrorCode.ERROR100.getCode(), "请求超时");
|
||||
result.setResult(wvpResult);
|
||||
});
|
||||
|
||||
ErrorCallback<String> callback = (code, msg, data) -> {
|
||||
WVPResult<String> wvpResult = new WVPResult<>();
|
||||
wvpResult.setCode(code);
|
||||
wvpResult.setMsg(msg);
|
||||
wvpResult.setData(data);
|
||||
result.setResult(wvpResult);
|
||||
};
|
||||
|
||||
channelControlService.fi(channel, controlCode, callback);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Operation(summary = "查询预置位", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@GetMapping("/preset/query")
|
||||
public DeferredResult<WVPResult<List<Preset>>> queryPreset(Integer channelId) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("[通用通道] 预置位查询API调用, {}", channelId);
|
||||
}
|
||||
|
||||
CommonGBChannel channel = channelService.getOne(channelId);
|
||||
Assert.notNull(channel, "通道不存在");
|
||||
|
||||
DeferredResult<WVPResult<List<Preset>>> result = new DeferredResult<>();
|
||||
|
||||
result.onTimeout(()->{
|
||||
WVPResult<List<Preset>> wvpResult = WVPResult.fail(ErrorCode.ERROR100.getCode(), "请求超时");
|
||||
result.setResult(wvpResult);
|
||||
});
|
||||
|
||||
ErrorCallback<List<Preset>> callback = (code, msg, data) -> {
|
||||
WVPResult<List<Preset>> wvpResult = new WVPResult<>();
|
||||
wvpResult.setCode(code);
|
||||
wvpResult.setMsg(msg);
|
||||
wvpResult.setData(data);
|
||||
result.setResult(wvpResult);
|
||||
};
|
||||
|
||||
channelControlService.queryPreset(channel, callback);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private DeferredResult<WVPResult<String>> controlPreset(Integer channelId, FrontEndControlCodeForPreset controlCode) {
|
||||
CommonGBChannel channel = channelService.getOne(channelId);
|
||||
Assert.notNull(channel, "通道不存在");
|
||||
|
||||
|
||||
DeferredResult<WVPResult<String>> result = new DeferredResult<>();
|
||||
|
||||
result.onTimeout(()->{
|
||||
WVPResult<String> wvpResult = WVPResult.fail(ErrorCode.ERROR100.getCode(), "请求超时");
|
||||
result.setResult(wvpResult);
|
||||
});
|
||||
|
||||
ErrorCallback<String> callback = (code, msg, data) -> {
|
||||
WVPResult<String> wvpResult = new WVPResult<>();
|
||||
wvpResult.setCode(code);
|
||||
wvpResult.setMsg(msg);
|
||||
wvpResult.setData(data);
|
||||
result.setResult(wvpResult);
|
||||
};
|
||||
|
||||
channelControlService.preset(channel, controlCode, callback);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Operation(summary = "预置位指令-设置预置位", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "presetId", description = "预置位编号", required = true)
|
||||
@Parameter(name = "presetName", description = "预置位名称", required = true)
|
||||
@GetMapping("/preset/add")
|
||||
public DeferredResult<WVPResult<String>> addPreset(Integer channelId, Integer presetId, String presetName) {
|
||||
FrontEndControlCodeForPreset controlCode = new FrontEndControlCodeForPreset();
|
||||
controlCode.setCode(1);
|
||||
controlCode.setPresetId(presetId);
|
||||
controlCode.setPresetName(presetName);
|
||||
|
||||
return controlPreset(channelId, controlCode);
|
||||
}
|
||||
|
||||
@Operation(summary = "预置位指令-调用预置位", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "presetId", description = "预置位编号(1-100)", required = true)
|
||||
@GetMapping("/preset/call")
|
||||
public DeferredResult<WVPResult<String>> callPreset(Integer channelId, Integer presetId) {
|
||||
FrontEndControlCodeForPreset controlCode = new FrontEndControlCodeForPreset();
|
||||
controlCode.setCode(2);
|
||||
controlCode.setPresetId(presetId);
|
||||
|
||||
return controlPreset(channelId, controlCode);
|
||||
}
|
||||
|
||||
@Operation(summary = "预置位指令-删除预置位", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "presetId", description = "预置位编号(1-100)", required = true)
|
||||
@GetMapping("/preset/delete")
|
||||
public DeferredResult<WVPResult<String>> deletePreset(Integer channelId, Integer presetId) {
|
||||
|
||||
FrontEndControlCodeForPreset controlCode = new FrontEndControlCodeForPreset();
|
||||
controlCode.setCode(3);
|
||||
controlCode.setPresetId(presetId);
|
||||
|
||||
return controlPreset(channelId, controlCode);
|
||||
}
|
||||
|
||||
private DeferredResult<WVPResult<String>> tourControl(Integer channelId, FrontEndControlCodeForTour controlCode) {
|
||||
CommonGBChannel channel = channelService.getOne(channelId);
|
||||
Assert.notNull(channel, "通道不存在");
|
||||
|
||||
DeferredResult<WVPResult<String>> result = new DeferredResult<>();
|
||||
|
||||
result.onTimeout(()->{
|
||||
WVPResult<String> wvpResult = WVPResult.fail(ErrorCode.ERROR100.getCode(), "请求超时");
|
||||
result.setResult(wvpResult);
|
||||
});
|
||||
|
||||
ErrorCallback<String> callback = (code, msg, data) -> {
|
||||
WVPResult<String> wvpResult = new WVPResult<>();
|
||||
wvpResult.setCode(code);
|
||||
wvpResult.setMsg(msg);
|
||||
wvpResult.setData(data);
|
||||
result.setResult(wvpResult);
|
||||
};
|
||||
|
||||
channelControlService.tour(channel, controlCode, callback);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Operation(summary = "巡航指令-加入巡航点", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "tourId", description = "巡航组号", required = true)
|
||||
@Parameter(name = "presetId", description = "预置位编号", required = true)
|
||||
@GetMapping("/tour/point/add")
|
||||
public DeferredResult<WVPResult<String>> addTourPoint(Integer channelId, Integer tourId, Integer presetId) {
|
||||
|
||||
FrontEndControlCodeForTour controlCode = new FrontEndControlCodeForTour();
|
||||
controlCode.setCode(1);
|
||||
controlCode.setPresetId(presetId);
|
||||
controlCode.setTourId(tourId);
|
||||
|
||||
return tourControl(channelId, controlCode);
|
||||
}
|
||||
|
||||
@Operation(summary = "巡航指令-删除一个巡航点", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "tourId", description = "巡航组号(1-100)", required = true)
|
||||
@Parameter(name = "presetId", description = "预置位编号(0-100, 为0时删除整个巡航)", required = true)
|
||||
@GetMapping("/tour/point/delete")
|
||||
public DeferredResult<WVPResult<String>> deleteCruisePoint(Integer channelId, Integer tourId, Integer presetId) {
|
||||
FrontEndControlCodeForTour controlCode = new FrontEndControlCodeForTour();
|
||||
controlCode.setCode(2);
|
||||
controlCode.setPresetId(presetId);
|
||||
controlCode.setTourId(tourId);
|
||||
|
||||
return tourControl(channelId, controlCode);
|
||||
}
|
||||
|
||||
@Operation(summary = "巡航指令-设置巡航速度", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "tourId", description = "巡航组号(0-100)", required = true)
|
||||
@Parameter(name = "speed", description = "巡航速度(1-4095)", required = true)
|
||||
@Parameter(name = "presetId", description = "预置位编号", required = true)
|
||||
@GetMapping("/tour/speed")
|
||||
public DeferredResult<WVPResult<String>> setCruiseSpeed(Integer channelId, Integer tourId, Integer speed, Integer presetId) {
|
||||
FrontEndControlCodeForTour controlCode = new FrontEndControlCodeForTour();
|
||||
controlCode.setCode(3);
|
||||
controlCode.setTourSpeed(speed);
|
||||
controlCode.setTourId(tourId);
|
||||
controlCode.setPresetId(presetId);
|
||||
return tourControl(channelId, controlCode);
|
||||
}
|
||||
|
||||
@Operation(summary = "巡航指令-设置巡航停留时间", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "tourId", description = "巡航组号", required = true)
|
||||
@Parameter(name = "time", description = "巡航停留时间(1-4095)", required = true)
|
||||
@Parameter(name = "presetId", description = "预置位编号", required = true)
|
||||
@GetMapping("/tour/time")
|
||||
public DeferredResult<WVPResult<String>> setCruiseTime(Integer channelId, Integer tourId, Integer time, Integer presetId) {
|
||||
FrontEndControlCodeForTour controlCode = new FrontEndControlCodeForTour();
|
||||
controlCode.setCode(4);
|
||||
controlCode.setTourTime(time);
|
||||
controlCode.setTourId(tourId);
|
||||
controlCode.setPresetId(presetId);
|
||||
return tourControl(channelId, controlCode);
|
||||
}
|
||||
|
||||
@Operation(summary = "巡航指令-开始巡航", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "tourId", description = "巡航组号)", required = true)
|
||||
@GetMapping("/tour/start")
|
||||
public DeferredResult<WVPResult<String>> startCruise(Integer channelId, Integer tourId) {
|
||||
FrontEndControlCodeForTour controlCode = new FrontEndControlCodeForTour();
|
||||
controlCode.setCode(5);
|
||||
controlCode.setTourId(tourId);
|
||||
return tourControl(channelId, controlCode);
|
||||
}
|
||||
|
||||
@Operation(summary = "巡航指令-停止巡航", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "tourId", description = "巡航组号", required = true)
|
||||
@GetMapping("/tour/stop")
|
||||
public DeferredResult<WVPResult<String>> stopCruise(Integer channelId, Integer tourId) {
|
||||
FrontEndControlCodeForTour controlCode = new FrontEndControlCodeForTour();
|
||||
controlCode.setCode(6);
|
||||
controlCode.setTourId(tourId);
|
||||
return tourControl(channelId, controlCode);
|
||||
}
|
||||
|
||||
private DeferredResult<WVPResult<String>> scanControl(Integer channelId, FrontEndControlCodeForScan controlCode) {
|
||||
|
||||
CommonGBChannel channel = channelService.getOne(channelId);
|
||||
Assert.notNull(channel, "通道不存在");
|
||||
DeferredResult<WVPResult<String>> result = new DeferredResult<>();
|
||||
|
||||
result.onTimeout(()->{
|
||||
WVPResult<String> wvpResult = WVPResult.fail(ErrorCode.ERROR100.getCode(), "请求超时");
|
||||
result.setResult(wvpResult);
|
||||
});
|
||||
|
||||
ErrorCallback<String> callback = (code, msg, data) -> {
|
||||
WVPResult<String> wvpResult = new WVPResult<>();
|
||||
wvpResult.setCode(code);
|
||||
wvpResult.setMsg(msg);
|
||||
wvpResult.setData(data);
|
||||
result.setResult(wvpResult);
|
||||
};
|
||||
channelControlService.scan(channel, controlCode, callback);
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
@Operation(summary = "扫描指令-开始自动扫描", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "scanId", description = "扫描组号(0-100)", required = true)
|
||||
@GetMapping("/scan/start")
|
||||
public DeferredResult<WVPResult<String>> startScan(Integer channelId, Integer scanId) {
|
||||
FrontEndControlCodeForScan controlCode = new FrontEndControlCodeForScan();
|
||||
controlCode.setCode(1);
|
||||
controlCode.setScanId(scanId);
|
||||
return scanControl(channelId, controlCode);
|
||||
|
||||
}
|
||||
|
||||
@Operation(summary = "扫描指令-停止自动扫描", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "scanId", description = "扫描组号(0-100)", required = true)
|
||||
@GetMapping("/scan/stop")
|
||||
public DeferredResult<WVPResult<String>> stopScan(Integer channelId, Integer scanId) {
|
||||
FrontEndControlCodeForScan controlCode = new FrontEndControlCodeForScan();
|
||||
controlCode.setCode(5);
|
||||
controlCode.setScanId(scanId);
|
||||
return scanControl(channelId, controlCode);
|
||||
}
|
||||
|
||||
@Operation(summary = "扫描指令-设置自动扫描左边界", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "scanId", description = "扫描组号(0-100)", required = true)
|
||||
@GetMapping("/scan/set/left")
|
||||
public DeferredResult<WVPResult<String>> setScanLeft(Integer channelId, Integer scanId) {
|
||||
FrontEndControlCodeForScan controlCode = new FrontEndControlCodeForScan();
|
||||
controlCode.setCode(2);
|
||||
controlCode.setScanId(scanId);
|
||||
return scanControl(channelId, controlCode);
|
||||
}
|
||||
|
||||
@Operation(summary = "扫描指令-设置自动扫描右边界", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "scanId", description = "扫描组号(0-100)", required = true)
|
||||
@GetMapping("/scan/set/right")
|
||||
public DeferredResult<WVPResult<String>> setScanRight(Integer channelId, Integer scanId) {
|
||||
FrontEndControlCodeForScan controlCode = new FrontEndControlCodeForScan();
|
||||
controlCode.setCode(3);
|
||||
controlCode.setScanId(scanId);
|
||||
return scanControl(channelId, controlCode);
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "扫描指令-设置自动扫描速度", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "scanId", description = "扫描组号(0-100)", required = true)
|
||||
@Parameter(name = "speed", description = "自动扫描速度(1-4095)", required = true)
|
||||
@GetMapping("/scan/set/speed")
|
||||
public DeferredResult<WVPResult<String>> setScanSpeed(Integer channelId, Integer scanId, Integer speed) {
|
||||
FrontEndControlCodeForScan controlCode = new FrontEndControlCodeForScan();
|
||||
controlCode.setCode(4);
|
||||
controlCode.setScanId(scanId);
|
||||
controlCode.setScanSpeed(speed);
|
||||
return scanControl(channelId, controlCode);
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "辅助开关控制指令-雨刷控制", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "command", description = "控制指令,允许值: on, off", required = true)
|
||||
@GetMapping("/wiper")
|
||||
public DeferredResult<WVPResult<String>> wiper(Integer channelId, String command){
|
||||
|
||||
CommonGBChannel channel = channelService.getOne(channelId);
|
||||
Assert.notNull(channel, "通道不存在");
|
||||
|
||||
FrontEndControlCodeForWiper controlCode = new FrontEndControlCodeForWiper();
|
||||
|
||||
switch (command){
|
||||
case "on":
|
||||
controlCode.setCode(1);
|
||||
break;
|
||||
case "off":
|
||||
controlCode.setCode(2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
DeferredResult<WVPResult<String>> result = new DeferredResult<>();
|
||||
|
||||
result.onTimeout(()->{
|
||||
WVPResult<String> wvpResult = WVPResult.fail(ErrorCode.ERROR100.getCode(), "请求超时");
|
||||
result.setResult(wvpResult);
|
||||
});
|
||||
|
||||
ErrorCallback<String> callback = (code, msg, data) -> {
|
||||
WVPResult<String> wvpResult = new WVPResult<>();
|
||||
wvpResult.setCode(code);
|
||||
wvpResult.setMsg(msg);
|
||||
wvpResult.setData(data);
|
||||
result.setResult(wvpResult);
|
||||
};
|
||||
|
||||
channelControlService.wiper(channel, controlCode, callback);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Operation(summary = "辅助开关控制指令", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "command", description = "控制指令,允许值: on, off", required = true)
|
||||
@Parameter(name = "auxiliaryId", description = "开关编号", required = true)
|
||||
@GetMapping("/auxiliary")
|
||||
public DeferredResult<WVPResult<String>> auxiliarySwitch(Integer channelId, String command, Integer auxiliaryId){
|
||||
|
||||
CommonGBChannel channel = channelService.getOne(channelId);
|
||||
Assert.notNull(channel, "通道不存在");
|
||||
|
||||
FrontEndControlCodeForAuxiliary controlCode = new FrontEndControlCodeForAuxiliary();
|
||||
controlCode.setAuxiliaryId(auxiliaryId);
|
||||
switch (command){
|
||||
case "on":
|
||||
controlCode.setCode(1);
|
||||
break;
|
||||
case "off":
|
||||
controlCode.setCode(2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
DeferredResult<WVPResult<String>> result = new DeferredResult<>();
|
||||
|
||||
result.onTimeout(()->{
|
||||
WVPResult<String> wvpResult = WVPResult.fail(ErrorCode.ERROR100.getCode(), "请求超时");
|
||||
result.setResult(wvpResult);
|
||||
});
|
||||
|
||||
ErrorCallback<String> callback = (code, msg, data) -> {
|
||||
WVPResult<String> wvpResult = new WVPResult<>();
|
||||
wvpResult.setCode(code);
|
||||
wvpResult.setMsg(msg);
|
||||
wvpResult.setData(data);
|
||||
result.setResult(wvpResult);
|
||||
};
|
||||
channelControlService.auxiliary(channel, controlCode, callback);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* 设备控制命令API接口
|
||||
*
|
||||
*
|
||||
* @author lawrencehj
|
||||
* @date 2021年2月1日
|
||||
*/
|
||||
@ -70,16 +70,16 @@ public class DeviceControl {
|
||||
|
||||
@Operation(summary = "布防/撤防", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "guardCmdStr", description = "命令, 可选值:SetGuard(布防),ResetGuard(撤防)", required = true)
|
||||
@Parameter(name = "guardCmd", description = "命令, 可选值:SetGuard(布防),ResetGuard(撤防)", required = true)
|
||||
@GetMapping("/guard")
|
||||
public DeferredResult<WVPResult<String>> guardApi(String deviceId, String guardCmdStr) {
|
||||
public DeferredResult<WVPResult<String>> guardApi(String deviceId, String guardCmd) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("布防/撤防API调用");
|
||||
}
|
||||
Device device = deviceService.getDeviceByDeviceId(deviceId);
|
||||
Assert.notNull(device, "设备不存在");
|
||||
DeferredResult<WVPResult<String>> result = new DeferredResult<>();
|
||||
deviceService.guard(device, guardCmdStr, (code, msg, data) -> {
|
||||
deviceService.guard(device, guardCmd, (code, msg, data) -> {
|
||||
result.setResult(new WVPResult<>(code, msg, data));
|
||||
});
|
||||
result.onTimeout(() -> {
|
||||
|
||||
@ -165,10 +165,10 @@ public class PlaybackController {
|
||||
@Operation(summary = "回放暂停", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "streamId", description = "回放流ID", required = true)
|
||||
@GetMapping("/pause/{streamId}")
|
||||
public void playPause(@PathVariable String streamId) {
|
||||
public void playbackPause(@PathVariable String streamId) {
|
||||
log.info("[回放暂停] streamId: {}", streamId);
|
||||
try {
|
||||
playService.pauseRtp(streamId);
|
||||
playService.playbackPause(streamId);
|
||||
} catch (ServiceException e) {
|
||||
throw new ControllerException(ErrorCode.ERROR400.getCode(), e.getMessage());
|
||||
} catch (InvalidArgumentException | ParseException | SipException e) {
|
||||
@ -183,7 +183,7 @@ public class PlaybackController {
|
||||
public void playResume(@PathVariable String streamId) {
|
||||
log.info("playResume: "+streamId);
|
||||
try {
|
||||
playService.resumeRtp(streamId);
|
||||
playService.playbackResume(streamId);
|
||||
} catch (ServiceException e) {
|
||||
throw new ControllerException(ErrorCode.ERROR400.getCode(), e.getMessage());
|
||||
} catch (InvalidArgumentException | ParseException | SipException e) {
|
||||
|
||||
@ -252,6 +252,7 @@ public interface DeviceMapper {
|
||||
"mobile_position_submission_interval,"+
|
||||
"subscribe_cycle_for_alarm,"+
|
||||
"ssrc_check,"+
|
||||
"media_server_id,"+
|
||||
"as_message_channel,"+
|
||||
"broadcast_push_after_ack,"+
|
||||
"geo_coord_sys,"+
|
||||
|
||||
@ -64,7 +64,7 @@ public class DeviceChannelProvider {
|
||||
public String queryChannels(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(getBaseSelectSql());
|
||||
sqlBuild.append(" where data_type = " + ChannelDataType.GB28181.value);
|
||||
sqlBuild.append(" where data_type = " + ChannelDataType.GB28181);
|
||||
if (params.get("dataDeviceId") != null) {
|
||||
sqlBuild.append(" AND dc.data_device_id = #{dataDeviceId} ");
|
||||
}
|
||||
@ -122,14 +122,14 @@ public class DeviceChannelProvider {
|
||||
public String queryChannelsByDeviceDbId(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(getBaseSelectSql());
|
||||
sqlBuild.append(" where data_type = " + ChannelDataType.GB28181.value + " and dc.data_device_id = #{dataDeviceId}");
|
||||
sqlBuild.append(" where data_type = " + ChannelDataType.GB28181 + " and dc.data_device_id = #{dataDeviceId}");
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
public String queryAllChannels(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(getBaseSelectSql());
|
||||
sqlBuild.append(" where data_type = " + ChannelDataType.GB28181.value + " and dc.data_device_id = #{dataDeviceId}");
|
||||
sqlBuild.append(" where data_type = " + ChannelDataType.GB28181 + " and dc.data_device_id = #{dataDeviceId}");
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
@ -143,25 +143,25 @@ public class DeviceChannelProvider {
|
||||
public String getOneByDeviceId(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(getBaseSelectSql());
|
||||
sqlBuild.append(" where data_type = " + ChannelDataType.GB28181.value + " and dc.data_device_id=#{dataDeviceId} and coalesce(dc.gb_device_id, dc.device_id) = #{channelId}");
|
||||
sqlBuild.append(" where data_type = " + ChannelDataType.GB28181 + " and dc.data_device_id=#{dataDeviceId} and coalesce(dc.gb_device_id, dc.device_id) = #{channelId}");
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String queryByDeviceId(Map<String, Object> params ){
|
||||
return getBaseSelectSql() + " where data_type = " + ChannelDataType.GB28181.value + " and channel_type = 0 and coalesce(gb_device_id, device_id) = #{gbDeviceId}";
|
||||
return getBaseSelectSql() + " where data_type = " + ChannelDataType.GB28181 + " and channel_type = 0 and coalesce(gb_device_id, device_id) = #{gbDeviceId}";
|
||||
}
|
||||
|
||||
public String queryById(Map<String, Object> params ){
|
||||
return getBaseSelectSql() + " where data_type = " + ChannelDataType.GB28181.value + " and channel_type = 0 and id = #{gbId}";
|
||||
return getBaseSelectSql() + " where data_type = " + ChannelDataType.GB28181 + " and channel_type = 0 and id = #{gbId}";
|
||||
}
|
||||
|
||||
|
||||
public String queryList(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(getBaseSelectSql());
|
||||
sqlBuild.append(" where channel_type = 0 and data_type = " + ChannelDataType.GB28181.value);
|
||||
sqlBuild.append(" where channel_type = 0 and data_type = " + ChannelDataType.GB28181);
|
||||
if (params.get("query") != null) {
|
||||
sqlBuild.append(" AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%')" +
|
||||
" OR coalesce(gb_name, name) LIKE concat('%',#{query},'%') )")
|
||||
|
||||
@ -200,5 +200,6 @@ public interface IDeviceService {
|
||||
|
||||
void deviceInfo(Device device, ErrorCallback<Object> callback);
|
||||
|
||||
void queryPreset(Device device, String channelId, ErrorCallback<Object> callback);
|
||||
void queryPreset(Device device, String channelId, ErrorCallback<List<Preset>> callback);
|
||||
|
||||
}
|
||||
|
||||
@ -1,16 +1,19 @@
|
||||
package com.genersoft.iot.vmp.gb28181.service;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.FrontEndControlCodeForPTZ;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IGbChannelControlService {
|
||||
|
||||
|
||||
void ptz(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback);
|
||||
void fi(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback);
|
||||
void preset(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback);
|
||||
void tour(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback);
|
||||
void scan(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback);
|
||||
void auxiliary(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback);
|
||||
void fi(CommonGBChannel channel, FrontEndControlCodeForFI frontEndControlCode, ErrorCallback<String> callback);
|
||||
void preset(CommonGBChannel channel, FrontEndControlCodeForPreset frontEndControlCode, ErrorCallback<String> callback);
|
||||
void tour(CommonGBChannel channel, FrontEndControlCodeForTour frontEndControlCode, ErrorCallback<String> callback);
|
||||
void scan(CommonGBChannel channel, FrontEndControlCodeForScan frontEndControlCode, ErrorCallback<String> callback);
|
||||
void wiper(CommonGBChannel channel, FrontEndControlCodeForWiper controlCode, ErrorCallback<String> callback);
|
||||
void auxiliary(CommonGBChannel channel, FrontEndControlCodeForAuxiliary frontEndControlCode, ErrorCallback<String> callback);
|
||||
void queryPreset(CommonGBChannel channel, ErrorCallback<List<Preset>> callback);
|
||||
}
|
||||
|
||||
@ -9,29 +9,24 @@ import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
|
||||
public interface IGbChannelPlayService {
|
||||
|
||||
void start(CommonGBChannel channel, InviteMessageInfo inviteInfo, Platform platform, ErrorCallback<StreamInfo> callback);
|
||||
void startInvite(CommonGBChannel channel, InviteMessageInfo inviteInfo, Platform platform, ErrorCallback<StreamInfo> callback);
|
||||
|
||||
void stopPlay(InviteSessionType type, CommonGBChannel channel, String stream);
|
||||
void stopInvite(InviteSessionType type, CommonGBChannel channel, String stream);
|
||||
|
||||
void playback(CommonGBChannel channel, Long startTime, Long stopTime, ErrorCallback<StreamInfo> callback);
|
||||
|
||||
void download(CommonGBChannel channel, Long startTime, Long stopTime, Integer downloadSpeed,
|
||||
ErrorCallback<StreamInfo> callback);
|
||||
|
||||
void stopPlay(CommonGBChannel channel, String stream);
|
||||
|
||||
void play(CommonGBChannel channel, Platform platform, Boolean record, ErrorCallback<StreamInfo> callback);
|
||||
|
||||
void playGbDeviceChannel(CommonGBChannel channel, Boolean record, ErrorCallback<StreamInfo> callback);
|
||||
void stopPlayback(CommonGBChannel channel, String stream);
|
||||
|
||||
void stopPlayDeviceChannel(InviteSessionType type, CommonGBChannel channel, String stream);
|
||||
void stopDownload(CommonGBChannel channel, String stream);
|
||||
|
||||
void playProxy(CommonGBChannel channel, Boolean record, ErrorCallback<StreamInfo> callback);
|
||||
void playbackPause(CommonGBChannel channel, String streamId);
|
||||
|
||||
void playJt1078(CommonGBChannel channel, Boolean record, ErrorCallback<StreamInfo> callback);
|
||||
|
||||
void stopPlayProxy(CommonGBChannel channel);
|
||||
|
||||
void playPush(CommonGBChannel channel, String platformDeviceId, String platformName, ErrorCallback<StreamInfo> callback);
|
||||
|
||||
void stopPlayPush(CommonGBChannel channel);
|
||||
|
||||
void stopPlayJt1078(CommonGBChannel channel);
|
||||
|
||||
void pauseRtp(String streamId);
|
||||
|
||||
void resumeRtp(String streamId);
|
||||
void playbackResume(CommonGBChannel channel, String streamId);
|
||||
}
|
||||
|
||||
@ -4,21 +4,18 @@ package com.genersoft.iot.vmp.gb28181.service;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Preset;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IPTZService {
|
||||
|
||||
|
||||
List<Preset> queryPresetList(String deviceId, String channelDeviceId);
|
||||
|
||||
void addPreset(Preset preset);
|
||||
|
||||
void deletePreset(Integer qq);
|
||||
|
||||
void ptz(Device device, String channelId, int cmdCode, int horizonSpeed, int verticalSpeed, int zoomSpeed);
|
||||
|
||||
void frontEndCommand(Device device, String channelId, int cmdCode, int parameter1, int parameter2, int combindCode2);
|
||||
|
||||
void frontEndCommand(CommonGBChannel channel, Integer cmdCode, Integer parameter1, Integer parameter2, Integer combindCode2);
|
||||
|
||||
void queryPresetList(CommonGBChannel channel, ErrorCallback<List<Preset>> callback);
|
||||
|
||||
}
|
||||
|
||||
@ -48,9 +48,9 @@ public interface IPlayService {
|
||||
|
||||
void stopAudioBroadcast(Device device, DeviceChannel channel);
|
||||
|
||||
void pauseRtp(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException;
|
||||
void playbackPause(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException;
|
||||
|
||||
void resumeRtp(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException;
|
||||
void playbackResume(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException;
|
||||
|
||||
void startPushStream(SendRtpInfo sendRtpItem, DeviceChannel channel, SIPResponse sipResponse, Platform platform, CallIdHeader callIdHeader);
|
||||
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
package com.genersoft.iot.vmp.gb28181.service;
|
||||
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
|
||||
/**
|
||||
* 资源能力接入-录像下载
|
||||
*/
|
||||
public interface ISourceDownloadService {
|
||||
|
||||
void download(CommonGBChannel channel, Long startTime, Long stopTime, Integer downloadSpeed, ErrorCallback<StreamInfo> callback);
|
||||
|
||||
void stopDownload(CommonGBChannel channel, String stream);
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.genersoft.iot.vmp.gb28181.service;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 资源能力接入-云台控制
|
||||
*/
|
||||
public interface ISourcePTZService {
|
||||
|
||||
void ptz(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback);
|
||||
|
||||
void preset(CommonGBChannel channel, FrontEndControlCodeForPreset frontEndControlCode, ErrorCallback<String> callback);
|
||||
|
||||
void fi(CommonGBChannel channel, FrontEndControlCodeForFI frontEndControlCode, ErrorCallback<String> callback);
|
||||
|
||||
void tour(CommonGBChannel channel, FrontEndControlCodeForTour frontEndControlCode, ErrorCallback<String> callback);
|
||||
|
||||
void scan(CommonGBChannel channel, FrontEndControlCodeForScan frontEndControlCode, ErrorCallback<String> callback);
|
||||
|
||||
void auxiliary(CommonGBChannel channel, FrontEndControlCodeForAuxiliary frontEndControlCode, ErrorCallback<String> callback);
|
||||
|
||||
void wiper(CommonGBChannel channel, FrontEndControlCodeForWiper frontEndControlCode, ErrorCallback<String> callback);
|
||||
|
||||
void queryPreset(CommonGBChannel channel, ErrorCallback<List<Preset>> callback);
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.genersoft.iot.vmp.gb28181.service;
|
||||
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
|
||||
/**
|
||||
* 资源能力接入-实时录像
|
||||
*/
|
||||
public interface ISourcePlayService {
|
||||
|
||||
void play(CommonGBChannel channel, Platform platform, Boolean record, ErrorCallback<StreamInfo> callback);
|
||||
|
||||
void stopPlay(CommonGBChannel channel, String stream);
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.genersoft.iot.vmp.gb28181.service;
|
||||
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
|
||||
/**
|
||||
* 资源能力接入-录像回放
|
||||
*/
|
||||
public interface ISourcePlaybackService {
|
||||
|
||||
void playback(CommonGBChannel channel, Long startTime, Long stopTime, ErrorCallback<StreamInfo> callback);
|
||||
|
||||
void stopPlayback(CommonGBChannel channel, String stream);
|
||||
|
||||
void playbackPause(CommonGBChannel channel, String stream);
|
||||
}
|
||||
@ -780,7 +780,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||
|
||||
@Override
|
||||
public void addChannel(DeviceChannel channel) {
|
||||
channel.setDataType(ChannelDataType.GB28181.value);
|
||||
channel.setDataType(ChannelDataType.GB28181);
|
||||
channel.setDataDeviceId(channel.getDataDeviceId());
|
||||
channelMapper.add(channel);
|
||||
}
|
||||
@ -826,7 +826,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||
|
||||
@Override
|
||||
public void queryRecordInfo(CommonGBChannel channel, String startTime, String endTime, ErrorCallback<RecordInfo> callback) {
|
||||
if (channel.getDataType() != ChannelDataType.GB28181.value){
|
||||
if (channel.getDataType() != ChannelDataType.GB28181){
|
||||
// 只支持国标的语音喊话
|
||||
log.warn("[INFO 消息] 非国标设备, 通道ID: {}", channel.getGbId());
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "非国标设备", null);
|
||||
|
||||
@ -691,7 +691,7 @@ public class DeviceServiceImpl implements IDeviceService, CommandLineRunner {
|
||||
|
||||
@Override
|
||||
public List<Device> getAllByStatus(Boolean status) {
|
||||
return deviceMapper.getDevices(ChannelDataType.GB28181.value, status);
|
||||
return deviceMapper.getDevices(ChannelDataType.GB28181, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -852,7 +852,7 @@ public class DeviceServiceImpl implements IDeviceService, CommandLineRunner {
|
||||
.replaceAll("%", "/%")
|
||||
.replaceAll("_", "/_");
|
||||
}
|
||||
List<Device> all = deviceMapper.getDeviceList(ChannelDataType.GB28181.value, query, status);
|
||||
List<Device> all = deviceMapper.getDeviceList(ChannelDataType.GB28181, query, status);
|
||||
return new PageInfo<>(all);
|
||||
}
|
||||
|
||||
@ -863,12 +863,12 @@ public class DeviceServiceImpl implements IDeviceService, CommandLineRunner {
|
||||
|
||||
@Override
|
||||
public Device getDeviceByChannelId(Integer channelId) {
|
||||
return deviceMapper.queryByChannelId(ChannelDataType.GB28181.value,channelId);
|
||||
return deviceMapper.queryByChannelId(ChannelDataType.GB28181,channelId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Device getDeviceBySourceChannelDeviceId(String channelId) {
|
||||
return deviceMapper.getDeviceBySourceChannelDeviceId(ChannelDataType.GB28181.value,channelId);
|
||||
return deviceMapper.getDeviceBySourceChannelDeviceId(ChannelDataType.GB28181,channelId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1252,9 +1252,9 @@ public class DeviceServiceImpl implements IDeviceService, CommandLineRunner {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queryPreset(Device device, String channelId, ErrorCallback<Object> callback) {
|
||||
public void queryPreset(Device device, String channelId, ErrorCallback<List<Preset>> callback) {
|
||||
if (!userSetting.getServerId().equals(device.getServerId())) {
|
||||
WVPResult<Object> result = redisRpcService.queryPreset(device.getServerId(), device, channelId);
|
||||
WVPResult<List<Preset>> result = redisRpcService.queryPreset(device.getServerId(), device, channelId);
|
||||
callback.run(result.getCode(), result.getMsg(), result.getData());
|
||||
return;
|
||||
}
|
||||
@ -1267,4 +1267,6 @@ public class DeviceServiceImpl implements IDeviceService, CommandLineRunner {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "命令发送失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,43 +1,128 @@
|
||||
package com.genersoft.iot.vmp.gb28181.service.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.FrontEndControlCodeForPTZ;
|
||||
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IGbChannelControlService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.ISourcePTZService;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.sip.message.Response;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class GbChannelControlServiceImpl implements IGbChannelControlService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private Map<String, ISourcePTZService> sourcePTZServiceMap;
|
||||
|
||||
|
||||
@Override
|
||||
public void ptz(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback) {
|
||||
log.info("[通用通道] 云台控制, 通道: {}", channel.getGbId());
|
||||
log.info("[通用通道] 云台控制, 类型: {}, 编号:{}", channel.getDataType(), channel.getGbDeviceId());
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourcePTZService sourcePTZService = sourcePTZServiceMap.get(ChannelDataType.PTZ_SERVICE + dataType);
|
||||
if (sourcePTZService == null) {
|
||||
// 通道数据异常
|
||||
log.error("[点播通用通道] 类型: {} 不支持云台控制", dataType);
|
||||
throw new PlayException(Response.BUSY_HERE, "channel not support");
|
||||
}
|
||||
sourcePTZService.ptz(channel, frontEndControlCode, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preset(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback) {
|
||||
log.info("[通用通道] 预置位, 通道: {}", channel.getGbId());
|
||||
public void preset(CommonGBChannel channel, FrontEndControlCodeForPreset frontEndControlCode, ErrorCallback<String> callback) {
|
||||
log.info("[通用通道] 预置位控制, 类型: {}, 编号:{}", channel.getDataType(), channel.getGbDeviceId());
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourcePTZService sourcePTZService = sourcePTZServiceMap.get(ChannelDataType.PTZ_SERVICE + dataType);
|
||||
if (sourcePTZService == null) {
|
||||
// 通道数据异常
|
||||
log.error("[点播通用通道] 类型: {} 不支持预置位控制", dataType);
|
||||
throw new PlayException(Response.BUSY_HERE, "channel not support");
|
||||
}
|
||||
sourcePTZService.preset(channel, frontEndControlCode, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fi(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback) {
|
||||
log.info("[通用通道] FI指令, 通道: {}", channel.getGbId());
|
||||
public void fi(CommonGBChannel channel, FrontEndControlCodeForFI frontEndControlCode, ErrorCallback<String> callback) {
|
||||
log.info("[通用通道] FI指令, 类型: {}, 编号:{}", channel.getDataType(), channel.getGbDeviceId());
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourcePTZService sourcePTZService = sourcePTZServiceMap.get(ChannelDataType.PTZ_SERVICE + dataType);
|
||||
if (sourcePTZService == null) {
|
||||
// 通道数据异常
|
||||
log.error("[点播通用通道] 类型: {} 不支持FI指令", dataType);
|
||||
throw new PlayException(Response.BUSY_HERE, "channel not support");
|
||||
}
|
||||
sourcePTZService.fi(channel, frontEndControlCode, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tour(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback) {
|
||||
|
||||
public void tour(CommonGBChannel channel, FrontEndControlCodeForTour frontEndControlCode, ErrorCallback<String> callback) {
|
||||
log.info("[通用通道] 巡航指令, 类型: {}, 编号:{}", channel.getDataType(), channel.getGbDeviceId());
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourcePTZService sourcePTZService = sourcePTZServiceMap.get(ChannelDataType.PTZ_SERVICE + dataType);
|
||||
if (sourcePTZService == null) {
|
||||
// 通道数据异常
|
||||
log.error("[点播通用通道] 类型: {} 不支持巡航指令", dataType);
|
||||
throw new PlayException(Response.BUSY_HERE, "channel not support");
|
||||
}
|
||||
sourcePTZService.tour(channel, frontEndControlCode, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scan(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback) {
|
||||
|
||||
public void scan(CommonGBChannel channel, FrontEndControlCodeForScan frontEndControlCode, ErrorCallback<String> callback) {
|
||||
log.info("[通用通道] 扫描指令, 类型: {}, 编号:{}", channel.getDataType(), channel.getGbDeviceId());
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourcePTZService sourcePTZService = sourcePTZServiceMap.get(ChannelDataType.PTZ_SERVICE + dataType);
|
||||
if (sourcePTZService == null) {
|
||||
// 通道数据异常
|
||||
log.error("[点播通用通道] 类型: {} 不支持扫描指令", dataType);
|
||||
throw new PlayException(Response.BUSY_HERE, "channel not support");
|
||||
}
|
||||
sourcePTZService.scan(channel, frontEndControlCode, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void auxiliary(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback) {
|
||||
public void auxiliary(CommonGBChannel channel, FrontEndControlCodeForAuxiliary frontEndControlCode, ErrorCallback<String> callback) {
|
||||
log.info("[通用通道] 辅助开关控制指令, 类型: {}, 编号:{}", channel.getDataType(), channel.getGbDeviceId());
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourcePTZService sourcePTZService = sourcePTZServiceMap.get(ChannelDataType.PTZ_SERVICE + dataType);
|
||||
if (sourcePTZService == null) {
|
||||
// 通道数据异常
|
||||
log.error("[点播通用通道] 类型: {} 不支持辅助开关控制指令", dataType);
|
||||
throw new PlayException(Response.BUSY_HERE, "channel not support");
|
||||
}
|
||||
sourcePTZService.auxiliary(channel, frontEndControlCode, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wiper(CommonGBChannel channel, FrontEndControlCodeForWiper frontEndControlCode, ErrorCallback<String> callback) {
|
||||
log.info("[通用通道] 雨刷控制, 类型: {}, 编号:{}", channel.getDataType(), channel.getGbDeviceId());
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourcePTZService sourcePTZService = sourcePTZServiceMap.get(ChannelDataType.PTZ_SERVICE + dataType);
|
||||
if (sourcePTZService == null) {
|
||||
// 通道数据异常
|
||||
log.error("[点播通用通道] 类型: {} 不支持雨刷控制", dataType);
|
||||
throw new PlayException(Response.BUSY_HERE, "channel not support");
|
||||
}
|
||||
sourcePTZService.wiper(channel, frontEndControlCode, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queryPreset(CommonGBChannel channel, ErrorCallback<List<Preset>> callback) {
|
||||
log.info("[通用通道] 预置位查询, 类型: {}, 编号:{}", channel.getDataType(), channel.getGbDeviceId());
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourcePTZService sourcePTZService = sourcePTZServiceMap.get(ChannelDataType.PTZ_SERVICE + dataType);
|
||||
if (sourcePTZService == null) {
|
||||
// 通道数据异常
|
||||
log.error("[点播通用通道] 类型: {} 不支持预置位查询", dataType);
|
||||
throw new PlayException(Response.BUSY_HERE, "channel not support");
|
||||
}
|
||||
sourcePTZService.queryPreset(channel, callback);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,106 +2,60 @@ package com.genersoft.iot.vmp.gb28181.service.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.common.InviteSessionType;
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||
import com.genersoft.iot.vmp.conf.exception.ServiceException;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.InviteMessageInfo;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.PlayException;
|
||||
import com.genersoft.iot.vmp.gb28181.service.*;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IGbChannelPlayService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IPlayService;
|
||||
import com.genersoft.iot.vmp.jt1078.service.Ijt1078PlayService;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
import com.genersoft.iot.vmp.streamProxy.service.IStreamProxyPlayService;
|
||||
import com.genersoft.iot.vmp.streamPush.service.IStreamPushPlayService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.sip.InvalidArgumentException;
|
||||
import javax.sip.SipException;
|
||||
import javax.sip.message.Response;
|
||||
import java.text.ParseException;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
|
||||
|
||||
@Autowired
|
||||
private IPlayService deviceChannelPlayService;
|
||||
private UserSetting userSetting;
|
||||
|
||||
@Autowired
|
||||
private IStreamProxyPlayService streamProxyPlayService;
|
||||
private Map<String, ISourcePlayService> sourcePlayServiceMap;
|
||||
|
||||
@Autowired
|
||||
private Ijt1078PlayService jt1078PlayService;
|
||||
|
||||
@Autowired
|
||||
private IStreamPushPlayService streamPushPlayService;
|
||||
private Map<String, ISourcePlaybackService> sourcePlaybackServiceMap;
|
||||
|
||||
@Autowired
|
||||
private UserSetting userSetting;
|
||||
private Map<String, ISourceDownloadService> sourceDownloadServiceMap;
|
||||
|
||||
|
||||
@Override
|
||||
public void start(CommonGBChannel channel, InviteMessageInfo inviteInfo, Platform platform, ErrorCallback<StreamInfo> callback) {
|
||||
public void startInvite(CommonGBChannel channel, InviteMessageInfo inviteInfo, Platform platform, ErrorCallback<StreamInfo> callback) {
|
||||
if (channel == null || inviteInfo == null || callback == null || channel.getDataType() == null) {
|
||||
log.warn("[通用通道点播] 参数异常, channel: {}, inviteInfo: {}, callback: {}", channel != null, inviteInfo != null, callback != null);
|
||||
throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error");
|
||||
}
|
||||
log.info("[点播通用通道] 类型:{}, 通道: {}({})", inviteInfo.getSessionName(), channel.getGbName(), channel.getGbDeviceId());
|
||||
|
||||
if ("Play".equalsIgnoreCase(inviteInfo.getSessionName())) {
|
||||
play(channel, platform, userSetting.getRecordSip(), callback);
|
||||
}else if ("Playback".equals(inviteInfo.getSessionName())) {
|
||||
if (channel.getDataType() == ChannelDataType.GB28181.value) {
|
||||
// 国标通道
|
||||
playbackGbDeviceChannel(channel, inviteInfo.getStartTime(), inviteInfo.getStopTime(), callback);
|
||||
} else if (channel.getDataType() == ChannelDataType.JT_1078.value) {
|
||||
// 部标通道
|
||||
playbackJtDeviceChannel(channel, inviteInfo.getStartTime(), inviteInfo.getStopTime(), callback);
|
||||
} else if (channel.getDataType() == ChannelDataType.STREAM_PROXY.value) {
|
||||
// 拉流代理
|
||||
log.warn("[回放通用通道] 不支持回放拉流代理的录像: {}({})", channel.getGbName(), channel.getGbDeviceId());
|
||||
throw new PlayException(Response.FORBIDDEN, "forbidden");
|
||||
} else if (channel.getDataType() == ChannelDataType.STREAM_PUSH.value) {
|
||||
// 推流
|
||||
log.warn("[回放通用通道] 不支持回放推流的录像: {}({})", channel.getGbName(), channel.getGbDeviceId());
|
||||
throw new PlayException(Response.FORBIDDEN, "forbidden");
|
||||
} else {
|
||||
// 通道数据异常
|
||||
log.error("[回放通用通道] 通道数据异常,无法识别通道来源: {}({})", channel.getGbName(), channel.getGbDeviceId());
|
||||
throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error");
|
||||
}
|
||||
playback(channel, inviteInfo.getStartTime(), inviteInfo.getStopTime(), callback);
|
||||
}else if ("Download".equals(inviteInfo.getSessionName())) {
|
||||
if (channel.getDataType() == ChannelDataType.GB28181.value) {
|
||||
int downloadSpeed = 4;
|
||||
try {
|
||||
if (inviteInfo.getDownloadSpeed() != null){
|
||||
downloadSpeed = Integer.parseInt(inviteInfo.getDownloadSpeed());
|
||||
}
|
||||
}catch (Exception ignored) {}
|
||||
|
||||
// 国标通道
|
||||
downloadGbDeviceChannel(channel, inviteInfo.getStartTime(), inviteInfo.getStopTime(), downloadSpeed, callback);
|
||||
} else if (channel.getDataType() == ChannelDataType.JT_1078.value) {
|
||||
// 部标录像下载
|
||||
log.warn("[下载通用通道录像] 不支持下载部标的录像: {}({})", channel.getGbName(), channel.getGbDeviceId());
|
||||
throw new PlayException(Response.FORBIDDEN, "forbidden");
|
||||
} else if (channel.getDataType() == ChannelDataType.STREAM_PROXY.value) {
|
||||
// 拉流代理
|
||||
log.warn("[下载通用通道录像] 不支持下载拉流代理的录像: {}({})", channel.getGbName(), channel.getGbDeviceId());
|
||||
throw new PlayException(Response.FORBIDDEN, "forbidden");
|
||||
} else if (channel.getDataType() == ChannelDataType.STREAM_PUSH.value) {
|
||||
// 推流
|
||||
log.warn("[下载通用通道录像] 不支持下载推流的录像: {}({})", channel.getGbName(), channel.getGbDeviceId());
|
||||
throw new PlayException(Response.FORBIDDEN, "forbidden");
|
||||
} else {
|
||||
// 通道数据异常
|
||||
log.error("[回放通用通道] 通道数据异常,无法识别通道来源: {}({})", channel.getGbName(), channel.getGbDeviceId());
|
||||
throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error");
|
||||
}
|
||||
Integer downloadSpeed = Integer.parseInt(inviteInfo.getDownloadSpeed());
|
||||
// 国标通道
|
||||
download(channel, inviteInfo.getStartTime(), inviteInfo.getStopTime(), downloadSpeed, callback);
|
||||
}else {
|
||||
// 不支持的点播方式
|
||||
log.error("[点播通用通道] 不支持的点播方式:{}, {}({})", inviteInfo.getSessionName(), channel.getGbName(), channel.getGbDeviceId());
|
||||
@ -110,23 +64,21 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopPlay(InviteSessionType type, CommonGBChannel channel, String stream) {
|
||||
if (channel.getDataType() == ChannelDataType.GB28181.value) {
|
||||
// 国标通道
|
||||
stopPlayDeviceChannel(type, channel, stream);
|
||||
} else if (channel.getDataType() == ChannelDataType.STREAM_PROXY.value) {
|
||||
// 拉流代理
|
||||
stopPlayProxy(channel);
|
||||
} else if (channel.getDataType() == ChannelDataType.STREAM_PUSH.value) {
|
||||
// 推流
|
||||
stopPlayPush(channel);
|
||||
} else if (channel.getDataType() == ChannelDataType.JT_1078.value) {
|
||||
// 推流
|
||||
stopPlayJt1078(channel);
|
||||
} else {
|
||||
// 通道数据异常
|
||||
log.error("[点播通用通道] 通道数据异常,无法识别通道来源: {}({})", channel.getGbName(), channel.getGbDeviceId());
|
||||
throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error");
|
||||
public void stopInvite(InviteSessionType type, CommonGBChannel channel, String stream) {
|
||||
switch (type) {
|
||||
case PLAY:
|
||||
stopPlay(channel, stream);
|
||||
break;
|
||||
case PLAYBACK:
|
||||
stopPlayback(channel, stream);
|
||||
break;
|
||||
case DOWNLOAD:
|
||||
stopDownload(channel, stream);
|
||||
break;
|
||||
default:
|
||||
// 通道数据异常
|
||||
log.error("[点播通用通道] 类型编号: {} 不支持此类型请求", type);
|
||||
throw new PlayException(Response.BUSY_HERE, "channel not support");
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,65 +87,40 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
|
||||
@Override
|
||||
public void play(CommonGBChannel channel, Platform platform, Boolean record, ErrorCallback<StreamInfo> callback) {
|
||||
log.info("[通用通道] 播放, 类型: {}, 编号:{}", channel.getDataType(), channel.getGbDeviceId());
|
||||
if (channel.getDataType() == ChannelDataType.GB28181.value) {
|
||||
// 国标通道
|
||||
playGbDeviceChannel(channel, record, callback);
|
||||
} else if (channel.getDataType() == ChannelDataType.STREAM_PROXY.value) {
|
||||
// 拉流代理
|
||||
playProxy(channel, record, callback);
|
||||
} else if (channel.getDataType() == ChannelDataType.STREAM_PUSH.value) {
|
||||
if (platform != null) {
|
||||
// 推流
|
||||
playPush(channel, platform.getServerGBId(), platform.getName(), callback);
|
||||
}else {
|
||||
// 推流
|
||||
playPush(channel, null, null, callback);
|
||||
}
|
||||
} else if (channel.getDataType() == ChannelDataType.JT_1078.value) {
|
||||
// 部标设备
|
||||
playJt1078(channel, record, callback);
|
||||
} else {
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourcePlayService sourceChannelPlayService = sourcePlayServiceMap.get(ChannelDataType.PLAY_SERVICE + dataType);
|
||||
if (sourceChannelPlayService == null) {
|
||||
// 通道数据异常
|
||||
log.error("[点播通用通道] 通道数据异常,无法识别通道来源: {}({})", channel.getGbName(), channel.getGbDeviceId());
|
||||
throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error");
|
||||
log.error("[点播通用通道] 类型编号: {} 不支持实时流预览", dataType);
|
||||
throw new PlayException(Response.BUSY_HERE, "channel not support");
|
||||
}
|
||||
sourceChannelPlayService.play(channel, platform, record, callback);
|
||||
}
|
||||
@Override
|
||||
public void playback(CommonGBChannel channel, Long startTime, Long stopTime, ErrorCallback<StreamInfo> callback) {
|
||||
log.info("[通用通道] 回放, 类型: {}, 编号:{}", channel.getDataType(), channel.getGbDeviceId());
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourcePlaybackService playbackService = sourcePlaybackServiceMap.get(ChannelDataType.PLAYBACK_SERVICE + dataType);
|
||||
if (playbackService == null) {
|
||||
// 通道数据异常
|
||||
log.error("[点播通用通道] 类型编号: {} 不支持回放", dataType);
|
||||
throw new PlayException(Response.BUSY_HERE, "channel not support");
|
||||
}
|
||||
playbackService.playback(channel, startTime, stopTime, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playGbDeviceChannel(CommonGBChannel channel, Boolean record, ErrorCallback<StreamInfo> callback){
|
||||
// 国标通道
|
||||
try {
|
||||
deviceChannelPlayService.play(channel, record, callback);
|
||||
} catch (PlayException e) {
|
||||
callback.run(e.getCode(), e.getMsg(), null);
|
||||
} catch (ControllerException e) {
|
||||
log.error("[点播失败] {}({}), {}", channel.getGbName(), channel.getGbDeviceId(), e.getMsg());
|
||||
callback.run(Response.BUSY_HERE, "busy here", null);
|
||||
} catch (Exception e) {
|
||||
log.error("[点播失败] {}({})", channel.getGbName(), channel.getGbDeviceId(), e);
|
||||
callback.run(Response.BUSY_HERE, "busy here", null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopPlayDeviceChannel(InviteSessionType type, CommonGBChannel channel, String stream) {
|
||||
// 国标通道
|
||||
try {
|
||||
deviceChannelPlayService.stop(type, channel, stream);
|
||||
} catch (Exception e) {
|
||||
log.error("[停止点播失败] {}({})", channel.getGbName(), channel.getGbDeviceId(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playProxy(CommonGBChannel channel, Boolean record, ErrorCallback<StreamInfo> callback){
|
||||
// 拉流代理通道
|
||||
try {
|
||||
streamProxyPlayService.start(channel.getDataDeviceId(), record, callback);
|
||||
}catch (Exception e) {
|
||||
log.info("[通用通道] 拉流代理点播异常 {}", e.getMessage());
|
||||
callback.run(Response.BUSY_HERE, "busy here", null);
|
||||
public void download(CommonGBChannel channel, Long startTime, Long stopTime, Integer downloadSpeed,
|
||||
ErrorCallback<StreamInfo> callback){
|
||||
log.info("[通用通道] 录像下载, 类型: {}, 编号:{}", channel.getDataType(), channel.getGbDeviceId());
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourceDownloadService downloadService = sourceDownloadServiceMap.get(ChannelDataType.DOWNLOAD_SERVICE + dataType);
|
||||
if (downloadService == null) {
|
||||
// 通道数据异常
|
||||
log.error("[点播通用通道] 类型编号: {} 不支持录像下载", dataType);
|
||||
throw new PlayException(Response.BUSY_HERE, "channel not support");
|
||||
}
|
||||
downloadService.download(channel, startTime, stopTime, downloadSpeed, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -208,36 +135,41 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopPlayProxy(CommonGBChannel channel) {
|
||||
// 拉流代理通道
|
||||
try {
|
||||
streamProxyPlayService.stop(channel.getDataDeviceId());
|
||||
}catch (Exception e) {
|
||||
log.error("[停止点播失败] {}({})", channel.getGbName(), channel.getGbDeviceId(), e);
|
||||
public void stopPlay(CommonGBChannel channel, String stream) {
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourcePlayService sourceChannelPlayService = sourcePlayServiceMap.get(ChannelDataType.PLAY_SERVICE + dataType);
|
||||
if (sourceChannelPlayService == null) {
|
||||
// 通道数据异常
|
||||
log.error("[点播通用通道] 类型编号: {} 不支持停止实时流", dataType);
|
||||
throw new PlayException(Response.BUSY_HERE, "channel not support");
|
||||
}
|
||||
sourceChannelPlayService.stopPlay(channel, stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playPush(CommonGBChannel channel, String platformDeviceId, String platformName, ErrorCallback<StreamInfo> callback){
|
||||
// 推流
|
||||
try {
|
||||
streamPushPlayService.start(channel.getDataDeviceId(), callback, platformDeviceId, platformName);
|
||||
}catch (PlayException e) {
|
||||
callback.run(e.getCode(), e.getMsg(), null);
|
||||
}catch (Exception e) {
|
||||
log.error("[点播推流通道失败] 通道: {}({})", channel.getGbName(), channel.getGbDeviceId(), e);
|
||||
callback.run(Response.BUSY_HERE, "busy here", null);
|
||||
public void stopPlayback(CommonGBChannel channel, String stream) {
|
||||
log.info("[通用通道] 停止回放, 类型: {}, 编号:{}", channel.getDataType(), channel.getGbDeviceId());
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourcePlaybackService playbackService = sourcePlaybackServiceMap.get(ChannelDataType.PLAYBACK_SERVICE + dataType);
|
||||
if (playbackService == null) {
|
||||
// 通道数据异常
|
||||
log.error("[点播通用通道] 类型编号: {} 不支持回放", dataType);
|
||||
throw new PlayException(Response.BUSY_HERE, "channel not support");
|
||||
}
|
||||
playbackService.stopPlayback(channel, stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopPlayPush(CommonGBChannel channel) {
|
||||
// 推流
|
||||
try {
|
||||
streamPushPlayService.stop(channel.getDataDeviceId());
|
||||
}catch (Exception e) {
|
||||
log.error("[停止点播失败] {}({})", channel.getGbName(), channel.getGbDeviceId(), e);
|
||||
public void stopDownload(CommonGBChannel channel, String stream) {
|
||||
log.info("[通用通道] 停止录像下载, 类型: {}, 编号:{} stream: {}", channel.getDataType(), channel.getGbDeviceId(), stream);
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourceDownloadService downloadService = sourceDownloadServiceMap.get(ChannelDataType.DOWNLOAD_SERVICE + dataType);
|
||||
if (downloadService == null) {
|
||||
// 通道数据异常
|
||||
log.error("[点播通用通道] 类型编号: {} 不支持录像下载", dataType);
|
||||
throw new PlayException(Response.BUSY_HERE, "channel not support");
|
||||
}
|
||||
downloadService.stopDownload(channel, stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -271,27 +203,28 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pauseRtp(String streamId) {
|
||||
try {
|
||||
deviceChannelPlayService.pauseRtp(streamId);
|
||||
} catch (ServiceException | InvalidArgumentException | ParseException | SipException ignore) {}
|
||||
public void playbackPause(CommonGBChannel channel, String stream) {
|
||||
log.info("[通用通道] 回放暂停, 类型: {}, 编号:{} stream:{}", channel.getDataType(), channel.getGbDeviceId(), stream);
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourcePlaybackService playbackService = sourcePlaybackServiceMap.get(ChannelDataType.PLAYBACK_SERVICE + dataType);
|
||||
if (playbackService == null) {
|
||||
// 通道数据异常
|
||||
log.error("[点播通用通道] 类型编号: {} 不支持回放暂停", dataType);
|
||||
throw new PlayException(Response.BUSY_HERE, "channel not support");
|
||||
}
|
||||
playbackService.playbackPause(channel, stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resumeRtp(String streamId) {
|
||||
try {
|
||||
deviceChannelPlayService.resumeRtp(streamId);
|
||||
} catch (ServiceException | InvalidArgumentException | ParseException | SipException ignore) {}
|
||||
}
|
||||
|
||||
private void downloadGbDeviceChannel(CommonGBChannel channel, Long startTime, Long stopTime, Integer downloadSpeed,
|
||||
ErrorCallback<StreamInfo> callback){
|
||||
try {
|
||||
deviceChannelPlayService.download(channel, startTime, stopTime, downloadSpeed, callback);
|
||||
} catch (PlayException e) {
|
||||
callback.run(e.getCode(), e.getMsg(), null);
|
||||
} catch (Exception e) {
|
||||
callback.run(Response.BUSY_HERE, "busy here", null);
|
||||
public void playbackResume(CommonGBChannel channel, String stream) {
|
||||
log.info("[通用通道] 回放暂停恢复, 类型: {}, 编号:{} stream:{}", channel.getDataType(), channel.getGbDeviceId(), stream);
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourcePlaybackService playbackService = sourcePlaybackServiceMap.get(ChannelDataType.PLAYBACK_SERVICE + dataType);
|
||||
if (playbackService == null) {
|
||||
// 通道数据异常
|
||||
log.error("[点播通用通道] 类型编号: {} 不支持回放暂停恢复", dataType);
|
||||
throw new PlayException(Response.BUSY_HERE, "channel not support");
|
||||
}
|
||||
playbackService.playbackPause(channel, stream);
|
||||
}
|
||||
}
|
||||
|
||||
@ -366,12 +366,12 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
log.warn("[重置国标通道] 未找到对应Id的通道: id: {}", id);
|
||||
throw new ControllerException(ErrorCode.ERROR400);
|
||||
}
|
||||
if (channel.getDataType() != ChannelDataType.GB28181.value) {
|
||||
if (channel.getDataType() != ChannelDataType.GB28181) {
|
||||
log.warn("[重置国标通道] 非国标下级通道无法重置: id: {}", id);
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "非国标下级通道无法重置");
|
||||
}
|
||||
// 这个多加一个参数,为了防止将非国标的通道通过此方法清空内容,导致意外发生
|
||||
commonGBChannelMapper.reset(id, ChannelDataType.GB28181.value, channel.getDataDeviceId(), DateUtil.getNow());
|
||||
commonGBChannelMapper.reset(id, ChannelDataType.GB28181, channel.getDataDeviceId(), DateUtil.getNow());
|
||||
CommonGBChannel channelNew = getOne(id);
|
||||
// 发送通过更新通知
|
||||
try {
|
||||
@ -494,7 +494,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
|
||||
@Override
|
||||
public void addChannelToRegionByGbDevice(String civilCode, List<Integer> deviceIds) {
|
||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(ChannelDataType.GB28181.value, deviceIds);
|
||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(ChannelDataType.GB28181, deviceIds);
|
||||
if (channelList.isEmpty()) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
||||
}
|
||||
@ -515,7 +515,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
|
||||
@Override
|
||||
public void deleteChannelToRegionByGbDevice(List<Integer> deviceIds) {
|
||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(ChannelDataType.GB28181.value, deviceIds);
|
||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(ChannelDataType.GB28181, deviceIds);
|
||||
if (channelList.isEmpty()) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
||||
}
|
||||
@ -632,7 +632,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
@Override
|
||||
@Transactional
|
||||
public void addChannelToGroupByGbDevice(String parentId, String businessGroup, List<Integer> deviceIds) {
|
||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(ChannelDataType.GB28181.value, deviceIds);
|
||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(ChannelDataType.GB28181, deviceIds);
|
||||
if (channelList.isEmpty()) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
||||
}
|
||||
@ -660,7 +660,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
|
||||
@Override
|
||||
public void deleteChannelToGroupByGbDevice(List<Integer> deviceIds) {
|
||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(ChannelDataType.GB28181.value, deviceIds);
|
||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(ChannelDataType.GB28181, deviceIds);
|
||||
if (channelList.isEmpty()) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
||||
}
|
||||
@ -702,7 +702,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
|
||||
@Override
|
||||
public List<CommonGBChannel> queryListByStreamPushList(List<StreamPush> streamPushList) {
|
||||
return commonGBChannelMapper.queryListByStreamPushList(ChannelDataType.STREAM_PUSH.value, streamPushList);
|
||||
return commonGBChannelMapper.queryListByStreamPushList(ChannelDataType.STREAM_PUSH, streamPushList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -719,13 +719,13 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
|
||||
@Override
|
||||
public void queryRecordInfo(CommonGBChannel channel, String startTime, String endTime, ErrorCallback<RecordInfo> callback) {
|
||||
if (channel.getDataType() == ChannelDataType.GB28181.value) {
|
||||
if (channel.getDataType() == ChannelDataType.GB28181) {
|
||||
deviceChannelService.queryRecordInfo(channel, startTime, endTime, callback);
|
||||
} else if (channel.getDataType() == ChannelDataType.STREAM_PROXY.value) {
|
||||
} else if (channel.getDataType() == ChannelDataType.STREAM_PROXY) {
|
||||
// 拉流代理
|
||||
log.warn("[下载通用通道录像] 不支持下载拉流代理的录像: {}({})", channel.getGbName(), channel.getGbDeviceId());
|
||||
throw new PlayException(Response.FORBIDDEN, "forbidden");
|
||||
} else if (channel.getDataType() == ChannelDataType.STREAM_PUSH.value) {
|
||||
} else if (channel.getDataType() == ChannelDataType.STREAM_PUSH) {
|
||||
// 推流
|
||||
log.warn("[下载通用通道录像] 不支持下载推流的录像: {}({})", channel.getGbName(), channel.getGbDeviceId());
|
||||
throw new PlayException(Response.FORBIDDEN, "forbidden");
|
||||
|
||||
@ -11,6 +11,7 @@ import com.genersoft.iot.vmp.gb28181.service.IDeviceChannelService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IDeviceService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IPTZService;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
import com.genersoft.iot.vmp.service.redisMsg.IRedisRpcPlayService;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -21,7 +22,6 @@ import org.springframework.util.Assert;
|
||||
import javax.sip.InvalidArgumentException;
|
||||
import javax.sip.SipException;
|
||||
import java.text.ParseException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@ -78,7 +78,7 @@ public class PTZServiceImpl implements IPTZService {
|
||||
|
||||
@Override
|
||||
public void frontEndCommand(CommonGBChannel channel, Integer cmdCode, Integer parameter1, Integer parameter2, Integer combindCode2) {
|
||||
if (channel.getDataType() != ChannelDataType.GB28181.value) {
|
||||
if (channel.getDataType() != ChannelDataType.GB28181) {
|
||||
// 只有国标通道的支持云台控制
|
||||
log.warn("[INFO 消息] 只有国标通道的支持云台控制, 通道ID: {}", channel.getGbId());
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "不支持");
|
||||
@ -92,17 +92,20 @@ public class PTZServiceImpl implements IPTZService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Preset> queryPresetList(String deviceId, String channelDeviceId) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPreset(Preset preset) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePreset(Integer qq) {
|
||||
|
||||
public void queryPresetList(CommonGBChannel channel, ErrorCallback<List<Preset>> callback) {
|
||||
if (channel.getDataType() != ChannelDataType.GB28181) {
|
||||
// 只有国标通道的支持云台控制
|
||||
log.warn("[INFO 消息] 只有国标通道的支持云台控制, 通道ID: {}", channel.getGbId());
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "不支持");
|
||||
}
|
||||
Device device = deviceService.getDevice(channel.getDataDeviceId());
|
||||
if (device == null) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到设备");
|
||||
}
|
||||
DeviceChannel deviceChannel = deviceChannelService.getOneForSourceById(channel.getGbId());
|
||||
if (deviceChannel == null) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到通道");
|
||||
}
|
||||
deviceService.queryPreset(device, deviceChannel.getDeviceId(), callback);
|
||||
}
|
||||
}
|
||||
|
||||
@ -296,14 +296,14 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
||||
@Override
|
||||
@Transactional
|
||||
public void addChannelByDevice(Integer platformId, List<Integer> deviceIds) {
|
||||
List<Integer> channelList = commonGBChannelMapper.queryByGbDeviceIdsForIds(ChannelDataType.GB28181.value, deviceIds);
|
||||
List<Integer> channelList = commonGBChannelMapper.queryByGbDeviceIdsForIds(ChannelDataType.GB28181, deviceIds);
|
||||
addChannels(platformId, channelList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void removeChannelByDevice(Integer platformId, List<Integer> deviceIds) {
|
||||
List<Integer> channelList = commonGBChannelMapper.queryByGbDeviceIdsForIds(ChannelDataType.GB28181.value, deviceIds);
|
||||
List<Integer> channelList = commonGBChannelMapper.queryByGbDeviceIdsForIds(ChannelDataType.GB28181, deviceIds);
|
||||
removeChannels(platformId, channelList);
|
||||
}
|
||||
|
||||
|
||||
@ -1386,7 +1386,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pauseRtp(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException {
|
||||
public void playbackPause(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException {
|
||||
|
||||
InviteInfo inviteInfo = inviteStreamService.getInviteInfoByStream(InviteSessionType.PLAYBACK, streamId);
|
||||
if (null == inviteInfo || inviteInfo.getStreamInfo() == null) {
|
||||
@ -1397,7 +1397,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "设备不存在");
|
||||
}
|
||||
if (!userSetting.getServerId().equals(device.getServerId())) {
|
||||
redisRpcPlayService.pauseRtp(device.getServerId(), streamId);
|
||||
redisRpcPlayService.playbackPause(device.getServerId(), streamId);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1424,7 +1424,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resumeRtp(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException {
|
||||
public void playbackResume(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException {
|
||||
InviteInfo inviteInfo = inviteStreamService.getInviteInfoByStream(InviteSessionType.PLAYBACK, streamId);
|
||||
if (null == inviteInfo || inviteInfo.getStreamInfo() == null) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "streamId不存在");
|
||||
@ -1434,7 +1434,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "设备不存在");
|
||||
}
|
||||
if (!userSetting.getServerId().equals(device.getServerId())) {
|
||||
redisRpcPlayService.resumeRtp(device.getServerId(), streamId);
|
||||
redisRpcPlayService.playbackResume(device.getServerId(), streamId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,35 @@
|
||||
package com.genersoft.iot.vmp.gb28181.service.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.common.InviteSessionType;
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IPlayService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.ISourceDownloadService;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service(ChannelDataType.DOWNLOAD_SERVICE + ChannelDataType.GB28181)
|
||||
public class SourceDownloadServiceForGbImpl implements ISourceDownloadService {
|
||||
|
||||
@Autowired
|
||||
private IPlayService deviceChannelPlayService;
|
||||
|
||||
@Override
|
||||
public void download(CommonGBChannel channel, Long startTime, Long stopTime, Integer downloadSpeed, ErrorCallback<StreamInfo> callback) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopDownload(CommonGBChannel channel, String stream) {
|
||||
// 国标通道
|
||||
try {
|
||||
deviceChannelPlayService.stop(InviteSessionType.DOWNLOAD, channel, stream);
|
||||
} catch (Exception e) {
|
||||
log.error("[停止下载失败] {}({})", channel.getGbName(), channel.getGbDeviceId(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,351 @@
|
||||
package com.genersoft.iot.vmp.gb28181.service.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IPTZService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.ISourcePTZService;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service(ChannelDataType.PTZ_SERVICE + ChannelDataType.GB28181)
|
||||
public class SourcePTZServiceForGbImpl implements ISourcePTZService {
|
||||
|
||||
@Autowired
|
||||
private IPTZService ptzService;
|
||||
|
||||
@Override
|
||||
public void ptz(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback) {
|
||||
try {
|
||||
int cmdCode = 0;
|
||||
int panSpeed = 0;
|
||||
int titleSpeed = 0;
|
||||
int zoomSpeed = 0;
|
||||
if (frontEndControlCode != null) {
|
||||
if (frontEndControlCode.getPan() != null) {
|
||||
if (frontEndControlCode.getPan() == 0) {
|
||||
cmdCode = cmdCode | 1 << 1;
|
||||
} else if (frontEndControlCode.getPan() == 1) {
|
||||
cmdCode = cmdCode | 1;
|
||||
}
|
||||
}
|
||||
if (frontEndControlCode.getTilt() != null) {
|
||||
if (frontEndControlCode.getTilt() == 0) {
|
||||
cmdCode = cmdCode | 1 << 3;
|
||||
} else if (frontEndControlCode.getTilt() == 1) {
|
||||
cmdCode = cmdCode | 1 << 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (frontEndControlCode.getZoom() != null) {
|
||||
if (frontEndControlCode.getZoom() == 0) {
|
||||
cmdCode = cmdCode | 1 << 5;
|
||||
} else if (frontEndControlCode.getZoom() == 1) {
|
||||
cmdCode = cmdCode | 1 << 4;
|
||||
}
|
||||
}
|
||||
if (frontEndControlCode.getPanSpeed() == null) {
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
|
||||
return;
|
||||
}
|
||||
if (frontEndControlCode.getTiltSpeed() == null) {
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
|
||||
return;
|
||||
}
|
||||
if (frontEndControlCode.getZoomSpeed() == null) {
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
|
||||
return;
|
||||
}
|
||||
panSpeed = (int)(frontEndControlCode.getPanSpeed()/100D* 255);
|
||||
titleSpeed = (int)(frontEndControlCode.getTiltSpeed()/100D* 255);;
|
||||
zoomSpeed = (int)(frontEndControlCode.getZoomSpeed()/100D* 16);
|
||||
}
|
||||
ptzService.frontEndCommand(channel, cmdCode, panSpeed, titleSpeed, zoomSpeed);
|
||||
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null);
|
||||
}catch (Exception e) {
|
||||
log.error("[云台控制失败] ", e);
|
||||
callback.run(ErrorCode.ERROR100.getCode(), e.getMessage(), null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preset(CommonGBChannel channel, FrontEndControlCodeForPreset frontEndControlCode, ErrorCallback<String> callback) {
|
||||
try {
|
||||
int cmdCode = 0;
|
||||
int parameter1 = 0;
|
||||
int parameter2 = 0;
|
||||
int parameter3 = 0;
|
||||
if (frontEndControlCode != null) {
|
||||
if (frontEndControlCode.getCode() != null) {
|
||||
if (frontEndControlCode.getCode() == 1) {
|
||||
cmdCode = 0x81;
|
||||
} else if (frontEndControlCode.getCode() == 2) {
|
||||
cmdCode = 0x82;
|
||||
}else if (frontEndControlCode.getCode() == 3) {
|
||||
cmdCode = 0x83;
|
||||
}
|
||||
}
|
||||
if (frontEndControlCode.getPresetId() == null) {
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
|
||||
return;
|
||||
}
|
||||
parameter2 = frontEndControlCode.getPresetId();
|
||||
}
|
||||
ptzService.frontEndCommand(channel, cmdCode, parameter1, parameter2, parameter3);
|
||||
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null);
|
||||
}catch (Exception e) {
|
||||
log.error("[预置位控制失败] ", e);
|
||||
callback.run(ErrorCode.ERROR100.getCode(), e.getMessage(), null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fi(CommonGBChannel channel, FrontEndControlCodeForFI frontEndControlCode, ErrorCallback<String> callback) {
|
||||
try {
|
||||
int cmdCode = 1 << 6;
|
||||
int focusSpeed = 0;
|
||||
int irisSpeed = 0;
|
||||
int parameter3 = 0;
|
||||
if (frontEndControlCode != null) {
|
||||
if (frontEndControlCode.getFocus() != null) {
|
||||
if (frontEndControlCode.getFocus() == 0) {
|
||||
cmdCode = cmdCode | 1 << 1;
|
||||
} else if (frontEndControlCode.getFocus() == 1) {
|
||||
cmdCode = cmdCode | 1;
|
||||
}else {
|
||||
log.error("[FI失败] 未知的聚焦指令 {}", frontEndControlCode.getFocus());
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "未知的指令", null);
|
||||
}
|
||||
}
|
||||
if (frontEndControlCode.getIris() != null) {
|
||||
if (frontEndControlCode.getIris() == 0) {
|
||||
cmdCode = cmdCode | 1 << 3;
|
||||
} else if (frontEndControlCode.getIris() == 1) {
|
||||
cmdCode = cmdCode | 1 << 2;
|
||||
}else {
|
||||
log.error("[FI失败] 未知的光圈指令 {}", frontEndControlCode.getIris());
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "未知的指令", null);
|
||||
}
|
||||
}
|
||||
if (frontEndControlCode.getFocusSpeed() == null) {
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
|
||||
return;
|
||||
}
|
||||
if (frontEndControlCode.getIrisSpeed() == null) {
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
|
||||
return;
|
||||
}
|
||||
focusSpeed = frontEndControlCode.getFocusSpeed();
|
||||
irisSpeed = frontEndControlCode.getIrisSpeed();
|
||||
}
|
||||
ptzService.frontEndCommand(channel, cmdCode, focusSpeed, irisSpeed, parameter3);
|
||||
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null);
|
||||
}catch (Exception e) {
|
||||
log.error("[云台控制失败] ", e);
|
||||
callback.run(ErrorCode.ERROR100.getCode(), e.getMessage(), null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tour(CommonGBChannel channel, FrontEndControlCodeForTour frontEndControlCode, ErrorCallback<String> callback) {
|
||||
try {
|
||||
int cmdCode = 0;
|
||||
int parameter1 = 0;
|
||||
int parameter2 = 0;
|
||||
int parameter3 = 0;
|
||||
if (frontEndControlCode != null) {
|
||||
if (frontEndControlCode.getCode() != null) {
|
||||
if (frontEndControlCode.getCode() == 1) {
|
||||
cmdCode = 0x84;
|
||||
if (frontEndControlCode.getPresetId() == null) {
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
|
||||
return;
|
||||
}
|
||||
parameter2 = frontEndControlCode.getPresetId();
|
||||
} else if (frontEndControlCode.getCode() == 2) {
|
||||
cmdCode = 0x85;
|
||||
if (frontEndControlCode.getPresetId() == null) {
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
|
||||
return;
|
||||
}
|
||||
parameter2 = frontEndControlCode.getPresetId();
|
||||
}else if (frontEndControlCode.getCode() == 3) {
|
||||
cmdCode = 0x86;
|
||||
if (frontEndControlCode.getPresetId() == null) {
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
|
||||
return;
|
||||
}
|
||||
parameter2 = frontEndControlCode.getPresetId();
|
||||
if (frontEndControlCode.getTourSpeed() == null) {
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
|
||||
return;
|
||||
}
|
||||
parameter3 = frontEndControlCode.getTourSpeed();
|
||||
}else if (frontEndControlCode.getCode() == 4) {
|
||||
cmdCode = 0x87;
|
||||
if (frontEndControlCode.getPresetId() == null) {
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
|
||||
return;
|
||||
}
|
||||
parameter2 = frontEndControlCode.getPresetId();
|
||||
if (frontEndControlCode.getTourTime() == null) {
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
|
||||
return;
|
||||
}
|
||||
parameter3 = frontEndControlCode.getTourTime();
|
||||
}else if (frontEndControlCode.getCode() == 5) {
|
||||
cmdCode = 0x88;
|
||||
}else if (frontEndControlCode.getCode() == 6) {
|
||||
}else {
|
||||
log.error("[巡航控制失败] 未知的指令 {}", frontEndControlCode.getCode());
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "未知的指令", null);
|
||||
}
|
||||
if (frontEndControlCode.getTourId() == null) {
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
|
||||
return;
|
||||
}
|
||||
parameter1 = frontEndControlCode.getTourId();
|
||||
}
|
||||
|
||||
}
|
||||
ptzService.frontEndCommand(channel, cmdCode, parameter1, parameter2, parameter3);
|
||||
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null);
|
||||
}catch (Exception e) {
|
||||
log.error("[巡航控制失败] ", e);
|
||||
callback.run(ErrorCode.ERROR100.getCode(), e.getMessage(), null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scan(CommonGBChannel channel, FrontEndControlCodeForScan frontEndControlCode, ErrorCallback<String> callback) {
|
||||
try {
|
||||
int cmdCode = 0;
|
||||
int parameter1 = 0;
|
||||
int parameter2 = 0;
|
||||
int parameter3 = 0;
|
||||
if (frontEndControlCode != null) {
|
||||
if (frontEndControlCode.getCode() != null) {
|
||||
if (frontEndControlCode.getCode() == 1) {
|
||||
cmdCode = 0x89;
|
||||
if (frontEndControlCode.getScanId() == null) {
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
|
||||
return;
|
||||
}
|
||||
parameter1 = frontEndControlCode.getScanId();
|
||||
} else if (frontEndControlCode.getCode() == 2) {
|
||||
cmdCode = 0x89;
|
||||
if (frontEndControlCode.getScanId() == null) {
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
|
||||
return;
|
||||
}
|
||||
parameter1 = frontEndControlCode.getScanId();
|
||||
parameter2 = 1;
|
||||
}else if (frontEndControlCode.getCode() == 3) {
|
||||
cmdCode = 0x89;
|
||||
if (frontEndControlCode.getScanId() == null) {
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
|
||||
return;
|
||||
}
|
||||
parameter1 = frontEndControlCode.getScanId();
|
||||
parameter2 = 2;
|
||||
}else if (frontEndControlCode.getCode() == 4) {
|
||||
cmdCode = 0x8A;
|
||||
if (frontEndControlCode.getScanId() == null) {
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
|
||||
return;
|
||||
}
|
||||
if (frontEndControlCode.getScanSpeed() == null) {
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
|
||||
return;
|
||||
}
|
||||
parameter1 = frontEndControlCode.getScanId();
|
||||
parameter2 = frontEndControlCode.getScanSpeed();
|
||||
}else if (frontEndControlCode.getCode() == 5) {
|
||||
}else {
|
||||
log.error("[巡航控制失败] 未知的指令 {}", frontEndControlCode.getCode());
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "未知的指令", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
ptzService.frontEndCommand(channel, cmdCode, parameter1, parameter2, parameter3);
|
||||
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null);
|
||||
}catch (Exception e) {
|
||||
log.error("[巡航控制失败] ", e);
|
||||
callback.run(ErrorCode.ERROR100.getCode(), e.getMessage(), null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void auxiliary(CommonGBChannel channel, FrontEndControlCodeForAuxiliary frontEndControlCode, ErrorCallback<String> callback) {
|
||||
try {
|
||||
int cmdCode = 0;
|
||||
int parameter1 = 0;
|
||||
int parameter2 = 0;
|
||||
int parameter3 = 0;
|
||||
if (frontEndControlCode != null) {
|
||||
if (frontEndControlCode.getCode() != null) {
|
||||
if (frontEndControlCode.getCode() == 1) {
|
||||
cmdCode = 0x8C;
|
||||
if (frontEndControlCode.getAuxiliaryId() == null) {
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
|
||||
return;
|
||||
}
|
||||
parameter1 = frontEndControlCode.getAuxiliaryId();
|
||||
} else if (frontEndControlCode.getCode() == 2) {
|
||||
cmdCode = 0x8D;
|
||||
if (frontEndControlCode.getAuxiliaryId() == null) {
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
|
||||
return;
|
||||
}
|
||||
parameter1 = frontEndControlCode.getAuxiliaryId();
|
||||
}else {
|
||||
log.error("[辅助开关失败] 未知的指令 {}", frontEndControlCode.getCode());
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "未知的指令", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
ptzService.frontEndCommand(channel, cmdCode, parameter1, parameter2, parameter3);
|
||||
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null);
|
||||
}catch (Exception e) {
|
||||
log.error("[辅助开关失败] ", e);
|
||||
callback.run(ErrorCode.ERROR100.getCode(), e.getMessage(), null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wiper(CommonGBChannel channel, FrontEndControlCodeForWiper frontEndControlCode, ErrorCallback<String> callback) {
|
||||
try {
|
||||
int cmdCode = 0;
|
||||
int parameter1 = 1;
|
||||
int parameter2 = 0;
|
||||
int parameter3 = 0;
|
||||
if (frontEndControlCode != null) {
|
||||
if (frontEndControlCode.getCode() != null) {
|
||||
if (frontEndControlCode.getCode() == 1) {
|
||||
cmdCode = 0x8C;
|
||||
} else if (frontEndControlCode.getCode() == 2) {
|
||||
cmdCode = 0x8D;
|
||||
}else {
|
||||
log.error("[雨刷开关失败] 未知的指令 {}", frontEndControlCode.getCode());
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "未知的指令", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
ptzService.frontEndCommand(channel, cmdCode, parameter1, parameter2, parameter3);
|
||||
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null);
|
||||
}catch (Exception e) {
|
||||
log.error("[雨刷开关失败] ", e);
|
||||
callback.run(ErrorCode.ERROR100.getCode(), e.getMessage(), null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queryPreset(CommonGBChannel channel, ErrorCallback<List<Preset>> callback) {
|
||||
ptzService.queryPresetList(channel, callback);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package com.genersoft.iot.vmp.gb28181.service.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.common.InviteSessionType;
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.PlayException;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IPlayService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.ISourcePlayService;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.sip.message.Response;
|
||||
|
||||
@Slf4j
|
||||
@Service(ChannelDataType.PLAY_SERVICE + ChannelDataType.GB28181)
|
||||
public class SourcePlayServiceForGbImpl implements ISourcePlayService {
|
||||
|
||||
@Autowired
|
||||
private IPlayService deviceChannelPlayService;
|
||||
|
||||
@Override
|
||||
public void play(CommonGBChannel channel, Platform platform, Boolean record, ErrorCallback<StreamInfo> callback) {
|
||||
// 国标通道
|
||||
try {
|
||||
deviceChannelPlayService.play(channel, record, callback);
|
||||
} catch (PlayException e) {
|
||||
callback.run(e.getCode(), e.getMsg(), null);
|
||||
} catch (ControllerException e) {
|
||||
log.error("[点播失败] {}({}), {}", channel.getGbName(), channel.getGbDeviceId(), e.getMsg());
|
||||
callback.run(Response.BUSY_HERE, "busy here", null);
|
||||
} catch (Exception e) {
|
||||
log.error("[点播失败] {}({})", channel.getGbName(), channel.getGbDeviceId(), e);
|
||||
callback.run(Response.BUSY_HERE, "busy here", null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopPlay(CommonGBChannel channel, String stream) {
|
||||
// 国标通道
|
||||
try {
|
||||
deviceChannelPlayService.stop(InviteSessionType.PLAY, channel, stream);
|
||||
} catch (Exception e) {
|
||||
log.error("[停止点播失败] {}({})", channel.getGbName(), channel.getGbDeviceId(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.genersoft.iot.vmp.gb28181.service.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.common.InviteSessionType;
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.PlayException;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IPlayService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.ISourcePlaybackService;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.sip.message.Response;
|
||||
|
||||
@Slf4j
|
||||
@Service(ChannelDataType.PLAYBACK_SERVICE + ChannelDataType.GB28181)
|
||||
public class SourcePlaybackServiceForGbImpl implements ISourcePlaybackService {
|
||||
|
||||
@Autowired
|
||||
private IPlayService deviceChannelPlayService;
|
||||
|
||||
@Override
|
||||
public void playback(CommonGBChannel channel, Long startTime, Long stopTime, ErrorCallback<StreamInfo> callback) {
|
||||
try {
|
||||
deviceChannelPlayService.playBack(channel, startTime, stopTime, callback);
|
||||
} catch (PlayException e) {
|
||||
callback.run(e.getCode(), e.getMsg(), null);
|
||||
} catch (Exception e) {
|
||||
callback.run(Response.BUSY_HERE, "busy here", null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopPlayback(CommonGBChannel channel, String stream) {
|
||||
// 国标通道
|
||||
try {
|
||||
deviceChannelPlayService.stop(InviteSessionType.PLAYBACK, channel, stream);
|
||||
} catch (Exception e) {
|
||||
log.error("[停止点播失败] {}({})", channel.getGbName(), channel.getGbDeviceId(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playbackPause(CommonGBChannel channel, String stream) {
|
||||
|
||||
}
|
||||
}
|
||||
@ -16,6 +16,7 @@ import gov.nist.javax.sip.message.SIPRequest;
|
||||
import javax.sip.InvalidArgumentException;
|
||||
import javax.sip.SipException;
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description:设备能力接口,用于定义设备的控制、查询能力
|
||||
@ -256,7 +257,7 @@ public interface ISIPCommander {
|
||||
*
|
||||
* @param device 视频设备
|
||||
*/
|
||||
void presetQuery(Device device, String channelId, ErrorCallback<Object> callback) throws InvalidArgumentException, SipException, ParseException;
|
||||
void presetQuery(Device device, String channelId, ErrorCallback<List<Preset>> callback) throws InvalidArgumentException, SipException, ParseException;
|
||||
|
||||
/**
|
||||
* 查询移动设备位置数据
|
||||
|
||||
@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.utils.GitUtil;
|
||||
import com.genersoft.iot.vmp.utils.IpPortUtil;
|
||||
import gov.nist.javax.sip.message.MessageFactoryImpl;
|
||||
import gov.nist.javax.sip.message.SIPRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -90,7 +91,7 @@ public class SIPRequestHeaderPlarformProvider {
|
||||
|
||||
|
||||
Request registerRequest = createRegisterRequest(parentPlatform, redisCatchStorage.getCSEQ(), fromTag, toTag, callIdHeader, expires);
|
||||
SipURI requestURI = SipFactory.getInstance().createAddressFactory().createSipURI(parentPlatform.getServerGBId(), parentPlatform.getServerIp() + ":" + parentPlatform.getServerPort());
|
||||
SipURI requestURI = SipFactory.getInstance().createAddressFactory().createSipURI(parentPlatform.getServerGBId(), IpPortUtil.concatenateIpAndPort(parentPlatform.getServerIp(), String.valueOf(parentPlatform.getServerPort())));
|
||||
if (www == null) {
|
||||
AuthorizationHeader authorizationHeader = SipFactory.getInstance().createHeaderFactory().createAuthorizationHeader("Digest");
|
||||
String username = parentPlatform.getUsername();
|
||||
@ -214,7 +215,7 @@ public class SIPRequestHeaderPlarformProvider {
|
||||
public SIPRequest createNotifyRequest(Platform parentPlatform, String content, SubscribeInfo subscribeInfo) throws PeerUnavailableException, ParseException, InvalidArgumentException {
|
||||
SIPRequest request = null;
|
||||
// sipuri
|
||||
SipURI requestURI = SipFactory.getInstance().createAddressFactory().createSipURI(parentPlatform.getServerGBId(), parentPlatform.getServerIp()+ ":" + parentPlatform.getServerPort());
|
||||
SipURI requestURI = SipFactory.getInstance().createAddressFactory().createSipURI(parentPlatform.getServerGBId(), IpPortUtil.concatenateIpAndPort(parentPlatform.getServerIp(), String.valueOf(parentPlatform.getServerPort())));
|
||||
// via
|
||||
ArrayList<ViaHeader> viaHeaders = new ArrayList<>();
|
||||
ViaHeader viaHeader = SipFactory.getInstance().createHeaderFactory().createViaHeader(parentPlatform.getDeviceIp(), parentPlatform.getDevicePort(),
|
||||
@ -274,7 +275,7 @@ public class SIPRequestHeaderPlarformProvider {
|
||||
|
||||
SIPRequest request = null;
|
||||
// sipuri
|
||||
SipURI requestURI = SipFactory.getInstance().createAddressFactory().createSipURI(platform.getServerGBId(), platform.getServerIp()+ ":" + platform.getServerPort());
|
||||
SipURI requestURI = SipFactory.getInstance().createAddressFactory().createSipURI(platform.getServerGBId(), IpPortUtil.concatenateIpAndPort(platform.getServerIp(), String.valueOf(platform.getServerPort())));
|
||||
// via
|
||||
ArrayList<ViaHeader> viaHeaders = new ArrayList<>();
|
||||
ViaHeader viaHeader = SipFactory.getInstance().createHeaderFactory().createViaHeader(platform.getDeviceIp(), platform.getDevicePort(),
|
||||
@ -380,7 +381,7 @@ public class SIPRequestHeaderPlarformProvider {
|
||||
|
||||
request.addHeader(SipUtils.createUserAgentHeader(gitUtil));
|
||||
|
||||
Address concatAddress = SipFactory.getInstance().createAddressFactory().createAddress(SipFactory.getInstance().createAddressFactory().createSipURI(sipConfig.getId(), sipLayer.getLocalIp(platform.getDeviceIp())+":"+ platform.getDevicePort()));
|
||||
Address concatAddress = SipFactory.getInstance().createAddressFactory().createAddress(SipFactory.getInstance().createAddressFactory().createSipURI(sipConfig.getId(), IpPortUtil.concatenateIpAndPort(sipLayer.getLocalIp(platform.getDeviceIp()), String.valueOf(platform.getDevicePort()))));
|
||||
request.addHeader(SipFactory.getInstance().createHeaderFactory().createContactHeader(concatAddress));
|
||||
|
||||
request.addHeader(SipUtils.createUserAgentHeader(gitUtil));
|
||||
|
||||
@ -7,6 +7,7 @@ import com.genersoft.iot.vmp.gb28181.bean.SipTransactionInfo;
|
||||
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.utils.GitUtil;
|
||||
import com.genersoft.iot.vmp.utils.IpPortUtil;
|
||||
import gov.nist.javax.sip.message.SIPRequest;
|
||||
import gov.nist.javax.sip.message.SIPResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -106,7 +107,7 @@ public class SIPRequestHeaderProvider {
|
||||
|
||||
request.addHeader(SipUtils.createUserAgentHeader(gitUtil));
|
||||
|
||||
Address concatAddress = SipFactory.getInstance().createAddressFactory().createAddress(SipFactory.getInstance().createAddressFactory().createSipURI(sipConfig.getId(), sipLayer.getLocalIp(device.getLocalIp())+":"+sipConfig.getPort()));
|
||||
Address concatAddress = SipFactory.getInstance().createAddressFactory().createAddress(SipFactory.getInstance().createAddressFactory().createSipURI(sipConfig.getId(), IpPortUtil.concatenateIpAndPort(sipLayer.getLocalIp(device.getLocalIp()), String.valueOf(sipConfig.getPort()))));
|
||||
// Address concatAddress = SipFactory.getInstance().createAddressFactory().createAddress(SipFactory.getInstance().createAddressFactory().createSipURI(sipConfig.getId(), device.getHost().getIp()+":"+device.getHost().getPort()));
|
||||
request.addHeader(SipFactory.getInstance().createHeaderFactory().createContactHeader(concatAddress));
|
||||
// Subject
|
||||
@ -142,7 +143,7 @@ public class SIPRequestHeaderProvider {
|
||||
CSeqHeader cSeqHeader = SipFactory.getInstance().createHeaderFactory().createCSeqHeader(redisCatchStorage.getCSEQ(), Request.INVITE);
|
||||
request = SipFactory.getInstance().createMessageFactory().createRequest(requestLine, Request.INVITE, callIdHeader, cSeqHeader,fromHeader, toHeader, viaHeaders, maxForwards);
|
||||
|
||||
Address concatAddress = SipFactory.getInstance().createAddressFactory().createAddress(SipFactory.getInstance().createAddressFactory().createSipURI(sipConfig.getId(), sipLayer.getLocalIp(device.getLocalIp())+":"+sipConfig.getPort()));
|
||||
Address concatAddress = SipFactory.getInstance().createAddressFactory().createAddress(SipFactory.getInstance().createAddressFactory().createSipURI(sipConfig.getId(), IpPortUtil.concatenateIpAndPort(sipLayer.getLocalIp(device.getLocalIp()), String.valueOf(sipConfig.getPort()))));
|
||||
// Address concatAddress = SipFactory.getInstance().createAddressFactory().createAddress(SipFactory.getInstance().createAddressFactory().createSipURI(sipConfig.getId(), device.getHost().getIp()+":"+device.getHost().getPort()));
|
||||
request.addHeader(SipFactory.getInstance().createHeaderFactory().createContactHeader(concatAddress));
|
||||
|
||||
@ -170,7 +171,7 @@ public class SIPRequestHeaderProvider {
|
||||
viaHeaders.add(viaHeader);
|
||||
//from
|
||||
// SipURI fromSipURI = SipFactory.getInstance().createAddressFactory().createSipURI(sipConfig.getId(),sipConfig.getDomain());
|
||||
SipURI fromSipURI = SipFactory.getInstance().createAddressFactory().createSipURI(sipConfig.getId(), sipLayer.getLocalIp(device.getLocalIp()) + ":" + sipConfig.getPort());
|
||||
SipURI fromSipURI = SipFactory.getInstance().createAddressFactory().createSipURI(sipConfig.getId(), IpPortUtil.concatenateIpAndPort(sipLayer.getLocalIp(device.getLocalIp()), String.valueOf(sipConfig.getPort())));
|
||||
Address fromAddress = SipFactory.getInstance().createAddressFactory().createAddress(fromSipURI);
|
||||
FromHeader fromHeader = SipFactory.getInstance().createHeaderFactory().createFromHeader(fromAddress, transactionInfo.getFromTag());
|
||||
//to
|
||||
@ -189,7 +190,7 @@ public class SIPRequestHeaderProvider {
|
||||
|
||||
request.addHeader(SipUtils.createUserAgentHeader(gitUtil));
|
||||
|
||||
Address concatAddress = SipFactory.getInstance().createAddressFactory().createAddress(SipFactory.getInstance().createAddressFactory().createSipURI(sipConfig.getId(), sipLayer.getLocalIp(device.getLocalIp())+":"+sipConfig.getPort()));
|
||||
Address concatAddress = SipFactory.getInstance().createAddressFactory().createAddress(SipFactory.getInstance().createAddressFactory().createSipURI(sipConfig.getId(), IpPortUtil.concatenateIpAndPort(sipLayer.getLocalIp(device.getLocalIp()), String.valueOf(sipConfig.getPort()))));
|
||||
request.addHeader(SipFactory.getInstance().createHeaderFactory().createContactHeader(concatAddress));
|
||||
|
||||
request.addHeader(SipUtils.createUserAgentHeader(gitUtil));
|
||||
@ -224,7 +225,7 @@ public class SIPRequestHeaderProvider {
|
||||
|
||||
request.addHeader(SipUtils.createUserAgentHeader(gitUtil));
|
||||
|
||||
Address concatAddress = SipFactory.getInstance().createAddressFactory().createAddress(SipFactory.getInstance().createAddressFactory().createSipURI(sipConfig.getId(), sipLayer.getLocalIp(device.getLocalIp())+":"+sipConfig.getPort()));
|
||||
Address concatAddress = SipFactory.getInstance().createAddressFactory().createAddress(SipFactory.getInstance().createAddressFactory().createSipURI(sipConfig.getId(), IpPortUtil.concatenateIpAndPort(sipLayer.getLocalIp(device.getLocalIp()), String.valueOf(sipConfig.getPort()))));
|
||||
request.addHeader(SipFactory.getInstance().createHeaderFactory().createContactHeader(concatAddress));
|
||||
|
||||
request.addHeader(SipUtils.createUserAgentHeader(gitUtil));
|
||||
@ -261,7 +262,7 @@ public class SIPRequestHeaderProvider {
|
||||
toHeader, viaHeaders, maxForwards);
|
||||
|
||||
|
||||
Address concatAddress = SipFactory.getInstance().createAddressFactory().createAddress(SipFactory.getInstance().createAddressFactory().createSipURI(sipConfig.getId(), sipLayer.getLocalIp(device.getLocalIp())+":"+sipConfig.getPort()));
|
||||
Address concatAddress = SipFactory.getInstance().createAddressFactory().createAddress(SipFactory.getInstance().createAddressFactory().createSipURI(sipConfig.getId(), IpPortUtil.concatenateIpAndPort(sipLayer.getLocalIp(device.getLocalIp()), String.valueOf(sipConfig.getPort()))));
|
||||
request.addHeader(SipFactory.getInstance().createHeaderFactory().createContactHeader(concatAddress));
|
||||
|
||||
// Expires
|
||||
@ -314,7 +315,7 @@ public class SIPRequestHeaderProvider {
|
||||
|
||||
request.addHeader(SipUtils.createUserAgentHeader(gitUtil));
|
||||
|
||||
Address concatAddress = SipFactory.getInstance().createAddressFactory().createAddress(SipFactory.getInstance().createAddressFactory().createSipURI(sipConfig.getId(), sipLayer.getLocalIp(device.getLocalIp())+":"+sipConfig.getPort()));
|
||||
Address concatAddress = SipFactory.getInstance().createAddressFactory().createAddress(SipFactory.getInstance().createAddressFactory().createSipURI(sipConfig.getId(), IpPortUtil.concatenateIpAndPort(sipLayer.getLocalIp(device.getLocalIp()), String.valueOf(sipConfig.getPort()))));
|
||||
request.addHeader(SipFactory.getInstance().createHeaderFactory().createContactHeader(concatAddress));
|
||||
|
||||
request.addHeader(SipUtils.createUserAgentHeader(gitUtil));
|
||||
@ -345,7 +346,7 @@ public class SIPRequestHeaderProvider {
|
||||
|
||||
request.addHeader(SipUtils.createUserAgentHeader(gitUtil));
|
||||
|
||||
Address concatAddress = SipFactory.getInstance().createAddressFactory().createAddress(SipFactory.getInstance().createAddressFactory().createSipURI(sipConfig.getId(), localIp + ":"+sipConfig.getPort()));
|
||||
Address concatAddress = SipFactory.getInstance().createAddressFactory().createAddress(SipFactory.getInstance().createAddressFactory().createSipURI(sipConfig.getId(), IpPortUtil.concatenateIpAndPort(localIp, String.valueOf(sipConfig.getPort()))));
|
||||
request.addHeader(SipFactory.getInstance().createHeaderFactory().createContactHeader(concatAddress));
|
||||
|
||||
request.addHeader(SipUtils.createUserAgentHeader(gitUtil));
|
||||
|
||||
@ -40,6 +40,7 @@ import javax.sip.SipFactory;
|
||||
import javax.sip.header.CallIdHeader;
|
||||
import javax.sip.message.Request;
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description:设备能力接口,用于定义设备的控制、查询能力
|
||||
@ -1118,7 +1119,7 @@ public class SIPCommander implements ISIPCommander {
|
||||
* @param device 视频设备
|
||||
*/
|
||||
@Override
|
||||
public void presetQuery(Device device, String channelId, ErrorCallback<Object> callback) throws InvalidArgumentException, SipException, ParseException {
|
||||
public void presetQuery(Device device, String channelId, ErrorCallback<List<Preset>> callback) throws InvalidArgumentException, SipException, ParseException {
|
||||
|
||||
String cmdType = "PresetQuery";
|
||||
int sn = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
@ -1136,10 +1137,10 @@ public class SIPCommander implements ISIPCommander {
|
||||
}
|
||||
cmdXml.append("</Query>\r\n");
|
||||
|
||||
MessageEvent<Object> messageEvent = MessageEvent.getInstance(cmdType, sn + "", channelId, 4000L, callback);
|
||||
MessageEvent<List<Preset>> messageEvent = MessageEvent.getInstance(cmdType, sn + "", channelId, 4000L, callback);
|
||||
messageSubscribe.addSubscribe(messageEvent);
|
||||
log.info("[预置位查询] 设备编号: {}, 通道编号: {}, SN: {}", device.getDeviceId(), channelId, sn);
|
||||
Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, SipUtils.getNewFromTag(), null,sipSender.getNewCallIdHeader(sipLayer.getLocalIp(device.getLocalIp()),device.getTransport()));
|
||||
Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), SipUtils.getNewViaTag(), SipUtils.getNewFromTag(), null,sipSender.getNewCallIdHeader(sipLayer.getLocalIp(device.getLocalIp()),device.getTransport()));
|
||||
sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), request, eventResult -> {
|
||||
messageSubscribe.removeSubscribe(messageEvent.getKey());
|
||||
callback.run(ErrorCode.ERROR100.getCode(), "失败," + eventResult.msg, null);
|
||||
|
||||
@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.SIPSender;
|
||||
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||
import com.genersoft.iot.vmp.utils.IpPortUtil;
|
||||
import com.google.common.primitives.Bytes;
|
||||
import gov.nist.javax.sip.message.SIPRequest;
|
||||
import gov.nist.javax.sip.message.SIPResponse;
|
||||
@ -95,7 +96,7 @@ public abstract class SIPRequestProcessorParent {
|
||||
if (responseAckExtraParam.sipURI != null && sipRequest.getMethod().equals(Request.INVITE)) {
|
||||
log.debug("responseSdpAck SipURI: {}:{}", responseAckExtraParam.sipURI.getHost(), responseAckExtraParam.sipURI.getPort());
|
||||
Address concatAddress = SipFactory.getInstance().createAddressFactory().createAddress(
|
||||
SipFactory.getInstance().createAddressFactory().createSipURI(responseAckExtraParam.sipURI.getUser(), responseAckExtraParam.sipURI.getHost()+":"+responseAckExtraParam.sipURI.getPort()
|
||||
SipFactory.getInstance().createAddressFactory().createSipURI(responseAckExtraParam.sipURI.getUser(), IpPortUtil.concatenateIpAndPort(responseAckExtraParam.sipURI.getHost(), String.valueOf(responseAckExtraParam.sipURI.getPort()))
|
||||
));
|
||||
response.addHeader(SipFactory.getInstance().createHeaderFactory().createContactHeader(concatAddress));
|
||||
}
|
||||
@ -135,7 +136,7 @@ public abstract class SIPRequestProcessorParent {
|
||||
// 兼容国标中的使用编码@域名作为RequestURI的情况
|
||||
SipURI sipURI = (SipURI)request.getRequestURI();
|
||||
if (sipURI.getPort() == -1) {
|
||||
sipURI = SipFactory.getInstance().createAddressFactory().createSipURI(platform.getServerGBId(), platform.getServerIp()+":"+platform.getServerPort());
|
||||
sipURI = SipFactory.getInstance().createAddressFactory().createSipURI(platform.getServerGBId(), IpPortUtil.concatenateIpAndPort(platform.getServerIp(), String.valueOf(platform.getServerPort())));
|
||||
}
|
||||
ResponseAckExtraParam responseAckExtraParam = new ResponseAckExtraParam();
|
||||
responseAckExtraParam.contentTypeHeader = contentTypeHeader;
|
||||
@ -156,7 +157,7 @@ public abstract class SIPRequestProcessorParent {
|
||||
|
||||
SipURI sipURI = (SipURI)request.getRequestURI();
|
||||
if (sipURI.getPort() == -1) {
|
||||
sipURI = SipFactory.getInstance().createAddressFactory().createSipURI(platform.getServerGBId(), platform.getServerIp()+":"+platform.getServerPort());
|
||||
sipURI = SipFactory.getInstance().createAddressFactory().createSipURI(platform.getServerGBId(), IpPortUtil.concatenateIpAndPort(platform.getServerIp(), String.valueOf(platform.getServerPort())));
|
||||
}
|
||||
ResponseAckExtraParam responseAckExtraParam = new ResponseAckExtraParam();
|
||||
responseAckExtraParam.contentTypeHeader = contentTypeHeader;
|
||||
|
||||
@ -161,7 +161,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
||||
log.error("[命令发送失败] 上级Invite TRYING: {}", e.getMessage());
|
||||
}
|
||||
|
||||
channelPlayService.start(channel, inviteInfo, platform, ((code, msg, streamInfo) -> {
|
||||
channelPlayService.startInvite(channel, inviteInfo, platform, ((code, msg, streamInfo) -> {
|
||||
if (code != InviteErrorCode.SUCCESS.getCode()) {
|
||||
try {
|
||||
responseAck(request, Response.BUSY_HERE , msg);
|
||||
@ -247,6 +247,13 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
||||
} catch (SipException | InvalidArgumentException | ParseException sendException) {
|
||||
log.error("[命令发送失败] invite 点播失败: {}", sendException.getMessage());
|
||||
}
|
||||
}catch (Exception e) {
|
||||
log.error("[Invite处理异常] ", e);
|
||||
try {
|
||||
responseAck(request, Response.SERVER_INTERNAL_ERROR, "");
|
||||
} catch (SipException | InvalidArgumentException | ParseException sendException) {
|
||||
log.error("[命令发送失败] invite 点播失败: {}", sendException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
|
||||
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.utils.IpPortUtil;
|
||||
import gov.nist.javax.sip.address.AddressImpl;
|
||||
import gov.nist.javax.sip.address.SipUri;
|
||||
import gov.nist.javax.sip.header.SIPDateHeader;
|
||||
@ -103,7 +104,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
|
||||
device.setExpires(request.getExpires().getExpires());
|
||||
device.setIp(remoteAddressInfo.getIp());
|
||||
device.setPort(remoteAddressInfo.getPort());
|
||||
device.setHostAddress(remoteAddressInfo.getIp().concat(":").concat(String.valueOf(remoteAddressInfo.getPort())));
|
||||
device.setHostAddress(IpPortUtil.concatenateIpAndPort(remoteAddressInfo.getIp(), String.valueOf(remoteAddressInfo.getPort())));
|
||||
|
||||
device.setLocalIp(request.getLocalAddress().getHostAddress());
|
||||
Response registerOkResponse = getRegisterOkResponse(request);
|
||||
@ -186,7 +187,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
|
||||
device.setServerId(userSetting.getServerId());
|
||||
device.setIp(remoteAddressInfo.getIp());
|
||||
device.setPort(remoteAddressInfo.getPort());
|
||||
device.setHostAddress(remoteAddressInfo.getIp().concat(":").concat(String.valueOf(remoteAddressInfo.getPort())));
|
||||
device.setHostAddress(IpPortUtil.concatenateIpAndPort(remoteAddressInfo.getIp(), String.valueOf(remoteAddressInfo.getPort())));
|
||||
device.setLocalIp(request.getLocalAddress().getHostAddress());
|
||||
if (request.getExpires().getExpires() == 0) {
|
||||
// 注销成功
|
||||
|
||||
@ -102,7 +102,7 @@ public class InfoRequestProcessor extends SIPRequestProcessorParent implements I
|
||||
return;
|
||||
}
|
||||
// 判断通道类型
|
||||
if (channel.getDataType() != ChannelDataType.GB28181.value) {
|
||||
if (channel.getDataType() != ChannelDataType.GB28181) {
|
||||
// 非国标通道不支持录像回放控制
|
||||
log.warn("[INFO 消息] 非国标通道不支持录像回放控制: 通道ID: {}", sendRtpInfo.getChannelId());
|
||||
responseAck(request, Response.FORBIDDEN, "");
|
||||
|
||||
@ -140,7 +140,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
|
||||
* 处理云台指令
|
||||
*/
|
||||
private void handlePtzCmd(CommonGBChannel channel, Element rootElement, SIPRequest request, DeviceControlType type) {
|
||||
if (channel.getDataType() == ChannelDataType.GB28181.value) {
|
||||
if (channel.getDataType() == ChannelDataType.GB28181) {
|
||||
|
||||
deviceChannelService.handlePtzCmd(channel.getDataDeviceId(), channel.getGbId(), rootElement, type, ((code, msg, data) -> {
|
||||
try {
|
||||
@ -166,54 +166,78 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
|
||||
case PTZ:
|
||||
channelControlService.ptz(channel, (FrontEndControlCodeForPTZ)frontEndControlCode, ((code, msg, data) -> {
|
||||
try {
|
||||
responseAck(request, code, msg);
|
||||
if (code == ErrorCode.SUCCESS.getCode()) {
|
||||
responseAck(request, Response.OK);
|
||||
}else {
|
||||
responseAck(request, Response.FORBIDDEN);
|
||||
}
|
||||
} catch (InvalidArgumentException | SipException | ParseException exception) {
|
||||
log.error("[命令发送失败] 云台指令: {}", exception.getMessage());
|
||||
}
|
||||
}));
|
||||
break;
|
||||
case FI:
|
||||
channelControlService.fi(channel, (FrontEndControlCodeForPTZ)frontEndControlCode, ((code, msg, data) -> {
|
||||
channelControlService.fi(channel, (FrontEndControlCodeForFI) frontEndControlCode, ((code, msg, data) -> {
|
||||
try {
|
||||
responseAck(request, code, msg);
|
||||
if (code == ErrorCode.SUCCESS.getCode()) {
|
||||
responseAck(request, Response.OK);
|
||||
}else {
|
||||
responseAck(request, Response.FORBIDDEN);
|
||||
}
|
||||
} catch (InvalidArgumentException | SipException | ParseException exception) {
|
||||
log.error("[命令发送失败] 云台指令: {}", exception.getMessage());
|
||||
log.error("[命令发送失败] FI指令: {}", exception.getMessage());
|
||||
}
|
||||
}));
|
||||
break;
|
||||
case PRESET:
|
||||
channelControlService.preset(channel, (FrontEndControlCodeForPTZ)frontEndControlCode, ((code, msg, data) -> {
|
||||
channelControlService.preset(channel, (FrontEndControlCodeForPreset) frontEndControlCode, ((code, msg, data) -> {
|
||||
try {
|
||||
responseAck(request, code, msg);
|
||||
if (code == ErrorCode.SUCCESS.getCode()) {
|
||||
responseAck(request, Response.OK);
|
||||
}else {
|
||||
responseAck(request, Response.FORBIDDEN);
|
||||
}
|
||||
} catch (InvalidArgumentException | SipException | ParseException exception) {
|
||||
log.error("[命令发送失败] 云台指令: {}", exception.getMessage());
|
||||
log.error("[命令发送失败] 预置位指令: {}", exception.getMessage());
|
||||
}
|
||||
}));
|
||||
break;
|
||||
case TOUR:
|
||||
channelControlService.tour(channel, (FrontEndControlCodeForPTZ)frontEndControlCode, ((code, msg, data) -> {
|
||||
channelControlService.tour(channel, (FrontEndControlCodeForTour) frontEndControlCode, ((code, msg, data) -> {
|
||||
try {
|
||||
responseAck(request, code, msg);
|
||||
if (code == ErrorCode.SUCCESS.getCode()) {
|
||||
responseAck(request, Response.OK);
|
||||
}else {
|
||||
responseAck(request, Response.FORBIDDEN);
|
||||
}
|
||||
} catch (InvalidArgumentException | SipException | ParseException exception) {
|
||||
log.error("[命令发送失败] 云台指令: {}", exception.getMessage());
|
||||
log.error("[命令发送失败] 巡航指令: {}", exception.getMessage());
|
||||
}
|
||||
}));
|
||||
break;
|
||||
case SCAN:
|
||||
channelControlService.scan(channel, (FrontEndControlCodeForPTZ)frontEndControlCode, ((code, msg, data) -> {
|
||||
channelControlService.scan(channel, (FrontEndControlCodeForScan) frontEndControlCode, ((code, msg, data) -> {
|
||||
try {
|
||||
responseAck(request, code, msg);
|
||||
if (code == ErrorCode.SUCCESS.getCode()) {
|
||||
responseAck(request, Response.OK);
|
||||
}else {
|
||||
responseAck(request, Response.FORBIDDEN);
|
||||
}
|
||||
} catch (InvalidArgumentException | SipException | ParseException exception) {
|
||||
log.error("[命令发送失败] 云台指令: {}", exception.getMessage());
|
||||
log.error("[命令发送失败] 扫描指令: {}", exception.getMessage());
|
||||
}
|
||||
}));
|
||||
break;
|
||||
case AUXILIARY:
|
||||
channelControlService.auxiliary(channel, (FrontEndControlCodeForPTZ)frontEndControlCode, ((code, msg, data) -> {
|
||||
channelControlService.auxiliary(channel, (FrontEndControlCodeForAuxiliary) frontEndControlCode, ((code, msg, data) -> {
|
||||
try {
|
||||
responseAck(request, code, msg);
|
||||
if (code == ErrorCode.SUCCESS.getCode()) {
|
||||
responseAck(request, Response.OK);
|
||||
}else {
|
||||
responseAck(request, Response.FORBIDDEN);
|
||||
}
|
||||
} catch (InvalidArgumentException | SipException | ParseException exception) {
|
||||
log.error("[命令发送失败] 云台指令: {}", exception.getMessage());
|
||||
log.error("[命令发送失败] 辅助开关指令: {}", exception.getMessage());
|
||||
}
|
||||
}));
|
||||
break;
|
||||
@ -232,7 +256,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
|
||||
* 处理强制关键帧
|
||||
*/
|
||||
private void handleIFameCmd(CommonGBChannel channel, SIPRequest request) {
|
||||
if (channel.getDataType() != ChannelDataType.GB28181.value) {
|
||||
if (channel.getDataType() != ChannelDataType.GB28181) {
|
||||
// 只支持国标的云台控制
|
||||
log.warn("[INFO 消息] 只支持国标的处理强制关键帧, 通道ID: {}", channel.getGbId());
|
||||
try {
|
||||
@ -280,7 +304,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
|
||||
* 处理重启命令
|
||||
*/
|
||||
private void handleTeleBootCmd(CommonGBChannel channel, SIPRequest request) {
|
||||
if (channel.getDataType() != ChannelDataType.GB28181.value) {
|
||||
if (channel.getDataType() != ChannelDataType.GB28181) {
|
||||
// 只支持国标的云台控制
|
||||
log.warn("[INFO 消息] 只支持国标的重启命令, 通道ID: {}", channel.getGbId());
|
||||
try {
|
||||
@ -315,7 +339,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
|
||||
* 处理拉框控制
|
||||
*/
|
||||
private void handleDragZoom(CommonGBChannel channel, Element rootElement, SIPRequest request, DeviceControlType type) {
|
||||
if (channel.getDataType() != ChannelDataType.GB28181.value) {
|
||||
if (channel.getDataType() != ChannelDataType.GB28181) {
|
||||
// 只支持国标的云台控制
|
||||
log.warn("[deviceControl-DragZoom] 只支持国标的拉框控制, 通道ID: {}", channel.getGbId());
|
||||
try {
|
||||
@ -380,7 +404,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
|
||||
* 处理看守位命令
|
||||
*/
|
||||
private void handleHomePositionCmd(CommonGBChannel channel, Element rootElement, SIPRequest request, DeviceControlType type) {
|
||||
if (channel.getDataType() != ChannelDataType.GB28181.value) {
|
||||
if (channel.getDataType() != ChannelDataType.GB28181) {
|
||||
// 只支持国标的云台控制
|
||||
log.warn("[INFO 消息] 只支持国标的看守位命令, 通道ID: {}", channel.getGbId());
|
||||
try {
|
||||
@ -436,7 +460,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
|
||||
* 处理告警消息
|
||||
*/
|
||||
private void handleAlarmCmd(CommonGBChannel channel, Element rootElement, SIPRequest request) {
|
||||
if (channel.getDataType() != ChannelDataType.GB28181.value) {
|
||||
if (channel.getDataType() != ChannelDataType.GB28181) {
|
||||
// 只支持国标的云台控制
|
||||
log.warn("[INFO 消息] 只支持国标的告警消息, 通道ID: {}", channel.getGbId());
|
||||
try {
|
||||
@ -486,7 +510,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
|
||||
* 处理录像控制
|
||||
*/
|
||||
private void handleRecordCmd(CommonGBChannel channel, Element rootElement, SIPRequest request, DeviceControlType type) {
|
||||
if (channel.getDataType() != ChannelDataType.GB28181.value) {
|
||||
if (channel.getDataType() != ChannelDataType.GB28181) {
|
||||
// 只支持国标的云台控制
|
||||
log.warn("[INFO 消息] 只支持国标的息录像控制, 通道ID: {}", channel.getGbId());
|
||||
try {
|
||||
@ -542,7 +566,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
|
||||
* 处理报警布防/撤防命令
|
||||
*/
|
||||
private void handleGuardCmd(CommonGBChannel channel, Element rootElement, SIPRequest request, DeviceControlType type) {
|
||||
if (channel.getDataType() != ChannelDataType.GB28181.value) {
|
||||
if (channel.getDataType() != ChannelDataType.GB28181) {
|
||||
// 只支持国标的云台控制
|
||||
log.warn("[INFO 消息] 只支持国标的报警布防/撤防命令, 通道ID: {}", channel.getGbId());
|
||||
try {
|
||||
|
||||
@ -107,7 +107,7 @@ public class BroadcastNotifyMessageHandler extends SIPRequestProcessorParent imp
|
||||
responseAck(request, Response.NOT_FOUND, "TargetID not found");
|
||||
return;
|
||||
}
|
||||
if (channel.getDataType() != ChannelDataType.GB28181.value) {
|
||||
if (channel.getDataType() != ChannelDataType.GB28181) {
|
||||
// 只支持国标的语音喊话
|
||||
log.warn("[INFO 消息] 只支持国标的语音喊话命令, 通道ID: {}", channel.getGbId());
|
||||
try {
|
||||
|
||||
@ -13,6 +13,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessag
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler;
|
||||
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.utils.IpPortUtil;
|
||||
import gov.nist.javax.sip.message.SIPRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dom4j.Element;
|
||||
@ -106,7 +107,7 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
|
||||
if (device.getIp() == null || !device.getIp().equalsIgnoreCase(remoteAddressInfo.getIp()) || device.getPort() != remoteAddressInfo.getPort()) {
|
||||
log.info("[收到心跳] 地址变化, {}({}), {}:{}->{}", device.getName(), device.getDeviceId(), remoteAddressInfo.getIp(), remoteAddressInfo.getPort(), request.getLocalAddress().getHostAddress());
|
||||
device.setPort(remoteAddressInfo.getPort());
|
||||
device.setHostAddress(remoteAddressInfo.getIp().concat(":").concat(String.valueOf(remoteAddressInfo.getPort())));
|
||||
device.setHostAddress(IpPortUtil.concatenateIpAndPort(remoteAddressInfo.getIp(), String.valueOf(remoteAddressInfo.getPort())));
|
||||
device.setIp(remoteAddressInfo.getIp());
|
||||
device.setLocalIp(request.getLocalAddress().getHostAddress());
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ public class DeviceInfoQueryMessageHandler extends SIPRequestProcessorParent imp
|
||||
return;
|
||||
}
|
||||
// 判断通道类型
|
||||
if (channel.getDataType() != ChannelDataType.GB28181.value) {
|
||||
if (channel.getDataType() != ChannelDataType.GB28181) {
|
||||
// 非国标通道不支持录像回放控制
|
||||
log.warn("[DeviceInfo] 非国标通道不支持录像回放控制: 通道ID: {}", channel.getGbId());
|
||||
try {
|
||||
|
||||
@ -105,7 +105,7 @@ public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent imp
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (channel.getDataType() != ChannelDataType.GB28181.value) {
|
||||
if (channel.getDataType() != ChannelDataType.GB28181) {
|
||||
log.info("[平台查询录像记录] 只支持查询国标28181的录像数据 {}/{}", platform.getName(), channelId );
|
||||
try {
|
||||
responseAck(request, Response.NOT_IMPLEMENTED); // 回复未实现
|
||||
|
||||
@ -136,7 +136,7 @@ public class PresetQueryResponseMessageHandler extends SIPRequestProcessorParent
|
||||
List<Preset> data = messageResponseTask.getData();
|
||||
data.addAll(presetQuerySipReqList);
|
||||
if (data.size() == sumNum) {
|
||||
responseMessageHandler.handMessageEvent(rootElement, presetQuerySipReqList);
|
||||
responseMessageHandler.handMessageEvent(rootElement, data);
|
||||
mesageMap.remove(key);
|
||||
boolean remove = delayQueue.remove(messageResponseTask);
|
||||
if (!remove) {
|
||||
|
||||
@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.SIPSender;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.SIPRequestHeaderProvider;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.event.response.SIPResponseProcessorAbstract;
|
||||
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||
import com.genersoft.iot.vmp.utils.IpPortUtil;
|
||||
import gov.nist.javax.sip.ResponseEventExt;
|
||||
import gov.nist.javax.sip.message.SIPResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -75,7 +76,7 @@ public class InviteResponseProcessor extends SIPResponseProcessorAbstract {
|
||||
String contentString = new String(response.getRawContent());
|
||||
Gb28181Sdp gb28181Sdp = SipUtils.parseSDP(contentString);
|
||||
SessionDescription sdp = gb28181Sdp.getBaseSdb();
|
||||
SipURI requestUri = SipFactory.getInstance().createAddressFactory().createSipURI(sdp.getOrigin().getUsername(), event.getRemoteIpAddress() + ":" + event.getRemotePort());
|
||||
SipURI requestUri = SipFactory.getInstance().createAddressFactory().createSipURI(sdp.getOrigin().getUsername(), IpPortUtil.concatenateIpAndPort(event.getRemoteIpAddress(), String.valueOf(event.getRemotePort())));
|
||||
Request reqAck = headerProvider.createAckRequest(response.getLocalAddress().getHostAddress(), requestUri, response);
|
||||
|
||||
log.info("[回复ack] {}-> {}:{} ", sdp.getOrigin().getUsername(), event.getRemoteIpAddress(), event.getRemotePort());
|
||||
|
||||
@ -20,9 +20,9 @@ public interface IRedisRpcPlayService {
|
||||
|
||||
void queryRecordInfo(String serverId, Integer channelId, String startTime, String endTime, ErrorCallback<RecordInfo> callback);
|
||||
|
||||
void pauseRtp(String serverId, String streamId);
|
||||
void playbackPause(String serverId, String streamId);
|
||||
|
||||
void resumeRtp(String serverId, String streamId);
|
||||
void playbackResume(String serverId, String streamId);
|
||||
|
||||
String frontEndCommand(String serverId, Integer channelId, int cmdCode, int parameter1, int parameter2, int combindCode2);
|
||||
|
||||
|
||||
@ -6,6 +6,8 @@ import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IRedisRpcService {
|
||||
|
||||
SendRtpInfo getSendRtpItem(String callId);
|
||||
@ -63,5 +65,5 @@ public interface IRedisRpcService {
|
||||
|
||||
WVPResult<Object> deviceInfo(String serverId, Device device);
|
||||
|
||||
WVPResult<Object> queryPreset(String serverId, Device device, String channelId);
|
||||
WVPResult<List<Preset>> queryPreset(String serverId, Device device, String channelId);
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.genersoft.iot.vmp.service.redisMsg.control;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.genersoft.iot.vmp.common.InviteSessionType;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
@ -10,9 +9,7 @@ import com.genersoft.iot.vmp.conf.redis.bean.RedisRpcMessage;
|
||||
import com.genersoft.iot.vmp.conf.redis.bean.RedisRpcRequest;
|
||||
import com.genersoft.iot.vmp.conf.redis.bean.RedisRpcResponse;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.InviteMessageInfo;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.SyncStatus;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IGbChannelPlayService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IPTZService;
|
||||
@ -81,7 +78,7 @@ public class RedisRpcChannelPlayController extends RpcController {
|
||||
|
||||
InviteMessageInfo inviteInfo = new InviteMessageInfo();
|
||||
inviteInfo.setSessionName("Play");
|
||||
channelPlayService.start(channel, inviteInfo, null, (code, msg, data) ->{
|
||||
channelPlayService.startInvite(channel, inviteInfo, null, (code, msg, data) ->{
|
||||
if (code == InviteErrorCode.SUCCESS.getCode()) {
|
||||
response.setStatusCode(ErrorCode.SUCCESS.getCode());
|
||||
response.setBody(data);
|
||||
@ -118,7 +115,7 @@ public class RedisRpcChannelPlayController extends RpcController {
|
||||
response.setBody("param error");
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
channelService.queryRecordInfo(channel, startTime, endTime, (code, msg, data) ->{
|
||||
if (code == InviteErrorCode.SUCCESS.getCode()) {
|
||||
@ -134,15 +131,15 @@ public class RedisRpcChannelPlayController extends RpcController {
|
||||
response.setStatusCode(ErrorCode.ERROR100.getCode());
|
||||
response.setBody(e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂停录像回放
|
||||
*/
|
||||
@RedisRpcMapping("pauseRtp")
|
||||
public RedisRpcResponse pauseRtp(RedisRpcRequest request) {
|
||||
@RedisRpcMapping("playbackPause")
|
||||
public RedisRpcResponse playbackPause(RedisRpcRequest request) {
|
||||
String streamId = request.getParam().toString();
|
||||
RedisRpcResponse response = request.getResponse();
|
||||
|
||||
@ -153,7 +150,7 @@ public class RedisRpcChannelPlayController extends RpcController {
|
||||
}
|
||||
|
||||
try {
|
||||
channelPlayService.pauseRtp(streamId);
|
||||
// channelPlayService.playbackPause(streamId);
|
||||
response.setStatusCode(ErrorCode.SUCCESS.getCode());
|
||||
}catch (ControllerException e) {
|
||||
response.setStatusCode(ErrorCode.ERROR100.getCode());
|
||||
@ -166,8 +163,8 @@ public class RedisRpcChannelPlayController extends RpcController {
|
||||
/**
|
||||
* 恢复录像回放
|
||||
*/
|
||||
@RedisRpcMapping("resumeRtp")
|
||||
public RedisRpcResponse resumeRtp(RedisRpcRequest request) {
|
||||
@RedisRpcMapping("playbackResume")
|
||||
public RedisRpcResponse playbackResume(RedisRpcRequest request) {
|
||||
String streamId = request.getParam().toString();
|
||||
RedisRpcResponse response = request.getResponse();
|
||||
|
||||
@ -178,7 +175,7 @@ public class RedisRpcChannelPlayController extends RpcController {
|
||||
}
|
||||
|
||||
try {
|
||||
channelPlayService.resumeRtp(streamId);
|
||||
// channelPlayService.playbackResume(streamId);
|
||||
response.setStatusCode(ErrorCode.SUCCESS.getCode());
|
||||
}catch (ControllerException e) {
|
||||
response.setStatusCode(ErrorCode.ERROR100.getCode());
|
||||
@ -216,7 +213,7 @@ public class RedisRpcChannelPlayController extends RpcController {
|
||||
return response;
|
||||
}
|
||||
try {
|
||||
channelPlayService.stopPlay(type, channel, stream);
|
||||
channelPlayService.stopInvite(type, channel, stream);
|
||||
response.setStatusCode(ErrorCode.SUCCESS.getCode());
|
||||
}catch (Exception e){
|
||||
response.setStatusCode(Response.SERVER_INTERNAL_ERROR);
|
||||
@ -253,7 +250,7 @@ public class RedisRpcChannelPlayController extends RpcController {
|
||||
inviteInfo.setSessionName("Playback");
|
||||
inviteInfo.setStartTime(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime));
|
||||
inviteInfo.setStopTime(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime));
|
||||
channelPlayService.start(channel, inviteInfo, null, (code, msg, data) ->{
|
||||
channelPlayService.startInvite(channel, inviteInfo, null, (code, msg, data) ->{
|
||||
if (code == InviteErrorCode.SUCCESS.getCode()) {
|
||||
response.setStatusCode(ErrorCode.SUCCESS.getCode());
|
||||
response.setBody(data);
|
||||
@ -296,7 +293,7 @@ public class RedisRpcChannelPlayController extends RpcController {
|
||||
inviteInfo.setStartTime(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime));
|
||||
inviteInfo.setStopTime(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime));
|
||||
inviteInfo.setDownloadSpeed(downloadSpeed + "");
|
||||
channelPlayService.start(channel, inviteInfo, null, (code, msg, data) ->{
|
||||
channelPlayService.startInvite(channel, inviteInfo, null, (code, msg, data) ->{
|
||||
if (code == InviteErrorCode.SUCCESS.getCode()) {
|
||||
response.setStatusCode(ErrorCode.SUCCESS.getCode());
|
||||
response.setBody(data);
|
||||
|
||||
@ -121,8 +121,8 @@ public class RedisRpcPlayServiceImpl implements IRedisRpcPlayService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pauseRtp(String serverId, String streamId) {
|
||||
RedisRpcRequest request = buildRequest("channel/pauseRtp", streamId);
|
||||
public void playbackPause(String serverId, String streamId) {
|
||||
RedisRpcRequest request = buildRequest("channel/playbackPause", streamId);
|
||||
request.setToId(serverId);
|
||||
RedisRpcResponse response = redisRpcConfig.request(request, 5, TimeUnit.SECONDS);
|
||||
if (response == null) {
|
||||
@ -135,8 +135,8 @@ public class RedisRpcPlayServiceImpl implements IRedisRpcPlayService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resumeRtp(String serverId, String streamId) {
|
||||
RedisRpcRequest request = buildRequest("channel/resumeRtp", streamId);
|
||||
public void playbackResume(String serverId, String streamId) {
|
||||
RedisRpcRequest request = buildRequest("channel/playbackResume", streamId);
|
||||
request.setToId(serverId);
|
||||
RedisRpcResponse response = redisRpcConfig.request(request, 5, TimeUnit.SECONDS);
|
||||
if (response == null) {
|
||||
|
||||
@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@ -406,7 +407,7 @@ public class RedisRpcServiceImpl implements IRedisRpcService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public WVPResult<Object> queryPreset(String serverId, Device device, String channelId) {
|
||||
public WVPResult<List<Preset>> queryPreset(String serverId, Device device, String channelId) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("device", device.getDeviceId());
|
||||
jsonObject.put("channelId", channelId);
|
||||
|
||||
@ -79,7 +79,7 @@ public class StreamProxy extends CommonGBChannel {
|
||||
if (ObjectUtils.isEmpty(this.getGbName())) {
|
||||
this.setGbName( app+ "-" +stream);
|
||||
}
|
||||
this.setDataType(ChannelDataType.STREAM_PROXY.value);
|
||||
this.setDataType(ChannelDataType.STREAM_PROXY);
|
||||
this.setDataDeviceId(this.getId());
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ public class StreamProxyProvider {
|
||||
public String getBaseSelectSql(){
|
||||
return "SELECT " +
|
||||
" st.*, " +
|
||||
ChannelDataType.STREAM_PROXY.value + " as data_type, " +
|
||||
ChannelDataType.STREAM_PROXY + " as data_type, " +
|
||||
" st.id as data_device_id, " +
|
||||
" wdc.*, " +
|
||||
" wdc.id as gb_id" +
|
||||
|
||||
@ -0,0 +1,42 @@
|
||||
package com.genersoft.iot.vmp.streamProxy.service.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
||||
import com.genersoft.iot.vmp.gb28181.service.ISourcePlayService;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
import com.genersoft.iot.vmp.streamProxy.service.IStreamProxyPlayService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.sip.message.Response;
|
||||
|
||||
@Slf4j
|
||||
@Service(ChannelDataType.PLAY_SERVICE + ChannelDataType.STREAM_PROXY)
|
||||
public class SourcePlayServiceForStreamProxyImpl implements ISourcePlayService {
|
||||
|
||||
@Autowired
|
||||
private IStreamProxyPlayService playService;
|
||||
|
||||
@Override
|
||||
public void play(CommonGBChannel channel, Platform platform, Boolean record, ErrorCallback<StreamInfo> callback) {
|
||||
// 拉流代理通道
|
||||
try {
|
||||
playService.start(channel.getDataDeviceId(), record, callback);
|
||||
}catch (Exception e) {
|
||||
callback.run(Response.BUSY_HERE, "busy here", null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopPlay(CommonGBChannel channel, String stream) {
|
||||
// 拉流代理通道
|
||||
try {
|
||||
playService.stop(channel.getDataDeviceId());
|
||||
}catch (Exception e) {
|
||||
log.error("[停止点播失败] {}({})", channel.getGbName(), channel.getGbDeviceId(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -179,7 +179,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
||||
streamProxy.setCreateTime(DateUtil.getNow());
|
||||
streamProxy.setUpdateTime(DateUtil.getNow());
|
||||
streamProxyMapper.add(streamProxy);
|
||||
streamProxy.setDataType(ChannelDataType.STREAM_PROXY.value);
|
||||
streamProxy.setDataType(ChannelDataType.STREAM_PROXY);
|
||||
streamProxy.setDataDeviceId(streamProxy.getId());
|
||||
}
|
||||
|
||||
|
||||
@ -105,7 +105,7 @@ public class StreamPush extends CommonGBChannel implements Comparable<StreamPush
|
||||
|
||||
private String uniqueKey;
|
||||
|
||||
private Integer dataType = ChannelDataType.STREAM_PUSH.value;
|
||||
private Integer dataType = ChannelDataType.STREAM_PUSH;
|
||||
|
||||
|
||||
@Override
|
||||
@ -145,7 +145,7 @@ public class StreamPush extends CommonGBChannel implements Comparable<StreamPush
|
||||
if (ObjectUtils.isEmpty(this.getGbName())) {
|
||||
this.setGbName( app+ "-" +stream);
|
||||
}
|
||||
this.setDataType(ChannelDataType.STREAM_PUSH.value);
|
||||
this.setDataType(ChannelDataType.STREAM_PUSH);
|
||||
this.setDataDeviceId(this.getId());
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -218,7 +218,7 @@ public class StreamPushController {
|
||||
if (!streamPushService.add(stream)) {
|
||||
throw new ControllerException(ErrorCode.ERROR100);
|
||||
}
|
||||
stream.setDataType(ChannelDataType.STREAM_PUSH.value);
|
||||
stream.setDataType(ChannelDataType.STREAM_PUSH);
|
||||
stream.setDataDeviceId(stream.getId());
|
||||
return stream;
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ import java.util.Set;
|
||||
@Repository
|
||||
public interface StreamPushMapper {
|
||||
|
||||
Integer dataType = ChannelDataType.GB28181.value;
|
||||
Integer dataType = ChannelDataType.GB28181;
|
||||
|
||||
@Insert("INSERT INTO wvp_stream_push (app, stream, media_server_id, server_id, push_time, update_time, create_time, pushing, start_offline_push) VALUES" +
|
||||
"(#{app}, #{stream}, #{mediaServerId} , #{serverId} , #{pushTime} ,#{updateTime}, #{createTime}, #{pushing}, #{startOfflinePush})")
|
||||
|
||||
@ -0,0 +1,53 @@
|
||||
package com.genersoft.iot.vmp.streamPush.service.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.PlayException;
|
||||
import com.genersoft.iot.vmp.gb28181.service.ISourcePlayService;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
import com.genersoft.iot.vmp.streamPush.service.IStreamPushPlayService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.sip.message.Response;
|
||||
|
||||
@Slf4j
|
||||
@Service(ChannelDataType.PLAY_SERVICE + ChannelDataType.STREAM_PUSH)
|
||||
public class SourcePlayServiceForStreamPushImpl implements ISourcePlayService {
|
||||
|
||||
@Autowired
|
||||
private IStreamPushPlayService playService;
|
||||
|
||||
@Override
|
||||
public void play(CommonGBChannel channel, Platform platform, Boolean record, ErrorCallback<StreamInfo> callback) {
|
||||
String serverGBId = null;
|
||||
String platformName = null;
|
||||
if (platform != null) {
|
||||
// 推流
|
||||
serverGBId = platform.getServerGBId();
|
||||
platformName = platform.getName();
|
||||
}
|
||||
// 推流
|
||||
try {
|
||||
playService.start(channel.getDataDeviceId(), callback, serverGBId, platformName);
|
||||
}catch (PlayException e) {
|
||||
callback.run(e.getCode(), e.getMsg(), null);
|
||||
}catch (Exception e) {
|
||||
log.error("[点播推流通道失败] 通道: {}({})", channel.getGbName(), channel.getGbDeviceId(), e);
|
||||
callback.run(Response.BUSY_HERE, "busy here", null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopPlay(CommonGBChannel channel, String stream) {
|
||||
// 推流
|
||||
try {
|
||||
playService.stop(channel.getDataDeviceId());
|
||||
}catch (Exception e) {
|
||||
log.error("[停止点播失败] {}({})", channel.getGbName(), channel.getGbDeviceId(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,21 +2,45 @@ package com.genersoft.iot.vmp.utils;
|
||||
|
||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||
import com.genersoft.iot.vmp.service.bean.DownloadFileInfo;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
/**
|
||||
* 云录像工具类
|
||||
*
|
||||
* @author 648540858
|
||||
*/
|
||||
@UtilityClass
|
||||
public class CloudRecordUtils {
|
||||
|
||||
|
||||
/**
|
||||
* 修复原始工具类中的格式化问题
|
||||
*
|
||||
* @param mediaServerItem 媒体服务器配置
|
||||
* @param filePath 文件路径(可能包含%等特殊字符)
|
||||
* @return 修复后的下载信息
|
||||
*/
|
||||
public static DownloadFileInfo getDownloadFilePath(MediaServer mediaServerItem, String filePath) {
|
||||
DownloadFileInfo downloadFileInfo = new DownloadFileInfo();
|
||||
// 将filePath作为独立参数传入,避免%符号解析问题
|
||||
String pathTemplate = "%s://%s:%s/index/api/downloadFile?file_path=%s";
|
||||
|
||||
String pathTemplate = "%s://%s:%s/index/api/downloadFile?file_path=" + filePath;
|
||||
DownloadFileInfo info = new DownloadFileInfo();
|
||||
|
||||
downloadFileInfo.setHttpPath(String.format(pathTemplate, "http", mediaServerItem.getStreamIp(),
|
||||
mediaServerItem.getHttpPort()));
|
||||
// filePath作为第4个参数
|
||||
info.setHttpPath(String.format(pathTemplate,
|
||||
"http",
|
||||
mediaServerItem.getStreamIp(),
|
||||
mediaServerItem.getHttpPort(),
|
||||
filePath));
|
||||
|
||||
// 同样作为第4个参数
|
||||
if (mediaServerItem.getHttpSSlPort() > 0) {
|
||||
downloadFileInfo.setHttpsPath(String.format(pathTemplate, "https", mediaServerItem.getStreamIp(),
|
||||
mediaServerItem.getHttpSSlPort()));
|
||||
info.setHttpsPath(String.format(pathTemplate,
|
||||
"https",
|
||||
mediaServerItem.getStreamIp(),
|
||||
mediaServerItem.getHttpSSlPort(),
|
||||
filePath));
|
||||
}
|
||||
return downloadFileInfo;
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
90
src/main/java/com/genersoft/iot/vmp/utils/IpPortUtil.java
Normal file
90
src/main/java/com/genersoft/iot/vmp/utils/IpPortUtil.java
Normal file
@ -0,0 +1,90 @@
|
||||
package com.genersoft.iot.vmp.utils;
|
||||
|
||||
import java.net.Inet6Address;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
public class IpPortUtil {
|
||||
|
||||
/**
|
||||
* 拼接IP和端口
|
||||
* @param ip IP地址字符串
|
||||
* @param port 端口号字符串
|
||||
* @return 拼接后的字符串
|
||||
* @throws IllegalArgumentException 如果IP地址无效或端口无效
|
||||
*/
|
||||
public static String concatenateIpAndPort(String ip, String port) {
|
||||
if (port == null || port.isEmpty()) {
|
||||
throw new IllegalArgumentException("端口号不能为空");
|
||||
}
|
||||
|
||||
// 验证端口是否为有效数字
|
||||
try {
|
||||
int portNum = Integer.parseInt(port);
|
||||
if (portNum < 0 || portNum > 65535) {
|
||||
throw new IllegalArgumentException("端口号必须在0-65535范围内");
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
throw new IllegalArgumentException("端口号必须是有效数字", e);
|
||||
}
|
||||
|
||||
try {
|
||||
InetAddress inetAddress = InetAddress.getByName(ip);
|
||||
|
||||
if (inetAddress instanceof Inet6Address) {
|
||||
// IPv6地址需要加上方括号
|
||||
return "[" + ip + "]:" + port;
|
||||
} else {
|
||||
// IPv4地址直接拼接
|
||||
return ip + ":" + port;
|
||||
}
|
||||
} catch (UnknownHostException e) {
|
||||
throw new IllegalArgumentException("无效的IP地址: " + ip, e);
|
||||
}
|
||||
}
|
||||
|
||||
// 测试用例
|
||||
public static void main(String[] args) {
|
||||
// IPv4测试
|
||||
String ipv4 = "192.168.1.1";
|
||||
String port1 = "8080";
|
||||
System.out.println(concatenateIpAndPort(ipv4, port1)); // 输出: 192.168.1.1:8080
|
||||
|
||||
// IPv6测试
|
||||
String ipv6 = "2001:0db8:85a3:0000:0000:8a2e:0370:7334";
|
||||
String port2 = "80";
|
||||
System.out.println(concatenateIpAndPort(ipv6, port2)); // 输出: [2001:0db8:85a3:0000:0000:8a2e:0370:7334]:80
|
||||
|
||||
// 压缩格式IPv6测试
|
||||
String ipv6Compressed = "2001:db8::1";
|
||||
System.out.println(concatenateIpAndPort(ipv6Compressed, port2)); // 输出: [2001:db8::1]:80
|
||||
|
||||
// 无效IP测试
|
||||
try {
|
||||
System.out.println(concatenateIpAndPort("invalid.ip", "1234"));
|
||||
} catch (IllegalArgumentException e) {
|
||||
System.out.println("捕获到预期异常: " + e.getMessage());
|
||||
}
|
||||
|
||||
// 无效端口测试 - 非数字
|
||||
try {
|
||||
System.out.println(concatenateIpAndPort(ipv4, "abc"));
|
||||
} catch (IllegalArgumentException e) {
|
||||
System.out.println("捕获到预期异常: " + e.getMessage());
|
||||
}
|
||||
|
||||
// 无效端口测试 - 超出范围
|
||||
try {
|
||||
System.out.println(concatenateIpAndPort(ipv4, "70000"));
|
||||
} catch (IllegalArgumentException e) {
|
||||
System.out.println("捕获到预期异常: " + e.getMessage());
|
||||
}
|
||||
|
||||
// 空端口测试
|
||||
try {
|
||||
System.out.println(concatenateIpAndPort(ipv4, ""));
|
||||
} catch (IllegalArgumentException e) {
|
||||
System.out.println("捕获到预期异常: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4,7 +4,6 @@ import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.genersoft.iot.vmp.common.SystemAllInfo;
|
||||
import com.genersoft.iot.vmp.common.VersionPo;
|
||||
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||
import com.genersoft.iot.vmp.conf.SipConfig;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.conf.VersionInfo;
|
||||
@ -46,7 +45,10 @@ import oshi.software.os.OperatingSystem;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Tag(name = "服务控制")
|
||||
@ -339,20 +341,6 @@ public class ServerController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping(value = "/channel/datatype")
|
||||
@ResponseBody
|
||||
@Operation(summary = "获取系统接入的数据类型", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
public List<Map<String, Object>> getDataType() {
|
||||
List<Map<String, Object>> result = new LinkedList<>();
|
||||
for (ChannelDataType item : ChannelDataType.values()) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("key", item.desc);
|
||||
map.put("value", item.value);
|
||||
result.add(map);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 单位转换
|
||||
*/
|
||||
|
||||
@ -63,7 +63,7 @@ export function getList(params) {
|
||||
const { page, count, query, online, hasRecordPlan, channelType } = params
|
||||
return request({
|
||||
method: 'get',
|
||||
url: `/api/common/channel/list`,
|
||||
url: '/api/common/channel/list',
|
||||
params: {
|
||||
page: page,
|
||||
count: count,
|
||||
@ -79,7 +79,7 @@ export function getCivilCodeList(params) {
|
||||
const { page, count, channelType, query, online, civilCode } = params
|
||||
return request({
|
||||
method: 'get',
|
||||
url: `/api/common/channel/civilcode/list`,
|
||||
url: '/api/common/channel/civilcode/list',
|
||||
params: {
|
||||
page: page,
|
||||
count: count,
|
||||
@ -95,7 +95,7 @@ export function getUnusualCivilCodeList(params) {
|
||||
const { page, count, channelType, query, online } = params
|
||||
return request({
|
||||
method: 'get',
|
||||
url: `/api/common/channel/civilCode/unusual/list`,
|
||||
url: '/api/common/channel/civilCode/unusual/list',
|
||||
params: {
|
||||
page: page,
|
||||
count: count,
|
||||
@ -110,7 +110,7 @@ export function getUnusualParentList(params) {
|
||||
const { page, count, channelType, query, online } = params
|
||||
return request({
|
||||
method: 'get',
|
||||
url: `/api/common/channel/parent/unusual/list`,
|
||||
url: '/api/common/channel/parent/unusual/list',
|
||||
params: {
|
||||
page: page,
|
||||
count: count,
|
||||
@ -125,7 +125,7 @@ export function clearUnusualCivilCodeList(params) {
|
||||
const { all, channelIds } = params
|
||||
return request({
|
||||
method: 'post',
|
||||
url: `/api/common/channel/civilCode/unusual/clear`,
|
||||
url: '/api/common/channel/civilCode/unusual/clear',
|
||||
data: {
|
||||
all: all,
|
||||
channelIds: channelIds
|
||||
@ -137,7 +137,7 @@ export function clearUnusualParentList(params) {
|
||||
const { all, channelIds } = params
|
||||
return request({
|
||||
method: 'post',
|
||||
url: `/api/common/channel/parent/unusual/clear`,
|
||||
url: '/api/common/channel/parent/unusual/clear',
|
||||
data: {
|
||||
all: all,
|
||||
channelIds: channelIds
|
||||
@ -149,7 +149,7 @@ export function getParentList(params) {
|
||||
const { page, count, channelType, query, online, groupDeviceId } = params
|
||||
return request({
|
||||
method: 'get',
|
||||
url: `/api/common/channel/parent/list`,
|
||||
url: '/api/common/channel/parent/list',
|
||||
params: {
|
||||
page: page,
|
||||
count: count,
|
||||
@ -165,7 +165,7 @@ export function addToRegion(params) {
|
||||
const { civilCode, channelIds } = params
|
||||
return request({
|
||||
method: 'post',
|
||||
url: `/api/common/channel/region/add`,
|
||||
url: '/api/common/channel/region/add',
|
||||
data: {
|
||||
civilCode: civilCode,
|
||||
channelIds: channelIds
|
||||
@ -176,7 +176,7 @@ export function addToRegion(params) {
|
||||
export function deleteFromRegion(channels) {
|
||||
return request({
|
||||
method: 'post',
|
||||
url: `/api/common/channel/region/delete`,
|
||||
url: '/api/common/channel/region/delete',
|
||||
data: {
|
||||
channelIds: channels
|
||||
}
|
||||
@ -187,7 +187,7 @@ export function addDeviceToRegion(params) {
|
||||
const { civilCode, deviceIds } = params
|
||||
return request({
|
||||
method: 'post',
|
||||
url: `/api/common/channel/region/device/add`,
|
||||
url: '/api/common/channel/region/device/add',
|
||||
data: {
|
||||
civilCode: civilCode,
|
||||
deviceIds: deviceIds
|
||||
@ -198,7 +198,7 @@ export function addDeviceToRegion(params) {
|
||||
export function deleteDeviceFromRegion(deviceIds) {
|
||||
return request({
|
||||
method: 'post',
|
||||
url: `/api/common/channel/region/device/delete`,
|
||||
url: '/api/common/channel/region/device/delete',
|
||||
data: {
|
||||
deviceIds: deviceIds
|
||||
}
|
||||
@ -209,7 +209,7 @@ export function addToGroup(params) {
|
||||
const { parentId, businessGroup, channelIds } = params
|
||||
return request({
|
||||
method: 'post',
|
||||
url: `/api/common/channel/group/add`,
|
||||
url: '/api/common/channel/group/add',
|
||||
data: {
|
||||
parentId: parentId,
|
||||
businessGroup: businessGroup,
|
||||
@ -221,7 +221,7 @@ export function addToGroup(params) {
|
||||
export function deleteFromGroup(channels) {
|
||||
return request({
|
||||
method: 'post',
|
||||
url: `/api/common/channel/group/delete`,
|
||||
url: '/api/common/channel/group/delete',
|
||||
data: {
|
||||
channelIds: channels
|
||||
}
|
||||
@ -232,7 +232,7 @@ export function addDeviceToGroup(params) {
|
||||
const { parentId, businessGroup, deviceIds } = params
|
||||
return request({
|
||||
method: 'post',
|
||||
url: `/api/common/channel/group/device/add`,
|
||||
url: '/api/common/channel/group/device/add',
|
||||
data: {
|
||||
parentId: parentId,
|
||||
businessGroup: businessGroup,
|
||||
@ -244,7 +244,7 @@ export function addDeviceToGroup(params) {
|
||||
export function deleteDeviceFromGroup(deviceIds) {
|
||||
return request({
|
||||
method: 'post',
|
||||
url: `/api/common/channel/group/device/delete`,
|
||||
url: '/api/common/channel/group/device/delete',
|
||||
data: {
|
||||
deviceIds: deviceIds
|
||||
}
|
||||
@ -260,3 +260,246 @@ export function playChannel(channelId) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 前端控制
|
||||
|
||||
export function setSpeedForScan({ channelId, scanId, speed }) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/common/channel/front-end/scan/set/speed',
|
||||
params: {
|
||||
channelId: channelId,
|
||||
scanId: scanId,
|
||||
speed: speed
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function setLeftForScan({ channelId, scanId }) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/common/channel/front-end/scan/set/left',
|
||||
params: {
|
||||
channelId: channelId,
|
||||
scanId: scanId
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function setRightForScan({ channelId, scanId }) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/common/channel/front-end/scan/set/right',
|
||||
params: {
|
||||
channelId: channelId,
|
||||
scanId: scanId
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
export function startScan({ channelId, scanId }) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/common/channel/front-end/scan/start',
|
||||
params: {
|
||||
channelId: channelId,
|
||||
scanId: scanId
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function stopScan({ channelId, scanId }) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/common/channel/front-end/scan/stop',
|
||||
params: {
|
||||
channelId: channelId,
|
||||
scanId: scanId
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
export function queryPreset(channelId) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/common/channel/front-end/preset/query',
|
||||
params: {
|
||||
channelId: channelId
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function addPointForCruise({ channelId, tourId, presetId }) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/common/channel/front-end/tour/point/add',
|
||||
params: {
|
||||
channelId: channelId,
|
||||
tourId: tourId,
|
||||
presetId: presetId
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function deletePointForCruise({ channelId, tourId, presetId }) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/common/channel/front-end/tour/point/delete',
|
||||
params: {
|
||||
channelId: channelId,
|
||||
tourId: tourId,
|
||||
presetId: presetId
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function setCruiseSpeed({ channelId, tourId, presetId , speed }) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/common/channel/front-end/tour/speed',
|
||||
params: {
|
||||
channelId: channelId,
|
||||
tourId: tourId,
|
||||
presetId: presetId,
|
||||
speed: speed
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function setCruiseTime({ channelId, tourId, presetId, time }) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/common/channel/front-end/tour/time',
|
||||
params: {
|
||||
channelId: channelId,
|
||||
tourId: tourId,
|
||||
presetId: presetId,
|
||||
time: time
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function startCruise({ channelId, tourId }) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/common/channel/front-end/tour/start',
|
||||
params: {
|
||||
channelId: channelId,
|
||||
tourId: tourId
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function stopCruise({ channelId, tourId }) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/common/channel/front-end/tour/stop',
|
||||
params: {
|
||||
channelId: channelId,
|
||||
tourId: tourId
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function addPreset({ channelId, presetId, presetName }) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/common/channel/front-end/preset/add',
|
||||
params: {
|
||||
channelId: channelId,
|
||||
presetId: presetId,
|
||||
presetName: presetName
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function callPreset({ channelId, presetId }) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/common/channel/front-end/preset/call',
|
||||
params: {
|
||||
channelId: channelId,
|
||||
presetId: presetId
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function deletePreset({ channelId, presetId }) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/common/channel/front-end/preset/delete',
|
||||
params: {
|
||||
channelId: channelId,
|
||||
presetId: presetId
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* command: on 开启, off 关闭
|
||||
*/
|
||||
export function auxiliary({ channelId, command, auxiliaryId }) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/common/channel/front-end/auxiliary',
|
||||
params: {
|
||||
channelId: channelId,
|
||||
command: command,
|
||||
auxiliaryId: auxiliaryId
|
||||
}
|
||||
})
|
||||
}
|
||||
/**
|
||||
* command: on 开启, off 关闭
|
||||
*/
|
||||
export function wiper({ channelId, command }) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/common/channel/front-end/wiper',
|
||||
params: {
|
||||
channelId: channelId,
|
||||
command: command
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function ptz({ channelId, command, panSpeed, tiltSpeed, zoomSpeed }) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/common/channel/front-end/ptz',
|
||||
params: {
|
||||
channelId: channelId,
|
||||
command: command,
|
||||
panSpeed: panSpeed,
|
||||
tiltSpeed: tiltSpeed,
|
||||
zoomSpeed: zoomSpeed
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function iris({ channelId, command, speed }) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/common/channel/front-end/fi/iris',
|
||||
params: {
|
||||
channelId: channelId,
|
||||
command: command,
|
||||
speed: speed
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function focus({ channelId, command, speed }) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/common/channel/front-end/fi/focus',
|
||||
params: {
|
||||
channelId: channelId,
|
||||
command: command,
|
||||
speed: speed
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -47,14 +47,22 @@ export function updateDeviceTransport(deviceId, streamMode) {
|
||||
export function setGuard(deviceId) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: `/api/device/control/guard/${deviceId}/SetGuard`
|
||||
url: `/api/device/control/guard`,
|
||||
params: {
|
||||
deviceId: deviceId,
|
||||
guardCmd: 'SetGuard'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function resetGuard(deviceId) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: `/api/device/control/guard/${deviceId}/ResetGuard`
|
||||
url: `/api/device/control/guard`,
|
||||
params: {
|
||||
deviceId: deviceId,
|
||||
guardCmd: 'ResetGuard'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -185,12 +193,13 @@ export function changeChannelAudio(params) {
|
||||
}
|
||||
|
||||
export function updateChannelStreamIdentification(params) {
|
||||
const { deviceDbId, streamIdentification } = params
|
||||
const { deviceDbId, streamIdentification, id } = params
|
||||
return request({
|
||||
method: 'post',
|
||||
url: `/api/device/query/channel/stream/identification/update/`,
|
||||
params: {
|
||||
deviceDbId: deviceDbId,
|
||||
id: id,
|
||||
streamIdentification: streamIdentification
|
||||
}
|
||||
})
|
||||
|
||||
@ -535,29 +535,29 @@ export default {
|
||||
ptzCamera: function(command) {
|
||||
console.log('云台控制:' + command)
|
||||
this.$store.dispatch('commonChanel/ptz',
|
||||
[
|
||||
this.channelId,
|
||||
command,
|
||||
parseInt(this.controSpeed * 255 / 100),
|
||||
parseInt(this.controSpeed * 255 / 100),
|
||||
parseInt(this.controSpeed * 16 / 100)
|
||||
])
|
||||
{
|
||||
channelId: this.channelId,
|
||||
command: command,
|
||||
panSpeed: this.controSpeed,
|
||||
tiltSpeed: this.controSpeed,
|
||||
zoomSpeed: this.controSpeed
|
||||
})
|
||||
},
|
||||
irisCamera: function(command) {
|
||||
this.$store.dispatch('commonChanel/iris',
|
||||
[
|
||||
this.channelId,
|
||||
command,
|
||||
parseInt(this.controSpeed * 255 / 100)
|
||||
])
|
||||
{
|
||||
channelId: this.channelId,
|
||||
command: command,
|
||||
speed: this.controSpeed
|
||||
})
|
||||
},
|
||||
focusCamera: function(command) {
|
||||
this.$store.dispatch('commonChanel/focus',
|
||||
[
|
||||
this.channelId,
|
||||
command,
|
||||
parseInt(this.controSpeed * 255 / 100)
|
||||
])
|
||||
{
|
||||
channelId: this.channelId,
|
||||
command: command,
|
||||
speed: this.controSpeed
|
||||
})
|
||||
},
|
||||
// ////////////////////播放器事件处理//////////////////////////
|
||||
videoError: function(e) {
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<div style="display: grid; grid-template-columns: 80px auto; line-height: 28px">
|
||||
<span>巡航组号: </span>
|
||||
<el-input
|
||||
v-model="cruiseId"
|
||||
v-model="tourId"
|
||||
min="1"
|
||||
max="255"
|
||||
placeholder="巡航组号"
|
||||
@ -93,7 +93,7 @@ export default {
|
||||
props: ['channelId'],
|
||||
data() {
|
||||
return {
|
||||
cruiseId: 1,
|
||||
tourId: 1,
|
||||
presetList: [],
|
||||
allPresetList: [],
|
||||
selectPreset: '',
|
||||
@ -110,7 +110,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getPresetList: function() {
|
||||
this.$store.dispatch('commonChanel/queryPreset', [this.channelId])
|
||||
this.$store.dispatch('commonChanel/queryPreset', this.channelId)
|
||||
.then((data) => {
|
||||
this.allPresetList = data
|
||||
})
|
||||
@ -124,7 +124,11 @@ export default {
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
this.$store.dispatch('commonChanel/addPointForCruise',
|
||||
[this.channelId, this.cruiseId, this.selectPreset.presetId])
|
||||
{
|
||||
channelId: this.channelId,
|
||||
tourId: this.tourId,
|
||||
presetId: this.selectPreset.presetId
|
||||
})
|
||||
.then((data) => {
|
||||
this.presetList.push(this.selectPreset)
|
||||
}).catch((error) => {
|
||||
@ -152,7 +156,11 @@ export default {
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
this.$store.dispatch('commonChanel/deletePointForCruise',
|
||||
[this.channelId, this.cruiseId, preset.presetId])
|
||||
{
|
||||
channelId: this.channelId,
|
||||
tourId: this.tourId,
|
||||
presetId: preset.presetId
|
||||
})
|
||||
.then((data) => {
|
||||
this.presetList.splice(index, 1)
|
||||
}).catch((error) => {
|
||||
@ -180,7 +188,11 @@ export default {
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
this.$store.dispatch('commonChanel/deletePointForCruise',
|
||||
[this.channelId, this.cruiseId, 0])
|
||||
{
|
||||
channelId: this.channelId,
|
||||
tourId: this.tourId,
|
||||
presetId: 0
|
||||
})
|
||||
.then((data) => {
|
||||
this.presetList = []
|
||||
}).catch((error) => {
|
||||
@ -195,6 +207,14 @@ export default {
|
||||
})
|
||||
},
|
||||
setCruiseSpeed: function() {
|
||||
if (this.presetList.length === 0) {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: '请添加巡航点',
|
||||
type: 'warning'
|
||||
})
|
||||
return
|
||||
}
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
fullscreen: true,
|
||||
@ -203,7 +223,12 @@ export default {
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
this.$store.dispatch('commonChanel/setCruiseSpeed',
|
||||
[this.channelId, this.cruiseId, this.cruiseSpeed])
|
||||
{
|
||||
channelId: this.channelId,
|
||||
tourId: this.tourId,
|
||||
presetId: this.presetList.at(-1).presetId,
|
||||
speed: this.cruiseSpeed
|
||||
})
|
||||
.then((data) => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
@ -227,6 +252,14 @@ export default {
|
||||
this.setSpeedVisible = false
|
||||
},
|
||||
setCruiseTime: function() {
|
||||
if (this.presetList.length === 0) {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: '请添加巡航点',
|
||||
type: 'warning'
|
||||
})
|
||||
return
|
||||
}
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
fullscreen: true,
|
||||
@ -235,7 +268,12 @@ export default {
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
this.$store.dispatch('commonChanel/setCruiseTime',
|
||||
[this.channelId, this.cruiseId, this.cruiseTime])
|
||||
{
|
||||
channelId: this.channelId,
|
||||
tourId: this.tourId,
|
||||
time: this.cruiseTime,
|
||||
presetId: this.presetList.at(-1).presetId
|
||||
})
|
||||
.then((data) => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
@ -267,7 +305,10 @@ export default {
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
this.$store.dispatch('commonChanel/startCruise',
|
||||
[this.channelId, this.cruiseId])
|
||||
{
|
||||
channelId: this.channelId,
|
||||
tourId: this.tourId
|
||||
})
|
||||
.then((data) => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
@ -295,7 +336,10 @@ export default {
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
this.$store.dispatch('commonChanel/stopCruise',
|
||||
[this.channelId, this.cruiseId])
|
||||
{
|
||||
channelId: this.channelId,
|
||||
tourId: this.tourId
|
||||
})
|
||||
.then((data) => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
@ -317,12 +361,3 @@ export default {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.channel-form {
|
||||
display: grid;
|
||||
background-color: #FFFFFF;
|
||||
padding: 1rem 2rem 0 2rem;
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
gap: 1rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -50,7 +50,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getPresetList: function() {
|
||||
this.$store.dispatch('commonChanel/queryPreset', [this.channelId])
|
||||
this.$store.dispatch('commonChanel/queryPreset', this.channelId)
|
||||
.then(data => {
|
||||
this.presetList = data
|
||||
// 防止出现表格错位
|
||||
@ -73,7 +73,11 @@ export default {
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
this.$store.dispatch('commonChanel/addPreset', [this.channelId, this.ptzPresetId])
|
||||
this.$store.dispatch('commonChanel/addPreset', {
|
||||
channelId: this.channelId,
|
||||
presetId: this.ptzPresetId,
|
||||
presetName: this.ptzPresetId
|
||||
})
|
||||
.then(data => {
|
||||
setTimeout(() => {
|
||||
this.inputVisible = false
|
||||
@ -99,7 +103,10 @@ export default {
|
||||
},
|
||||
gotoPreset: function(preset) {
|
||||
console.log(preset)
|
||||
this.$store.dispatch('commonChanel/callPreset', [this.channelId, preset.presetId])
|
||||
this.$store.dispatch('commonChanel/callPreset', {
|
||||
channelId: this.channelId,
|
||||
presetId: preset.presetId
|
||||
})
|
||||
.then(data => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
@ -128,7 +135,10 @@ export default {
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
this.$store.dispatch('commonChanel/deletePreset', [this.channelId, preset.presetId])
|
||||
this.$store.dispatch('commonChanel/deletePreset', {
|
||||
channelId: this.channelId,
|
||||
presetId: preset.presetId
|
||||
})
|
||||
.then(data => {
|
||||
setTimeout(() => {
|
||||
this.getPresetList()
|
||||
|
||||
@ -65,7 +65,12 @@ export default {
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
this.$store.dispatch('commonChanel/setSpeedForScan', [this.channelId, this.scanId, this.speed])
|
||||
this.$store.dispatch('commonChanel/setSpeedForScan',
|
||||
{
|
||||
channelId: this.channelId,
|
||||
scanId: this.scanId,
|
||||
speed: this.speed
|
||||
})
|
||||
.then(data => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
@ -97,7 +102,11 @@ export default {
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
this.$store.dispatch('commonChanel/setLeftForScan', [this.channelId, this.scanId])
|
||||
this.$store.dispatch('commonChanel/setLeftForScan',
|
||||
{
|
||||
channelId: this.channelId,
|
||||
scanId: this.scanId
|
||||
})
|
||||
.then(data => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
@ -125,7 +134,11 @@ export default {
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
this.$store.dispatch('commonChanel/setRightForScan', [this.channelId, this.scanId])
|
||||
this.$store.dispatch('commonChanel/setRightForScan',
|
||||
{
|
||||
channelId: this.channelId,
|
||||
scanId: this.scanId
|
||||
})
|
||||
.then(data => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
@ -153,7 +166,11 @@ export default {
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
this.$store.dispatch('commonChanel/startScan', [this.channelId, this.scanId])
|
||||
this.$store.dispatch('commonChanel/startScan',
|
||||
{
|
||||
channelId: this.channelId,
|
||||
scanId: this.scanId
|
||||
})
|
||||
.then(data => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
@ -179,7 +196,11 @@ export default {
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
this.$store.dispatch('commonChanel/stopScan', [this.channelId, this.scanId])
|
||||
this.$store.dispatch('commonChanel/stopScan',
|
||||
{
|
||||
channelId: this.channelId,
|
||||
scanId: this.scanId
|
||||
})
|
||||
.then(data => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<el-form size="mini" :inline="true">
|
||||
<el-form-item>
|
||||
<el-input
|
||||
v-model="switchId"
|
||||
v-model="auxiliaryId"
|
||||
min="1"
|
||||
max="4095"
|
||||
placeholder="开关编号"
|
||||
@ -29,7 +29,7 @@ export default {
|
||||
props: ['channelId'],
|
||||
data() {
|
||||
return {
|
||||
switchId: 1
|
||||
auxiliaryId: 1
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@ -43,7 +43,12 @@ export default {
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
this.$store.dispatch('commonChanel/auxiliary', [this.channelId, command, this.switchId])
|
||||
this.$store.dispatch('commonChanel/auxiliary',
|
||||
{
|
||||
channelId: this.channelId,
|
||||
command: command,
|
||||
auxiliaryId: this.auxiliaryId
|
||||
})
|
||||
.then(data => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
@ -64,13 +69,4 @@ export default {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.channel-form {
|
||||
display: grid;
|
||||
background-color: #FFFFFF;
|
||||
padding: 1rem 2rem 0 2rem;
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@ -25,7 +25,11 @@ export default {
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
this.$store.dispatch('commonChanel/wiper', [this.channelId, command])
|
||||
this.$store.dispatch('commonChanel/wiper',
|
||||
{
|
||||
channelId: this.channelId,
|
||||
command: command
|
||||
})
|
||||
.then(data => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
|
||||
@ -55,8 +55,8 @@
|
||||
<el-option label="streamnumber:1(子码流-2022)" value="streamnumber:1" />
|
||||
<el-option label="streamprofile:0(主码流-大华)" value="streamprofile:0" />
|
||||
<el-option label="streamprofile:1(子码流-大华)" value="streamprofile:1" />
|
||||
<el-option label="streamMode:main(主码流-水星+TP-LINK)" value="streamMode:main" />
|
||||
<el-option label="streamMode:sub(子码流-水星+TP-LINK)" value="streamMode:sub" />
|
||||
<el-option label="streamMode:MAIN(主码流-水星+TP-LINK)" value="streamMode:MAIN" />
|
||||
<el-option label="streamMode:SUB(子码流-水星+TP-LINK)" value="streamMode:SUB" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item style="float: right;">
|
||||
@ -123,8 +123,8 @@
|
||||
<el-option label="streamnumber:1(子码流-2022)" value="streamnumber:1" />
|
||||
<el-option label="streamprofile:0(主码流-大华)" value="streamprofile:0" />
|
||||
<el-option label="streamprofile:1(子码流-大华)" value="streamprofile:1" />
|
||||
<el-option label="streamMode:main(主码流-水星+TP-LINK)" value="streamMode:main" />
|
||||
<el-option label="streamMode:sub(子码流-水星+TP-LINK)" value="streamMode:sub" />
|
||||
<el-option label="streamMode:MAIN(主码流-水星+TP-LINK)" value="streamMode:MAIN" />
|
||||
<el-option label="streamMode:SUB(子码流-水星+TP-LINK)" value="streamMode:SUB" />
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@ -362,7 +362,7 @@ export default {
|
||||
})
|
||||
},
|
||||
resetGuard: function(itemData) {
|
||||
this.$store.dispatch('device/ResetGuard', itemData.deviceId)
|
||||
this.$store.dispatch('device/resetGuard', itemData.deviceId)
|
||||
.then((data) => {
|
||||
this.$message.success({
|
||||
showClose: true,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user