示例#1
0
        /// <summary>
        /// 读取按钮按下处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnReadConfig_Click(object sender, EventArgs e)
        {
            bool returnValue = false;
            switch (tbcMain.SelectedIndex)
            {
                case 0://设备属性                    
                    returnValue = DHClient.DHGetDevConfig(pLoginID, ref sysAttrConfig);
                    if (returnValue == true)
                    {
                        setDataToControl(sysAttrConfig);
                    }
                    else
                    {
                        //报最后一次操作的错误信息
                        MessageBox.Show(DHClient.LastOperationInfo.ToString(pErrInfoFormatStyle), pMsgTitle);
                    }
                    break;
                case 1://通道属性

                    # region << 获取指定通道的通道属性 >>
                    //DHDEV_CHANNEL_CFG channelConfig = new DHDEV_CHANNEL_CFG();
                    //returnValue = DHClient.DHGetDevConfig(pLoginID, 0, ref channelConfig);
                    //if (returnValue == true)
                    //{
                    //    setDataToControl(channelConfig);
                    //}
                    //else
                    //{
                    //    //报最后一次操作的错误信息
                    //    MessageBox.Show(DHClient.LastOperationInfo.ToString(pErrInfoFormatStyle), pMsgTitle);
                    //}
                    #endregion

                    #region << 获取所有通道的通道属性  >>
                    if (sysAttrConfig.Equals(new DHDEV_SYSTEM_ATTR_CFG()) == false)
                    {
                        channelConfig = new DHDEV_CHANNEL_CFG[sysAttrConfig.byVideoCaptureNum];
                        #region << 通道号选择列表处理 >>
                        cmbChannelNum.Items.Clear();
                        for (int i = 0; i < sysAttrConfig.byVideoCaptureNum; i++)
                        {
                            cmbChannelNum.Items.Add(i.ToString());
                        }
                        #endregion
                        returnValue = DHClient.DHGetDevConfig(pLoginID, ref channelConfig);
                        if (returnValue == true)
                        {
                            //setDataToControl(channelConfig[0]);//显示0通道信息
                            cmbChannelNum.SelectedIndex = 0;//显示0通道信息
                        }
                        else
                        {
                            //报最后一次操作的错误信息
                            MessageBox.Show(DHClient.LastOperationInfo.ToString(pErrInfoFormatStyle), pMsgTitle);
                        }
                    }
                    #endregion

                    #region << 多预览 >>
                    //DHDEV_PREVIEW_CFG previewConfig = new DHDEV_PREVIEW_CFG();
                    //returnValue = DHClient.DHGetDevConfig(pLoginID, ref previewConfig);
                    //if(returnValue==true)
                    //{

                    //}
                    //else
                    //{
                    //    //报最后一次操作的错误信息
                    //    MessageBox.Show(DHClient.LastOperationInfo.ToString(pErrInfoFormatStyle), pMsgTitle);
                    //}
                    #endregion

                    break;
                case 2://串口属性
                    //获取串口属性
                    commConfig = new DHDEV_COMM_CFG();
                    returnValue = DHClient.DHGetDevConfig(pLoginID, ref commConfig);
                    if (returnValue == true)
                    {
                        cmbCOMFunction.Items.Clear();
                        foreach(DH_PROANDFUN_NAME pName in commConfig.s232FuncName)
                        {
                            cmbCOMFunction.Items.Add(DHClient.DHByteArrayToString(pName.ProName));
                        }
                        cmb458DecProName.Items.Clear();
                        foreach (DH_PROANDFUN_NAME pName in commConfig.DecProName)
                        {
                            cmb458DecProName.Items.Add(DHClient.DHByteArrayToString(pName.ProName));
                        }
                        cmbRS232.SelectedIndex = 0;
                        cmb485.SelectedIndex = 0;
                        //setDataToControl(commConfig.st232[0]);//显示232串口属性
                        //setDataToControl(commConfig.stDecoder[0]);//显示485串口属性
                    }
                    else
                    {
                        //报最后一次操作的错误信息
                        MessageBox.Show(DHClient.LastOperationInfo.ToString(pErrInfoFormatStyle), pMsgTitle);
                    }

                    break;
                case 3://录像配置

                    #region << 获取指定通道录像配置 >>
                    //DHDEV_RECORD_CFG recConfig = new DHDEV_RECORD_CFG();
                    //returnValue = DHClient.DHGetDevConfig(pLoginID, 0, ref recConfig);
                    //if (returnValue == true)
                    //{
                    //    //setDataToControl(recConfig);//显示录像配置
                    //}
                    //else
                    //{
                    //    //报最后一次操作的错误信息
                    //    MessageBox.Show(DHClient.LastOperationInfo.ToString(pErrInfoFormatStyle), pMsgTitle);
                    //}
                    #endregion

                    #region << 获取所有通道录像配置 >>
                    if (sysAttrConfig.Equals(new DHDEV_SYSTEM_ATTR_CFG()) == false)
                    {
                        cmbRecChannel.Items.Clear();
                        for (int i = 0; i < sysAttrConfig.byVideoCaptureNum; i++)
                        {
                            cmbRecChannel.Items.Add(i.ToString());
                        }
                            recConfig = new DHDEV_RECORD_CFG[sysAttrConfig.byVideoCaptureNum];
                        returnValue = DHClient.DHGetDevConfig(pLoginID, ref recConfig);

                        if (returnValue == true)
                        {
                            cmbRecChannel.SelectedIndex = 0;
                        }
                        else
                        {
                            //报最后一次操作的错误信息
                            MessageBox.Show(DHClient.LastOperationInfo.ToString(pErrInfoFormatStyle), pMsgTitle);
                        }
                    }
                    #endregion

                    break;
                case 4://网络配置

                    returnValue = DHClient.DHGetDevConfig(pLoginID, ref  netConfig);
                    if (returnValue == true)
                    {
                        setDataToControl(netConfig);
                    }
                    else
                    {
                        //报最后一次操作的错误信息
                        MessageBox.Show(DHClient.LastOperationInfo.ToString(pErrInfoFormatStyle), pMsgTitle);
                    }
                    break;
                case 5://报警属性
                    alarmAllConfig = new DHDEV_ALARM_SCHEDULE();
                    returnValue = DHClient.DHGetDevConfig(pLoginID, ref  alarmAllConfig);
                    if (returnValue == true)
                    {
                        cmbAlarm.SelectedIndex = 0;                        
                        //setDataToControl(alarmConfig);//显示报警属性
                    }
                    else
                    {
                        //报最后一次操作的错误信息
                        MessageBox.Show(DHClient.LastOperationInfo.ToString(pErrInfoFormatStyle), pMsgTitle);
                    }
                    ////DVR时间信息的取得
                    //NET_TIME dvrTime = new NET_TIME();
                    //returnValue = DHClient.DHGetDevConfig(pLoginID, ref  dvrTime);
                    //if (returnValue == true)
                    //{
                    //    //setDataToControl(alarmConfig);//显示报警属性
                    //}
                    //else
                    //{
                    //    //报最后一次操作的错误信息
                    //    MessageBox.Show(DHClient.LastOperationInfo.ToString(pErrInfoFormatStyle), pMsgTitle);
                    //}
                    //break;                    
                    break;
            }
        }
示例#2
0
        /// <summary>
        /// 用户登录按钮按下
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUserLogin_Click(object sender, EventArgs e)
        {
            string strLogin = StringUtil.ConvertString("设备用户登录");
            string strLogout = StringUtil.ConvertString("设备用户注销");

            if (btnUserLogin.Text.Equals(strLogin))
            {
                frm_AddDevice fadFrom = new frm_AddDevice();
                fadFrom.ShowDialog();
                if (fadFrom.blnOKEnter == true)
                {
                    //设备用户信息获得
                    NET_DEVICEINFO deviceInfo = new NET_DEVICEINFO();
                    int error = 0;
                    pLoginID = DHClient.DHLogin(fadFrom.cmbDevIP.Text.ToString(), ushort.Parse(fadFrom.txtDevProt.Text.ToString()), fadFrom.txtName.Text.ToString(), fadFrom.txtPassword.Text.ToString(), out deviceInfo, out error);
                    if (pLoginID != 0)
                    {
                        btnUserLogin.BackColor = Color.Yellow;
                        btnUserLogin.Text = strLogout;
                        grbMain.Enabled = true;
                        tbcMain.SelectedIndex = 0;
                    }
                    else
                    {
                        //报最后一次操作的错误信息
                        MessageBox.Show(DHClient.LastOperationInfo.ToString(pErrInfoFormatStyle), pMsgTitle);
                        btnUserLogin_Click(null, null);
                    }
                }
            }
            else
            {
                bool result = DHClient.DHLogout(pLoginID);
                if (result == false)
                {
                    //报最后一次操作的错误信息
                    MessageBox.Show(DHClient.LastOperationInfo.ToString(pErrInfoFormatStyle), pMsgTitle);
                }

                //画面初始化
                this.Controls.Clear();
                InitializeComponent();
                pLoginID = 0;
                sysAttrConfig = new DHDEV_SYSTEM_ATTR_CFG();
                channelConfig = new DHDEV_CHANNEL_CFG[16];
                netConfig = new DHDEV_NET_CFG();
                recConfig = new DHDEV_RECORD_CFG[16];
                commConfig = new DHDEV_COMM_CFG();
                alarmAllConfig = new DHDEV_ALARM_SCHEDULE();
                btnUserLogin.BackColor = Color.Transparent;
                btnUserLogin.Text = strLogin;
                grbMain.Enabled = false;
                tbcMain.SelectedIndex = 0;
            }
        }
示例#3
0
 /// <summary>
 /// 设定报警参数
 /// </summary>
 /// <param name="lLoginID">设备用户登录ID:CLIENT_Login的返回值</param>
 /// <param name="alarmConfig">报警参数</param>
 /// <param name="waittime">等待时间</param>
 /// <returns>true:成功;false:失败</returns>
 public static bool DHSetDevConfig(int lLoginID,DHDEV_ALARM_SCHEDULE alarmConfig, int waittime)
 {
     bool returnValue = false;
     returnValue = PSetDevConfig(lLoginID, 0, CONFIG_COMMAND.DH_DEV_ALARMCFG, (object)alarmConfig, typeof(DHDEV_ALARM_SCHEDULE), waittime);
     return returnValue;
 }
示例#4
0
 /// <summary>
 /// 设定报警参数[默认等待时间3000]
 /// </summary>
 /// <param name="lLoginID">设备用户登录ID:CLIENT_Login的返回值</param>
 /// <param name="alarmConfig">报警参数</param>
 /// <returns>true:成功;false:失败</returns>
 public static bool DHSetDevConfig(int lLoginID,DHDEV_ALARM_SCHEDULE alarmConfig)
 {
     return DHSetDevConfig(lLoginID,alarmConfig, 3000);
 }
示例#5
0
 /// <summary>
 ///  获取报警参数
 /// </summary>
 /// <param name="lLoginID">设备用户登录ID:CLIENT_Login的返回值</param>
 /// <param name="alarmConfig">报警参数</param>
 /// <param name="waittime">等待时间</param>
 /// <returns>true:成功;false:失败</returns>
 public static bool DHGetDevConfig(int lLoginID, ref DHDEV_ALARM_SCHEDULE alarmConfig, int waittime)
 {
     object result = new object();
     bool returnValue = false;
     returnValue = PGetDevConfig(lLoginID, 0, CONFIG_COMMAND.DH_DEV_ALARMCFG, ref result, typeof(DHDEV_ALARM_SCHEDULE), waittime);
     alarmConfig = (DHDEV_ALARM_SCHEDULE)result;
     return returnValue;
 }