HDL Home App 第二版本 旧平台金堂用 正在使用
请合并门锁最新代码【1、优化门锁常开模式推送和增加机械门锁开锁功能;2、优化面板调光目标】
8个文件已修改
279 ■■■■■ 已修改文件
ZigbeeApp20200519/Shared/Phone/Device/Logic/SkipView.cs 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZigbeeApp20200519/Shared/Phone/Device/Logic/SoneLogicList.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZigbeeApp20200519/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs 134 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZigbeeApp20200519/Shared/Phone/UserCenter/CommonBase/Resourse/ControlCommonResourse.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZigbeeApp20200519/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZigbeeApp20200519/Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZigbeeApp20200519/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs 77 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZigbeeApp20200519/Shared/Phone/ZigBee/Device/ZbGateway.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZigbeeApp20200519/Shared/Phone/Device/Logic/SkipView.cs
old mode 100755 new mode 100644
@@ -8,7 +8,7 @@
namespace Shared.Phone.Device.Logic
{
    public class SkipView:FrameLayout
    public class SkipView : FrameLayout
    {
        /// <summary>
        /// 其它界面跳进来的入口
@@ -60,12 +60,12 @@
                        doorLockLogicList.Show();
                    }
                    break;
            }
        }
        #region ◆ 自动化__________________________
        /// <summary>
        /// 自动化功能代码入口
@@ -315,14 +315,14 @@
            Automationview(logicScrolView, no);
            CommonPage.Loading.Hide();
        }
        static RowLayout selectedRow = new RowLayout() { Tag = "0" };//记录左滑状态
        //static RowLayout selectedRow = new RowLayout() { Tag = "0" };//记录左滑状态
        /// <summary>
        /// 加载自动化列表界面
        /// </summary>
        /// <param name="refresview">Refresview.</param>
        private static async void Automationview(VerticalRefreshLayout refresview, bool no)
        {
            refresview.RemoveAll();
            if (Common.Logic.LogicList.Count == 0 && no == false)
            {
@@ -400,18 +400,18 @@
                //左滑菜单事件
                logicRowlayout.OpenMenuAction += () =>
                {
                    if (selectedRow.Tag.ToString() != logicRowlayout.Tag.ToString())
                    {   //保留左滑只有一个;
                        selectedRow.HideMenu();//
                    }
                    selectedRow = logicRowlayout;
                    //if (selectedRow.Tag.ToString() != logicRowlayout.Tag.ToString())
                    //{   //保留左滑只有一个;
                    //    selectedRow.HideMenu();//
                    //}
                    //selectedRow = logicRowlayout;
                };
                if (i == 1)
                {
                    //实现android显示逻辑列表的圆角;
                    fLayout.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft);
                    logicRowlayout.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft);
                }
                i++;
                var logicnameBtn = new Button
@@ -717,7 +717,7 @@
            timeConditionsInfo.Add("DelayTime", "0");
            timeConditionsInfo.Add("StartHour", h);
            timeConditionsInfo.Add("StartMin", m);
            timeConditionsInfo.Add("DoorLockOpenDelayTime", (timeVlaue*60*60).ToString());
            timeConditionsInfo.Add("DoorLockOpenDelayTime", (timeVlaue * 60).ToString());
            //timeConditionsInfo.Add("DoorLockOpenDelayTime", (timeVlaue * 3600).ToString());
            Dictionary<string, object> actionsInfo = new Dictionary<string, object>();
            actionsInfo.Add("LinkType", 8);
ZigbeeApp20200519/Shared/Phone/Device/Logic/SoneLogicList.cs
old mode 100755 new mode 100644
@@ -226,6 +226,22 @@
                catch { }
            };
            UserCenter.DoorLock.DoorLockCommonInfo.UpdateCurrentDoorlockAction += (DoorlockKey, _bool) =>
            {
                var key = Send.CurrentDoorLock.DeviceAddr + Send.CurrentDoorLock.DeviceEpoint;
                if (DoorlockKey == key)
                {
                    try
                    {
                        Application.RunOnMainThread(() =>
                        {
                            Send.CurrentDoorLock.IsDoorLockNormallyMode = _bool;
                            ModeView();
                        });
                    }
                    catch { }
                }
            };
        }
        /// <summary>
        /// 常开模式开关切换图标界面
@@ -471,7 +487,7 @@
            listLogicFl.Width = Application.GetRealWidth(1022);
            listLogicFl.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor;
            verticalRefresh.Y = Application.GetRealHeight(187);
            verticalRefresh.Y = Application.GetRealHeight(187);
            verticalRefresh.X = Application.GetRealWidth(46);
            verticalRefresh.Height = listLogicFl.Height - Application.GetRealHeight(187);//动态改动上下滑动view高度;
            verticalRefresh.Width = listLogicFl.Width - Application.GetRealWidth(46);
ZigbeeApp20200519/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs
old mode 100755 new mode 100644
@@ -599,50 +599,48 @@
        /// </summary>
        /// <param name="receiveData"></param>
        private void DoorLockDeviceReportPush(JObject receiveData)
        {
            //只有徐梅的门锁界面没有打开的情况下,才会处理这个东西
            if (ControlCommonResourse.IsDoorLockPageOpen == false && UserCenterResourse.UserInfo.AuthorityNo == 1)
            {
                var device = Common.LocalDevice.Current.GetDevice(receiveData.Value<string>("DeviceAddr"), receiveData.Value<int>("Epoint"));
                if (device.Type != DeviceType.DoorLock)
                {
                    //它不是门锁
                    return;
                }
                var info = Newtonsoft.Json.JsonConvert.DeserializeObject<DoorLockAlarmsResult>(receiveData["Data"].ToString());
                if (info.Clusterid == 257)
                {
                    //常开模式关闭
                    if (info.AlarmCode == 217 || info.AlarmCode == 219)
                    {
                        HdlThreadLogic.Current.RunThread(async () =>
                        {
                            //温居城的要网关中是否有逻辑存在
                            //参数:2-常开自动化;3-失效时间自动化
                            var result = await Shared.Phone.Device.Logic.SkipView.Exist(3, (ZigBee.Device.DoorLock)device);
                            HdlThreadLogic.Current.RunMain(() =>
                            {
                                //弹出徐梅的那个窗口
                                DoorLock.DoorLockCommonInfo.NomallyOpenModeInvalidDialog((ZigBee.Device.DoorLock)device, DoorLock.DoorLockCommonInfo.DoorLockMessType.ServicePush,
                                    result != 0 ? true : false, null);
                            });
                        });
                    }
                }
            }
            //显示有新消息的特效
            this.ShowHadNewMessageAppeal();
        }
        {
            if (UserCenterResourse.UserInfo.AuthorityNo == 1)
            {
                var device = Common.LocalDevice.Current.GetDevice(receiveData.Value<string>("DeviceAddr"), receiveData.Value<int>("Epoint"));
                if (device.Type != DeviceType.DoorLock)
                {
                    //它不是门锁
                    return;
                }
                var info = Newtonsoft.Json.JsonConvert.DeserializeObject<DoorLockAlarmsResult>(receiveData["Data"].ToString());
                if (info.Clusterid == 257)
                {
                    //216:锁上设置的常开
                    if (info.AlarmCode == 216)
                    {
                        HdlThreadLogic.Current.RunThread(async () =>
                        {
                            HdlThreadLogic.Current.RunMain(() =>
                           {
                               //更新门锁涉及的常开/常关的界面
                               if (UserCenter.DoorLock.DoorLockCommonInfo.UpdateCurrentDoorlockAction != null)
                               {
                                   UserCenter.DoorLock.DoorLockCommonInfo.UpdateCurrentDoorlockAction(device.DeviceAddr + device.DeviceEpoint, true);
                               }
                           });
                        });
                    }
                }
                //显示有新消息的特效
                this.ShowHadNewMessageAppeal();
            }
        }
        #endregion
        #region ■ 设备在线状态更新反馈_______________
        /// <summary>
        /// 设备在线状态更新反馈
        /// </summary>
        /// <param name="receiveData"></param>
        private void DeviceOnlineChangePush (JObject receiveData)
        private void DeviceOnlineChangePush(JObject receiveData)
        {
            if (this.dicDeviceEvent.Count == 0)
            {
@@ -825,35 +823,43 @@
        private void LogicExecutePush(JObject receiveData)
        {
            //显示有新消息的特效
            this.ShowHadNewMessageAppeal();
            this.ShowHadNewMessageAppeal();
            // 逻辑执行常开模式失效的情况
            if (UserCenterResourse.UserInfo.AuthorityNo == 1)
            {
                //自动化执行 常开关闭
                var data = Newtonsoft.Json.JsonConvert.DeserializeObject<LogicPushResult>(receiveData["Data"].ToString());
                if (data != null && data.ActionData != null)
                {
                    var deviceAddr = data.ActionData.MacStr;
                    var epoint = 1; //data.ActionData.Epoint;  门锁发送时是200,但是上传时要把真实的端点给网关上报
                    var device = Common.LocalDevice.Current.GetDevice(deviceAddr, epoint);
                    if (device.Type != DeviceType.DoorLock)
                    {
                        return;
                    }
            //这个东西暂时不处理
            ////只有徐梅的门锁界面没有打开的情况下,才会处理这个东西
            //if (ControlCommonResourse.IsDoorLockPageOpen == false && UserCenterResourse.UserInfo.AuthorityNo == 1)
            //{
            //    var device = Common.LocalDevice.Current.GetDevice(receiveData.Value<string>("DeviceAddr"), receiveData.Value<int>("Epoint"));
            //    if (device.Type != DeviceType.DoorLock)
            //    {
            //        return;
            //    }
            //    //自动化执行 常开关闭
            //    var data = Newtonsoft.Json.JsonConvert.DeserializeObject<LogicPushResult>(receiveData["Data"].ToString());
            //    if (data.ActionData != null && data.ActionData.Actiontype == 8
            //        && data.ActionData.PassDataString == "055704010113")
            //    {
            //        HdlThreadLogic.Current.RunMain(() =>
            //        {
            //            //弹出徐梅的那个窗口
            //            DoorLock.DoorLockCommonInfo.NomallyOpenModeInvalidDialog((ZigBee.Device.DoorLock)device, DoorLock.DoorLockCommonInfo.DoorLockMessType.ServicePush, null);
            //        });
            //    }
            //}
        }
                    if (data.ActionData.Actiontype == 8 && data.ActionData.PassDataString == "055704010113")
                    {
                        HdlThreadLogic.Current.RunThread(async () =>
                        {
                            var result = await Shared.Phone.Device.Logic.SkipView.Exist(3, (ZigBee.Device.DoorLock)device);
                            HdlThreadLogic.Current.RunMain(() =>
                            {
                                //弹出徐梅的那个窗口
                                DoorLock.DoorLockCommonInfo.NomallyOpenModeInvalidDialog((ZigBee.Device.DoorLock)device, DoorLock.DoorLockCommonInfo.DoorLockMessType.ServicePush,
                                    result != 0 ? true : false, ControlCommonResourse.UpdateDoorLockStatusAction);
                            });
                        });
                    }
                }
            }
        }
        #endregion
        #region ■ 场景触发上报_______________________
        /// <summary>
        /// 场景触发上报
        /// </summary>
ZigbeeApp20200519/Shared/Phone/UserCenter/CommonBase/Resourse/ControlCommonResourse.cs
old mode 100755 new mode 100644
@@ -67,7 +67,11 @@
        /// <summary>
        /// 徐梅的门锁界面是否是打开的状态
        /// </summary>
        public static bool IsDoorLockPageOpen = false;
        //public static bool IsDoorLockPageOpen = false;
        /// <summary>
        /// 门锁界面是否是更新状态
        /// </summary>
        public static Action<bool> UpdateDoorLockStatusAction = null;
        /// <summary>
        /// 是否是界面正在加载中(底层专用,不需要理)
        /// </summary>
ZigbeeApp20200519/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs
old mode 100755 new mode 100644
@@ -1170,6 +1170,16 @@
                removeDevice.BindMacAddr = bindDevice.BindMacAddr;
                removeDevice.BindEpoint = bindDevice.BindEpoint;
                delDevice.RemoveBindList.Add(removeDevice);
                //是亮度再次发删除6的命令
                if (currentClusterID == 8)
                {
                    var removeDevice2 = new RemoveBindListObj();
                    removeDevice2.BindCluster = 6;
                    removeDevice2.BindType = 0;
                    removeDevice2.BindMacAddr = bindDevice.BindMacAddr;
                    removeDevice2.BindEpoint = bindDevice.BindEpoint;
                    delDevice.RemoveBindList.Add(removeDevice2);
                }
            }
            else if (bindDevice.BindType == 2)
            {
ZigbeeApp20200519/Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs
@@ -15,6 +15,10 @@
        /// </summary>
        public static Action<bool> LogicAction = null;
        /// <summary>
        /// 更新当前门锁涉及的状态【主要用于门锁操作常开模式的回调】
        /// </summary>
        public static Action<string, bool> UpdateCurrentDoorlockAction = null;
        /// <summary>
        /// 网关(门锁)所在的时间
        /// </summary>
        public static DateTime DoorlockZoneTime = DateTime.Now;
ZigbeeApp20200519/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs
@@ -17,12 +17,29 @@
        public UserDoorLockPage(Room room, CommonDevice doorLock)
        {
            //徐梅的门锁界面打开(网关全局接收时使用)
            ControlCommonResourse.IsDoorLockPageOpen = true;
            //ControlCommonResourse.IsDoorLockPageOpen = true;
            this.doorLock = doorLock as ZigBee.Device.DoorLock;
            currentRoom = room;
            deviceUI = doorLock;
            BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor;
            ZbGateway.StatusList.Add(this);
            Application.RunOnMainThread(() =>
            {
                ControlCommonResourse.UpdateDoorLockStatusAction = (obj) =>
                {
                    UpdateNomallyOpenStatus();
                };
                UserCenter.DoorLock.DoorLockCommonInfo.UpdateCurrentDoorlockAction += (DoorlockKey, status) =>
                {
                    var key = doorLock.DeviceAddr + doorLock.DeviceEpoint;
                    if (DoorlockKey == key)
                    {
                        DoorLockCommonInfo.NormallyOpenModeValue(this.doorLock, status);
                        UpdateNomallyOpenStatus();
                    }
                };
            });
        }
        #region  变量申明
@@ -621,6 +638,35 @@
                }
            }
            //网关执行逻辑,常开模式失效上报
            //if (typeTag == "DoorLockAlarmsSendAlarmInform" && tempDevice != null)
            //{
            //    var doorL = (ZigBee.Device.DoorLock)tempDevice;
            //    if (doorL.DeviceAddr + doorL.DeviceEpoint == doorLock.DeviceAddr + doorLock.DeviceEpoint)
            //    {
            //        //非主人不弹这个窗口
            //        if (UserCenterResourse.UserInfo.AuthorityNo != 1)
            //        {
            //            return;
            //        }
            //        if (doorLock.IsDoorLockNormallyMode)
            //        {
            //            if (canOpenNormallyMode)
            //            {
            //                Application.RunOnMainThread(() =>
            //                {
            //                    Action<bool> action = (obj) =>
            //                    {
            //                        UpdateNomallyOpenStatus();
            //                    };
            //                    DoorLockCommonInfo.NomallyOpenModeInvalidDialog(doorLock, DoorLockCommonInfo.DoorLockMessType.ServicePush, haveLogicNormallyOpenMode, action);
            //                });
            //            }
            //        }
            //    }
            //}
            if (typeTag == "DeviceStatusReport" && tempDevice != null)
            {
                if (tempDevice != null)
@@ -687,18 +733,19 @@
                                tempRes = false;
                            }
                            DoorLockCommonInfo.NormallyOpenModeValue(doorLock, tempRes);
                            Application.RunOnMainThread(async () =>
                            {
                                var resTemp = await Shared.Phone.Device.Logic.SkipView.Exist(3, doorLock);
                                if (resTemp == 1)
                                {
                                    haveLogicNormallyOpenMode = true;
                                }
                                else if (resTemp == 0)
                                {
                                    haveLogicNormallyOpenMode = false;
                                }
                            });
                            //Application.RunOnMainThread(async () =>
                            //{
                            //var resTemp = await Shared.Phone.Device.Logic.SkipView.Exist(3, doorLock);
                            //if (resTemp == 1)
                            //{
                            //    haveLogicNormallyOpenMode = true;
                            //}
                            //else if (resTemp == 0)
                            //{
                            //    haveLogicNormallyOpenMode = false;
                            //}
                            //});
                        }
                    }
                    else
@@ -1186,7 +1233,9 @@
        public override void RemoveFromParent()
        {
            //徐梅的门锁界面关闭(网关全局接收时使用)
            ControlCommonResourse.IsDoorLockPageOpen = false;
            //ControlCommonResourse.IsDoorLockPageOpen = false;
            ControlCommonResourse.UpdateDoorLockStatusAction = null;
            UserCenter.DoorLock.DoorLockCommonInfo.UpdateCurrentDoorlockAction = null;
            if (IsDrawerLockMode)
            {
                CommonPage.Instance.IsDrawerLockMode = false;
ZigbeeApp20200519/Shared/Phone/ZigBee/Device/ZbGateway.cs
old mode 100755 new mode 100644
@@ -2758,8 +2758,8 @@
           .WithTcpServer(domain, int.Parse(port))
           .WithCredentials(connEmqUserName, connEmqPwd)
           .WithKeepAlivePeriod(TimeSpan.FromSeconds(20))
           .WithCleanSession()
           //.WithCommunicationTimeout(TimeSpan.FromSeconds(10))
           .WithCleanSession()
           //.WithCommunicationTimeout(TimeSpan.FromSeconds(10))
           .Build();
                                await DisConnectRemoteMqttClient("StartRemoteMqtt");
                                await RemoteMqttClient.ConnectAsync(options, CancellationToken.None);
@@ -3230,6 +3230,7 @@
                    UpdateDeviceInfo(tempDevice, "DeviceStatusReport");
                }
                #endregion
                #region 门锁操作事件通知
                else if (topic == gatewayID + "/" + "DoorLock/DoorLockOperatingEventNotificationCommand")
                {
@@ -3253,6 +3254,7 @@
                    }
                }
                #endregion
                #region 门锁编程事件通知
                else if (topic == gatewayID + "/" + "DoorLock/DoorLockProgrammingEventNotificationCommand")
                {