Browse Source

优化录像查询,优化注释

pull/31/head
panlinlin 4 years ago
parent
commit
730a64be07
  1. 31
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
  2. 17
      src/main/java/com/genersoft/iot/vmp/vmanager/ptz/PtzController.java
  3. 13
      src/main/java/com/genersoft/iot/vmp/vmanager/record/RecordController.java
  4. 1
      web_src/src/components/videoList.vue

31
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java

@ -188,19 +188,29 @@ public class SIPCommander implements ISIPCommander {
* @param moveSpeed 镜头移动速度 默认 0XFF (0-255)
* @param zoomSpeed 镜头缩放速度 默认 0X1 (0-255)
*/
public static String frontEndCmdString(int cmdCode, int parameter1, int parameter2, int combineCode2) {
/**
* 云台指令码计算
*
* @param cmdCode 指令码
* @param horizonSpeed 水平移动速度
* @param verticalSpeed 垂直移动速度
* @param zoomSpeed 缩放速度
* @return
*/
public static String frontEndCmdString(int cmdCode, int horizonSpeed, int verticalSpeed, int zoomSpeed) {
StringBuilder builder = new StringBuilder("A50F01");
String strTmp;
strTmp = String.format("%02X", cmdCode);
builder.append(strTmp, 0, 2);
strTmp = String.format("%02X", parameter1);
strTmp = String.format("%02X", horizonSpeed);
builder.append(strTmp, 0, 2);
strTmp = String.format("%02X", parameter2);
strTmp = String.format("%02X", verticalSpeed);
builder.append(strTmp, 0, 2);
strTmp = String.format("%X", combineCode2);
strTmp = String.format("%X", zoomSpeed);
builder.append(strTmp, 0, 1).append("0");
//计算校验码
int checkCode = (0XA5 + 0X0F + 0X01 + cmdCode + parameter1 + parameter2 + (combineCode2 & 0XF0)) % 0X100;
int checkCode = (0XA5 + 0X0F + 0X01 + cmdCode + horizonSpeed + verticalSpeed + (zoomSpeed & 0XF0)) % 0X100;
strTmp = String.format("%02X", checkCode);
builder.append(strTmp, 0, 2);
return builder.toString();
@ -249,14 +259,14 @@ public class SIPCommander implements ISIPCommander {
* @param device 控制设备
* @param channelId 预览通道
* @param cmdCode 指令码
* @param parameter1 数据1
* @param parameter2 数据2
* @param combineCode2 组合码2
* @param horizonSpeed 水平移动速度
* @param verticalSpeed 垂直移动速度
* @param zoomSpeed 缩放速度
*/
@Override
public boolean frontEndCmd(Device device, String channelId, int cmdCode, int parameter1, int parameter2, int combineCode2) {
public boolean frontEndCmd(Device device, String channelId, int cmdCode, int horizonSpeed, int verticalSpeed, int zoomSpeed) {
try {
String cmdStr= frontEndCmdString(cmdCode, parameter1, parameter2, combineCode2);
String cmdStr= frontEndCmdString(cmdCode, horizonSpeed, verticalSpeed, zoomSpeed);
System.out.println("控制字符串:" + cmdStr);
StringBuffer ptzXml = new StringBuffer(200);
ptzXml.append("<?xml version=\"1.0\" ?>\r\n");
@ -701,7 +711,6 @@ public class SIPCommander implements ISIPCommander {
Request request = headerProvider.createMessageRequest(device, recordInfoXml.toString(), "ViaRecordInfoBranch", "FromRecordInfoTag", null);
transmitRequest(device, request);
} catch (SipException | ParseException | InvalidArgumentException e) {
e.printStackTrace();

17
src/main/java/com/genersoft/iot/vmp/vmanager/ptz/PtzController.java

@ -29,15 +29,14 @@ public class PtzController {
private IVideoManagerStorager storager;
/***
* http://localhost:8080/api/ptz/34020000001320000002_34020000001320000008?leftRight=1&upDown=0&inOut=0&moveSpeed=50&zoomSpeed=0
* @param deviceId
* @param channelId
* @param leftRight
* @param upDown
* @param inOut
* @param moveSpeed
* @param zoomSpeed
* @return
* 云台控制
* @param deviceId 设备id
* @param channelId 通道id
* @param cmdCode 指令码
* @param horizonSpeed 水平移动速度
* @param verticalSpeed 垂直移动速度
* @param zoomSpeed 缩放速度
* @return String 控制结果
*/
@PostMapping("/ptz/{deviceId}/{channelId}")
public ResponseEntity<String> ptz(@PathVariable String deviceId,@PathVariable String channelId,int cmdCode, int horizonSpeed, int verticalSpeed, int zoomSpeed){

13
src/main/java/com/genersoft/iot/vmp/vmanager/record/RecordController.java

@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.vmanager.record;
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -32,7 +33,7 @@ public class RecordController {
@Autowired
private DeferredResultHolder resultHolder;
@GetMapping("/record/{deviceId}/{channelId}")
public DeferredResult<ResponseEntity<RecordInfo>> recordinfo(@PathVariable String deviceId,@PathVariable String channelId, String startTime, String endTime){
@ -42,9 +43,17 @@ public class RecordController {
Device device = storager.queryVideoDevice(deviceId);
cmder.recordInfoQuery(device, channelId, startTime, endTime);
DeferredResult<ResponseEntity<RecordInfo>> result = new DeferredResult<ResponseEntity<RecordInfo>>();
// 指定超时时间 1分钟30秒
DeferredResult<ResponseEntity<RecordInfo>> result = new DeferredResult<ResponseEntity<RecordInfo>>(90*1000L);
// 录像查询以channelId作为deviceId查询
resultHolder.put(DeferredResultHolder.CALLBACK_CMD_RECORDINFO+channelId, result);
result.onTimeout(()->{
RequestMessage msg = new RequestMessage();
msg.setDeviceId(deviceId);
msg.setType(DeferredResultHolder.CALLBACK_CMD_RECORDINFO);
msg.setData("timeout");
resultHolder.invokeResult(msg);
});
return result;
}
}

1
web_src/src/components/videoList.vue

@ -182,6 +182,7 @@
type: 'success'
});
}
that.initData()
that.$refs[itemData.deviceId + 'refbtn' ].loading = false;
}).catch(function(e) {
console.error(e)

Loading…
Cancel
Save