CapturePictureModule.java 1.65 KB
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);
    }

}