Commit 946e1dc245ab629b39c1124cbe2f4cc4685b5935
1 parent
a53dce38
添加远程启动信令
Showing
3 changed files
with
38 additions
and
9 deletions
doc/README.md
| @@ -21,7 +21,7 @@ | @@ -21,7 +21,7 @@ | ||
| 21 | - [X] 实时视音频点播 | 21 | - [X] 实时视音频点播 |
| 22 | - [X] 设备控制 | 22 | - [X] 设备控制 |
| 23 | - [X] 云台控制 | 23 | - [X] 云台控制 |
| 24 | - - [ ] 远程启动 | 24 | + - [X] 远程启动 |
| 25 | - [ ] 录像控制 | 25 | - [ ] 录像控制 |
| 26 | - [ ] 报警布防/撤防 | 26 | - [ ] 报警布防/撤防 |
| 27 | - [ ] 报警复位 | 27 | - [ ] 报警复位 |
| @@ -29,7 +29,7 @@ | @@ -29,7 +29,7 @@ | ||
| 29 | - [ ] 拉框放大 | 29 | - [ ] 拉框放大 |
| 30 | - [ ] 拉框缩小 | 30 | - [ ] 拉框缩小 |
| 31 | - [ ] 看守位控制 | 31 | - [ ] 看守位控制 |
| 32 | - - [ ] 设备配置 | 32 | + - [X] 设备配置 |
| 33 | - [X] 报警事件通知和分发 | 33 | - [X] 报警事件通知和分发 |
| 34 | - [X] 设备目录订阅 | 34 | - [X] 设备目录订阅 |
| 35 | - [X] 网络设备信息查询 | 35 | - [X] 网络设备信息查询 |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java
| @@ -2,19 +2,17 @@ package com.genersoft.iot.vmp.gb28181.transmit.cmd; | @@ -2,19 +2,17 @@ package com.genersoft.iot.vmp.gb28181.transmit.cmd; | ||
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.common.StreamInfo; | 3 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 4 | import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException; | 4 | import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException; |
| 5 | -import com.genersoft.iot.vmp.gb28181.bean.*; | 5 | +import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 6 | +import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm; | ||
| 7 | +import com.genersoft.iot.vmp.gb28181.bean.InviteStreamCallback; | ||
| 6 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; | 8 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
| 7 | import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe; | 9 | import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe; |
| 8 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 10 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 9 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; | 11 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| 10 | import gov.nist.javax.sip.message.SIPRequest; | 12 | import gov.nist.javax.sip.message.SIPRequest; |
| 11 | 13 | ||
| 12 | -import javax.sip.Dialog; | ||
| 13 | import javax.sip.InvalidArgumentException; | 14 | import javax.sip.InvalidArgumentException; |
| 14 | -import javax.sip.PeerUnavailableException; | ||
| 15 | import javax.sip.SipException; | 15 | import javax.sip.SipException; |
| 16 | -import javax.sip.message.Message; | ||
| 17 | -import javax.sip.message.Request; | ||
| 18 | import java.text.ParseException; | 16 | import java.text.ParseException; |
| 19 | 17 | ||
| 20 | /** | 18 | /** |
| @@ -235,7 +233,7 @@ public interface ISIPCommander { | @@ -235,7 +233,7 @@ public interface ISIPCommander { | ||
| 235 | */ | 233 | */ |
| 236 | void deviceConfigCmd(Device device); | 234 | void deviceConfigCmd(Device device); |
| 237 | 235 | ||
| 238 | - /** | 236 | + /** |
| 239 | * 设备配置命令:basicParam | 237 | * 设备配置命令:basicParam |
| 240 | * | 238 | * |
| 241 | * @param device 视频设备 | 239 | * @param device 视频设备 |
| @@ -246,7 +244,15 @@ public interface ISIPCommander { | @@ -246,7 +244,15 @@ public interface ISIPCommander { | ||
| 246 | * @param heartBeatCount 心跳超时次数(可选) | 244 | * @param heartBeatCount 心跳超时次数(可选) |
| 247 | */ | 245 | */ |
| 248 | void deviceBasicConfigCmd(Device device, String channelId, String name, String expiration, String heartBeatInterval, String heartBeatCount, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; | 246 | void deviceBasicConfigCmd(Device device, String channelId, String name, String expiration, String heartBeatInterval, String heartBeatCount, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; |
| 249 | - | 247 | + |
| 248 | + | ||
| 249 | + /** | ||
| 250 | + * 设备配置命令:远程启动 | ||
| 251 | + * | ||
| 252 | + * @param device 视频设备 | ||
| 253 | + */ | ||
| 254 | + void deviceTeleBootCmd(Device device, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; | ||
| 255 | + | ||
| 250 | /** | 256 | /** |
| 251 | * 查询设备状态 | 257 | * 查询设备状态 |
| 252 | * | 258 | * |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| @@ -908,6 +908,29 @@ public class SIPCommander implements ISIPCommander { | @@ -908,6 +908,29 @@ public class SIPCommander implements ISIPCommander { | ||
| 908 | } | 908 | } |
| 909 | 909 | ||
| 910 | /** | 910 | /** |
| 911 | + * 设备配置命令:远程启动 | ||
| 912 | + * | ||
| 913 | + * @param device 视频设备 | ||
| 914 | + */ | ||
| 915 | + @Override | ||
| 916 | + public void deviceTeleBootCmd(Device device, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException { | ||
| 917 | + | ||
| 918 | + StringBuffer cmdXml = new StringBuffer(200); | ||
| 919 | + String charset = device.getCharset(); | ||
| 920 | + cmdXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n"); | ||
| 921 | + cmdXml.append("<Control>\r\n"); | ||
| 922 | + cmdXml.append("<CmdType>DeviceControl</CmdType>\r\n"); | ||
| 923 | + cmdXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); | ||
| 924 | + cmdXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n"); | ||
| 925 | + cmdXml.append("<PTZCmd></PTZCmd>\r\n"); | ||
| 926 | + cmdXml.append("<TeleBoot>Boot</PTZCmd>\r\n"); | ||
| 927 | + cmdXml.append("</Control>\r\n"); | ||
| 928 | + | ||
| 929 | + Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, SipUtils.getNewFromTag(), null,sipSender.getNewCallIdHeader(sipLayer.getLocalIp(device.getLocalIp()),device.getTransport())); | ||
| 930 | + sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), request, errorEvent); | ||
| 931 | + } | ||
| 932 | + | ||
| 933 | + /** | ||
| 911 | * 查询设备状态 | 934 | * 查询设备状态 |
| 912 | * | 935 | * |
| 913 | * @param device 视频设备 | 936 | * @param device 视频设备 |