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
package com.ycl.api.YS.ptz.ptzextend;
 
import com.ycl.api.YS.NetDemo;
import com.ycl.api.YS.lib.NetDEVSDKLib.NETDEV_PTZ_E;
 
import javax.swing.*;
 
public class ExtendOperation {
    /**
     * 
     * @introduction The extending operation of PTZ,including wiper,heater,lighter,snow remove.
     * @description  It is mainly including open and close the ability.
     * @param [Parameter1] [operation] Different functions are realized by passing different parameters.
     */
    public static void Operation( int operation) {
        
        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;
        }
        /* PTZ preset operation(Do not need to start preview) */
        boolean bRet = NetDemo.netdevsdk.NETDEV_PTZControl_Other(NetDemo.lpUserID, NetDemo.ChannelID, operation, NetDemo.jComboBoxPTZSpeed.getSelectedIndex()+1);
        if(bRet != true)
        {
            JOptionPane.showMessageDialog(null, "Set failed,maybe not support,error code"+NetDemo.netdevsdk.NETDEV_GetLastError());
            System.out.printf("NETDEV_PTZControl_Other failed:%d\n", NetDemo.netdevsdk.NETDEV_GetLastError());
            return;
        }
        else 
        {
            if(operation==NETDEV_PTZ_E.NETDEV_PTZ_BRUSHON ||operation==NETDEV_PTZ_E.NETDEV_PTZ_HEATON || operation==NETDEV_PTZ_E.NETDEV_PTZ_LIGHTON || operation==NETDEV_PTZ_E.NETDEV_PTZ_SNOWREMOINGON)
            {
                JOptionPane.showMessageDialog(null, "Open success");
            }
            else 
            {
                JOptionPane.showMessageDialog(null, "Close success");
            }
        } 
    }
 
}