From 946e1dc245ab629b39c1124cbe2f4cc4685b5935 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期五, 18 十一月 2022 17:17:01 +0800
Subject: [PATCH] 添加远程启动信令

---
 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java |   23 +++++++++++++++++++++++
 doc/README.md                                                                   |    4 ++--
 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java     |   20 +++++++++++++-------
 3 files changed, 38 insertions(+), 9 deletions(-)

diff --git a/doc/README.md b/doc/README.md
index 635a4a5..46b27fb 100644
--- a/doc/README.md
+++ b/doc/README.md
@@ -21,7 +21,7 @@
 - [X] 瀹炴椂瑙嗛煶棰戠偣鎾�
 - [X] 璁惧鎺у埗
   - [X] 浜戝彴鎺у埗
-  - [ ] 杩滅▼鍚姩
+  - [X] 杩滅▼鍚姩
   - [ ] 褰曞儚鎺у埗
   - [ ] 鎶ヨ甯冮槻/鎾ら槻
   - [ ] 鎶ヨ澶嶄綅
@@ -29,7 +29,7 @@
   - [ ] 鎷夋鏀惧ぇ
   - [ ] 鎷夋缂╁皬
   - [ ] 鐪嬪畧浣嶆帶鍒�
-  - [ ] 璁惧閰嶇疆
+  - [X] 璁惧閰嶇疆
 - [X] 鎶ヨ浜嬩欢閫氱煡鍜屽垎鍙�
 - [X] 璁惧鐩綍璁㈤槄
 - [X] 缃戠粶璁惧淇℃伅鏌ヨ
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java
index b99286e..8fcee5a 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java
@@ -2,19 +2,17 @@
 
 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 @@
 	 */
 	void deviceConfigCmd(Device device);
 	
-		/**
+	/**
 	 * 璁惧閰嶇疆鍛戒护锛歜asicParam
 	 * 
 	 * @param device  			瑙嗛璁惧
@@ -246,7 +244,15 @@
 	 * @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;
+
 	/**
 	 * 鏌ヨ璁惧鐘舵��
 	 * 
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
index b382b63..55b200c 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
@@ -908,6 +908,29 @@
     }
 
     /**
+     * 璁惧閰嶇疆鍛戒护锛氳繙绋嬪惎鍔�
+     *
+     * @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);
+    }
+
+    /**
      * 鏌ヨ璁惧鐘舵��
      *
      * @param device 瑙嗛璁惧

--
Gitblit v1.8.0