wjc
2023-08-28 5215a463afd281f62ecd67b2ae87d37404174287
2023年08月28日15:41:39

场景输出增加海信设备
11个文件已修改
317 ■■■■ 已修改文件
HDL_ON/Common/Utlis.cs 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Server/NewAPI.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Entity/Function/Function.cs 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Entity/Function/Scene.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/MainPage.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs 149 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/HisenseTV /Send.cs 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/Utlis.cs
@@ -32,6 +32,14 @@
            if (url == "")
            {
                return;
            }
            if (!string.IsNullOrEmpty(content))
            {
                if (content.StartsWith("{") && content.EndsWith("}"))
                {
                    //完全是为了打印好看一点,没特殊意义;
                    content = Newtonsoft.Json.JsonConvert.DeserializeObject(content)?.ToString();
                }
            }
            string text = tag + "======" + url + "\r\n" + content;
            Console.WriteLine(text);
HDL_ON/DAL/Server/NewAPI.cs
@@ -757,6 +757,11 @@
        /// 解绑第三方iot平台账号
        /// </summary>
        public const string Api_Post_Unbound3tyIotAccount = "/smart-open/open-platform/tripartite/userUnbind";
        /// <summary>
        /// 解绑住宅下的第三方设备
        /// </summary>
        public const string Api_Post_UnbindDeviceToHome = "/smart-open/open-platform/tripartite/unbindDeviceToHome";
        #endregion
        #region ■  -- 红外宝接口___________________________
HDL_ON/Entity/Function/Function.cs
@@ -860,6 +860,28 @@
                    }
                }
            }
            else if (spk == SPK.MusicStandard|| spk == SPK.AvMusic)
            {
                list.AddRange(attributes);
            }
            else if (spk == SPK.ElectricalTvHisense)
            {
                list.Add(new FunctionAttributes
                {
                    key = FunctionAttributeKey.OnOff,
                    curValue = string.Empty,
                });
                list.Add(new FunctionAttributes
                {
                    key = FunctionAttributeKey.SetVolume,
                    curValue = string.Empty,
                });
                list.Add(new FunctionAttributes
                {
                    key = FunctionAttributeKey.Signal,
                    curValue = string.Empty,
                });
            }
            else
            {
                list.AddRange(attributes);
@@ -940,6 +962,9 @@
                switch (attr.key)
                {
                    case FunctionAttributeKey.SetVolume:
                    case FunctionAttributeKey.Signal:
                    case FunctionAttributeKey.OnOff:
                    case FunctionAttributeKey.Brightness:
                    case FunctionAttributeKey.Mode:
@@ -1577,6 +1602,14 @@
        /// </summary>
        public const string TotalElectricity = "total_electricity";
        /// <summary>
        /// 海信tv音量
        /// </summary>
        public const string SetVolume = "set_volume";
        /// <summary>
        /// 海信tv信号源(0:LiveTV;2:PS;3:HDMI_1;4:HDMI_2;5:HDMI_3;6:HDMI_4;11:AV;)
        /// </summary>
        public const string Signal = "signal";
    }
    /// <summary>
HDL_ON/Entity/Function/Scene.cs
@@ -706,6 +706,12 @@
                case "security":
                    text = Language.StringByID(StringId.DeploymentStatus);
                    break;
                case FunctionAttributeKey.SetVolume:
                    text = Language.StringByID(StringId.yinliang);
                    break;
                case FunctionAttributeKey.Signal:
                    text = Language.StringByID(StringId.xinhaoyuan);
                    break;
            }
            return text;
        }
@@ -851,6 +857,14 @@
                case "auto":
                    text = Language.StringByID(StringId.Auto);
                    break;
                case FunctionAttributeKey.SetVolume:
                    text = value;
                    break;
                case FunctionAttributeKey.Signal:
                    var p = new UI.UI2.Intelligence.Automation.PublicInterface();
                    var dic = p.GetHisenseSignalSourceDic();
                    text = p.GetKey(dic, value);
                    break;
            }
            return text;
        }
HDL_ON/UI/MainPage.cs
@@ -122,9 +122,9 @@
            SPK.PanelSocket,SPK.ElectricSocket,
            SPK.MechanicalArm,SPK.IpCam_Imou,
            SPK.GroupControl,
            //SPK.AvMusic,
            //SPK.MusicStandard,
            //SPK.ElectricalTvHisense
            SPK.AvMusic,
            SPK.MusicStandard,
            SPK.ElectricalTvHisense
        };
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -1519,7 +1519,9 @@
                                        }
                                        if (!string.IsNullOrEmpty(signal))
                                        {
                                            stateStr += signal.Replace("_", " ");
                                            var p = new PublicInterface();
                                            string key = p.GetKey(p.GetHisenseSignalSourceDic(), signal);
                                            stateStr += key;
                                        }
                                        stateStr = stateStr.TrimEnd(',');
                                    }
@@ -2535,7 +2537,9 @@
                                            //怕调试软件乱上东西导致抛异常
                                            break;
                                        }
                                        button3.Text = value.Replace("_", " ");
                                        var p = new PublicInterface();
                                        string key = p.GetKey(p.GetHisenseSignalSourceDic(), value);
                                        button3.Text = key;
                                    }
                                    break;
                            }
HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation
{
@@ -1305,5 +1306,60 @@
        }
        /// <summary>
        /// 获取key值
        /// </summary>
        /// <param name="value"></param>
        /// <returns>不存在返回空字符“”</returns>
        public string GetKey(Dictionary<string, string> dic, string value)
        {
            if (string.IsNullOrEmpty(value)) {
                return  string.Empty;
            }
            if (dic==null||dic.Count==0)
            {
                return string.Empty;
            }
            //如果出现多个相同Value,这里默认返回是第一个key值
            var key = dic.FirstOrDefault(q => q.Value == value).Key;
            return key == null ? string.Empty : key;
        }
        /// <summary>
        /// 获取value值
        /// </summary>
        /// <param name="key">键</param>
        /// <returns>不存在返回空字符“”</returns>
        public string GetValue(Dictionary<string, string> dic, string key)
        {
            if (string.IsNullOrEmpty(key))
            {
                return string.Empty;
            }
            if (dic == null || dic.Count == 0)
            {
                return string.Empty;
            }
            string value = string.Empty;
            dic.TryGetValue(key, out value);
            return value == null ? string.Empty : value;
        }
        /// <summary>
        /// 获取海信电视信号源列表( 0:LiveTV;2:PS;3:HDMI_1;4:HDMI_2;5:HDMI_3;6:HDMI_4;11:AV;)
        /// </summary>
        /// <returns></returns>
        public Dictionary<string, string> GetHisenseSignalSourceDic()
        {
            var dic = new Dictionary<string, string>();
            dic.Add("HDML 1", "3");
            dic.Add("HDML 2", "4");
            dic.Add("HDML 3", "5");
            dic.Add("HDML 4", "6");
            dic.Add("Live TV", "0");
            dic.Add("PS", "2");
            dic.Add("AV", "11");
            return dic;
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using System.Linq;
namespace HDL_ON.UI.UI2.Intelligence.Automation
{
@@ -874,20 +875,13 @@
                            string key = "signal"; 
                            selectedState = device.spk + "_" + key;
                            PublicInterface pif = new PublicInterface();
                            var sourceList = new List<string>();
                            sourceList.Add("HDML 1");
                            sourceList.Add("HDML 2");
                            sourceList.Add("HDML 3");
                            sourceList.Add("HDML 4");
                            sourceList.Add("Live TV");
                            sourceList.Add("PS");
                            sourceList.Add("AV");
                            pif.SingleSelectionShow(this, sourceList, Language.StringByID(StringId.xinhaoyuan), currText
                            var dic = pif.GetHisenseSignalSourceDic();
                            pif.SingleSelectionShow(this, dic.Keys.ToList(), Language.StringByID(StringId.xinhaoyuan), currText
                               , (valueStr) => 
                               {
                                   //界面显示选中值
                                   sourceView.btnState.Text = valueStr;
                                   string value = valueStr.Replace(" ", "_");
                                   string value = pif.GetValue(dic, valueStr);
                                   //数据封装
                                   AddDictionary(key, value);
HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs
@@ -571,6 +571,20 @@
                }
            }
            var perSetVolume = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SetVolume);
            if (perSetVolume != null)
            {
                sceneFunctionInfo += " " + perSetVolume.value ;
            }
            var perSignal = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Signal);
            if (perSignal != null)
            {
                var p = new HDL_ON.UI.UI2.Intelligence.Automation.PublicInterface();
                string key = p.GetKey(p.GetHisenseSignalSourceDic(), perSignal.value);
                sceneFunctionInfo += " " + key;
            }
            return sceneFunctionInfo;
        }
HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
@@ -3,6 +3,7 @@
using HDL_ON.UI.CSS;
using Shared;
using System.Collections.Generic;
using System.Linq;
namespace HDL_ON.UI
{
@@ -25,8 +26,10 @@
        SceneFunction rgbColorful;
        bool isOnStatus = false;
        public SceneFunctionInfoEditPage(Scene s, SceneFunction fc,Action action)
        {
            bodyView = this; 
             scene = s;
            sceneFunction = fc.localFunction.ConvertSceneFunction();
@@ -118,6 +121,12 @@
                    case "security"://大华摄像布防撤防
                        LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == "security"));
                        break;
                    case FunctionAttributeKey.SetVolume:
                        LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SetVolume));
                        break;
                    case FunctionAttributeKey.Signal:
                        LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Signal));
                        break;
                }
            }
@@ -153,7 +162,8 @@
            btnConfrim.MouseUpEventHandler = (sender, e) =>
            {
                if (sceneFunction.localFunction.spk == SPK.GroupControl) {
                if (sceneFunction.localFunction.spk == SPK.GroupControl)
                {
                    var colorBegin = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.ColorfulBegin);
                    if (colorBegin != null)
                    {
@@ -301,7 +311,8 @@
                            }
                        }
                    }
                }catch(Exception ex)
                }
                catch (Exception ex)
                {
                    MainPage.Log($"UpdataFuntionRow error:{ex.Message}");
                }
@@ -510,11 +521,28 @@
                        case FunctionAttributeKey.Percent:
                            LoadEditDialog_Percent(sceneStatus, btnFunctionText);
                            break;
                        case FunctionAttributeKey.SetVolume:
                            BrightnessView(btnFunctionText.Text, btnFunctionName.Text, (volume, uintStr) =>
                            {
                                btnFunctionText.Text = volume;
                                sceneStatus.value = volume;
                            });
                            break;
                        case FunctionAttributeKey.Signal:
                            var p = new UI2.Intelligence.Automation.PublicInterface();
                            var dic = p.GetHisenseSignalSourceDic();
                            ListView(dic.Keys.ToList(), btnFunctionText.Text, btnFunctionName.Text, (valueStr) =>
                            {
                                btnFunctionText.Text = valueStr;
                                sceneStatus.value = p.GetValue(dic, valueStr);
                            });
                            break;
                    }
                };
                #endregion
            }catch(Exception ex)
            }
            catch (Exception ex)
            {
                MainPage.Log($"场景加载设备属性异常:{ex.Message}");
            }
@@ -672,8 +700,10 @@
            delayRow.AddChidren(btnSceneDelayTitle);
            btnSceneDelayTitle.MouseUpEventHandler = (sender, e) => {
                Action<string> action = (obj) => {
            btnSceneDelayTitle.MouseUpEventHandler = (sender, e) =>
            {
                Action<string> action = (obj) =>
                {
                    sceneFunction.delay = obj;
                    btnDelayInfo.Text = new Scene() { delay = sceneFunction.delay }.GetDelayText();
                };
@@ -974,21 +1004,25 @@
            dialog.Show();
            pView.MouseUpEventHandler = (sender, e) => {
            pView.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
            };
            btnCancel.MouseUpEventHandler = (sender, e) => {
            btnCancel.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
            };
            btnOn.MouseUpEventHandler = (sender, e) => {
            btnOn.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
                trait.value = "true";
                sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Security).value = "true";
                btn.Text = trait.GetValueText() + trait.GetUintString();
            };
            btnOff.MouseUpEventHandler = (sender, e) => {
            btnOff.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
                trait.value = "false";
                sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Security).value = "false";
@@ -1093,17 +1127,21 @@
            dialog.Show();
            pView.MouseUpEventHandler = (sender, e) => {
            pView.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
            };
            btnCancel.MouseUpEventHandler = (sender, e) => {
            btnCancel.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
            };
            uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => {
            uIPickerView.OnSelectChangeEvent = (int1, int2, int3) =>
            {
                selectItem = pickerItems[int1];
            };
            btnConfrim.MouseUpEventHandler = (sender, e) => {
            btnConfrim.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
                btn.Text = selectItem;
                //sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.value.ToString() ;
@@ -1206,17 +1244,21 @@
            //uIPickerView.setCurrentItems
            dialog.Show();
            pView.MouseUpEventHandler = (sender, e) => {
            pView.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
            };
            btnCancel.MouseUpEventHandler = (sender, e) => {
            btnCancel.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
            };
            uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => {
            uIPickerView.OnSelectChangeEvent = (int1, int2, int3) =>
            {
                selectItem = pickerItems[int1];
            };
            btnConfrim.MouseUpEventHandler = (sender, e) => {
            btnConfrim.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
                btn.Text = selectItem;
                //sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.value.ToString() ;
@@ -1501,17 +1543,21 @@
            dialog.Show();
            pView.MouseUpEventHandler = (sender, e) => {
            pView.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
            };
            btnCancel.MouseUpEventHandler = (sender, e) => {
            btnCancel.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
            };
            uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => {
            uIPickerView.OnSelectChangeEvent = (int1, int2, int3) =>
            {
                selectItem = pickerItems[int1];
            };
            btnConfrim.MouseUpEventHandler = (sender, e) => {
            btnConfrim.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
                btn.Text = selectItem;
                //sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.value.ToString() ;
@@ -1642,7 +1688,8 @@
            int circleR = colorPicker.Width / 2 - Application.GetRealWidth(12);
            colorPicker.ColorChaged += (sender2, e2) => {
            colorPicker.ColorChaged += (sender2, e2) =>
            {
                rgbString = (e2[0] + "," + e2[1] + "," + e2[2]).ToString();
                //trait.value = rgbString;
                btnCurColor.BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(rgbString));
@@ -1695,7 +1742,8 @@
                TextID = StringId.Cancel,
            };
            bottomView.AddChidren(btnCancel);
            btnCancel.MouseUpEventHandler = (sender, e) => {
            btnCancel.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
            };
@@ -1715,7 +1763,8 @@
            //例:右下圆角 大小为50
            int mRectCornerID = HDLUtils.RectCornerBottomRight;
            btnComplete.SetCornerWithSameRadius((uint)Application.GetRealWidth(14), mRectCornerID);
            btnComplete.MouseUpEventHandler = (sender, e) => {
            btnComplete.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
                trait.value = rgbString;
                btn.BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(rgbString));
@@ -1745,7 +1794,8 @@
                return;
            }
            Dialog dialog = new Dialog() {
            Dialog dialog = new Dialog()
            {
                Height = Application.GetRealHeight(647),
            };
@@ -1845,7 +1895,8 @@
            int circleR = colorPicker.Width / 2 - Application.GetRealWidth(12);
            colorPicker.ColorChaged += (sender2, e2) => {
            colorPicker.ColorChaged += (sender2, e2) =>
            {
                rgbString = (e2[0] + "," + e2[1] + "," + e2[2]).ToString();
                //trait.value = rgbString;
                btnCurColor.BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(rgbString));
@@ -1888,7 +1939,8 @@
                TextID = StringId.Cancel,
            };
            titleView.AddChidren(btnCancel);
            btnCancel.MouseUpEventHandler = (sender, e) => {
            btnCancel.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
            };
@@ -1907,7 +1959,8 @@
            //例:右下圆角 大小为50
            int mRectCornerID = HDLUtils.RectCornerBottomRight;
            btnComplete.SetCornerWithSameRadius((uint)Application.GetRealWidth(14), mRectCornerID);
            btnComplete.MouseUpEventHandler = (sender, e) => {
            btnComplete.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
                trait.value = rgbString;
                btn.BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(rgbString));
@@ -2278,7 +2331,8 @@
                };
                row.AddChidren(btnPropertyTitle);
                btnPropertyTitle.MouseUpEventHandler = (sender, e) => {
                btnPropertyTitle.MouseUpEventHandler = (sender, e) =>
                {
                    btnChoose.IsSelected = true;
                    if (lastButton != null)
                    {
@@ -2295,14 +2349,17 @@
            dialog.Show();
            pView.MouseUpEventHandler = (sender, e) => {
            pView.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
            };
            btnCancel.MouseUpEventHandler = (sender, e) => {
            btnCancel.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
            };
            btnConfrim.MouseUpEventHandler = (sender, e) => {
            btnConfrim.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
                trait.value = lastData;
                //sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.curValue.ToString() ;
@@ -2311,6 +2368,34 @@
        }
        /// <summary>
        /// 百分比
        /// </summary>
        /// <param name="oldStateValue">旧状态值</param>
        /// <param name="titleName">标题</param>
        ///  <param name="action">回调</param>
        void BrightnessView(string oldStateValue, string titleName, Action<string, string> action)
        {
            #region 界面
            var brightness = new UI2.Intelligence.Automation.LogicView.BrightnessView();
            brightness.FLayoutView(this, titleName, oldStateValue, action);
            #endregion
        }
        /// <summary>
        /// 列表界面
        /// </summary>
        /// <param name="list">界面显示数据源</param>
        /// <param name="oldStateValue">旧状态值</param>
        /// <param name="titleName">标题</param>
        ///  <param name="action">回调</param>
        void ListView(List<string> list, string oldStateValue, string titleName, Action<string> action)
        {
            var pif = new UI2.Intelligence.Automation.PublicInterface();
            pif.SingleSelectionShow(this, list, titleName, oldStateValue, action);
        }
        #endregion
    }
HDL_ON/UI/UI2/FuntionControlView/HisenseTV /Send.cs
@@ -35,17 +35,17 @@
        /// <param name="deviceId">设备id</param>
        /// <param name="action">成功返回true</param>
        /// <param name="tipType">是否需要提示,默认提示</param>
        public bool DelDevice(string deviceId,Action<bool>action, TipType tipType = TipType.flicker)
        public void DelDevice(string deviceId, Action<bool> action, TipType tipType = TipType.flicker)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);//设备id
            var responsePackNew = UI.Music.SendMethod.Current.RequestServerhomeId(d, NewAPI.Api_Post_Aks_KeypadExecute, "删除海信电视");
            d.Add("deviceIds", new List<string> { deviceId });//设备id
            var responsePackNew = UI.Music.SendMethod.Current.RequestServerhomeId(d, NewAPI.Api_Post_UnbindDeviceToHome, "删除海信电视");
            if (!this.DataChecking(responsePackNew, tipType))
            {
                return false;
                action?.Invoke(false);
            }
            return true;
            action?.Invoke(true);
        }
        /// <summary>