Пример #1
0
 private void btnCloseAlarm_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < iDeviceNumber; i++)
     {
         m_lUserID = Int32.Parse(listViewDevice.Items[i].SubItems[0].Text);
         if (m_lAlarmHandle[m_lUserID] >= 0)
         {
             if (!CHCNetSDK.NET_DVR_CloseAlarmChan_V30(m_lAlarmHandle[m_lUserID]))
             {
                 iLastErr = CHCNetSDK.NET_DVR_GetLastError();
                 strErr   = "撤防失败,错误号:" + iLastErr; //撤防失败,输出错误号
                 listViewDevice.Items[i].SubItems[2].Text = strErr;
             }
             else
             {
                 listViewDevice.Items[i].SubItems[2].Text = "未布防";
                 m_lAlarmHandle[i] = -1;
             }
         }
         else
         {
             listViewDevice.Items[i].SubItems[2].Text = "未布防";
         }
     }
     btn_SetAlarm.Enabled = true;
 }
Пример #2
0
 private void listViewDevice_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         if (listViewDevice.SelectedItems.Count > 0)
         {
             if (DialogResult.OK == MessageBox.Show("请确认是否删除所选择的设备!", "删除提示", MessageBoxButtons.OKCancel))
             {
                 foreach (ListViewItem item in this.listViewDevice.SelectedItems)
                 {
                     if (item.Selected)
                     {
                         m_lUserID = Int32.Parse(item.SubItems[0].Text);
                         CHCNetSDK.NET_DVR_CloseAlarmChan_V30(m_lAlarmHandle[m_lUserID]);
                         CHCNetSDK.NET_DVR_Logout(m_lUserID);
                         item.Remove();
                         iDeviceNumber--;
                     }
                 }
                 this.listViewDevice.Refresh();
             }
         }
         else
         {
         }
     }
 }
Пример #3
0
        /// <summary>
        /// 撤销报警上传通道
        /// </summary>
        /// <param name="alarmHandle">上传通道值</param>
        /// <returns>true:撤销成功 false:撤销失败</returns>
        public override bool CloseAlarmChan(DeviceInfo deviceInfo)
        {
            bool result = false;

            result = CHCNetSDK.NET_DVR_CloseAlarmChan_V30(deviceInfo.alarmHandle);

            return(result);
        }
Пример #4
0
 private void btnAlarmChanEnd_Click(object sender, EventArgs e)
 {
     //停止布防结构体
     if (!CHCNetSDK.NET_DVR_CloseAlarmChan_V30(alarmChan))
     {
         MessageBox.Show(CHCNetSDK.NET_DVR_GetLastError().ToString());//报错参数
     }
     else
     {
         MessageBox.Show("撤防成功!");
         btnAlarmChanB.Enabled   = true;
         btnAlarmChanEnd.Enabled = false;
     }
 }
Пример #5
0
 //撤防
 public bool CloseAlarm()
 {
     if (m_lAlarmHandle >= 0)
     {
         if (!CHCNetSDK.NET_DVR_CloseAlarmChan_V30(m_lAlarmHandle))
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
     return(true);
 }
Пример #6
0
        /// <summary>
        /// 撤防
        /// </summary>
        /// <param name="AlarmHandleID">布防操作ID</param>
        /// <returns></returns>
        public static bool NetDVRCloseAlarmChan(Int32 AlarmHandleID)
        {
            bool res = CHCNetSDK.NET_DVR_CloseAlarmChan_V30(AlarmHandleID);

            if (!res)
            {
                var iLastErr = CHCNetSDK.NET_DVR_GetLastError();
                var strErr   = "撤防失败,错误号:" + iLastErr; //撤防失败,输出错误号
                WriteMsg(strErr);
            }
            else
            {
                var strErr = "当前设备撤防成功,时间:" + DateTime.Now.ToString("yyyy年MM月dd HH时mm分ss秒");
                WriteMsg(strErr, "ok");
            }
            return(res);
        }
Пример #7
0
        private void btnFortify_Click(object sender, EventArgs e)
        {
            if (m_bGuard)
            {
                if (m_lFortifyHandle != -1)
                {
                    if (CHCNetSDK.NET_DVR_CloseAlarmChan_V30(m_lFortifyHandle))
                    {
                        DebugInfo("NET_DVR_CloseAlarmChan_V30 Succ");
                        btnFortify.Text = "Guard";
                        m_bGuard        = !m_bGuard;
                    }
                    else
                    {
                        DebugInfo("NET_DVR_CloseAlarmChan_V30 Fail");
                    }
                }
            }
            else
            {
                m_lFortifyHandle = CHCNetSDK.NET_DVR_SetupAlarmChan_V30(m_lUserID);
                if (m_lFortifyHandle != -1)
                {
                    btnFortify.Text = "Unguard";
                    m_bGuard        = !m_bGuard;
                    DebugInfo("NET_DVR_SetupAlarmChan_V30 Succ");
                }
                else
                {
                    DebugInfo("NET_DVR_SetupAlarmChan_V30 Succ");
                }


                m_falarmData = new CHCNetSDK.MSGCallBack(MsgCallback);
                if (CHCNetSDK.NET_DVR_SetDVRMessageCallBack_V30(m_falarmData, IntPtr.Zero))
                {
                    DebugInfo("NET_DVR_SetDVRMessageCallBack_V30 Succ");
                }
                else
                {
                    uint i = CHCNetSDK.NET_DVR_GetLastError();
                    DebugInfo("NET_DVR_SetDVRMessageCallBack_V30 Fail");
                }
            }
        }
Пример #8
0
        public bool LogoutCamera(string cameraIp)
        {
            CameraInfo camera = m_cameraInfos.Find(
                delegate(CameraInfo intpar1) { return(intpar1.CameraIp == cameraIp); });

            if (camera == null)
            {
                return(false);
            }

            Int32 lUserID = camera.UserNum;

            CHCNetSDK.NET_DVR_CloseAlarmChan_V30(m_lAlarmHandle[lUserID]);
            CHCNetSDK.NET_DVR_Logout(lUserID);

            m_cameraInfos.Remove(camera);
            return(true);
        }
Пример #9
0
 public int camera_CloseAlarm()
 {
     for (int i = 0; i < iDeviceNumber; i++)
     {
         if (m_lAlarmHandle >= 0)
         {
             if (!CHCNetSDK.NET_DVR_CloseAlarmChan_V30(m_lAlarmHandle))
             {
                 iLastErr = CHCNetSDK.NET_DVR_GetLastError();
                 strErr   = "撤防失败,错误号:" + iLastErr; //撤防失败,输出错误号
                 return(-1);
             }
         }
         else
         {
             strErr = "未布防";
         }
     }
     return(0);
 }
Пример #10
0
        private void StopAlarmListener()
        {
            if (m_lUserID < 0)
            {
                return;
            }

            if (m_lAlarmHandle >= 0)
            {
                if (!CHCNetSDK.NET_DVR_CloseAlarmChan_V30(m_lAlarmHandle))
                {
                    Console.WriteLine("[CCTV] -  NET_DVR_CloseAlarmChan_V30 Failed : {0}", CHCNetSDK.NET_DVR_GetLastError());
                }
                else
                {
                    m_lAlarmHandle = -1;
                    Console.WriteLine("[CCTV] - Stop Alarm Listener.");
                }
            }
            //SystemEnv.ShowLogMessage("[CCTV] - AlarmHandle : {0}", m_lAlarmHandle);
        }
Пример #11
0
 private bool StopAlarm()
 {
     for (int i = 0; i < m_cameraInfos.Count; i++)
     {
         Int32 lUserID = m_cameraInfos[i].UserNum;
         if (m_lAlarmHandle[lUserID] >= 0)
         {
             if (!CHCNetSDK.NET_DVR_CloseAlarmChan_V30(m_lAlarmHandle[lUserID]))
             {
                 iLastErr = CHCNetSDK.NET_DVR_GetLastError();
                 strErr   = "撤防失败,错误号:" + iLastErr; //撤防失败,输出错误号
                 return(false);
             }
             else
             {
                 // 未布防
                 m_lAlarmHandle[i] = -1;
             }
         }
     }
     return(true);
 }
Пример #12
0
 private void m_CloseAlarm()
 {
     if (m_lAlarmHandle >= 0)
     {
         if (!CHCNetSDK.NET_DVR_CloseAlarmChan_V30(m_lAlarmHandle))
         {
             //撤防失败,输出错误号
             iLastErr = CHCNetSDK.NET_DVR_GetLastError();
             WriteLog("NET_DVR_CloseAlarmChan_V30 failed, error code= " + iLastErr);
         }
         else
         {
             //未布防
             WriteLog("NET_DVR_CloseAlarmChan_V30 succeeded!");
             m_lAlarmHandle = -1;
         }
     }
     else
     {
         //未布防
         WriteLog("Haven't set alarm");
     }
 }
Пример #13
0
        /// <summary>
        /// 设备撤防
        /// </summary>
        /// <param name="deviceinfo">设备信息</param>
        public void DeviceAlarmClose(DeviceInfo deviceInfo)
        {
            if (DeviceIsNull(deviceInfo))
            {
                return;
            }

            if (!DeviceIsRegist(deviceInfo, false))
            {
                return;
            }

            if (deviceInfo.DVRAlarmHandle == DeviceInfo.Const_DeviceDisable)
            {
                if (OnShowInfoData != null)
                {
                    OnShowInfoData(InfoType.设备信息, deviceInfo, "已经撤防,不需要重复撤防!");
                }
            }


            if (!CHCNetSDK.NET_DVR_CloseAlarmChan_V30(deviceInfo.DVRAlarmHandle))
            {
                if (OnShowInfoData != null)
                {
                    OnShowInfoData(InfoType.设备信息, deviceInfo, "撤防失败,错误代码:" + CHCNetSDK.NET_DVR_GetLastError().ToString());
                }
            }
            else
            {
                deviceInfo.DVRAlarmHandle = DeviceInfo.Const_DeviceDisable;
                if (OnShowInfoData != null)
                {
                    OnShowInfoData(InfoType.设备信息, deviceInfo, "撤防成功");
                }
            }
        }
Пример #14
0
 /// <summary>
 /// 关闭布防
 /// </summary>
 public bool CloseAlarm()
 {
     return(CHCNetSDK.NET_DVR_CloseAlarmChan_V30(this.alarmResult));
 }
Пример #15
0
 public bool stopAlarm(int AlarmHandle)
 {
     return(CHCNetSDK.NET_DVR_CloseAlarmChan_V30(AlarmHandle));
 }