From bc1b8098a2d042bd94038128f3e83c604b0418c9 Mon Sep 17 00:00:00 2001
From: 648540858 <456panlinlin>
Date: 星期一, 21 三月 2022 16:58:42 +0800
Subject: [PATCH] 修身颠簸与录像回放redis前缀重复的问题

---
 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java |   32 ++++++++++++++++++++------------
 1 files changed, 20 insertions(+), 12 deletions(-)

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 d2ef5ed..48bffd7 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
@@ -1120,8 +1120,9 @@
 	@Override
 	public boolean deviceStatusQuery(Device device, SipSubscribe.Event errorEvent) {
 		try {
+			String charset = device.getCharset();
 			StringBuffer catalogXml = new StringBuffer(200);
-			catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n");
+			catalogXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n");
 			catalogXml.append("<Query>\r\n");
 			catalogXml.append("<CmdType>DeviceStatus</CmdType>\r\n");
 			catalogXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n");
@@ -1153,7 +1154,8 @@
 	public boolean deviceInfoQuery(Device device) {
 		try {
 			StringBuffer catalogXml = new StringBuffer(200);
-			catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n");
+			String charset = device.getCharset();
+			catalogXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n");
 			catalogXml.append("<Query>\r\n");
 			catalogXml.append("<CmdType>DeviceInfo</CmdType>\r\n");
 			catalogXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n");
@@ -1185,7 +1187,8 @@
 	public boolean catalogQuery(Device device, SipSubscribe.Event errorEvent) {
 		try {
 			StringBuffer catalogXml = new StringBuffer(200);
-			catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n");
+			String charset = device.getCharset();
+			catalogXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n");
 			catalogXml.append("<Query>\r\n");
 			catalogXml.append("<CmdType>Catalog</CmdType>\r\n");
 			catalogXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n");
@@ -1224,7 +1227,8 @@
 		}
 		try {
 			StringBuffer recordInfoXml = new StringBuffer(200);
-			recordInfoXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n");
+			String charset = device.getCharset();
+			recordInfoXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n");
 			recordInfoXml.append("<Query>\r\n");
 			recordInfoXml.append("<CmdType>RecordInfo</CmdType>\r\n");
 			recordInfoXml.append("<SN>" + sn + "</SN>\r\n");
@@ -1396,7 +1400,8 @@
 	public boolean mobilePostitionQuery(Device device, SipSubscribe.Event errorEvent) {
 		try {
 			StringBuffer mobilePostitionXml = new StringBuffer(200);
-			mobilePostitionXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n");
+			String charset = device.getCharset();
+			mobilePostitionXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n");
 			mobilePostitionXml.append("<Query>\r\n");
 			mobilePostitionXml.append("<CmdType>MobilePosition</CmdType>\r\n");
 			mobilePostitionXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n");
@@ -1431,7 +1436,8 @@
 	public boolean mobilePositionSubscribe(Device device, int expires, int interval) {
 		try {
 			StringBuffer subscribePostitionXml = new StringBuffer(200);
-			subscribePostitionXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n");
+			String charset = device.getCharset();
+			subscribePostitionXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n");
 			subscribePostitionXml.append("<Query>\r\n");
 			subscribePostitionXml.append("<CmdType>MobilePosition</CmdType>\r\n");
 			subscribePostitionXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n");
@@ -1473,7 +1479,8 @@
 	public boolean alarmSubscribe(Device device, int expires, String startPriority, String endPriority, String alarmMethod, String alarmType, String startTime, String endTime) {
 		try {
 			StringBuffer cmdXml = new StringBuffer(200);
-			cmdXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n");
+			String charset = device.getCharset();
+			cmdXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n");
 			cmdXml.append("<Query>\r\n");
 			cmdXml.append("<CmdType>Alarm</CmdType>\r\n");
 			cmdXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n");
@@ -1518,7 +1525,8 @@
 	public boolean catalogSubscribe(Device device, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) {
 		try {
 			StringBuffer cmdXml = new StringBuffer(200);
-			cmdXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n");
+			String charset = device.getCharset();
+			cmdXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n");
 			cmdXml.append("<Query>\r\n");
 			cmdXml.append("<CmdType>Catalog</CmdType>\r\n");
 			cmdXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n");
@@ -1620,7 +1628,7 @@
 			content.append("PAUSE RTSP/1.0\r\n");
 			content.append("CSeq: " + cseq + "\r\n");
 			content.append("PauseTime: now\r\n");
-			Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq);
+			Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString());
 			if (request == null) {
 				return;
 			}
@@ -1651,7 +1659,7 @@
 			content.append("PLAY RTSP/1.0\r\n");
 			content.append("CSeq: " + cseq + "\r\n");
 			content.append("Range: npt=now-\r\n");
-			Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq);
+			Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString());
 			if (request == null) return;
 			logger.info(request.toString());
 			ClientTransaction clientTransaction = null;
@@ -1680,7 +1688,7 @@
 			content.append("CSeq: " + cseq + "\r\n");
 			content.append("Range: npt=" + Math.abs(seekTime) + "-\r\n");
 
-			Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq);
+			Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString());
 			if (request == null) return;
 			logger.info(request.toString());
 			ClientTransaction clientTransaction = null;
@@ -1708,7 +1716,7 @@
 			content.append("PLAY RTSP/1.0\r\n");
 			content.append("CSeq: " + cseq + "\r\n");
 			content.append("Scale: " + String.format("%.1f",speed) + "\r\n");
-			Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq);
+			Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString());
 			if (request == null) return;
 			logger.info(request.toString());
 			ClientTransaction clientTransaction = null;

--
Gitblit v1.8.0