From 49207386ea4a3d663628347eef443af9c7cc7f39 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期二, 17 十月 2023 17:20:46 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ard-work/src/main/java/com/ruoyi/device/dhsdk/module/CapturePictureModule.java |  106 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 106 insertions(+), 0 deletions(-)

diff --git a/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/CapturePictureModule.java b/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/CapturePictureModule.java
new file mode 100644
index 0000000..0b1c73d
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/CapturePictureModule.java
@@ -0,0 +1,106 @@
+package com.ruoyi.device.dhsdk.module;
+import com.ruoyi.device.dhsdk.lib.NetSDKLib;
+import com.ruoyi.device.dhsdk.lib.ToolKits;
+import com.sun.jna.ptr.IntByReference;
+
+/**
+ * \if ENGLISH_LANG
+ * Capture Picture Interface
+ * contains:local銆乺emote銆乼imer and stop capture picture
+ * \else
+ * 鎶撳浘鎺ュ彛瀹炵幇
+ * 鍖呭惈: 鏈湴銆佽繙绋嬨�佸畾鏃跺拰鍋滄鎶撳浘
+ * \endif
+ */
+public class CapturePictureModule {
+
+	public static NetSDKLib netsdk = NetSDKLib.NETSDK_INSTANCE;
+
+	/**
+	 * \if ENGLISH_LANG
+	 * Local Capture Picture
+	 * \else
+	 * 鏈湴鎶撳浘
+	 * \endif
+	 */
+	public static boolean localCapturePicture(NetSDKLib.LLong hPlayHandle, String picFileName) {
+				
+		if (!netsdk.CLIENT_CapturePictureEx(hPlayHandle, picFileName, NetSDKLib.NET_CAPTURE_FORMATS.NET_CAPTURE_JPEG)) {
+			System.err.printf("CLIENT_CapturePicture Failed!" + ToolKits.getErrorCodePrint());
+			return false;
+		} else { 
+			System.out.println("CLIENT_CapturePicture success"); 
+		}
+		return true;
+	}
+	
+	/**
+	 * \if ENGLISH_LANG
+	 * Remote Capture Picture
+	 * \else
+	 * 杩滅▼鎶撳浘
+	 * \endif
+	 */
+	public static boolean remoteCapturePicture(NetSDKLib.LLong m_hLoginHandle,int chn) {
+		return snapPicture(m_hLoginHandle,chn, 0, 0);
+	}
+	
+	/**
+	 * \if ENGLISH_LANG
+	 * Timer Capture Picture
+	 * \else
+	 * 瀹氭椂鎶撳浘
+	 * \endif
+	 */
+	public static boolean timerCapturePicture(NetSDKLib.LLong m_hLoginHandle,int chn) {
+		return snapPicture(m_hLoginHandle,chn, 1, 2);
+	}
+	
+	/**
+	 * \if ENGLISH_LANG
+	 * Stop Timer Capture Picture
+	 * \else
+	 * 鍋滄瀹氭椂鎶撳浘
+	 * \endif
+	 */
+	public static boolean stopCapturePicture(NetSDKLib.LLong m_hLoginHandle,int chn) {
+		return snapPicture(m_hLoginHandle,chn, -1, 0);
+	}
+	
+	/**
+	 * \if ENGLISH_LANG
+	 * Capture Picture (except local capture picture, others all call this interface)
+	 * \else
+	 * 鎶撳浘 (闄ゆ湰鍦版姄鍥惧, 鍏朵粬鍏ㄩ儴璋冪敤姝ゆ帴鍙�)
+	 * \endif
+	 */
+	private static boolean snapPicture(NetSDKLib.LLong m_hLoginHandle,int chn, int mode, int interval) {
+		// send caputre picture command to device
+		NetSDKLib.SNAP_PARAMS stuSnapParams = new NetSDKLib.SNAP_PARAMS(); 
+		stuSnapParams.Channel = chn;  			// channel
+		stuSnapParams.mode = mode;    			// capture picture mode
+		stuSnapParams.Quality = 3;				// picture quality
+		stuSnapParams.InterSnap = interval; 	// timer capture picture time interval
+		stuSnapParams.CmdSerial = 0;  			// request serial  
+		
+		IntByReference reserved = new IntByReference(0);
+		if (!LoginModule.netsdk.CLIENT_SnapPictureEx(m_hLoginHandle, stuSnapParams, reserved)) {
+			System.err.printf("CLIENT_SnapPictureEx Failed!" + ToolKits.getErrorCodePrint());
+			return false;
+		} else { 
+			System.out.println("CLIENT_SnapPictureEx success"); 
+		}
+		return true;
+	}
+	
+	/**
+	 * \if ENGLISH_LANG
+	 * Set Capture Picture Callback
+	 * \else
+	 * 璁剧疆鎶撳浘鍥炶皟鍑芥暟
+	 * \endif
+	 */
+	public static void setSnapRevCallBack(NetSDKLib.fSnapRev cbSnapReceive){ 
+		LoginModule.netsdk.CLIENT_SetSnapRevCallBack(cbSnapReceive, null);
+	}
+}

--
Gitblit v1.9.3