| | |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 更新设备状态 |
| | | /// A协议数据 |
| | | /// </summary> |
| | | /// <param name="updateBytes"></param> |
| | | public void UpdataGroupControlStatus(string revString, byte[] usefulBytes, bool isCloudData = false) |
| | | { |
| | | var temp = JsonConvert.DeserializeObject<AlinkFunctionStatusObj>(revString); |
| | | if (temp != null) |
| | | { |
| | | Control_Udp.ReceiveRepeatManager(temp.id, usefulBytes); |
| | | var allLocalFuntion = FunctionList.List.groupControls; |
| | | foreach (var updateTemp in temp.objects) |
| | | { |
| | | try |
| | | { |
| | | var localFunction = allLocalFuntion.Find((obj) => obj.sid == updateTemp.sid); |
| | | if (localFunction == null) |
| | | { |
| | | continue; |
| | | } |
| | | MainPage.Log($"收到数据:{revString}"); |
| | | foreach (var attr in updateTemp.status) |
| | | { |
| | | localFunction.time_stamp = temp.time_stamp; |
| | | localFunction.SetAttrState(attr.key, attr.value); |
| | | |
| | | } |
| | | |
| | | //更新界面状态 |
| | | switch (localFunction.spk) |
| | | { |
| | | case SPK.ElectricEnergy: |
| | | EnergyMainPage.UpdataStatus(localFunction); |
| | | break; |
| | | } |
| | | |
| | | HomePage.UpdataFunctionStates(localFunction); |
| | | RoomPage.UpdataStates(localFunction); |
| | | FunctionPage.UpdataStates(localFunction); |
| | | ClassificationPage.UpdataInfo(localFunction); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"A协议更新状态异常:{ex.Message}"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 更新设备状态 |
| | | /// A协议数据 |
| | | /// </summary> |
| | | public void UpdataFunctionStatus(string revString, byte[] usefulBytes, bool isCloudData = false) |
| | | { |
| | | ////test 云端连接成功时,不适用本地数据更新 |
| | |
| | | } |
| | | } |
| | | |
| | | if (SPK.MusicSpkList().Contains(localFunction.spk)) |
| | | { |
| | | MainPage.Log($"音乐收到数据:{revString}"); |
| | | |
| | | } |
| | | //if (SPK.MusicSpkList().Contains(localFunction.spk)) |
| | | //{ |
| | | // if (updateTemp.status.Count < 3) |
| | | // { |
| | | // ///是音乐功能的 |
| | | // ///上报属性少3条不做处理 |
| | | // return; |
| | | // } |
| | | //} |
| | | MainPage.Log($"收到数据:{revString}"); |
| | | foreach (var attr in updateTemp.status) |
| | | { |
| | | localFunction.time_stamp = temp.time_stamp; |