/// <summary> /// 通道号选择前保存处理 /// </summary> /// <param name="channelConfig"></param> private void ChannelNumSaveData(ref DHDEV_CHANNEL_CFG channelConfig) { try { DHClient.DHStringToByteArry(txtChannelName.Text ,ref channelConfig.szChannelName); channelConfig.stColorCfg[0].byBrightness=(byte)int.Parse(txtBrightness0.Text);//亮度 channelConfig.stColorCfg[0].byContrast=(byte)int.Parse(txtContrast0.Text );//对比度 channelConfig.stColorCfg[0].bySaturation=(byte)int.Parse(txtSaturation0.Text);//饱和度 channelConfig.stColorCfg[0].byHue=(byte)int.Parse(txtHue0.Text);//色度 channelConfig.stColorCfg[0].byGainEn = (byte)(chkGainEn0.Checked ==true ?1 : 0);//增益使能 channelConfig.stColorCfg[0].byGain=(byte)int.Parse(txtGain0.Text);//增益 channelConfig.stColorCfg[1].byBrightness = (byte)int.Parse(txtBrightness1.Text);//亮度 channelConfig.stColorCfg[1].byContrast = (byte)int.Parse(txtContrast1.Text);//对比度 channelConfig.stColorCfg[1].bySaturation = (byte)int.Parse(txtSaturation1.Text);//饱和度 channelConfig.stColorCfg[1].byHue = (byte)int.Parse(txtHue1.Text);//色度 channelConfig.stColorCfg[1].byGainEn = (byte)(chkGainEn1.Checked == true ? 1 : 0);//增益使能 channelConfig.stColorCfg[1].byGain = (byte)int.Parse(txtGain1.Text);//增益 } catch { MessageBox.Show("保存错误!", pMsgTitle); } }
/// <summary> /// 通道信息显示 /// </summary> /// <param name="netConfig">通道信息</param> private void setDataToControl(DHDEV_CHANNEL_CFG channelConfig) { try { txtChannelName.Text = DHClient.DHByteArrayToString(channelConfig.szChannelName); txtBrightness0.Text = channelConfig.stColorCfg[0].byBrightness.ToString("D");//亮度 txtContrast0.Text = channelConfig.stColorCfg[0].byContrast.ToString("D");//对比度 txtSaturation0.Text = channelConfig.stColorCfg[0].bySaturation.ToString("D");//饱和度 txtHue0.Text = channelConfig.stColorCfg[0].byHue.ToString("D");//色度 chkGainEn0.Checked = (channelConfig.stColorCfg[0].byGainEn == 1 ? true : false);//增益使能 txtGain0.Text = channelConfig.stColorCfg[0].byGain.ToString("D");//增益 txtBrightness1.Text = channelConfig.stColorCfg[1].byBrightness.ToString("D");//亮度 txtContrast1.Text = channelConfig.stColorCfg[1].byContrast.ToString("D");//对比度 txtSaturation1.Text = channelConfig.stColorCfg[1].bySaturation.ToString("D");//饱和度 txtHue1.Text = channelConfig.stColorCfg[1].byHue.ToString("D");//色度 chkGainEn1.Checked = (channelConfig.stColorCfg[1].byGainEn == 1 ? true : false);//增益使能 txtGain1.Text = channelConfig.stColorCfg[1].byGain.ToString("D");//增益 cmbVideoEncOpt.SelectedIndex = 0;//码流选择 cmbOSD.SelectedIndex = 0;//OSD类型选择 } catch { MessageBox.Show("赋值错误!", pMsgTitle); } }
/// <summary> /// 设定所有通道配置 /// </summary> /// <param name="lLoginID">设备用户登录ID:CLIENT_Login的返回值</param> /// <param name="lChannel">通道号</param> /// <param name="netConfig">通道配置</param> /// <param name="waittime">等待时间</param> /// <returns>true:成功;false:失败</returns> public static bool DHSetDevConfig(int lLoginID, DHDEV_CHANNEL_CFG[] channelConfig) { return DHSetDevConfig(lLoginID, channelConfig, 3000); }
/// <summary> /// 设定所有通道配置 /// </summary> /// <param name="lLoginID">设备用户登录ID:CLIENT_Login的返回值</param> /// <param name="lChannel">通道号</param> /// <param name="netConfig">通道配置</param> /// <param name="waittime">等待时间</param> /// <returns>true:成功;false:失败</returns> public static bool DHSetDevConfig(int lLoginID, DHDEV_CHANNEL_CFG[] channelConfig, int waittime) { object[] result = new object[channelConfig.Length]; for (int i = 0; i < channelConfig.Length; i++) { result[i] = (object)channelConfig[i]; } bool returnValue = false; returnValue = PSetDevConfig(lLoginID, CONFIG_COMMAND.DH_DEV_CHANNELCFG, result, typeof(DHDEV_CHANNEL_CFG), waittime); return returnValue; }
/// <summary> /// 设定指定通道配置 /// </summary> /// <param name="lLoginID">设备用户登录ID:CLIENT_Login的返回值</param> /// <param name="lChannel">通道号[此值不能为-1]</param> /// <param name="netConfig">通道配置</param> /// <param name="waittime">等待时间</param> /// <returns>true:成功;false:失败</returns> public static bool DHSetDevConfig(int lLoginID, int lChannel, DHDEV_CHANNEL_CFG channelConfig, int waittime) { bool returnValue = false; returnValue = PSetDevConfig(lLoginID, lChannel, CONFIG_COMMAND.DH_DEV_CHANNELCFG,(object)channelConfig, typeof(DHDEV_CHANNEL_CFG), waittime); return returnValue; }
/// <summary> /// 获取指定通道配置[默认等待时间3000] /// </summary> /// <param name="lLoginID">设备用户登录ID:CLIENT_Login的返回值</param> /// <param name="lChannel">通道号[此值不能为-1]</param> /// <param name="netConfig">通道配置</param> /// <returns>true:成功;false:失败</returns> public static bool DHGetDevConfig(int lLoginID, int lChannel, ref DHDEV_CHANNEL_CFG channelConfig) { return DHGetDevConfig(lLoginID, lChannel, ref channelConfig); }
/// <summary> /// 获取指定通道配置 /// </summary> /// <param name="lLoginID">设备用户登录ID:CLIENT_Login的返回值</param> /// <param name="lChannel">通道号[此值不能为-1]</param> /// <param name="netConfig">通道配置</param> /// <param name="waittime">等待时间</param> /// <returns>true:成功;false:失败</returns> public static bool DHGetDevConfig(int lLoginID, int lChannel, ref DHDEV_CHANNEL_CFG channelConfig, int waittime) { object result = new object(); bool returnValue = false; returnValue = PGetDevConfig(lLoginID, lChannel, CONFIG_COMMAND.DH_DEV_CHANNELCFG, ref result, typeof(DHDEV_CHANNEL_CFG), waittime); channelConfig = (DHDEV_CHANNEL_CFG)result; return returnValue; }