Commit 059a5a678ab21738c3fecb9e2bd1e2dc47220a4f
Merge remote-tracking branch 'origin/master' into wvp-28181-2.0
Showing
3 changed files
with
19 additions
and
27 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| ... | ... | @@ -182,35 +182,24 @@ public class SIPCommander implements ISIPCommander { |
| 182 | 182 | /** |
| 183 | 183 | * 云台指令码计算 |
| 184 | 184 | * |
| 185 | - * @param leftRight 镜头左移右移 0:停止 1:左移 2:右移 | |
| 186 | - * @param upDown 镜头上移下移 0:停止 1:上移 2:下移 | |
| 187 | - * @param inOut 镜头放大缩小 0:停止 1:缩小 2:放大 | |
| 188 | - * @param moveSpeed 镜头移动速度 默认 0XFF (0-255) | |
| 189 | - * @param zoomSpeed 镜头缩放速度 默认 0X1 (0-255) | |
| 185 | + * @param cmdCode 指令码 | |
| 186 | + * @param parameter1 数据1 | |
| 187 | + * @param parameter2 数据2 | |
| 188 | + * @param combineCode2 组合码2 | |
| 190 | 189 | */ |
| 191 | - | |
| 192 | - /** | |
| 193 | - * 云台指令码计算 | |
| 194 | - * | |
| 195 | - * @param cmdCode 指令码 | |
| 196 | - * @param horizonSpeed 水平移动速度 | |
| 197 | - * @param verticalSpeed 垂直移动速度 | |
| 198 | - * @param zoomSpeed 缩放速度 | |
| 199 | - * @return | |
| 200 | - */ | |
| 201 | - public static String frontEndCmdString(int cmdCode, int horizonSpeed, int verticalSpeed, int zoomSpeed) { | |
| 190 | + public static String frontEndCmdString(int cmdCode, int parameter1, int parameter2, int combineCode2) { | |
| 202 | 191 | StringBuilder builder = new StringBuilder("A50F01"); |
| 203 | 192 | String strTmp; |
| 204 | 193 | strTmp = String.format("%02X", cmdCode); |
| 205 | 194 | builder.append(strTmp, 0, 2); |
| 206 | - strTmp = String.format("%02X", horizonSpeed); | |
| 195 | + strTmp = String.format("%02X", parameter1); | |
| 207 | 196 | builder.append(strTmp, 0, 2); |
| 208 | - strTmp = String.format("%02X", verticalSpeed); | |
| 197 | + strTmp = String.format("%02X", parameter2); | |
| 209 | 198 | builder.append(strTmp, 0, 2); |
| 210 | - strTmp = String.format("%X", zoomSpeed); | |
| 199 | + strTmp = String.format("%X", combineCode2); | |
| 211 | 200 | builder.append(strTmp, 0, 1).append("0"); |
| 212 | 201 | //计算校验码 |
| 213 | - int checkCode = (0XA5 + 0X0F + 0X01 + cmdCode + horizonSpeed + verticalSpeed + (zoomSpeed & 0XF0)) % 0X100; | |
| 202 | + int checkCode = (0XA5 + 0X0F + 0X01 + cmdCode + parameter1 + parameter2 + (combineCode2 & 0XF0)) % 0X100; | |
| 214 | 203 | strTmp = String.format("%02X", checkCode); |
| 215 | 204 | builder.append(strTmp, 0, 2); |
| 216 | 205 | return builder.toString(); |
| ... | ... | @@ -259,14 +248,14 @@ public class SIPCommander implements ISIPCommander { |
| 259 | 248 | * @param device 控制设备 |
| 260 | 249 | * @param channelId 预览通道 |
| 261 | 250 | * @param cmdCode 指令码 |
| 262 | - * @param horizonSpeed 水平移动速度 | |
| 263 | - * @param verticalSpeed 垂直移动速度 | |
| 264 | - * @param zoomSpeed 缩放速度 | |
| 251 | + * @param parameter1 数据1 | |
| 252 | + * @param parameter2 数据2 | |
| 253 | + * @param combineCode2 组合码2 | |
| 265 | 254 | */ |
| 266 | 255 | @Override |
| 267 | - public boolean frontEndCmd(Device device, String channelId, int cmdCode, int horizonSpeed, int verticalSpeed, int zoomSpeed) { | |
| 256 | + public boolean frontEndCmd(Device device, String channelId, int cmdCode, int parameter1, int parameter2, int combineCode2) { | |
| 268 | 257 | try { |
| 269 | - String cmdStr= frontEndCmdString(cmdCode, horizonSpeed, verticalSpeed, zoomSpeed); | |
| 258 | + String cmdStr= frontEndCmdString(cmdCode, parameter1, parameter2, combineCode2); | |
| 270 | 259 | System.out.println("控制字符串:" + cmdStr); |
| 271 | 260 | StringBuffer ptzXml = new StringBuffer(200); |
| 272 | 261 | ptzXml.append("<?xml version=\"1.0\" ?>\r\n"); | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
| ... | ... | @@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
| 21 | 21 | import org.springframework.beans.factory.annotation.Value; |
| 22 | 22 | import org.springframework.http.HttpStatus; |
| 23 | 23 | import org.springframework.http.ResponseEntity; |
| 24 | +import org.springframework.util.StringUtils; | |
| 24 | 25 | import org.springframework.web.bind.annotation.PostMapping; |
| 25 | 26 | import org.springframework.web.bind.annotation.RequestBody; |
| 26 | 27 | import org.springframework.web.bind.annotation.RequestMapping; |
| ... | ... | @@ -68,6 +69,9 @@ public class ZLMHttpHookListener { |
| 68 | 69 | @Value("${media.ip}") |
| 69 | 70 | private String mediaIp; |
| 70 | 71 | |
| 72 | + @Value("${media.wanIp}") | |
| 73 | + private String mediaWanIp; | |
| 74 | + | |
| 71 | 75 | @Value("${media.port}") |
| 72 | 76 | private int mediaPort; |
| 73 | 77 | |
| ... | ... | @@ -358,6 +362,7 @@ public class ZLMHttpHookListener { |
| 358 | 362 | // List<MediaServerConfig> mediaServerConfigs = JSON.parseArray(JSON.toJSONString(json), MediaServerConfig.class); |
| 359 | 363 | // MediaServerConfig mediaServerConfig = mediaServerConfigs.get(0); |
| 360 | 364 | MediaServerConfig mediaServerConfig = JSON.toJavaObject(json, MediaServerConfig.class); |
| 365 | + mediaServerConfig.setWanIp(StringUtils.isEmpty(mediaWanIp)? mediaIp: mediaWanIp); | |
| 361 | 366 | mediaServerConfig.setLocalIP(mediaIp); |
| 362 | 367 | redisCatchStorage.updateMediaInfo(mediaServerConfig); |
| 363 | 368 | // TODO Auto-generated method stub | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
| ... | ... | @@ -112,8 +112,6 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { |
| 112 | 112 | return new PageInfo<>(all); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - | |
| 116 | - | |
| 117 | 115 | @Override |
| 118 | 116 | public List<DeviceChannel> queryChannelsByDeviceId(String deviceId) { |
| 119 | 117 | return deviceChannelMapper.queryChannelsByDeviceId(deviceId, null,null, null, null); | ... | ... |