Commit 08af41b1dd568e9607279da918391c192d137d1d
1 parent
76a75bf3
改进变焦速度计算方式
Showing
1 changed file
with
3 additions
and
5 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| @@ -101,7 +101,7 @@ public class SIPCommander implements ISIPCommander { | @@ -101,7 +101,7 @@ public class SIPCommander implements ISIPCommander { | ||
| 101 | * @param upDown 镜头上移下移 0:停止 1:上移 2:下移 | 101 | * @param upDown 镜头上移下移 0:停止 1:上移 2:下移 |
| 102 | * @param inOut 镜头放大缩小 0:停止 1:缩小 2:放大 | 102 | * @param inOut 镜头放大缩小 0:停止 1:缩小 2:放大 |
| 103 | * @param moveSpeed 镜头移动速度 默认 0XFF (0-255) | 103 | * @param moveSpeed 镜头移动速度 默认 0XFF (0-255) |
| 104 | - * @param zoomSpeed 镜头缩放速度 默认 0X1 (0-15) | 104 | + * @param zoomSpeed 镜头缩放速度 默认 0X1 (0-255) |
| 105 | */ | 105 | */ |
| 106 | public static String cmdString(int leftRight, int upDown, int inOut, int moveSpeed, int zoomSpeed) { | 106 | public static String cmdString(int leftRight, int upDown, int inOut, int moveSpeed, int zoomSpeed) { |
| 107 | int cmdCode = 0; | 107 | int cmdCode = 0; |
| @@ -127,12 +127,10 @@ public class SIPCommander implements ISIPCommander { | @@ -127,12 +127,10 @@ public class SIPCommander implements ISIPCommander { | ||
| 127 | strTmp = String.format("%02X", moveSpeed); | 127 | strTmp = String.format("%02X", moveSpeed); |
| 128 | builder.append(strTmp, 0, 2); | 128 | builder.append(strTmp, 0, 2); |
| 129 | builder.append(strTmp, 0, 2); | 129 | builder.append(strTmp, 0, 2); |
| 130 | - // strTmp = String.format("%X", zoomSpeed); | ||
| 131 | - int zs=(zoomSpeed<<4 & 0XF0); | ||
| 132 | - strTmp = String.format("%X", zs); | 130 | + strTmp = String.format("%X", zoomSpeed); |
| 133 | builder.append(strTmp, 0, 1).append("0"); | 131 | builder.append(strTmp, 0, 1).append("0"); |
| 134 | //计算校验码 | 132 | //计算校验码 |
| 135 | - int checkCode = (0XA5 + 0X0F + 0X01 + cmdCode + moveSpeed + moveSpeed + zs/*(zoomSpeed << 4 & 0XF0)*/) % 0X100; | 133 | + int checkCode = (0XA5 + 0X0F + 0X01 + cmdCode + moveSpeed + moveSpeed + (zoomSpeed /*<< 4*/ & 0XF0)) % 0X100; |
| 136 | strTmp = String.format("%02X", checkCode); | 134 | strTmp = String.format("%02X", checkCode); |
| 137 | builder.append(strTmp, 0, 2); | 135 | builder.append(strTmp, 0, 2); |
| 138 | return builder.toString(); | 136 | return builder.toString(); |