HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2020-10-12 dc6493db59dcb0893eac50b72122f94c24056b3f
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs
@@ -33,6 +33,14 @@
        }
        /// <summary>
        /// 网关接收事件(参数1:主题 参数2:推送消息)
        /// </summary>
        private Action<string, string> GatewayReceiveEvent = null;
        /// <summary>
        /// 接收网关的id
        /// </summary>
        private string GatewayReceiveId = null;
        /// <summary>
        /// 设备推送事件集合
        /// </summary>
        private Dictionary<string, Action<CommonDevice>> dicDeviceEvent = new Dictionary<string, Action<CommonDevice>>();
@@ -194,6 +202,11 @@
                else if (topic == gatewayId + "/Scene/Exec_Respon")
                {
                    this.SceneExecPush(null);
                }
                //网关接收事件
                else if (gatewayId == this.GatewayReceiveId)
                {
                    this.GatewayReceiveEvent?.Invoke(topic, msgData);
                }
            }
            catch (Exception ex)
@@ -1115,6 +1128,18 @@
            }
        }
        /// <summary>
        /// 添加网关接收事件(action只能存在一个,与AddAttributeEvent不共存,AddAttributeEvent优先)
        /// </summary>
        /// <param name="i_gatewayId">网关id</param>
        /// <param name="action">只能存在一个action (参数1:主题 参数2:推送消息)</param>
        public void AddGatewayReceiveEvent(string i_gatewayId, Action<string, string> action)
        {
            //添加事件
            this.GatewayReceiveEvent = action;
            this.GatewayReceiveId = i_gatewayId;
        }
        #endregion
        #region ■ 移除设备监听_______________________
@@ -1158,6 +1183,15 @@
            }
        }
        /// <summary>
        /// 移除网关接收事件(只能存在一个事件)
        /// </summary>
        public void RemoveGatewayReceiveEvent()
        {
            this.GatewayReceiveEvent = null;
            this.GatewayReceiveId = null;
        }
        #endregion
        #region ■ 一般方法___________________________