private Hashtable GetXmlData(string type) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load("CamSettingsConfig.xml"); var camsElements = xmlDoc.SelectNodes("/SettingItem/" + type + "/illumination"); Hashtable listStr = new Hashtable(); foreach (XmlNode xn in camsElements) { if (type.Equals("Infrared")) { } else { CameraParam cp = new CameraParam() { iris = Convert.ToInt32(xn.Attributes["iris"].Value), shutter = Convert.ToInt32(xn.Attributes["shutter"].Value), agc = Convert.ToInt32(xn.Attributes["agc"].Value) }; listStr.Add(Model.ToString() + xn.Attributes["value"].Value, cp); } } return(listStr); }
/// <summary> /// 读取端口 /// </summary> /// <param name="modle">BrightType</param> /// <param name="Ip">摄像机的Ip</param> public void ReadPort(object obj) { OpenPort(); int count = 0; int[] arrInt = new int[5]; while (true) { try { int temp = Convert.ToInt32(sp.ReadLine()); if (count == 5) { int good = (GetBestValue(arrInt.ToArray()) / 4 + 5) / 10 * 10; //获得中间值 CameraParam setVal = new CameraParam(); setVal = GetSettingString(Model.ToString() + good.ToString(), Model.ToString()); //获得相匹配的字符串 if (setVal != null) { this.SettingCamera(setVal); //设置相机 } count = 0; sp.Close(); Thread.Sleep(2500); } else { arrInt[count++] = temp; } } catch (Exception ex) { Console.WriteLine("Erro Message:" + ex.Message); } Thread.Sleep(1500); OpenPort(); } }
public SetCamera(CameraParam ccp, string Ip) { cp = ccp; url = string.Format("http://{0}", Ip); }
/// <summary> /// 设置照相机 /// </summary> /// <param name="cp"></param> /// <param name="Ip"></param> private void SettingCamera(CameraParam cp) { SetCamera sd = new SetCamera(cp, Ip); sd.Connect(); }
public SetCamera(CameraParam ccp, string Ip) { cp = ccp; url = string.Format("http://{0}",Ip); }
private Hashtable GetXmlData(string type) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load("CamSettingsConfig.xml"); var camsElements = xmlDoc.SelectNodes("/SettingItem/" + type + "/illumination"); Hashtable listStr = new Hashtable(); foreach (XmlNode xn in camsElements) { if (type.Equals("Infrared")) { } else { CameraParam cp = new CameraParam() { iris = Convert.ToInt32(xn.Attributes["iris"].Value), shutter = Convert.ToInt32(xn.Attributes["shutter"].Value), agc = Convert.ToInt32(xn.Attributes["agc"].Value) }; listStr.Add(Model.ToString() + xn.Attributes["value"].Value, cp); } } return listStr; }
/// <summary> /// 读取端口 /// </summary> /// <param name="modle">BrightType</param> /// <param name="Ip">摄像机的Ip</param> public void ReadPort(object obj) { OpenPort(); int count = 0; int[] arrInt = new int[5]; while (true) { try { int temp = Convert.ToInt32(sp.ReadLine()); if (count == 5) { int good =(GetBestValue(arrInt.ToArray()) / 4 + 5)/10*10;//获得中间值 CameraParam setVal = new CameraParam(); setVal = GetSettingString(Model.ToString() + good.ToString(), Model.ToString());//获得相匹配的字符串 if (setVal != null) this.SettingCamera(setVal); //设置相机 count = 0; sp.Close(); Thread.Sleep(2500); } else { arrInt[count++] = temp; } } catch (Exception ex) { Console.WriteLine("Erro Message:" + ex.Message); } Thread.Sleep(1500); OpenPort(); } }