From 3591fc47eaa3e301252dc06d257d46bd3a45e120 Mon Sep 17 00:00:00 2001
From: liusuyi <13324259@qq.com>
Date: 星期一, 23 十月 2023 22:10:19 +0800
Subject: [PATCH] 相机sdk异步登录

---
 ard-work/src/main/java/com/ruoyi/device/dhsdk/module/PtzControlModule.java |  319 ++++++++++++++++++++++++++++------------------------
 1 files changed, 172 insertions(+), 147 deletions(-)

diff --git a/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/PtzControlModule.java b/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/PtzControlModule.java
index 5885eee..32fa9a0 100644
--- a/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/PtzControlModule.java
+++ b/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/PtzControlModule.java
@@ -2,205 +2,230 @@
 
 import com.ruoyi.device.dhsdk.lib.NetSDKLib;
 
+import static com.ruoyi.device.dhsdk.module.LoginModule.netsdk;
+
 /**
  * 浜戝彴鎺у埗鎺ュ彛瀹炵幇
  * 涓昏鏈� 锛氬叓涓柟鍚戞帶鍒躲�佸彉鍊嶃�佸彉鐒︺�佸厜鍦堝姛鑳�
  */
 public class PtzControlModule {
+    public static NetSDKLib netsdk = NetSDKLib.NETSDK_INSTANCE;
+    /**
+     * 鎸塪wPTZCommand绫诲瀷鎺у埗
+     */
+    public static boolean ptzControl(NetSDKLib.LLong m_hLoginHandle,int nChannelID, int dwPTZCommand,int lParam1, int lParam2,int lParam3, int dwStop) {
+        return  netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID, dwPTZCommand, lParam1, lParam2, lParam3, dwStop);
+    }
 
-	/**
-	 * 鍚戜笂
-	 */
-	public static boolean ptzControlUpStart(NetSDKLib.LLong lLoginID,int nChannelID, int lParam1, int lParam2) {
-		return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-									NetSDKLib.NET_PTZ_ControlType.NET_PTZ_UP_CONTROL, 
-									lParam1, lParam2, 0, 0);
-	}
-	public static boolean ptzControlUpEnd(int nChannelID) {
-		return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-									 NetSDKLib.NET_PTZ_ControlType.NET_PTZ_UP_CONTROL, 
-									 0, 0, 0, 1);
-	}
-	
-	/**
-	 * 鍚戜笅
-	 */
-	public static boolean ptzControlDownStart(int nChannelID, int lParam1, int lParam2) {
-		return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-											NetSDKLib.NET_PTZ_ControlType.NET_PTZ_DOWN_CONTROL, 
-											lParam1, lParam2, 0, 0);
-	}
-	public static boolean ptzControlDownEnd(int nChannelID) {
-		return 	LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-											 NetSDKLib.NET_PTZ_ControlType.NET_PTZ_DOWN_CONTROL, 
-											 0, 0, 0, 1);
-	}
-	
-	/**
-	 * 鍚戝乏
-	 */
-	public static boolean ptzControlLeftStart(int nChannelID, int lParam1, int lParam2) {
-		return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-											NetSDKLib.NET_PTZ_ControlType.NET_PTZ_LEFT_CONTROL, 
-											lParam1, lParam2, 0, 0);	
-	}
-	public static boolean ptzControlLeftEnd(int nChannelID) {
-		return	LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-											 NetSDKLib.NET_PTZ_ControlType.NET_PTZ_LEFT_CONTROL, 
-											 0, 0, 0, 1);	
-	}
-	
-	/**
-	 * 鍚戝彸
-	 */
-	public static boolean ptzControlRightStart(int nChannelID, int lParam1,int lParam2) {
-		return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-											NetSDKLib.NET_PTZ_ControlType.NET_PTZ_RIGHT_CONTROL, 
-											lParam1, lParam2, 0, 0);
-	}
-	public static boolean ptzControlRightEnd(int nChannelID) {
-		return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-											 NetSDKLib.NET_PTZ_ControlType.NET_PTZ_RIGHT_CONTROL, 
-											 0, 0, 0, 1);		
-	}
-	
-	/**
-	 * 鍚戝乏涓�
-	 */
-	public static boolean ptzControlLeftUpStart(int nChannelID, int lParam1, int lParam2) {
-		return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-											NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTTOP, 
-											lParam1, lParam2, 0, 0);
-	}
-	public static boolean ptzControlLeftUpEnd(int nChannelID) {
-		return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-											 NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTTOP, 
-											 0, 0, 0, 1);	
-	}
-	
-	/**
-	 * 鍚戝彸涓�
-	 */
-	public static boolean ptzControlRightUpStart(int nChannelID, int lParam1, int lParam2) {
-		return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-											NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTTOP, 
-											lParam1, lParam2, 0, 0);
-	}
-	public static boolean ptzControlRightUpEnd(int nChannelID) {
-		return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-											 NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTTOP, 
-											 0, 0, 0, 1);	
-	}
 
-	/**
-	 * 鍚戝乏涓�
-	 */
-	public static boolean ptzControlLeftDownStart(int nChannelID, int lParam1, int lParam2) {
-		return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-													NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTDOWN, 
-													lParam1, lParam2, 0, 0);
-	}
-	public static boolean ptzControlLeftDownEnd(int nChannelID) {
-		return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-										 NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTDOWN, 
-										 0, 0, 0, 1);
-	}
-	
-	/**
-	 * 鍚戝彸涓�
-	 */
-	public static boolean ptzControlRightDownStart(int nChannelID, int lParam1, int lParam2) {
-		return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-													NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTDOWN, 
-													lParam1, lParam2, 0, 0);
-	}
-	public static boolean ptzControlRightDownEnd(int nChannelID) {
-		return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-										 NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTDOWN, 
-										 0, 0, 0, 1);
-	}
-	
+    /**
+     * 鍚戜笂
+     */
+    public static boolean ptzControlUpStart(NetSDKLib.LLong m_hLoginHandle, int nChannelID, int lParam1, int lParam2) {
+        return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_PTZ_ControlType.NET_PTZ_UP_CONTROL,
+                lParam1, lParam2, 0, 0);
+    }
+
+    public static boolean ptzControlUpEnd(int nChannelID) {
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_PTZ_ControlType.NET_PTZ_UP_CONTROL,
+                0, 0, 0, 1);
+    }
+
+    /**
+     * 鍚戜笅
+     */
+    public static boolean ptzControlDownStart(int nChannelID, int lParam1, int lParam2) {
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_PTZ_ControlType.NET_PTZ_DOWN_CONTROL,
+                lParam1, lParam2, 0, 0);
+    }
+
+    public static boolean ptzControlDownEnd(int nChannelID) {
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_PTZ_ControlType.NET_PTZ_DOWN_CONTROL,
+                0, 0, 0, 1);
+    }
+
+    /**
+     * 鍚戝乏
+     */
+    public static boolean ptzControlLeftStart(int nChannelID, int lParam1, int lParam2) {
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_PTZ_ControlType.NET_PTZ_LEFT_CONTROL,
+                lParam1, lParam2, 0, 0);
+    }
+
+    public static boolean ptzControlLeftEnd(int nChannelID) {
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_PTZ_ControlType.NET_PTZ_LEFT_CONTROL,
+                0, 0, 0, 1);
+    }
+
+    /**
+     * 鍚戝彸
+     */
+    public static boolean ptzControlRightStart(int nChannelID, int lParam1, int lParam2) {
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_PTZ_ControlType.NET_PTZ_RIGHT_CONTROL,
+                lParam1, lParam2, 0, 0);
+    }
+
+    public static boolean ptzControlRightEnd(int nChannelID) {
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_PTZ_ControlType.NET_PTZ_RIGHT_CONTROL,
+                0, 0, 0, 1);
+    }
+
+    /**
+     * 鍚戝乏涓�
+     */
+
+    public static boolean ptzControlLeftUpStart(int nChannelID, int lParam1, int lParam2) {
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTTOP,
+                lParam1, lParam2, 0, 0);
+    }
+
+    public static boolean ptzControlLeftUpEnd(int nChannelID) {
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTTOP,
+                0, 0, 0, 1);
+    }
+
+    /**
+     * 鍚戝彸涓�
+     */
+    public static boolean ptzControlRightUpStart(int nChannelID, int lParam1, int lParam2) {
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTTOP,
+                lParam1, lParam2, 0, 0);
+    }
+
+    public static boolean ptzControlRightUpEnd(int nChannelID) {
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTTOP,
+                0, 0, 0, 1);
+    }
+
+    /**
+     * 鍚戝乏涓�
+     */
+    public static boolean ptzControlLeftDownStart(int nChannelID, int lParam1, int lParam2) {
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTDOWN,
+                lParam1, lParam2, 0, 0);
+    }
+
+    public static boolean ptzControlLeftDownEnd(int nChannelID) {
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTDOWN,
+                0, 0, 0, 1);
+    }
+
+    /**
+     * 鍚戝彸涓�
+     */
+    public static boolean ptzControlRightDownStart(int nChannelID, int lParam1, int lParam2) {
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTDOWN,
+                lParam1, lParam2, 0, 0);
+    }
+
+    public static boolean ptzControlRightDownEnd(int nChannelID) {
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTDOWN,
+                0, 0, 0, 1);
+    }
+
     /**
      * 鍙樺��+
      */
     public static boolean ptzControlZoomAddStart(int nChannelID, int lParam2) {
-        return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-							        	   NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_ADD_CONTROL, 
-							        	   0, lParam2, 0, 0);
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_ADD_CONTROL,
+                0, lParam2, 0, 0);
     }
+
     public static boolean ptzControlZoomAddEnd(int nChannelID) {
-        return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-					            		    NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_ADD_CONTROL, 
-					            		    0, 0, 0, 1);
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_ADD_CONTROL,
+                0, 0, 0, 1);
     }
 
     /**
      * 鍙樺��-
      */
     public static boolean ptzControlZoomDecStart(int nChannelID, int lParam2) {
-       return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-							        	    NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_DEC_CONTROL, 
-							        	    0, lParam2, 0, 0);
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_DEC_CONTROL,
+                0, lParam2, 0, 0);
     }
+
     public static boolean ptzControlZoomDecEnd(int nChannelID) {
-        return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-					            		     NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_DEC_CONTROL, 
-					            		     0, 0, 0, 1);
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_DEC_CONTROL,
+                0, 0, 0, 1);
     }
 
     /**
      * 鍙樼劍+
      */
     public static boolean ptzControlFocusAddStart(int nChannelID, int lParam2) {
-    	return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-									        	    NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_ADD_CONTROL, 
-									        	    0, lParam2, 0, 0);
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_ADD_CONTROL,
+                0, lParam2, 0, 0);
     }
+
     public static boolean ptzControlFocusAddEnd(int nChannelID) {
-    	return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-				            		     NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_ADD_CONTROL, 
-				            		     0, 0, 0, 1);
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_ADD_CONTROL,
+                0, 0, 0, 1);
     }
 
     /**
      * 鍙樼劍-
      */
     public static boolean ptzControlFocusDecStart(int nChannelID, int lParam2) {
-        return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-							        	    NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_DEC_CONTROL, 
-							        	    0, lParam2, 0, 0);
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_DEC_CONTROL,
+                0, lParam2, 0, 0);
     }
+
     public static boolean ptzControlFocusDecEnd(int nChannelID) {
-        return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-					            		     NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_DEC_CONTROL, 
-					            		     0, 0, 0, 1);
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_DEC_CONTROL,
+                0, 0, 0, 1);
     }
 
     /**
      * 鍏夊湀+
      */
     public static boolean ptzControlIrisAddStart(int nChannelID, int lParam2) {
-        return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-							        	    NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_ADD_CONTROL, 
-							        	    0, lParam2, 0, 0);
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_ADD_CONTROL,
+                0, lParam2, 0, 0);
     }
+
     public static boolean ptzControlIrisAddEnd(int nChannelID) {
-        return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-					            		     NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_ADD_CONTROL, 
-					            		     0, 0, 0, 1);
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_ADD_CONTROL,
+                0, 0, 0, 1);
     }
 
     /**
      * 鍏夊湀-
      */
     public static boolean ptzControlIrisDecStart(int nChannelID, int lParam2) {
-        return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-									        	    NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_DEC_CONTROL, 
-									        	    0, lParam2, 0, 0);
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_DEC_CONTROL,
+                0, lParam2, 0, 0);
     }
+
     public static boolean ptzControlIrisDecEnd(int nChannelID) {
-        return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, 
-					            		     NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_DEC_CONTROL, 
-					            		     0, 0, 0, 1);
+        return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+                NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_DEC_CONTROL,
+                0, 0, 0, 1);
     }
 }

--
Gitblit v1.9.3