| | |
| | | this.zbGateway.ReportAction += receiveAction;
|
| | |
|
| | | //读取空调模块版本
|
| | | var result = await deviceAc.ReadACFirewareVersionAsync();
|
| | | var result = await HdlDeviceAirConditionerLogic.Current.ReadACFirewareVersionAsync(deviceAc);
|
| | | if (result == null || result.readACFirewareVersionResponData == null || result.readACFirewareVersionResponData.Status != 0)
|
| | | {
|
| | | //获取空调模块版本失败
|
| | |
| | | this.UpdateStatu = UpdateStatuMode.DeviceUpdateFail;
|
| | | this.zbGateway.ReportAction -= receiveAction;
|
| | | //发送失败给设备
|
| | | deviceAc.SendFinishAsync(1);
|
| | | HdlDeviceAirConditionerLogic.Current.SendFinishAsync(deviceAc, 1);
|
| | | return;
|
| | | }
|
| | | //发送升级通知
|
| | | var result2 = await deviceAc.UpggradeACNotificationAsync(result.readACFirewareVersionResponData.FirewareVersion, this.deviceFirmwareByte.Length);
|
| | | var result2 = await HdlDeviceAirConditionerLogic.Current.UpggradeACNotificationAsync(deviceAc, result.readACFirewareVersionResponData.FirewareVersion, this.deviceFirmwareByte.Length);
|
| | | if (result2.responseData == null)
|
| | | {
|
| | | //发送升级命令失败
|
| | |
| | | this.UpdateStatu = UpdateStatuMode.DeviceUpdateFail;
|
| | | this.zbGateway.ReportAction -= receiveAction;
|
| | | //发送失败给设备
|
| | | deviceAc.SendFinishAsync(1);
|
| | | HdlDeviceAirConditionerLogic.Current.SendFinishAsync(deviceAc, 1);
|
| | | return;
|
| | | }
|
| | | else if (result2.responseData.status == 1)
|
| | |
| | | this.UpdateStatu = UpdateStatuMode.DeviceUpdateFail;
|
| | | this.zbGateway.ReportAction -= receiveAction;
|
| | | //发送失败给设备
|
| | | deviceAc.SendFinishAsync(1);
|
| | | HdlDeviceAirConditionerLogic.Current.SendFinishAsync(deviceAc, 1);
|
| | | return;
|
| | | }
|
| | | else if (result2.responseData.status != 0)
|
| | |
| | | this.UpdateStatu = UpdateStatuMode.DeviceUpdateFail;
|
| | | this.zbGateway.ReportAction -= receiveAction;
|
| | | //发送失败给设备
|
| | | deviceAc.SendFinishAsync(1);
|
| | | HdlDeviceAirConditionerLogic.Current.SendFinishAsync(deviceAc, 1);
|
| | | return;
|
| | | }
|
| | |
|
| | |
| | | this.UpdateStatu = UpdateStatuMode.DeviceUpdateFail;
|
| | | this.zbGateway.ReportAction -= receiveAction;
|
| | | //发送失败给设备
|
| | | deviceAc.SendFinishAsync(1);
|
| | | HdlDeviceAirConditionerLogic.Current.SendFinishAsync(deviceAc, 1);
|
| | | return;
|
| | | }
|
| | | await System.Threading.Tasks.Task.Delay(1000);
|
| | |
| | | /// <summary>
|
| | | /// 执行设备升级操作
|
| | | /// </summary>
|
| | | private async void DoSetUpdateDevice(string i_offset,int i_dataLength)
|
| | | private async void DoSetUpdateDevice(string i_offset, int i_dataLength)
|
| | | {
|
| | | this.UpdateStatu = UpdateStatuMode.DeviceUpdateReady;
|
| | | //设备正在升级…
|
| | |
| | | this.UpdateStatu = UpdateStatuMode.DeviceUpdateFail;
|
| | | this.zbGateway.ReportAction -= receiveAction;
|
| | | //发送失败给设备
|
| | | deviceAc.SendFinishAsync(1);
|
| | | HdlDeviceAirConditionerLogic.Current.SendFinishAsync(deviceAc, 1);
|
| | | return;
|
| | | }
|
| | | await System.Threading.Tasks.Task.Delay(50);
|
| | |
| | | }
|
| | | }
|
| | | //发送透传数据
|
| | | var sendData = new AC.SendUpgradeData() { dataLength = i_dataLength, offset = i_offset };
|
| | | var sendData = new HdlDeviceAirConditionerLogic.SendUpgradeData() { dataLength = i_dataLength, offset = i_offset };
|
| | | sendData.databytes = listData.ToArray();
|
| | | deviceAc.UpgradeAsync(sendData);
|
| | | HdlDeviceAirConditionerLogic.Current.UpgradeAsync(deviceAc, sendData);
|
| | | }
|
| | | this.zbGateway.ReportAction -= receiveAction;
|
| | |
|
| | |
| | | this.UpdateStatuChangedEvent?.Invoke(0, Language.StringByID(R.MyInternationalizationString.uSendingFinishUpdateComand));
|
| | |
|
| | | //发送成功命令给设备
|
| | | deviceAc.SendFinishAsync(0);
|
| | | HdlDeviceAirConditionerLogic.Current.SendFinishAsync(deviceAc, 0);
|
| | |
|
| | | //等个两秒钟吧
|
| | | await System.Threading.Tasks.Task.Delay(2000);
|