old mode 100644
new mode 100755
| | |
| | | TemplateData.TemplateDeviceDataLogic.Current.AddDeviceBindList(addBindData, result.JsonData[0]);
|
| | | var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<BindObj.AddedDeviceBindResponseData>(result.ReceiptData);
|
| | | return new BindObj.AddedDeviceBindResponseAllData() { addedDeviceBindResponseData = tempData };
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 获取添加设备绑定的命令字符
|
| | | /// </summary>
|
| | |
| | | ///设备绑定【一对一 绑定,一个按键回路只能绑定一个设备】
|
| | | /// </summary>
|
| | | public BindObj.AddedDeviceSingleBindResponseAllData AddDeviceSingleBindAsync(BindObj.AddSingleBindData addSingleBindData)
|
| | | { |
| | | {
|
| | | var device = Common.LocalDevice.Current.GetDevice(addSingleBindData.DeviceAddr, addSingleBindData.Epoint);
|
| | | //获取发送的命令字符
|
| | | var sendData = this.GetAddDeviceListSingleBindCommandText(addSingleBindData);
|
| | |
| | | if (result.ErrorMsg != null || result.ErrorMsgDiv == 0)
|
| | | {
|
| | | return null;
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<BindObj.AddedDeviceSingleBindResponseData>(result.ReceiptData);
|
| | | return new BindObj.AddedDeviceSingleBindResponseAllData() { addedDeviceSingleBindResponseData = tempData };
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 获取添加设备绑定的命令字符
|
| | | /// </summary>
|
| | | /// <param name="addBindData"></param>
|
| | | /// <returns></returns>
|
| | | public string GetAddDeviceListSingleBindCommandText(BindObj.AddSingleBindData addSingleBindData)
|
| | | { |
| | | {
|
| | | var jObject = new JObject { { "DeviceAddr", addSingleBindData.DeviceAddr }, { "Epoint", addSingleBindData.Epoint }, { "Cluster_ID", 0 }, { "Command", 5020 } };
|
| | | var data = new JObject { }; |
| | | var bindClusterList = new JArray { }; |
| | | var data = new JObject { };
|
| | | var bindClusterList = new JArray { };
|
| | | foreach (var cluster in addSingleBindData.BindClusterList)
|
| | | { |
| | | {
|
| | | bindClusterList.Add(cluster);
|
| | | } |
| | | if (addSingleBindData.BindType == 0) |
| | | { |
| | | data = new JObject { { "BindName", addSingleBindData.BindName }, { "BindType", addSingleBindData.BindType }, { "BindClusterList", bindClusterList }, { "BindMacAddr", addSingleBindData.BindMacAddr }, { "BindEpoint", addSingleBindData.BindEpoint } }; |
| | | } |
| | | else if (addSingleBindData.BindType == 1) |
| | | { |
| | | data = new JObject { { "BindName", addSingleBindData.BindName }, { "BindType", addSingleBindData.BindType }, { "BindClusterList", bindClusterList }, { "BindScenesId", addSingleBindData.BindScenesId } }; |
| | | |
| | | }
|
| | | if (addSingleBindData.BindType == 0)
|
| | | {
|
| | | data = new JObject { { "BindName", addSingleBindData.BindName }, { "BindType", addSingleBindData.BindType }, { "BindClusterList", bindClusterList }, { "BindMacAddr", addSingleBindData.BindMacAddr }, { "BindEpoint", addSingleBindData.BindEpoint } };
|
| | | }
|
| | | else if (addSingleBindData.BindType == 1)
|
| | | {
|
| | | data = new JObject { { "BindName", addSingleBindData.BindName }, { "BindType", addSingleBindData.BindType }, { "BindClusterList", bindClusterList }, { "BindScenesId", addSingleBindData.BindScenesId } };
|
| | |
|
| | | }
|
| | | jObject.Add("Data", data);
|
| | | return jObject.ToString();
|