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
package com.ycl.api.YS.maintenance;
 
import com.ycl.api.YS.NetDemo;
import com.ycl.api.YS.lib.NetDEVSDKLib.NETDEV_MANUAL_RECORD_CFG_S;
import com.ycl.api.YS.lib.NetDEVSDKLib.NETDEV_RECORD_TYPE_E;
 
import javax.swing.*;
 
/**
 * @description To enable or disable manual recording.
 * @introduction Support NVR/VMS.
 */
public class ManualRecord {
    /**
     * @description  Enable manual recording.
     * @introduction Calling the interface of NETDEV_StartManualRecord.
     */
    public static void startRecord() {
        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_MANUAL_RECORD_CFG_S stManualRecordCfg = new NETDEV_MANUAL_RECORD_CFG_S();
        stManualRecordCfg.dwChannelID = NetDemo.ChannelID;
        stManualRecordCfg.enRecordType = NETDEV_RECORD_TYPE_E.NETDEV_RECORD_TYPE_MANUAL;
        boolean bRet = NetDemo.netdevsdk.NETDEV_StartManualRecord(NetDemo.lpUserID, stManualRecordCfg);
        if(bRet != true)
        {
            JOptionPane.showMessageDialog(null, "Set failed,error code"+NetDemo.netdevsdk.NETDEV_GetLastError());
            System.out.printf("NETDEV_StartManualRecord failed:%d\n", NetDemo.netdevsdk.NETDEV_GetLastError());
            return;
        }
        else 
        {
            JOptionPane.showMessageDialog(null, "Set success");
        }
    
    }
    /**
     * @description Disable manual recording.
     * @introduction Calling the interface of NETDEV_StopManualRecord.
     */
    public static void stopRecord() {
        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_MANUAL_RECORD_CFG_S stManualRecordCfg = new NETDEV_MANUAL_RECORD_CFG_S();
        stManualRecordCfg.dwChannelID = NetDemo.ChannelID;
        stManualRecordCfg.enRecordType = NETDEV_RECORD_TYPE_E.NETDEV_RECORD_TYPE_MANUAL;
        boolean bRet = NetDemo.netdevsdk.NETDEV_StopManualRecord(NetDemo.lpUserID, stManualRecordCfg);
        if(bRet != true)
        {
            System.out.printf("NETDEV_StopManualRecord failed:%d\n", NetDemo.netdevsdk.NETDEV_GetLastError());
            return;
        }
        else 
        {
            JOptionPane.showMessageDialog(null, "Stop success");
        }
    }
}