Exemple #1
0
        private void FrmHikVideo_Load(object sender, EventArgs e)
        {
            try
            {
                //初始化SDK
                IPCer.InitSDK();

                CmcsCamera cmcsCamera = commonDAO.SelfDber.Entity <CmcsCamera>("where Name=:Name", new { Name = this.Text });

                if (cmcsCamera == null)
                {
                    panVideo1.Text = "登录失败:未找到该摄像头配置信息";
                    return;
                }

                bool b = ipCer.Login(cmcsCamera.Ip, cmcsCamera.Port, cmcsCamera.UserName, cmcsCamera.Password);
                if (!b)
                {
                    panVideo1.Text = "登录失败:" + returnError(IPCer.GetLastErrorCode());
                    return;
                }
                b = ipCer.StartPreview(panVideo1.Handle, cmcsCamera.Channel);
                if (!b)
                {
                    panVideo1.Text = "预览失败:" + returnError(IPCer.GetLastErrorCode());
                    return;
                }
            }
            catch (Exception ex)
            {
                panVideo1.Text = "预览异常:请检查参数是否正确;" + ex.Message;
            }
        }
Exemple #2
0
        private void FrmHikVideo_Load(object sender, EventArgs e)
        {
            if (currentCamera == null)
            {
                panVideo1.Text = "摄像机参数未配置";
                return;
            }
            try
            {
                //初始化SDK
                IPCer.InitSDK();

                bool b = ipCer.Login(currentCamera.Ip, currentCamera.Port, currentCamera.UserName, currentCamera.Password);
                if (!b)
                {
                    panVideo1.Text = "登录失败:" + returnError(IPCer.GetLastErrorCode());
                    return;
                }
                b = ipCer.StartPreview(panVideo1.Handle, currentCamera.Channel);
                if (!b)
                {
                    panVideo1.Text = "预览失败:" + returnError(IPCer.GetLastErrorCode());
                    return;
                }
            }
            catch (Exception ex)
            {
                panVideo1.Text = "预览异常:请检查参数是否正确;" + ex.Message;
            }
        }
        /// <summary>
        /// 开门
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void btnOpen_Click(object sender, EventArgs e)
        {
            GridButtonXEditControl btn = sender as GridButtonXEditControl;

            if (btn == null)
            {
                return;
            }
            CmcsCamareTemp camera = btn.EditorCell.GridRow.DataItem as CmcsCamareTemp;

            if (camera == null)
            {
                return;
            }
            if (IsLogin)
            {
                iPCer1.LoginOut();
            }
            if (iPCer1.Login(camera.Ip, camera.Port, camera.UserName, camera.Password) && iPCer1.OpenDoor())
            {
                IsLogin = true;
                MessageBoxEx.Show("开门成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                commonDAO.SaveOperationLog(camera.Name + "开门", GlobalVars.LoginUser.Name);
            }
        }
Exemple #4
0
        /// <summary>
        /// 开始模拟数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnStart_Click(object sender, EventArgs e)
        {
            iPCer_Identify1.Login("192.168.1.50", 80, "admin", "admin123");
            uint ss = IPCer.GetLastErrorCode();

            iPCer_Identify1.StartPreview(panVideo1.Handle, 1);
            //iPCer_Identify1.OnReceived = ReceiveData1;
            iPCer_Identify1.SetDVRCallBack();
            iPCer_Identify1.SetupAlarm();
        }