• 大小: 306KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-07-20
  • 语言: 其他
  • 标签: 海康SDK包  

资源简介

调用海康SDK包,报警布防、监听接收报警信息的相关功能,bin文件夹下为已编译的可执行程序

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.IO;
using System.xml;

namespace AlarmCSharpDemo
{
    public partial class AlarmDemo : Form
    {
        private Int32 m_lUserID = -1;
        private Int32[] m_lAlarmHandle = new Int32[200];
        private Int32 iListenHandle = -1; 
        private int iDeviceNumber = 0; //添加设备个数
        private uint iLastErr = 0;
        private string strErr;
        private CHCNetSDK.MSGCallBack m_falarmData = null;
        public delegate void UpdateListBoxCallback(string strAlarmTime string strDevIP string strAlarmMsg);

        CHCNetSDK.NET_VCA_TRAVERSE_PLANE m_struTraversePlane = new CHCNetSDK.NET_VCA_TRAVERSE_PLANE();
        CHCNetSDK.NET_VCA_AREA m_struVcaArea = new CHCNetSDK.NET_VCA_AREA();
        CHCNetSDK.NET_VCA_INTRUSION m_struIntrusion = new CHCNetSDK.NET_VCA_INTRUSION();
        CHCNetSDK.UNION_STATframe m_struStatframe = new CHCNetSDK.UNION_STATframe();
        CHCNetSDK.UNION_STATTIME m_struStatTime = new CHCNetSDK.UNION_STATTIME();
        public AlarmDemo()
        {
            InitializeComponent();
            bool m_bInitSDK = CHCNetSDK.NET_DVR_Init();
            if (m_bInitSDK == false)
            {
                MessageBox.Show(“NET_DVR_Init error!“);
                return;
            }
            else
            {
                byte[] strIP = new byte[16 * 16];
                uint dwValidNum=0;
                Boolean bEnableBind=false;

                //获取本地PC网卡IP信息
                if (CHCNetSDK.NET_DVR_GetLocalIP(strIP ref dwValidNum ref bEnableBind))
                {
                    if (dwValidNum > 0)
                    {
                        //取第一张网卡的IP地址为默认监听端口
                        textBoxListenIP.Text = System.Text.Encoding.UTF8.GetString(strIP 0 16);
                    }
                
                }

                //保存SDK日志 To save the SDK log
                CHCNetSDK.NET_DVR_SetLogToFile(3 “C:\\SdkLog\\“ true);
                for (int i = 0; i < 200; i++)
                {
                    m_lAlarmHandle[i] = -1;
                }

                //设置报警回调函数
                m_falarmData = new CHCNetSDK.MSGCallBack(MsgCallback);
                CHCNetSDK.NET_DVR_SetDVRMessCallBack_V30(m_falarmData IntPtr.Zero);
            }
        }

        public void MsgCallback(int lCommand ref CHCNetSDK.NET_DVR_ALARMER pAlarmer IntPtr pAlarmInfo uint dwBufLen IntPtr pUser)
        {
            //通过lCommand来判断接收到的报警信息类型,不同的lCommand对应不同的pAlarmInfo内容
            switch (lCommand)
            {
                case CHCNetSDK.COMM_ALARM: //(DS-8000老设备)移动侦测、视频丢失、遮挡、IO信号量等报警信息
                    ProcessCommAlarm(ref pAlarmer pAlarmInfo dwBufLen pUser);
                   

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       3833  2015-12-25 15:32  报警布防监听\AlarmCSharpDemo\AlarmCSharpDemo.csproj

     文件      39888  2017-08-16 11:11  报警布防监听\AlarmCSharpDemo\AlarmDemo.cs

     文件      20423  2017-08-16 11:11  报警布防监听\AlarmCSharpDemo\AlarmDemo.Designer.cs

     文件       5817  2017-08-16 11:11  报警布防监听\AlarmCSharpDemo\AlarmDemo.resx

     文件     230400  2017-08-21 11:15  报警布防监听\AlarmCSharpDemo\bin\AlarmCSharpDemo.exe

     文件      87552  2017-08-21 11:15  报警布防监听\AlarmCSharpDemo\bin\AlarmCSharpDemo.pdb

     文件      11608  2017-08-24 16:06  报警布防监听\AlarmCSharpDemo\bin\AlarmCSharpDemo.vshost.exe

     文件        490  2010-03-17 22:39  报警布防监听\AlarmCSharpDemo\bin\AlarmCSharpDemo.vshost.exe.manifest

     文件       1151  2015-12-25 15:32  报警布防监听\AlarmCSharpDemo\bin\请先看这里:Demo内容说明和注意事项.txt

     文件     801961  2017-08-10 14:46  报警布防监听\AlarmCSharpDemo\CHCNetSDK.cs

     文件        180  2017-08-21 11:15  报警布防监听\AlarmCSharpDemo\obj\x64\Debug\AlarmCSharpDemo.AlarmDemo.resources

     文件       1562  2017-08-24 16:06  报警布防监听\AlarmCSharpDemo\obj\x64\Debug\AlarmCSharpDemo.csproj.FileListAbsolute.txt

     文件        979  2017-08-21 11:15  报警布防监听\AlarmCSharpDemo\obj\x64\Debug\AlarmCSharpDemo.csproj.GenerateResource.Cache

     文件       3746  2017-08-03 16:49  报警布防监听\AlarmCSharpDemo\obj\x64\Debug\AlarmCSharpDemo.csprojResolveAssemblyReference.cache

     文件     230400  2017-08-21 11:15  报警布防监听\AlarmCSharpDemo\obj\x64\Debug\AlarmCSharpDemo.exe

     文件      87552  2017-08-21 11:15  报警布防监听\AlarmCSharpDemo\obj\x64\Debug\AlarmCSharpDemo.pdb

     文件        180  2017-08-03 16:49  报警布防监听\AlarmCSharpDemo\obj\x64\Debug\AlarmCSharpDemo.Properties.Resources.resources

     文件       3295  2017-08-07 09:21  报警布防监听\AlarmCSharpDemo\obj\x64\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       5650  2017-08-21 11:15  报警布防监听\AlarmCSharpDemo\obj\x64\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        491  2015-12-25 15:32  报警布防监听\AlarmCSharpDemo\Program.cs

     文件       1442  2015-12-25 15:32  报警布防监听\AlarmCSharpDemo\Properties\AssemblyInfo.cs

     文件       2859  2015-12-25 15:32  报警布防监听\AlarmCSharpDemo\Properties\Resources.Designer.cs

     文件       5612  2015-12-25 15:32  报警布防监听\AlarmCSharpDemo\Properties\Resources.resx

     文件       1101  2015-12-25 15:32  报警布防监听\AlarmCSharpDemo\Properties\Settings.Designer.cs

     文件        249  2015-12-25 15:32  报警布防监听\AlarmCSharpDemo\Properties\Settings.settings

     文件       1241  2015-12-25 15:32  报警布防监听\AlarmCSharpDemo.sln

    ..A..H.     22528  2017-08-24 16:16  报警布防监听\AlarmCSharpDemo.suo

     文件       1181  2015-12-25 15:32  报警布防监听\请先看这里:Demo内容说明和注意事项.txt

     目录          0  2017-08-03 16:49  报警布防监听\AlarmCSharpDemo\obj\x64\Debug\TempPE

     目录          0  2017-08-03 16:49  报警布防监听\AlarmCSharpDemo\obj\x86\Debug\TempPE

............此处省略12个文件信息

评论

共有 条评论

相关资源