| | |
| | | }
|
| | |
|
| | | /// <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>>();
|
| | |
| | | else if (topic == gatewayId + "/Scene/Exec_Respon")
|
| | | {
|
| | | this.SceneExecPush(null);
|
| | | }
|
| | | //网关接收事件
|
| | | else if (gatewayId == this.GatewayReceiveId)
|
| | | {
|
| | | this.GatewayReceiveEvent?.Invoke(topic, msgData);
|
| | | }
|
| | | }
|
| | | catch (Exception ex)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /// <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 ■ 移除设备监听_______________________
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 移除网关接收事件(只能存在一个事件)
|
| | | /// </summary>
|
| | | public void RemoveGatewayReceiveEvent()
|
| | | {
|
| | | this.GatewayReceiveEvent = null;
|
| | | this.GatewayReceiveId = null;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 一般方法___________________________
|