1
zhanghua
2024-09-26 c775c6953d9759e70f08acbfa8f6d7490aaae3d1
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package com.netsdk.demo.customize;
 
import com.netsdk.demo.util.CaseMenu;
import com.netsdk.lib.NetSDKLib;
import com.netsdk.lib.ToolKits;
import com.netsdk.lib.utils.Initialization;
import com.sun.jna.Memory;
 
/**
 * @author 291189
 * @version 1.0
 * @description ERR221212121
 * @date 2022/12/15 16:05
 */
public class FaceOpenDoorDemo extends Initialization {
 
    /**
     * 人脸开门
     */
 
    public void Test_FaceOpenDoor(){
        if(loginHandle.longValue()==0){
            return;
        }
        //入参
        NetSDKLib.NET_IN_FACE_OPEN_DOOR pInParam=new NetSDKLib.NET_IN_FACE_OPEN_DOOR();
 
        pInParam.nChannel=0;
        /**
         *        比对结果, {@link com.netsdk.lib.enumeration.EM_COMPARE_RESULT}
          */
        pInParam.emCompareResult=1;
 
        NetSDKLib.NET_OPENDOOR_MATCHINFO stuMatchInfo
                = pInParam.stuMatchInfo;
 
        NetSDKLib.NET_CUSTOM_EDUCATION_INFO   info=new  NetSDKLib.NET_CUSTOM_EDUCATION_INFO();
 
        String content="hello";
 
        StringToByteArr(content,info.szInfoContent,encode);
 
        stuMatchInfo.pstuCustomEducationInfo=new Memory(info.size());
 
        stuMatchInfo.pstuCustomEducationInfo.clear( info.size() );
 
        ToolKits.SetStructDataToPointer(info,stuMatchInfo.pstuCustomEducationInfo,0);
 
 
        //出参
        NetSDKLib.NET_OUT_FACE_OPEN_DOOR pOutParam=new NetSDKLib.NET_OUT_FACE_OPEN_DOOR();
 
        boolean bRet =netSdk.CLIENT_FaceOpenDoor(loginHandle, pInParam, pOutParam, 3000);
        if (!bRet)
        {
            System.err.printf("Test_FaceOpenDoor field Fail.Error[%s]\n", ToolKits.getErrorCode());
            return;
        }
    }
 
 
    public static void StringToByteArr(String src, byte[] dst,String charset) {
        try {
            byte[] GBKBytes = src.getBytes(charset);
            for (int i = 0; i < GBKBytes.length; i++) {
                dst[i] = (byte) GBKBytes[i];
            }
        } catch (Exception e1) {
            e1.printStackTrace();
        }
    }
 
    public void RunTest()
    {
        System.out.println("Run Test");
        CaseMenu menu = new CaseMenu();;
        menu.addItem((new CaseMenu.Item(this , "Test_FaceOpenDoor" , "Test_FaceOpenDoor")));
 
        menu.run();
    }
 
    public static void main(String[] args) {
        FaceOpenDoorDemo demo=new FaceOpenDoorDemo();
        InitTest("172.10.6.182",37777,"admin","admin123");
        demo.RunTest();
        LoginOut();
    }
}