Exemplo n.º 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;
            }
        }
Exemplo n.º 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;
            }
        }
Exemplo n.º 3
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();
        }