CapturePictureModule.java
1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.huaheng.api.erp.domain;
import com.netsdk.demo.module.LoginModule;
import com.netsdk.lib.NetSDKLib;
import com.netsdk.lib.ToolKits;
import com.sun.jna.ptr.IntByReference;
public class CapturePictureModule {
public static boolean remoteCapturePicture(int chn, NetSDKLib.LLong m_hLoginHandle) {
return snapPicture(chn, 0, 0,m_hLoginHandle);
}
/**
* \if ENGLISH_LANG
* Capture Picture (except local capture picture, others all call this interface)
* \else
* 抓图 (除本地抓图外, 其他全部调用此接口)
* \endif
*/
private static boolean snapPicture(int chn, int mode, int interval, NetSDKLib.LLong m_hLoginHandle) {
// 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;
}
public static void setSnapRevCallBack(NetSDKLib.fSnapRev cbSnapReceive){
LoginModule.netsdk.CLIENT_SetSnapRevCallBack(cbSnapReceive, null);
}
}