Exemplo n.º 1
0
        /// <summary>
        /// 远程开门控制
        /// </summary>
        public static void ControlGateWayOpen(int m_lUserID)
        {
            //开门,以门 1 为例
            bool bRet;
            int  lGatewayIndex = 1; //门禁序号,从 1 开始, -1 表示对所有门进行操作
            uint dwStaic       = 1; //命令值: 0-关闭, 1-打开, 2-常开, 3-常关

            bRet = CHCNetSDK.NET_DVR_ControlGateway(m_lUserID, lGatewayIndex, dwStaic);
            if (!bRet)
            {
                Console.WriteLine("NET_DVR_ControlGateway failed, error:%d\n", CHCNetSDK.NET_DVR_GetLastError());
                CHCNetSDK.NET_DVR_Logout(m_lUserID);
                CHCNetSDK.NET_DVR_Cleanup();
                return;
            }
            //---------------------------------------
            //两秒钟之后就控制关
            //Thread.Sleep(2000);
            //dwStaic = 0;
            //bRet = CHCNetSDK.NET_DVR_ControlGateway(m_lUserID, lGatewayIndex, dwStaic);
            //if (!bRet)
            //{
            //    Console.WriteLine("NET_DVR_ControlGateway failed, error:%d\n", CHCNetSDK.NET_DVR_GetLastError());
            //    CHCNetSDK.NET_DVR_Logout(m_lUserID);
            //    CHCNetSDK.NET_DVR_Cleanup();
            //    return;
            //}

            Thread.Sleep(5000);
            CHCNetSDK.NET_DVR_Logout(m_lUserID);
            CHCNetSDK.NET_DVR_Cleanup();
            return;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 开门
        /// </summary>
        /// <returns></returns>
        public bool OpenDoor()
        {
            if (m_lUserID < 0)
            {
                return(false);
            }

            return(CHCNetSDK.NET_DVR_ControlGateway(m_lUserID, 1, 1));
        }
Exemplo n.º 3
0
 private void btnStayClose_Click(object sender, EventArgs e)
 {
     if (CHCNetSDK.NET_DVR_ControlGateway(m_UserID, 1, 2))
     {
         MessageBox.Show("NET_DVR_ControlGateway: stay open door succeed");
     }
     else
     {
         MessageBox.Show("NET_DVR_ControlGateway:  stay open door failed error:" + CHCNetSDK.NET_DVR_GetLastError());
     }
 }
 /// <summary>
 /// 开关门远程控制
 /// 调用SDK底层函数 NET_DVR_ControlGateway
 /// </summary>
 /// <param name="userId">NET_DVR_Login_V40等登录接口的返回值</param>
 /// <param name="gatewayIndex">门禁序号(楼层编号、锁ID),从1开始,-1表示对所有门(或者梯控的所有楼层)进行操作 </param>
 /// <param name="dwStatic">命令值:0- 关闭(对于梯控,表示受控),1- 打开(对于梯控,表示开门),2- 常开(对于梯控,表示自由、通道状态),3- 常关(对于梯控,表示禁用),4- 恢复(梯控,普通状态),5- 访客呼梯(梯控),6- 住户呼梯(梯控) </param>
 /// <returns></returns>
 public bool ControlGateway(int userId, int gatewayIndex, uint dwStatic)
 {
     return(CHCNetSDK.NET_DVR_ControlGateway(userId, gatewayIndex, dwStatic));
 }