old mode 100755
new mode 100644
File was renamed from ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs |
| | |
| | | using System.Threading.Tasks;
|
| | | using Newtonsoft.Json.Linq;
|
| | |
|
| | | namespace Shared.Phone.UserCenter
|
| | | namespace Shared.Phone |
| | | {
|
| | | /// <summary>
|
| | | /// 设备绑定的逻辑
|
| | |
| | | //获取设备的绑定目标失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uGetDeviceBindTargetFail);
|
| | | //拼接上【网关回复超时】的Msg
|
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
|
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | |
|
| | | this.ShowErrorMsg(msg);
|
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, msg); |
| | | return null;
|
| | | }
|
| | | var listDevice = new List<CommonDevice>();
|
| | | foreach (var data in result.getAllBindResponseData.BindList)
|
| | | {
|
| | | CommonDevice deviceTemp = Common.LocalDevice.Current.GetDevice(data.BindMacAddr, data.BindEpoint);
|
| | | CommonDevice deviceTemp = HdlDeviceCommonLogic.Current.GetDevice(data.BindMacAddr, data.BindEpoint); |
| | | if (deviceTemp == null)
|
| | | {
|
| | | continue;
|
| | |
| | | addData.BindList.Add(info);
|
| | |
|
| | | //返回成功设备的时候使用
|
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
|
| | | string mainkeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device); |
| | | dicDevice[mainkeys] = device;
|
| | | }
|
| | | //执行绑定
|
| | |
| | | //绑定目标设置失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uSetBindTargetsFail);
|
| | | //拼接上【网关回复超时】的Msg
|
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
|
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | |
|
| | | this.ShowErrorMsg(msg);
|
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, msg); |
| | | return null;
|
| | | }
|
| | |
|
| | | var listSuccess = new List<CommonDevice>();
|
| | | foreach (var data in result.addedDeviceBindResponseData.BindList)
|
| | | {
|
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(data.BindMacAddr, data.BindEpoint);
|
| | | string mainkeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(data.BindMacAddr, data.BindEpoint); |
| | | if (dicDevice.ContainsKey(mainkeys) == true)
|
| | | {
|
| | | listSuccess.Add(dicDevice[mainkeys]);
|
| | |
| | | {
|
| | | //绑定目标设置失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uSetBindTargetsFail);
|
| | | this.ShowTipMsg(msg);
|
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, msg); |
| | | }
|
| | | return listSuccess;
|
| | | }
|
| | |
| | | return TemplateData.TemplateDeviceDataLogic.Current.AddDeviceBindList(addBindData, null);
|
| | | }
|
| | |
|
| | | var device = Common.LocalDevice.Current.GetDevice(addBindData.DeviceAddr, addBindData.Epoint);
|
| | | var device = HdlDeviceCommonLogic.Current.GetDevice(addBindData.DeviceAddr, addBindData.Epoint); |
| | | //获取发送的命令字符
|
| | | var sendData = this.GetAddDeviceListBindCommandText(addBindData);
|
| | | //发送
|
| | |
| | | /// </summary>
|
| | | public BindObj.AddedDeviceSingleBindResponseAllData AddDeviceSingleBindAsync(BindObj.AddSingleBindData addSingleBindData)
|
| | | {
|
| | | var device = Common.LocalDevice.Current.GetDevice(addSingleBindData.DeviceAddr, addSingleBindData.Epoint);
|
| | | var device = HdlDeviceCommonLogic.Current.GetDevice(addSingleBindData.DeviceAddr, addSingleBindData.Epoint); |
| | | //获取发送的命令字符
|
| | | var sendData = this.GetAddDeviceListSingleBindCommandText(addSingleBindData);
|
| | | //发送
|
| | |
| | | //删除绑定目标失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uDeleteBindTargetsFail);
|
| | | //拼接上【网关回复超时】的Msg
|
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
|
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | |
|
| | | this.ShowErrorMsg(msg);
|
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, msg); |
| | | return false;
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | //其他绑定目标正在删除中,请稍后再试
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uOtherBindTargetsIsDelettingPleaseWait);
|
| | | this.ShowErrorMsg(msg);
|
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, msg); |
| | | return false;
|
| | | }
|
| | | //2:未知,由节点设备反馈发送“Bind/BindResult”主题消息确定是否成功
|
| | |
| | | {
|
| | | //删除绑定目标失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uDeleteBindTargetsFail);
|
| | | this.ShowErrorMsg(msg);
|
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, msg); |
| | | return false;
|
| | | }
|
| | | else
|
| | |
| | | {
|
| | | //删除绑定目标失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uDeleteBindTargetsFail);
|
| | | this.ShowErrorMsg(msg);
|
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, msg); |
| | | return false;
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | deleteData.RemoveBindList.Add(info);
|
| | | //返回成功设备的时候使用
|
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
|
| | | string mainkeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device); |
| | | dicDevice[mainkeys] = device;
|
| | | }
|
| | | var listSuccess = new List<CommonDevice>();
|
| | |
| | | //删除绑定目标失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uDeleteBindTargetsFail);
|
| | | //拼接上【网关回复超时】的Msg
|
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
|
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | |
|
| | | this.ShowErrorMsg(msg);
|
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, msg); |
| | | return listSuccess;
|
| | | }
|
| | |
|
| | | foreach (var data in result.delDeviceBindResponseData.RemoveBindList)
|
| | | {
|
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(data.BindMacAddr, data.BindEpoint);
|
| | | string mainkeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(data.BindMacAddr, data.BindEpoint); |
| | | //0:成功 1:设备不在绑定列表中 ,也可以代表成功
|
| | | if (data.Result == 0 || data.Result == 1)
|
| | | {
|
| | |
| | | else if (data.Result == 3)
|
| | | {
|
| | | //设备名称 其他绑定目标正在删除中,请稍后再试
|
| | | string msg = Common.LocalDevice.Current.GetDeviceEpointName(dicDevice[mainkeys]) + "\r\n";
|
| | | string msg = HdlDeviceCommonLogic.Current.GetDeviceEpointName(dicDevice[mainkeys]) + "\r\n"; |
| | | msg += Language.StringByID(R.MyInternationalizationString.uOtherBindTargetsIsDelettingPleaseWait);
|
| | | this.ShowErrorMsg(msg);
|
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, msg); |
| | | }
|
| | | //2:未知,由节点设备反馈发送“Bind/BindResult”主题消息确定是否成功
|
| | | else if (data.Result == 2)
|
| | |
| | | if (result.removeBindResultResponseData == null)
|
| | | {
|
| | | //设备名称 删除绑定目标失败
|
| | | string msg = Common.LocalDevice.Current.GetDeviceEpointName(dicDevice[mainkeys]) + "\r\n";
|
| | | string msg = HdlDeviceCommonLogic.Current.GetDeviceEpointName(dicDevice[mainkeys]) + "\r\n"; |
| | | msg += Language.StringByID(R.MyInternationalizationString.uDeleteBindTargetsFail);
|
| | | this.ShowErrorMsg(msg);
|
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, msg); |
| | | }
|
| | | else
|
| | | {
|
| | |
| | | else
|
| | | {
|
| | | //设备名称 删除绑定目标失败
|
| | | string msg = Common.LocalDevice.Current.GetDeviceEpointName(dicDevice[mainkeys]) + "\r\n";
|
| | | string msg = HdlDeviceCommonLogic.Current.GetDeviceEpointName(dicDevice[mainkeys]) + "\r\n"; |
| | | msg += Language.StringByID(R.MyInternationalizationString.uDeleteBindTargetsFail);
|
| | | this.ShowErrorMsg(msg);
|
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, msg); |
| | | }
|
| | | }
|
| | | }
|
| | |
| | | {
|
| | | return TemplateData.TemplateDeviceDataLogic.Current.DeleteDeviceBindList(delDeviceBindData);
|
| | | }
|
| | | var device = Common.LocalDevice.Current.GetDevice(delDeviceBindData.DeviceAddr, delDeviceBindData.Epoint);
|
| | | var device = HdlDeviceCommonLogic.Current.GetDevice(delDeviceBindData.DeviceAddr, delDeviceBindData.Epoint); |
| | | //获取需要发送的数据
|
| | | var sendData = this.GetDeleteDeviceBindCommandText(delDeviceBindData);
|
| | | //发送命令
|
| | |
| | | if (topic == errorTopic)
|
| | | {
|
| | | var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
|
| | | reResult.ErrorMsg = HdlCheckLogic.Current.CheckCommonErrorCode(temp.Error);
|
| | | reResult.ErrorMsg = HdlCheckLogic.Current.CheckGatewayErrorCode(temp.Error); |
| | | }
|
| | | //如果是指定的主题
|
| | | for (int i = 0; i < listReceiptTopic.Count; i++)
|
| | |
| | | var data = new JObject { { "Undivided", 0 }, { "AttributeId", 6533 }, { "AttributeDataType", 33 }, { "AttributeData", (int)value } }; |
| | | jObject.Add("Data", data); |
| | | return jObject.ToString(); |
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 一般方法___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 显示错误信息窗口
|
| | | /// </summary>
|
| | | /// <param name="msg"></param>
|
| | | private void ShowErrorMsg(string msg)
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | var contr = new ShowMsgControl(ShowMsgType.Error, msg);
|
| | | contr.Show();
|
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 显示Tip信息窗口
|
| | | /// </summary>
|
| | | /// <param name="msg"></param>
|
| | | private void ShowTipMsg(string msg)
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | var contr = new UserCenter.ShowMsgControl(ShowMsgType.Tip, msg);
|
| | | contr.Show();
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|