| | |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { common }); |
| | | |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType != Common.DeviceConcreteType.AirQualitySensor) |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | AirSonser(flMain, SelectedDeviceStatus, edit, common); |
| | | AirSonser(flMain, SelectedDeviceStatus, edit, common, devices); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | private static void AirSonser(FrameLayout flMain,string SelectedDeviceStatus,bool edit,CommonDevice common) { |
| | | /// <summary> |
| | | /// 空气质量传感器View(特殊处理) |
| | | /// </summary> |
| | | /// <param name="flMain"></param> |
| | | /// <param name="SelectedDeviceStatus"></param> |
| | | /// <param name="edit"></param> |
| | | /// <param name="common"></param> |
| | | /// <param name="dic"></param> |
| | | private static void AirSonser(FrameLayout flMain,string SelectedDeviceStatus,bool edit,CommonDevice common, Dictionary<string, string> dic=null) { |
| | | flMain.RemoveAll(); |
| | | if (edit&&dic!=null) { |
| | | AirProperty(flMain, dic, common,"", edit, SelectedDeviceStatus); |
| | | } |
| | | else |
| | | { |
| | | PublicInterface publicInterface = new PublicInterface(); |
| | | var list0 = publicInterface.GetViewList("空气质量传感器"); |
| | | publicInterface.SingleSelectionShow(flMain, list0, MyInternationalizationString.airqualitysensor, "", (tagText) => |
| | | { |
| | | flMain.RemoveAll(); |
| | | SelectedDeviceStatus = "TemperatureSensor"; |
| | | AirProperty(flMain, dic, common,tagText, edit, SelectedDeviceStatus); |
| | | }, () => { flMain.RemoveFromParent(); }); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 空气质量传感器属性值(特殊处理) |
| | | /// </summary> |
| | | /// <param name="flMain"></param> |
| | | /// <param name="dic"></param> |
| | | /// <param name="common"></param> |
| | | /// <param name="tagText"></param> |
| | | /// <param name="edit"></param> |
| | | /// <param name="SelectedDeviceStatus"></param> |
| | | private static void AirProperty(FrameLayout flMain, Dictionary<string, string> dic,CommonDevice common,string tagText,bool edit, string SelectedDeviceStatus) { |
| | | PublicInterface publicInterface = new PublicInterface(); |
| | | string range = ""; |
| | | string stateText = ""; |
| | | if (edit&& dic!=null) |
| | | { |
| | | range = dic["Range"]; |
| | | switch (dic["Cluster_ID"]) |
| | | { |
| | | case "1066": |
| | | { |
| | | if (dic["AttriButeId"] == "57344") |
| | | { |
| | | tagText = Language.StringByID(MyInternationalizationString.kongqizhiliang); |
| | | switch (dic["AttriButeData1"]) |
| | | { |
| | | |
| | | case "1": |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.you); |
| | | } |
| | | break; |
| | | case "2": |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.liang); |
| | | } |
| | | break; |
| | | case "3": |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.cha); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | tagText = Language.StringByID(MyInternationalizationString.pm25); |
| | | ///Pm2.5 |
| | | int intValue = int.Parse(dic["AttriButeData1"]); |
| | | if (0 < intValue && intValue < 30) |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.pmyou); |
| | | } |
| | | else if (36 < intValue && intValue < 75) |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.pmliang); |
| | | } |
| | | else if (76 < intValue && intValue < 115) |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.pmqingdu); |
| | | } |
| | | else if (intValue > 115) |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.pmzhongdu); |
| | | } |
| | | |
| | | } |
| | | } |
| | | break; |
| | | case "1037": |
| | | { |
| | | tagText = Language.StringByID(MyInternationalizationString.co2); |
| | | ///co2 |
| | | int intValue = int.Parse(dic["AttriButeData1"]); |
| | | if (0 < intValue && intValue < 1000) |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.co2qingxin); |
| | | } |
| | | else if (1000 < intValue && intValue < 2000) |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.co2huizhuo); |
| | | } |
| | | else if (2000 < intValue && intValue < 5000) |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.co2queyang); |
| | | } |
| | | else if (intValue > 5000) |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.co2yanzhongqueyang); |
| | | } |
| | | } |
| | | break; |
| | | case "1026": |
| | | { |
| | | tagText = Language.StringByID(MyInternationalizationString.sensortemperature); |
| | | stateText = dic["AttriButeData1"]; |
| | | } |
| | | break; |
| | | case "1029": |
| | | { |
| | | tagText = Language.StringByID(MyInternationalizationString.sensorhumidity); |
| | | stateText = dic["AttriButeData1"]; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | Dictionary<string, string> airqualitysensorDic = new Dictionary<string, string>(); |
| | | Send.dictionary(airqualitysensorDic, "Type", "1"); |
| | | Send.dictionary(airqualitysensorDic, "IsValid", "1"); |
| | | Send.dictionary(airqualitysensorDic, "MacAddr", common.DeviceAddr); |
| | | Send.dictionary(airqualitysensorDic, "Epoint", common.DeviceEpoint.ToString()); |
| | | //编辑时的状态值 |
| | | string stateText = ""; |
| | | if (tagText == Language.StringByID(MyInternationalizationString.kongqizhiliang)) |
| | | { |
| | | |
| | |
| | | AddDic(flMain, SelectedDeviceStatus, edit, common, airqualitysensorDic); |
| | | |
| | | |
| | | }, () =>{ AirSonser(flMain, SelectedDeviceStatus, edit, common); }); |
| | | }, () => { |
| | | if (edit) { flMain.RemoveFromParent(); } |
| | | else |
| | | { |
| | | AirSonser(flMain, SelectedDeviceStatus, edit, common); |
| | | } }); |
| | | |
| | | } |
| | | else if (tagText == Language.StringByID(MyInternationalizationString.pm25)) |
| | |
| | | AddDic(flMain, SelectedDeviceStatus, edit, common, airqualitysensorDic); |
| | | |
| | | |
| | | }, () => {AirSonser(flMain, SelectedDeviceStatus, edit, common); }); |
| | | }, () => { |
| | | if (edit) { flMain.RemoveFromParent(); } |
| | | else |
| | | { |
| | | AirSonser(flMain, SelectedDeviceStatus, edit, common); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | else if (tagText == Language.StringByID(MyInternationalizationString.co2)) |
| | |
| | | } |
| | | else if (strText == Language.StringByID(MyInternationalizationString.co2huizhuo)) |
| | | { |
| | | valuaStr = "1000"; |
| | | valuaStr = "1500"; |
| | | } |
| | | else if (strText == Language.StringByID(MyInternationalizationString.co2queyang)) |
| | | { |
| | |
| | | AddDic(flMain, SelectedDeviceStatus, edit, common, airqualitysensorDic); |
| | | |
| | | |
| | | }, () => { AirSonser(flMain, SelectedDeviceStatus, edit, common); }); |
| | | }, () => { |
| | | if (edit) { flMain.RemoveFromParent(); } |
| | | else |
| | | { |
| | | AirSonser(flMain, SelectedDeviceStatus, edit, common); |
| | | } |
| | | }); |
| | | |
| | | |
| | | |
| | |
| | | else if (tagText == Language.StringByID(MyInternationalizationString.sensortemperature)) |
| | | { |
| | | //编辑时的状态值 |
| | | string str1 = ""; |
| | | string str2 = ""; |
| | | publicInterface.TemperatureShow1(flMain, tagText, "℃", str2, str1, (relationValueStr, tempValueStr) => |
| | | string str1 = range; |
| | | string str2 = stateText; |
| | | publicInterface.TemperatureShow1(flMain, tagText, "℃", str1, str2, (relationValueStr, tempValueStr) => |
| | | { |
| | | |
| | | SelectedDeviceStatus = "TemperatureSensor"; |
| | |
| | | |
| | | }, () => |
| | | { |
| | | if (edit) { flMain.RemoveFromParent(); } |
| | | else |
| | | { |
| | | AirSonser(flMain, SelectedDeviceStatus, edit, common); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | else if (tagText == Language.StringByID(MyInternationalizationString.sensorhumidity)) |
| | | { |
| | | //编辑时的状态值 |
| | | string str1 = ""; |
| | | string str2 = ""; |
| | | publicInterface.TemperatureShow1(flMain, tagText, "%", str2, str1, (relationValueStr, tempValueStr) => |
| | | string str1 = range; |
| | | string str2 = stateText; |
| | | publicInterface.TemperatureShow1(flMain, tagText, "%", str1, str2, (relationValueStr, tempValueStr) => |
| | | { |
| | | SelectedDeviceStatus = "TemperatureSensor"; |
| | | Send.dictionary(airqualitysensorDic, "Cluster_ID", "1029"); |
| | |
| | | Send.dictionary(airqualitysensorDic, "AttriButeData2", "0"); |
| | | Send.dictionary(airqualitysensorDic, "Range", relationValueStr); |
| | | AddDic(flMain, SelectedDeviceStatus, edit, common, airqualitysensorDic); |
| | | }, () => { AirSonser(flMain, SelectedDeviceStatus, edit, common);}); |
| | | }, () => { |
| | | if (edit) { flMain.RemoveFromParent(); } |
| | | else |
| | | { |
| | | AirSonser(flMain, SelectedDeviceStatus, edit, common); |
| | | } |
| | | }, () => { flMain.RemoveFromParent(); }); |
| | | }); |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 空气质量传感器 |
| | | /// 空气质量传感器(特殊处理) |
| | | /// </summary> |
| | | /// <param name="flMain"></param> |
| | | /// <param name="SelectedDeviceStatus"></param> |