优化录像查询,优化注释
parent
5ef229f02c
commit
730a64be07
|
@ -188,19 +188,29 @@ public class SIPCommander implements ISIPCommander {
|
||||||
* @param moveSpeed 镜头移动速度 默认 0XFF (0-255)
|
* @param moveSpeed 镜头移动速度 默认 0XFF (0-255)
|
||||||
* @param zoomSpeed 镜头缩放速度 默认 0X1 (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");
|
StringBuilder builder = new StringBuilder("A50F01");
|
||||||
String strTmp;
|
String strTmp;
|
||||||
strTmp = String.format("%02X", cmdCode);
|
strTmp = String.format("%02X", cmdCode);
|
||||||
builder.append(strTmp, 0, 2);
|
builder.append(strTmp, 0, 2);
|
||||||
strTmp = String.format("%02X", parameter1);
|
strTmp = String.format("%02X", horizonSpeed);
|
||||||
builder.append(strTmp, 0, 2);
|
builder.append(strTmp, 0, 2);
|
||||||
strTmp = String.format("%02X", parameter2);
|
strTmp = String.format("%02X", verticalSpeed);
|
||||||
builder.append(strTmp, 0, 2);
|
builder.append(strTmp, 0, 2);
|
||||||
strTmp = String.format("%X", combineCode2);
|
strTmp = String.format("%X", zoomSpeed);
|
||||||
builder.append(strTmp, 0, 1).append("0");
|
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);
|
strTmp = String.format("%02X", checkCode);
|
||||||
builder.append(strTmp, 0, 2);
|
builder.append(strTmp, 0, 2);
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
|
@ -249,14 +259,14 @@ public class SIPCommander implements ISIPCommander {
|
||||||
* @param device 控制设备
|
* @param device 控制设备
|
||||||
* @param channelId 预览通道
|
* @param channelId 预览通道
|
||||||
* @param cmdCode 指令码
|
* @param cmdCode 指令码
|
||||||
* @param parameter1 数据1
|
* @param horizonSpeed 水平移动速度
|
||||||
* @param parameter2 数据2
|
* @param verticalSpeed 垂直移动速度
|
||||||
* @param combineCode2 组合码2
|
* @param zoomSpeed 缩放速度
|
||||||
*/
|
*/
|
||||||
@Override
|
@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 {
|
try {
|
||||||
String cmdStr= frontEndCmdString(cmdCode, parameter1, parameter2, combineCode2);
|
String cmdStr= frontEndCmdString(cmdCode, horizonSpeed, verticalSpeed, zoomSpeed);
|
||||||
System.out.println("控制字符串:" + cmdStr);
|
System.out.println("控制字符串:" + cmdStr);
|
||||||
StringBuffer ptzXml = new StringBuffer(200);
|
StringBuffer ptzXml = new StringBuffer(200);
|
||||||
ptzXml.append("<?xml version=\"1.0\" ?>\r\n");
|
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);
|
Request request = headerProvider.createMessageRequest(device, recordInfoXml.toString(), "ViaRecordInfoBranch", "FromRecordInfoTag", null);
|
||||||
|
|
||||||
|
|
||||||
transmitRequest(device, request);
|
transmitRequest(device, request);
|
||||||
} catch (SipException | ParseException | InvalidArgumentException e) {
|
} catch (SipException | ParseException | InvalidArgumentException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -29,15 +29,14 @@ public class PtzController {
|
||||||
private IVideoManagerStorager storager;
|
private IVideoManagerStorager storager;
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* http://localhost:8080/api/ptz/34020000001320000002_34020000001320000008?leftRight=1&upDown=0&inOut=0&moveSpeed=50&zoomSpeed=0
|
* 云台控制
|
||||||
* @param deviceId
|
* @param deviceId 设备id
|
||||||
* @param channelId
|
* @param channelId 通道id
|
||||||
* @param leftRight
|
* @param cmdCode 指令码
|
||||||
* @param upDown
|
* @param horizonSpeed 水平移动速度
|
||||||
* @param inOut
|
* @param verticalSpeed 垂直移动速度
|
||||||
* @param moveSpeed
|
* @param zoomSpeed 缩放速度
|
||||||
* @param zoomSpeed
|
* @return String 控制结果
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@PostMapping("/ptz/{deviceId}/{channelId}")
|
@PostMapping("/ptz/{deviceId}/{channelId}")
|
||||||
public ResponseEntity<String> ptz(@PathVariable String deviceId,@PathVariable String channelId,int cmdCode, int horizonSpeed, int verticalSpeed, int zoomSpeed){
|
public ResponseEntity<String> ptz(@PathVariable String deviceId,@PathVariable String channelId,int cmdCode, int horizonSpeed, int verticalSpeed, int zoomSpeed){
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.genersoft.iot.vmp.vmanager.record;
|
package com.genersoft.iot.vmp.vmanager.record;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -42,9 +43,17 @@ public class RecordController {
|
||||||
|
|
||||||
Device device = storager.queryVideoDevice(deviceId);
|
Device device = storager.queryVideoDevice(deviceId);
|
||||||
cmder.recordInfoQuery(device, channelId, startTime, endTime);
|
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查询
|
// 录像查询以channelId作为deviceId查询
|
||||||
resultHolder.put(DeferredResultHolder.CALLBACK_CMD_RECORDINFO+channelId, result);
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,6 +182,7 @@
|
||||||
type: 'success'
|
type: 'success'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
that.initData()
|
||||||
that.$refs[itemData.deviceId + 'refbtn' ].loading = false;
|
that.$refs[itemData.deviceId + 'refbtn' ].loading = false;
|
||||||
}).catch(function(e) {
|
}).catch(function(e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
|
|
Loading…
Reference in New Issue