Jelajahi Sumber

添加远程启动信令

648540858 2 tahun lalu
induk
melakukan
946e1dc245

+ 2 - 2
doc/README.md

@@ -21,7 +21,7 @@
 - [X] 实时视音频点播
 - [X] 设备控制
   - [X] 云台控制
-  - [ ] 远程启动
+  - [X] 远程启动
   - [ ] 录像控制
   - [ ] 报警布防/撤防
   - [ ] 报警复位
@@ -29,7 +29,7 @@
   - [ ] 拉框放大
   - [ ] 拉框缩小
   - [ ] 看守位控制
-  - [ ] 设备配置
+  - [X] 设备配置
 - [X] 报警事件通知和分发
 - [X] 设备目录订阅
 - [X] 网络设备信息查询

+ 13 - 7
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java

@@ -2,19 +2,17 @@ package com.genersoft.iot.vmp.gb28181.transmit.cmd;
 
 import com.genersoft.iot.vmp.common.StreamInfo;
 import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
-import com.genersoft.iot.vmp.gb28181.bean.*;
+import com.genersoft.iot.vmp.gb28181.bean.Device;
+import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm;
+import com.genersoft.iot.vmp.gb28181.bean.InviteStreamCallback;
 import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
 import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
 import com.genersoft.iot.vmp.service.bean.SSRCInfo;
 import gov.nist.javax.sip.message.SIPRequest;
 
-import javax.sip.Dialog;
 import javax.sip.InvalidArgumentException;
-import javax.sip.PeerUnavailableException;
 import javax.sip.SipException;
-import javax.sip.message.Message;
-import javax.sip.message.Request;
 import java.text.ParseException;
 
 /**    
@@ -235,7 +233,7 @@ public interface ISIPCommander {
 	 */
 	void deviceConfigCmd(Device device);
 	
-		/**
+	/**
 	 * 设备配置命令:basicParam
 	 * 
 	 * @param device  			视频设备
@@ -246,7 +244,15 @@ public interface ISIPCommander {
 	 * @param heartBeatCount	心跳超时次数(可选)
 	 */  
 	void deviceBasicConfigCmd(Device device, String channelId, String name, String expiration, String heartBeatInterval, String heartBeatCount, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException;
-	
+
+
+	/**
+	 * 设备配置命令:远程启动
+	 *
+	 * @param device 视频设备
+	 */
+	void deviceTeleBootCmd(Device device, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException;
+
 	/**
 	 * 查询设备状态
 	 * 

+ 23 - 0
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java

@@ -907,6 +907,29 @@ public class SIPCommander implements ISIPCommander {
         sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), request, errorEvent);
     }
 
+    /**
+     * 设备配置命令:远程启动
+     *
+     * @param device 视频设备
+     */
+    @Override
+    public void deviceTeleBootCmd(Device device, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException {
+
+        StringBuffer cmdXml = new StringBuffer(200);
+        String charset = device.getCharset();
+        cmdXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n");
+        cmdXml.append("<Control>\r\n");
+        cmdXml.append("<CmdType>DeviceControl</CmdType>\r\n");
+        cmdXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n");
+        cmdXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n");
+        cmdXml.append("<PTZCmd></PTZCmd>\r\n");
+        cmdXml.append("<TeleBoot>Boot</PTZCmd>\r\n");
+        cmdXml.append("</Control>\r\n");
+
+        Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, SipUtils.getNewFromTag(), null,sipSender.getNewCallIdHeader(sipLayer.getLocalIp(device.getLocalIp()),device.getTransport()));
+        sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), request, errorEvent);
+    }
+
     /**
      * 查询设备状态
      *