Merge remote-tracking branch 'origin/master' into wvp-28181-2.0

pull/29/head
panlinlin 2021-01-07 15:31:16 +08:00
commit 059a5a678a
3 changed files with 19 additions and 27 deletions

View File

@ -182,35 +182,24 @@ public class SIPCommander implements ISIPCommander {
/** /**
* *
* *
* @param leftRight 0: 1: 2: * @param cmdCode
* @param upDown 0: 1: 2: * @param parameter1 1
* @param inOut 0: 1: 2: * @param parameter2 2
* @param moveSpeed 0XFF (0-255) * @param combineCode2 2
* @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", horizonSpeed); strTmp = String.format("%02X", parameter1);
builder.append(strTmp, 0, 2); builder.append(strTmp, 0, 2);
strTmp = String.format("%02X", verticalSpeed); strTmp = String.format("%02X", parameter2);
builder.append(strTmp, 0, 2); builder.append(strTmp, 0, 2);
strTmp = String.format("%X", zoomSpeed); strTmp = String.format("%X", combineCode2);
builder.append(strTmp, 0, 1).append("0"); builder.append(strTmp, 0, 1).append("0");
//计算校验码 //计算校验码
int checkCode = (0XA5 + 0X0F + 0X01 + cmdCode + horizonSpeed + verticalSpeed + (zoomSpeed & 0XF0)) % 0X100; int checkCode = (0XA5 + 0X0F + 0X01 + cmdCode + parameter1 + parameter2 + (combineCode2 & 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();
@ -259,14 +248,14 @@ public class SIPCommander implements ISIPCommander {
* @param device * @param device
* @param channelId * @param channelId
* @param cmdCode * @param cmdCode
* @param horizonSpeed * @param parameter1 1
* @param verticalSpeed * @param parameter2 2
* @param zoomSpeed * @param combineCode2 2
*/ */
@Override @Override
public boolean frontEndCmd(Device device, String channelId, int cmdCode, int horizonSpeed, int verticalSpeed, int zoomSpeed) { public boolean frontEndCmd(Device device, String channelId, int cmdCode, int parameter1, int parameter2, int combineCode2) {
try { try {
String cmdStr= frontEndCmdString(cmdCode, horizonSpeed, verticalSpeed, zoomSpeed); String cmdStr= frontEndCmdString(cmdCode, parameter1, parameter2, combineCode2);
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");

View File

@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -68,6 +69,9 @@ public class ZLMHttpHookListener {
@Value("${media.ip}") @Value("${media.ip}")
private String mediaIp; private String mediaIp;
@Value("${media.wanIp}")
private String mediaWanIp;
@Value("${media.port}") @Value("${media.port}")
private int mediaPort; private int mediaPort;
@ -358,6 +362,7 @@ public class ZLMHttpHookListener {
// List<MediaServerConfig> mediaServerConfigs = JSON.parseArray(JSON.toJSONString(json), MediaServerConfig.class); // List<MediaServerConfig> mediaServerConfigs = JSON.parseArray(JSON.toJSONString(json), MediaServerConfig.class);
// MediaServerConfig mediaServerConfig = mediaServerConfigs.get(0); // MediaServerConfig mediaServerConfig = mediaServerConfigs.get(0);
MediaServerConfig mediaServerConfig = JSON.toJavaObject(json, MediaServerConfig.class); MediaServerConfig mediaServerConfig = JSON.toJavaObject(json, MediaServerConfig.class);
mediaServerConfig.setWanIp(StringUtils.isEmpty(mediaWanIp)? mediaIp: mediaWanIp);
mediaServerConfig.setLocalIP(mediaIp); mediaServerConfig.setLocalIP(mediaIp);
redisCatchStorage.updateMediaInfo(mediaServerConfig); redisCatchStorage.updateMediaInfo(mediaServerConfig);
// TODO Auto-generated method stub // TODO Auto-generated method stub

View File

@ -112,8 +112,6 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
return new PageInfo<>(all); return new PageInfo<>(all);
} }
@Override @Override
public List<DeviceChannel> queryChannelsByDeviceId(String deviceId) { public List<DeviceChannel> queryChannelsByDeviceId(String deviceId) {
return deviceChannelMapper.queryChannelsByDeviceId(deviceId, null,null, null, null); return deviceChannelMapper.queryChannelsByDeviceId(deviceId, null,null, null, null);