From 1af77ab5f7c11a4b3d59c1989b51b9fca29679ce Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期二, 18 十月 2022 22:18:49 +0800
Subject: [PATCH] Merge pull request #645 from IKangXu/wvp-28181-2.0

---
 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java |  105 +++++++++++++++++++++++++++++++---------------------
 1 files changed, 62 insertions(+), 43 deletions(-)

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 f4bcbb6..b99286e 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
@@ -1,13 +1,21 @@
 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.event.SipSubscribe;
-import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe;
+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;
 
 /**    
  * @description:璁惧鑳藉姏鎺ュ彛锛岀敤浜庡畾涔夎澶囩殑鎺у埗銆佹煡璇㈣兘鍔�   
@@ -24,7 +32,7 @@
 	 * @param leftRight  闀滃ご宸︾Щ鍙崇Щ 0:鍋滄 1:宸︾Щ 2:鍙崇Щ
      * @param upDown     闀滃ご涓婄Щ涓嬬Щ 0:鍋滄 1:涓婄Щ 2:涓嬬Щ
 	 */
-	boolean ptzdirectCmd(Device device,String channelId,int leftRight, int upDown);
+	void ptzdirectCmd(Device device,String channelId,int leftRight, int upDown) throws InvalidArgumentException, ParseException, SipException;
 	
 	/**
 	 * 浜戝彴鏂瑰悜鏀炬帶鍒�
@@ -35,7 +43,7 @@
      * @param upDown     闀滃ご涓婄Щ涓嬬Щ 0:鍋滄 1:涓婄Щ 2:涓嬬Щ
      * @param moveSpeed  闀滃ご绉诲姩閫熷害
 	 */
-	boolean ptzdirectCmd(Device device,String channelId,int leftRight, int upDown, int moveSpeed);
+	void ptzdirectCmd(Device device,String channelId,int leftRight, int upDown, int moveSpeed) throws InvalidArgumentException, ParseException, SipException;
 	
 	/**
 	 * 浜戝彴缂╂斁鎺у埗锛屼娇鐢ㄩ厤缃枃浠朵腑鐨勯粯璁ら暅澶寸缉鏀鹃�熷害
@@ -44,7 +52,7 @@
 	 * @param channelId  棰勮閫氶亾
      * @param inOut      闀滃ご鏀惧ぇ缂╁皬 0:鍋滄 1:缂╁皬 2:鏀惧ぇ
 	 */
-	boolean ptzZoomCmd(Device device,String channelId,int inOut);
+	void ptzZoomCmd(Device device,String channelId,int inOut) throws InvalidArgumentException, ParseException, SipException;
 	
 	/**
 	 * 浜戝彴缂╂斁鎺у埗
@@ -53,7 +61,7 @@
 	 * @param channelId  棰勮閫氶亾
      * @param inOut      闀滃ご鏀惧ぇ缂╁皬 0:鍋滄 1:缂╁皬 2:鏀惧ぇ
 	 */
-	boolean ptzZoomCmd(Device device,String channelId,int inOut, int moveSpeed);
+	void ptzZoomCmd(Device device,String channelId,int inOut, int moveSpeed) throws InvalidArgumentException, ParseException, SipException;
 	
 	/**
 	 * 浜戝彴鎺у埗锛屾敮鎸佹柟鍚戜笌缂╂斁鎺у埗
@@ -66,7 +74,7 @@
      * @param moveSpeed  闀滃ご绉诲姩閫熷害
      * @param zoomSpeed  闀滃ご缂╂斁閫熷害
 	 */
-	boolean ptzCmd(Device device,String channelId,int leftRight, int upDown, int inOut, int moveSpeed, int zoomSpeed);
+	void ptzCmd(Device device,String channelId,int leftRight, int upDown, int inOut, int moveSpeed, int zoomSpeed) throws InvalidArgumentException, SipException, ParseException;
 	
 	/**
 	 * 鍓嶇鎺у埗锛屽寘鎷琍TZ鎸囦护銆丗I鎸囦护銆侀缃綅鎸囦护銆佸贰鑸寚浠ゃ�佹壂鎻忔寚浠ゅ拰杈呭姪寮�鍏虫寚浠�
@@ -78,7 +86,7 @@
      * @param parameter2	鏁版嵁2
      * @param combineCode2	缁勫悎鐮�2
 	 */
-	boolean frontEndCmd(Device device, String channelId, int cmdCode, int parameter1, int parameter2, int combineCode2);
+	void frontEndCmd(Device device, String channelId, int cmdCode, int parameter1, int parameter2, int combineCode2) throws SipException, InvalidArgumentException, ParseException;
 	
 	/**
 	 * 鍓嶇鎺у埗鎸囦护锛堢敤浜庤浆鍙戜笂绾ф寚浠わ級
@@ -86,14 +94,14 @@
 	 * @param channelId		棰勮閫氶亾
 	 * @param cmdString		鍓嶇鎺у埗鎸囦护涓�
 	 */
-	boolean fronEndCmd(Device device, String channelId, String cmdString, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent);
+	void fronEndCmd(Device device, String channelId, String cmdString, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException;
 
 	/**
 	 * 璇锋眰棰勮瑙嗛娴�
 	 * @param device  瑙嗛璁惧
 	 * @param channelId  棰勮閫氶亾
 	 */
-	void playStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId, ZLMHttpHookSubscribe.Event event, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent);
+	void playStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId, ZlmHttpHookSubscribe.Event event, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException;
 
 	/**
 	 * 璇锋眰鍥炴斁瑙嗛娴�
@@ -103,7 +111,7 @@
 	 * @param startTime 寮�濮嬫椂闂�,鏍煎紡瑕佹眰锛歽yyy-MM-dd HH:mm:ss
 	 * @param endTime 缁撴潫鏃堕棿,鏍煎紡瑕佹眰锛歽yyy-MM-dd HH:mm:ss
 	 */
-	void playbackStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInf, Device device, String channelId, String startTime, String endTime,InviteStreamCallback inviteStreamCallback, InviteStreamCallback event, SipSubscribe.Event errorEvent);
+	void playbackStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInf, Device device, String channelId, String startTime, String endTime,InviteStreamCallback inviteStreamCallback, InviteStreamCallback event, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException;
 
 	/**
 	 * 璇锋眰鍘嗗彶濯掍綋涓嬭浇
@@ -116,49 +124,59 @@
 	 */ 
 	void downloadStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId,
 						   String startTime, String endTime, int downloadSpeed, InviteStreamCallback inviteStreamCallback, InviteStreamCallback hookEvent,
-						   SipSubscribe.Event errorEvent);
+						   SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException;
 
 	/**
 	 * 瑙嗛娴佸仠姝�
 	 */
-	void streamByeCmd(String deviceId, String channelId, String stream, String callId, SipSubscribe.Event okEvent);
-	void streamByeCmd(String deviceId, String channelId, String stream, String callId);
+	void streamByeCmd(Device device, String channelId, String stream, String callId, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException;
+
+	void streamByeCmd(Device device, String channelId, String stream, String callId) throws InvalidArgumentException, ParseException, SipException, SsrcTransactionNotFoundException;
 
 	/**
 	 * 鍥炴斁鏆傚仠
 	 */
-	void playPauseCmd(Device device, StreamInfo streamInfo);
+	void playPauseCmd(Device device, StreamInfo streamInfo) throws InvalidArgumentException, ParseException, SipException;
 
 	/**
 	 * 鍥炴斁鎭㈠
 	 */
-	void playResumeCmd(Device device, StreamInfo streamInfo);
+	void playResumeCmd(Device device, StreamInfo streamInfo) throws InvalidArgumentException, ParseException, SipException;
 
 	/**
 	 * 鍥炴斁鎷栧姩鎾斁
 	 */
-	void playSeekCmd(Device device, StreamInfo streamInfo, long seekTime);
+	void playSeekCmd(Device device, StreamInfo streamInfo, long seekTime) throws InvalidArgumentException, ParseException, SipException;
 
 	/**
 	 * 鍥炴斁鍊嶉�熸挱鏀�
 	 */
-	void playSpeedCmd(Device device, StreamInfo streamInfo, Double speed);
-
+	void playSpeedCmd(Device device, StreamInfo streamInfo, Double speed) throws InvalidArgumentException, ParseException, SipException;
+	
 	/**
+	 * 鍥炴斁鎺у埗
+	 * @param device
+	 * @param streamInfo
+	 * @param content
+	 */
+	void playbackControlCmd(Device device, StreamInfo streamInfo, String content,SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) throws SipException, InvalidArgumentException, ParseException;
+
+
+    /**
 	 * 璇煶骞挎挱
 	 * 
 	 * @param device  瑙嗛璁惧
 	 * @param channelId  棰勮閫氶亾
 	 */
-	boolean audioBroadcastCmd(Device device,String channelId);
+	void audioBroadcastCmd(Device device,String channelId);
 	
 	/**
 	 * 璇煶骞挎挱
 	 * 
 	 * @param device  瑙嗛璁惧
 	 */
-	void audioBroadcastCmd(Device device, SipSubscribe.Event okEvent);
-	boolean audioBroadcastCmd(Device device);
+	void audioBroadcastCmd(Device device, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException;
+	void audioBroadcastCmd(Device device) throws InvalidArgumentException, SipException, ParseException;
 	
 	/**
 	 * 闊宠棰戝綍鍍忔帶鍒�
@@ -167,21 +185,21 @@
 	 * @param channelId  	棰勮閫氶亾
 	 * @param recordCmdStr	褰曞儚鍛戒护锛歊ecord / StopRecord
 	 */
-	boolean recordCmd(Device device, String channelId, String recordCmdStr, SipSubscribe.Event errorEvent);
+	void recordCmd(Device device, String channelId, String recordCmdStr, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException;
 	
 	/**
 	 * 杩滅▼鍚姩鎺у埗鍛戒护
 	 * 
 	 * @param device	瑙嗛璁惧
 	 */
-	boolean teleBootCmd(Device device);
+	void teleBootCmd(Device device) throws InvalidArgumentException, SipException, ParseException;
 
 	/**
 	 * 鎶ヨ甯冮槻/鎾ら槻鍛戒护
 	 * 
 	 * @param device  	瑙嗛璁惧
 	 */
-	boolean guardCmd(Device device, String guardCmdStr, SipSubscribe.Event errorEvent);
+	void guardCmd(Device device, String guardCmdStr, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException;
 	
 	/**
 	 * 鎶ヨ澶嶄綅鍛戒护
@@ -190,7 +208,7 @@
 	 * @param alarmMethod	鎶ヨ鏂瑰紡锛堝彲閫夛級
 	 * @param alarmType		鎶ヨ绫诲瀷锛堝彲閫夛級
 	 */
-	boolean alarmCmd(Device device, String alarmMethod, String alarmType, SipSubscribe.Event errorEvent);
+	void alarmCmd(Device device, String alarmMethod, String alarmType, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException;
 	
 	/**
 	 * 寮哄埗鍏抽敭甯у懡浠�,璁惧鏀跺埌姝ゅ懡浠ゅ簲绔嬪埢鍙戦�佷竴涓狪DR甯�
@@ -198,7 +216,7 @@
 	 * @param device  瑙嗛璁惧
 	 * @param channelId  棰勮閫氶亾
 	 */
-	boolean iFrameCmd(Device device, String channelId);
+	void iFrameCmd(Device device, String channelId) throws InvalidArgumentException, SipException, ParseException;
 	
 	/**
 	 * 鐪嬪畧浣嶆帶鍒跺懡浠�
@@ -208,14 +226,14 @@
 	 * @param resetTime		鑷姩褰掍綅鏃堕棿闂撮殧锛屽紑鍚湅瀹堜綅鏃朵娇鐢紝鍗曚綅:绉�(s)
 	 * @param presetIndex	璋冪敤棰勭疆浣嶇紪鍙凤紝寮�鍚湅瀹堜綅鏃朵娇鐢紝鍙栧�艰寖鍥�0~255
 	 */
-	boolean homePositionCmd(Device device, String channelId, String enabled, String resetTime, String presetIndex, SipSubscribe.Event errorEvent);
+	void homePositionCmd(Device device, String channelId, String enabled, String resetTime, String presetIndex, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException;
 	
 	/**
 	 * 璁惧閰嶇疆鍛戒护
 	 * 
 	 * @param device  瑙嗛璁惧
 	 */
-	boolean deviceConfigCmd(Device device);
+	void deviceConfigCmd(Device device);
 	
 		/**
 	 * 璁惧閰嶇疆鍛戒护锛歜asicParam
@@ -227,14 +245,14 @@
 	 * @param heartBeatInterval	蹇冭烦闂撮殧鏃堕棿锛堝彲閫夛級
 	 * @param heartBeatCount	蹇冭烦瓒呮椂娆℃暟锛堝彲閫夛級
 	 */  
-	boolean deviceBasicConfigCmd(Device device, String channelId, String name, String expiration, String heartBeatInterval, String heartBeatCount, SipSubscribe.Event errorEvent);
+	void deviceBasicConfigCmd(Device device, String channelId, String name, String expiration, String heartBeatInterval, String heartBeatCount, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException;
 	
 	/**
 	 * 鏌ヨ璁惧鐘舵��
 	 * 
 	 * @param device 瑙嗛璁惧
 	 */
-	boolean deviceStatusQuery(Device device, SipSubscribe.Event errorEvent);
+	void deviceStatusQuery(Device device, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException;
 	
 	/**
 	 * 鏌ヨ璁惧淇℃伅
@@ -242,14 +260,14 @@
 	 * @param device 瑙嗛璁惧
 	 * @return 
 	 */
-	boolean deviceInfoQuery(Device device);
+	void deviceInfoQuery(Device device) throws InvalidArgumentException, SipException, ParseException;
 	
 	/**
 	 * 鏌ヨ鐩綍鍒楄〃
 	 * 
 	 * @param device 瑙嗛璁惧
 	 */
-	boolean catalogQuery(Device device, int sn, SipSubscribe.Event errorEvent);
+	void catalogQuery(Device device, int sn, SipSubscribe.Event errorEvent) throws SipException, InvalidArgumentException, ParseException;
 	
 	/**
 	 * 鏌ヨ褰曞儚淇℃伅
@@ -259,7 +277,7 @@
 	 * @param endTime 缁撴潫鏃堕棿,鏍煎紡瑕佹眰锛歽yyy-MM-dd HH:mm:ss
 	 * @param sn
 	 */
-	boolean recordInfoQuery(Device device, String channelId, String startTime, String endTime, int sn,  Integer Secrecy, String type, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent);
+	void recordInfoQuery(Device device, String channelId, String startTime, String endTime, int sn,  Integer Secrecy, String type, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException;
 	
 	/**
 	 * 鏌ヨ鎶ヨ淇℃伅
@@ -273,8 +291,8 @@
 	 * @param endTime		鎶ヨ鍙戠敓缁堟鏃堕棿锛堝彲閫夛級
 	 * @return				true = 鍛戒护鍙戦�佹垚鍔�
 	 */
-	boolean alarmInfoQuery(Device device, String startPriority, String endPriority, String alarmMethod,
-							String alarmType, String startTime, String endTime, SipSubscribe.Event errorEvent);	
+	void alarmInfoQuery(Device device, String startPriority, String endPriority, String alarmMethod,
+							String alarmType, String startTime, String endTime, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException;
 	
 	/**
 	 * 鏌ヨ璁惧閰嶇疆
@@ -283,21 +301,21 @@
 	 * @param channelId		閫氶亾缂栫爜锛堝彲閫夛級
 	 * @param configType	閰嶇疆绫诲瀷锛�
 	 */
-	boolean deviceConfigQuery(Device device, String channelId, String configType,  SipSubscribe.Event errorEvent);
+	void deviceConfigQuery(Device device, String channelId, String configType,  SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException;
 	
 	/**
 	 * 鏌ヨ璁惧棰勭疆浣嶇疆
 	 * 
 	 * @param device 瑙嗛璁惧
 	 */
-	boolean presetQuery(Device device, String channelId, SipSubscribe.Event errorEvent);
+	void presetQuery(Device device, String channelId, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException;
 	
 	/**
 	 * 鏌ヨ绉诲姩璁惧浣嶇疆鏁版嵁
 	 * 
 	 * @param device 瑙嗛璁惧
 	 */
-	boolean mobilePostitionQuery(Device device, SipSubscribe.Event errorEvent);
+	void mobilePostitionQuery(Device device, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException;
 
 	/**
 	 * 璁㈤槄銆佸彇娑堣闃呯Щ鍔ㄤ綅缃�
@@ -305,7 +323,7 @@
 	 * @param device	瑙嗛璁惧
 	 * @return			true = 鍛戒护鍙戦�佹垚鍔�
 	 */
-	boolean mobilePositionSubscribe(Device device, Dialog dialog, SipSubscribe.Event okEvent , SipSubscribe.Event errorEvent);
+	SIPRequest mobilePositionSubscribe(Device device, SIPRequest request, SipSubscribe.Event okEvent , SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException;
 
 	/**
 	 * 璁㈤槄銆佸彇娑堣闃呮姤璀︿俊鎭�
@@ -318,14 +336,14 @@
 	 * @param endTime		鎶ヨ鍙戠敓缁堟鏃堕棿锛堝彲閫夛級
 	 * @return				true = 鍛戒护鍙戦�佹垚鍔�
 	 */
-	boolean alarmSubscribe(Device device, int expires, String startPriority, String endPriority, String alarmMethod, String alarmType, String startTime, String endTime);
+	void alarmSubscribe(Device device, int expires, String startPriority, String endPriority, String alarmMethod, String alarmType, String startTime, String endTime) throws InvalidArgumentException, SipException, ParseException;
 
 	/**
 	 * 璁㈤槄銆佸彇娑堣闃呯洰褰曚俊鎭�
 	 * @param device		瑙嗛璁惧
 	 * @return				true = 鍛戒护鍙戦�佹垚鍔�
 	 */
-	boolean catalogSubscribe(Device device, Dialog dialog, SipSubscribe.Event okEvent ,SipSubscribe.Event errorEvent);
+	SIPRequest catalogSubscribe(Device device, SIPRequest request, SipSubscribe.Event okEvent ,SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException;
 
 	/**
 	 * 鎷夋鎺у埗鍛戒护
@@ -334,7 +352,7 @@
 	 * @param channelId 閫氶亾id
 	 * @param cmdString 鍓嶇鎺у埗鎸囦护涓�
 	 */
-	boolean dragZoomCmd(Device device, String channelId, String cmdString);
+	void dragZoomCmd(Device device, String channelId, String cmdString) throws InvalidArgumentException, SipException, ParseException;
 
 
 	/**
@@ -343,5 +361,6 @@
 	 * @param deviceAlarm 鎶ヨ淇℃伅淇℃伅
 	 * @return
 	 */
-	boolean sendAlarmMessage(Device device, DeviceAlarm deviceAlarm);
+	void sendAlarmMessage(Device device, DeviceAlarm deviceAlarm) throws InvalidArgumentException, SipException, ParseException;
+
 }

--
Gitblit v1.8.0