| | |
| | | public List<Scene.GetSceneDeviceListInfo> SceneDeviceList = new List<Scene.GetSceneDeviceListInfo>(); |
| | | |
| | | /// <summary> |
| | | /// 网关中逻辑列表 |
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public static List<Logic.GetLogicInfoResponseData> LogicList = new List<Logic.GetLogicInfoResponseData>(); |
| | | |
| | | /// <summary> |
| | | /// 网关中hdl私有按键绑定列表 |
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | |
| | | public static readonly System.Collections.Generic.List<IStatus> StatusList = new System.Collections.Generic.List<IStatus>(); |
| | | |
| | | /// <summary> |
| | | /// 设备状态更新 |
| | | /// </summary> |
| | | /// <param name="commonDevice">Common device.</param> |
| | | public static void UpdateDeviceStatus(CommonDevice commonDevice) |
| | | { |
| | | if (commonDevice == null) |
| | | { |
| | | return; |
| | | } |
| | | for (int i = 0; i < StatusList.Count; i++) |
| | | { |
| | | StatusList[i].Changed(commonDevice); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设备信息变化 |
| | | /// <para>type:如果为 DeviceInComingRespon:设备新上报</para> |
| | | /// <para>type:如果为 IASInfoReport:RemoveDeviceRespon</para> |
| | |
| | | AllowRemoteCtrl = false;
|
| | | return;
|
| | | } |
| | | //虽然不知道对挤下线那一块有没有用,不过先这么弄 |
| | | await System.Threading.Tasks.Task.Delay(1500); |
| | | |
| | | var responseData = jobject["ResponseData"]; |
| | | if (responseData != null) |
| | | { |
| | |
| | | gwa.ReportAction("DeviceInComingRespon", tempDevice.getNewDeviceInfo);
|
| | | }
|
| | | UpdateDeviceInfo(tempDevice, "DeviceInComingRespon");
|
| | | UpdateDeviceStatus(gwa); |
| | | } |
| | | #endregion |
| | | #region 设备在线状态更新反馈 |
| | |
| | | if (infoTempDevice == null)
|
| | | {
|
| | | gwa.DeviceList.Add(tempDevice);
|
| | | UpdateDeviceStatus(tempDevice);
|
| | | UpdateDeviceInfo(tempDevice, "OnlineStatusChange");
|
| | | }
|
| | | else
|
| | |
| | | infoTempDevice.DeviceInfo.IsOnline = infoTempDevice.IsOnline;
|
| | | }
|
| | | UpdateDeviceInfo(infoTempDevice, "OnlineStatusChange");
|
| | | UpdateDeviceStatus(infoTempDevice);
|
| | | } |
| | | } |
| | | #endregion |
| | |
| | | }
|
| | | else
|
| | | {
|
| | | UpdateDeviceStatus(tempDevice);
|
| | | UpdateDeviceInfo(tempDevice, "RemoveDeviceRespon");
|
| | | if (tempDevice.removeDeviceResponseData.Result == 0)
|
| | | {
|
| | |
| | | |
| | | var tempDevice = new CommonDevice { DeviceID = deviceID, DeviceAddr = deviceAddr, DeviceEpoint = tempEpoint, DataID = dataId };
|
| | | tempDevice.DeviceStatusReport = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.DeviceStatusReportData>(jobject["Data"].ToString());
|
| | | UpdateDeviceStatus(tempDevice);
|
| | | UpdateDeviceInfo(tempDevice, "DeviceStatusReport"); |
| | | } |
| | | #endregion |
| | |
| | | DebugPrintLog("DoorLockProgrammingEventNotificationCommand已经通知"); |
| | | gwa.ReportAction("DoorLockProgrammingEventNotificationCommand", doorLock); |
| | | } |
| | | UpdateDeviceStatus(doorLock); |
| | | UpdateDeviceInfo(doorLock, "DoorLockProgrammingEventNotificationCommand"); |
| | | break; |
| | | } |
| | |
| | | DebugPrintLog("DoorLockProgrammingEventNotificationCommand已经通知"); |
| | | gwa.ReportAction("DoorLockProgrammingEventNotificationCommand", doorLock); |
| | | } |
| | | UpdateDeviceStatus(doorLock); |
| | | UpdateDeviceInfo(doorLock, "DoorLockProgrammingEventNotificationCommand"); |
| | | break; |
| | | } |
| | |
| | | //ias.Save(); |
| | | gwa.ReportAction("IASInfoReport", ias.iASInfo); |
| | | } |
| | | |
| | | UpdateDeviceStatus(ias); |
| | | UpdateDeviceInfo(ias, "IASInfoReport"); |
| | | break; |
| | | } |
| | |
| | | #region 逻辑被调用反馈 |
| | | else if (topic == gatewayID + "/" + "Logic/Execute_Respon") |
| | | { |
| | | var logic = new Logic() { DataID = jobject.Value<int>("Data_ID"), GateWayId = gwa.getGatewayBaseInfo.gwID }; |
| | | logic.logicExecuteRespo = Newtonsoft.Json.JsonConvert.DeserializeObject<Logic.ExecuteResponse>(jobject["Data"].ToString()); |
| | | //var logic = new Logic() { DataID = jobject.Value<int>("Data_ID"), GateWayId = gwa.getGatewayBaseInfo.gwID }; |
| | | //logic.logicExecuteRespo = Newtonsoft.Json.JsonConvert.DeserializeObject<Logic.ExecuteResponse>(jobject["Data"].ToString()); |
| | | |
| | | if (logic.logicExecuteRespo == null) |
| | | { |
| | | return; |
| | | } |
| | | //上报类型通知 |
| | | if (gwa.ReportAction != null) |
| | | { |
| | | DebugPrintLog("LogicExecuteReport已经通知"); |
| | | gwa.ReportAction("LogicExecuteReport", logic.logicExecuteRespo); |
| | | } |
| | | //if (logic.logicExecuteRespo == null) |
| | | //{ |
| | | // return; |
| | | //} |
| | | ////上报类型通知 |
| | | //if (gwa.ReportAction != null) |
| | | //{ |
| | | // DebugPrintLog("LogicExecuteReport已经通知"); |
| | | // gwa.ReportAction("LogicExecuteReport", logic.logicExecuteRespo); |
| | | //} |
| | | } |
| | | #endregion |
| | | #region 时间点条件推迟执行 |
| | | else if (topic == gatewayID + "/" + "Logic/TimingWillArrive") |
| | | { |
| | | var logic = new Logic() { DataID = jobject.Value<int>("Data_ID"), GateWayId = gwa.getGatewayBaseInfo.gwID }; |
| | | logic.timingWillArriveData = Newtonsoft.Json.JsonConvert.DeserializeObject<Logic.TimingWillArriveData>(jobject["Data"].ToString()); |
| | | //var logic = new Logic() { DataID = jobject.Value<int>("Data_ID"), GateWayId = gwa.getGatewayBaseInfo.gwID }; |
| | | //logic.timingWillArriveData = Newtonsoft.Json.JsonConvert.DeserializeObject<Logic.TimingWillArriveData>(jobject["Data"].ToString()); |
| | | |
| | | if (logic.timingWillArriveData == null) |
| | | { |
| | | return; |
| | | } |
| | | //上报类型通知 |
| | | if (gwa.ReportAction != null) |
| | | { |
| | | DebugPrintLog("TimingWillArrive已经通知"); |
| | | gwa.ReportAction("TimingWillArrive", logic.timingWillArriveData); |
| | | } |
| | | //if (logic.timingWillArriveData == null) |
| | | //{ |
| | | // return; |
| | | //} |
| | | ////上报类型通知 |
| | | //if (gwa.ReportAction != null) |
| | | //{ |
| | | // DebugPrintLog("TimingWillArrive已经通知"); |
| | | // gwa.ReportAction("TimingWillArrive", logic.timingWillArriveData); |
| | | //} |
| | | } |
| | | #endregion |
| | | #region 模式安防动作被最终激活时发送报警信息 |