fuliqi
2024-08-29 4163c93761115c7524ef74a557a1f5e01eafb429
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
89
90
91
92
package com.ycl.api.YS.config.video;
 
import com.sun.jna.ptr.IntByReference;
import com.ycl.api.YS.NetDemo;
import com.ycl.api.YS.lib.NetDEVSDKLib.NETDEV_CONFIG_COMMAND_E;
import com.ycl.api.YS.lib.NetDEVSDKLib.NETDEV_IRCUT_FILTER_INFO_S;
import com.ycl.api.YS.lib.NetDEVSDKLib.NETDEV_IR_CUT_FILTER_MODE_E;
 
import javax.swing.*;
 
/**
 *
 * @introduction IrCut Filter information
 * @description
 */
public class IrCutFilterMode {
 
    /**
     *
     * @introduction Get IrCutFilter Mode
     * @description Calling the interface of NETDEV_GetDevConfig
     *
     */
    public static void getIrCutFilterMode() {
        if(null == NetDemo.lpUserID){
            JOptionPane.showMessageDialog(null, "Please Login device first. error code"+NetDemo.netdevsdk.NETDEV_GetLastError());
            return;
        }
        if(NetDemo.ChannelID == 0){
            JOptionPane.showMessageDialog(null, "Please select an online channel after login.");
            return;
        }
 
        NETDEV_IRCUT_FILTER_INFO_S IrcutMode=new NETDEV_IRCUT_FILTER_INFO_S();
        IrcutMode.write();
        IntByReference dwBytesReturned = new IntByReference();
        boolean bRet = NetDemo.netdevsdk.NETDEV_GetDevConfig(NetDemo.lpUserID, NetDemo.ChannelID, NETDEV_CONFIG_COMMAND_E.NETDEV_GET_IRCUTFILTERINFO, IrcutMode.getPointer(), IrcutMode.size(), dwBytesReturned );
        if(bRet != true)
        {
            JOptionPane.showMessageDialog(null, "Get data failed,error code"+NetDemo.netdevsdk.NETDEV_GetLastError());
            System.out.printf("NETDEV_GetDevConfig failed:%d\n", NetDemo.netdevsdk.NETDEV_GetLastError());
            return;
        }else {
            IrcutMode.read();
            if(IrcutMode.enIrCutFilterMode==0) {
                NetDemo.jComboBoxIRcutMode.setSelectedIndex(0);
            }else if(IrcutMode.enIrCutFilterMode==1) {
                NetDemo.jComboBoxIRcutMode.setSelectedIndex(1);
            }else if(IrcutMode.enIrCutFilterMode==2) {
                NetDemo.jComboBoxIRcutMode.setSelectedIndex(2);
            }
        }
    }
 
    /**
     *
     * @introduction Set IrCutFilter Mode
     * @description Calling the interface of NETDEV_SetDevConfig
     *
     */
    public static void setIrCutFilterMode() {
        if(null == NetDemo.lpUserID){
            JOptionPane.showMessageDialog(null, "Please Login device first. error code"+NetDemo.netdevsdk.NETDEV_GetLastError());
            return;
        }
        if(NetDemo.ChannelID == 0){
            JOptionPane.showMessageDialog(null, "Please select an online channel after login.");
            return;
        }
 
        NETDEV_IRCUT_FILTER_INFO_S IrcutMode=new NETDEV_IRCUT_FILTER_INFO_S();
        int crutMode=0;
        if(NetDemo.jComboBoxIRcutMode.getItemAt(NetDemo.jComboBoxIRcutMode.getSelectedIndex()).equals("DAY")) {
            crutMode=NETDEV_IR_CUT_FILTER_MODE_E.NETDEV_IR_CUT_FILTER_ON;
        }else if(NetDemo.jComboBoxIRcutMode.getItemAt(NetDemo.jComboBoxIRcutMode.getSelectedIndex()).equals("NIGHT")) {
            crutMode=NETDEV_IR_CUT_FILTER_MODE_E.NETDEV_IR_CUT_FILTER_OFF;
        }else if(NetDemo.jComboBoxIRcutMode.getItemAt(NetDemo.jComboBoxIRcutMode.getSelectedIndex()).equals("AUTO")) {
            crutMode=NETDEV_IR_CUT_FILTER_MODE_E.NETDEV_IR_CUT_FILTER_AUTO;
        }
        IrcutMode.enIrCutFilterMode=crutMode;
        IrcutMode.write();
        boolean bRet2 = NetDemo.netdevsdk.NETDEV_SetDevConfig(NetDemo.lpUserID, NetDemo.ChannelID, NETDEV_CONFIG_COMMAND_E.NETDEV_SET_IRCUTFILTERINFO, IrcutMode.getPointer(), IrcutMode.size() );
        if(bRet2 != true)
        {
            JOptionPane.showMessageDialog(null, "Set failed,error code"+ NetDemo.netdevsdk.NETDEV_GetLastError());
            System.out.printf("NETDEV_SetDevConfig failed:%d\n", NetDemo.netdevsdk.NETDEV_GetLastError());
            return;
        }else {
            JOptionPane.showMessageDialog(null, "Set success");
        }
    }
}