• 大小: 24.14MB
    文件类型: .7z
    金币: 1
    下载: 0 次
    发布日期: 2023-06-13
  • 语言: 其他
  • 标签: 摄像头  

资源简介

大华摄像头的集成demo已经使用说明书,库文件,头文件,让使用者更加方便地对摄像头进行二次开发

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using NetSDKCS;
using System.Diagnostics;
using System.Runtime.InteropServices;

namespace AlarmDemo
{
    public partial class AlarmDemo : Form
    {
        private static fDisConnectCallBack m_DisConnectCallBack;
        private static fHaveReConnectCallBack m_ReConnectCallBack;
        private static fMessCallBackEx m_AlarmCallBack;
        private const int ALARM_START = 1;
        private const int ALARM_STOP = 0;
        private const int ListViewCount = 100;

        private IntPtr m_LoginID = IntPtr.Zero;
        private NET_DEVICEINFO_Ex m_DeviceInfo;
        private bool m_IsListen = false;
        private Int64 m_ID = 1;
        private List m_ManangeAlarmInfo = new List();
        private byte[] data;

        public AlarmDemo()
        {
            InitializeComponent();
            this.Load += new EventHandler(AlarmDemo_Load);
        }

        private void AlarmDemo_Load(object sender EventArgs e)
        {
            m_DisConnectCallBack = new fDisConnectCallBack(DisConnectCallBack);
            m_ReConnectCallBack = new fHaveReConnectCallBack(ReConnectCallBack);
            m_AlarmCallBack = new fMessCallBackEx(AlarmCallBackEx);
            try
            {
                NETClient.Init(m_DisConnectCallBack IntPtr.Zero null);
                NETClient.SetAutoReconnect(m_ReConnectCallBack IntPtr.Zero);
                NETClient.SetDVRMessCallBack(m_AlarmCallBack IntPtr.Zero);
                InitOrLogoutUI();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Process.GetCurrentProcess().Kill();
            }
        }

        private bool AlarmCallBackEx(int lCommand IntPtr lLoginID IntPtr pBuf uint dwBufLen IntPtr pchDVRIP int nDVRPort bool bAlarmAckFlag int nEventID IntPtr dwUser)
        {
            EM_ALARM_TYPE type = (EM_ALARM_TYPE)lCommand;
            switch (type)
            {
                case EM_ALARM_TYPE.ALARM_ALARM_EX:
                case EM_ALARM_TYPE.MOTION_ALARM_EX:
                case EM_ALARM_TYPE.VIDEOLOST_ALARM_EX:
                case EM_ALARM_TYPE.SHELTER_ALARM_EX:
                case EM_ALARM_TYPE.DISKFULL_ALARM_EX:
                case EM_ALARM_TYPE.DISKERROR_ALARM_EX:
                    data = new byte[dwBufLen];
                    Marshal.Copy(pBuf data 0 (int)dwBufLen);
                    for (int i = 0; i < dwBufLen; i++)
                    {
                        if (data[i] == ALARM_START) // alarm start 报警开始
                        {
                            AlarmInfo info = new AlarmInfo();
                            info.AlarmType = type;
                            info.ID = m_ID;
                            

评论

共有 条评论