| | |
| | | //如果当前是虚拟住宅
|
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | return ModelData.DeviceModelDataLogic.Current.GetPanelColorInfo(device, keyNum);
|
| | | //这里特殊,这里是按回路分的
|
| | | return TemplateData.TemplateDeviceDataLogic.Current.GetPanelColorInfo(device.DeviceAddr, device.DeviceEpoint, keyNum);
|
| | | }
|
| | | //发送数据 keyNum转为16进制 范围:01~10
|
| | | var passData = "0504040101" + Convert.ToString((int)keyNum, 16).ToUpper().PadLeft(2, '0');
|
| | |
| | | //如果当前是虚拟住宅
|
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | return ModelData.DeviceModelDataLogic.Current.SetPanelColorInfo(device, keyColorData, keyNumStatus, "ZbDataPassthrough");
|
| | | //这个也是特殊,按回路来分
|
| | | return TemplateData.TemplateDeviceDataLogic.Current.SetPanelColorInfo(device.DeviceAddr, device.DeviceEpoint, keyColorData, keyNumStatus, null);
|
| | | }
|
| | | //获取配置按键指示灯颜色的命令字符
|
| | | var sendData = this.GetPanelColorCommandText(device.DeviceAddr, keyColorData, keyNumStatus);
|
| | |
| | | var tempD = new CommonDevice.ResponseData();
|
| | | tempD.command = data[12].ToString() + data[13].ToString() + data[10].ToString() + data[11].ToString();
|
| | | tempD.status = Convert.ToInt32(data[14].ToString() + data[15].ToString(), 16);
|
| | |
|
| | | //添加缓存
|
| | | TemplateData.TemplateDeviceDataLogic.Current.SetPanelColorInfo(device.DeviceAddr, device.DeviceEpoint, keyColorData, keyNumStatus, result.JsonData[0]);
|
| | |
|
| | | return new CommonDevice.ResponseAllData { responseData = tempD };
|
| | | }
|
| | |
|
| | |
| | | //如果当前是虚拟住宅
|
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | return ModelData.DeviceModelDataLogic.Current.GetDeviceLightSettion(device);
|
| | | return TemplateData.TemplateDeviceDataLogic.Current.GetDeviceLightSettion(device.DeviceAddr, 200);
|
| | | }
|
| | | //获取发送的命令字符
|
| | | var passData = "050604010101";
|
| | |
| | | //如果当前是虚拟住宅
|
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | return ModelData.DeviceModelDataLogic.Current.SetDeviceLightSettion(device, directionsLevel, backlightLevel, "ZbDataPassthrough");
|
| | | return TemplateData.TemplateDeviceDataLogic.Current.SetDeviceLightSettion(device.DeviceAddr, 200, directionsLevel, backlightLevel, null);
|
| | | }
|
| | | //获取修改面板的亮度调节的命令字符
|
| | | var sendData = this.GetPanelLevelCommadText(device.DeviceAddr, directionsLevel, backlightLevel);
|
| | |
| | | }
|
| | |
|
| | | //修改缓存
|
| | | ModelData.DeviceModelDataLogic.Current.SetDeviceLightSettion(device, directionsLevel, backlightLevel, "ZbDataPassthrough");
|
| | | TemplateData.TemplateDeviceDataLogic.Current.SetDeviceLightSettion(device.DeviceAddr, 200, directionsLevel, backlightLevel, result.JsonData[0]);
|
| | |
|
| | | return true;
|
| | | }
|
| | |
| | | }
|
| | | #endregion
|
| | |
|
| | | #region ■ 校正温度___________________________ |
| | | /// <summary>
|
| | | /// 校正温度
|
| | | /// </summary>
|
| | | /// <param name="device">设备对象</param>
|
| | | /// <param name="correctValue">校正温度值</param>
|
| | | /// <param name="direction">补偿方向0不补偿 1:正向;2:反向</param>
|
| | | /// <param name="type">0 温度 ;1 湿度</param>
|
| | | /// <returns></returns> |
| | | public async Task<bool> CorrectTemperature(CommonDevice device, double correctValue, int direction = 0, int type = 0)
|
| | | {
|
| | | //借用它的函t
|
| | | var panel = new Panel();
|
| | | panel.DeviceAddr = device.DeviceAddr;
|
| | | panel.DeviceEpoint = 200;
|
| | | panel.CurrentGateWayId = device.CurrentGateWayId;
|
| | |
|
| | | var result = await panel.CorrectTemperature(correctValue, direction, type);
|
| | | panel = null;
|
| | |
|
| | | //共通错误检测
|
| | | string error = HdlCheckLogic.Current.CheckCommonErrorCode(result);
|
| | | if (error != null)
|
| | | {
|
| | | this.ShowErrorMsg(error);
|
| | | return false;
|
| | | }
|
| | |
|
| | | if (result == null || result.responseData == null)
|
| | | {
|
| | | //矫正温度失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.DataCorrectionFailed);
|
| | | //拼接上【网关回复超时】的Msg
|
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
|
| | |
|
| | | this.ShowTipMsg(msg);
|
| | | return false;
|
| | | }
|
| | | return true;
|
| | | }
|
| | | #endregion |
| | |
|
| | | #region ■ 节能模式___________________________
|
| | | /// <summary>
|
| | | /// 获取设备节能模式的配置状态(ui叫节能模式)
|
| | |
| | | //如果当前住宅是虚拟住宅
|
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | return ModelData.DeviceModelDataLogic.Current.GetDeviceEnergyConservationMode(device);
|
| | | return TemplateData.TemplateDeviceDataLogic.Current.GetDeviceEnergyConservationMode(device.DeviceAddr, 200);
|
| | | }
|
| | | //发送命令
|
| | | string passData = "050804010101";
|
| | | var jObject = new JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } };
|
| | | var data = new JObject { { "PassData", passData } };
|
| | | jObject.Add("Data", data);
|
| | | var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway2(device, jObject.ToString(), "0409", 16, 9);
|
| | | //16:旧版本 18:新版本
|
| | | var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway2(device, jObject.ToString(), "0409", 16, 9, new List<int> { 18 });
|
| | | if (result.ErrorMsg != null)
|
| | | {
|
| | | this.ShowTipMsg(result.ErrorMsg);
|
| | |
| | | {
|
| | | energyInfo.enable = false;
|
| | | }
|
| | | energyInfo.time = Convert.ToInt32(result.ReceiptData[12].ToString() + result.ReceiptData[13].ToString(), 16);
|
| | | energyInfo.level = Convert.ToInt32(result.ReceiptData[14].ToString() + result.ReceiptData[15].ToString(), 16);
|
| | |
|
| | | //新版本:07 0904 11 04 01 3C00 32
|
| | | if (result.ReceiptData.Length == 18)
|
| | | {
|
| | | energyInfo.time = Convert.ToInt32(result.ReceiptData[14].ToString() + result.ReceiptData[15].ToString() +
|
| | | result.ReceiptData[12].ToString() + result.ReceiptData[13].ToString(), 16);
|
| | |
|
| | | energyInfo.level = Convert.ToInt32(result.ReceiptData[16].ToString() + result.ReceiptData[17].ToString(), 16); |
| | | }
|
| | | //旧版本:07 0904 11 03 01 3C 32
|
| | | else
|
| | | {
|
| | | energyInfo.time = Convert.ToInt32(result.ReceiptData[12].ToString() + result.ReceiptData[13].ToString(), 16);
|
| | | energyInfo.level = Convert.ToInt32(result.ReceiptData[14].ToString() + result.ReceiptData[15].ToString(), 16);
|
| | | }
|
| | | return energyInfo;
|
| | | }
|
| | |
|
| | |
| | | //如果当前是虚拟住宅
|
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | return ModelData.DeviceModelDataLogic.Current.SetDeviceEnergyConservationMode(device, modeEnable, modeTime, level, "ZbDataPassthrough");
|
| | | return TemplateData.TemplateDeviceDataLogic.Current.SetDeviceEnergyConservationMode(device.DeviceAddr, 200, modeEnable, modeTime, level, null);
|
| | | }
|
| | | //获取设置设备的节能模式的命令字符
|
| | | var sendData = this.GetDeviceEnergyConservationModeCommandText(device.DeviceAddr, modeEnable, modeTime, level);
|
| | |
| | | }
|
| | |
|
| | | //修改缓存
|
| | | ModelData.DeviceModelDataLogic.Current.SetDeviceEnergyConservationMode(device, modeEnable, modeTime, level, "ZbDataPassthrough");
|
| | | TemplateData.TemplateDeviceDataLogic.Current.SetDeviceEnergyConservationMode(device.DeviceAddr, 200, modeEnable, modeTime, level, result.JsonData[0]);
|
| | |
|
| | | return true;
|
| | | }
|
| | |
| | | /// </summary>
|
| | | /// <param name="panel">干接点对象</param>
|
| | | /// <returns></returns>
|
| | | public async Task<List<CommonDevice.AttributeDataObj>> GetDryContactConfigureInfo(CommonDevice device)
|
| | | public List<CommonDevice.AttributeDataObj> GetDryContactConfigureInfo(CommonDevice device)
|
| | | {
|
| | | //借用它的函数
|
| | | var panel = new Panel();
|
| | | panel.DeviceAddr = device.DeviceAddr;
|
| | | panel.DeviceEpoint = device.DeviceEpoint;
|
| | | panel.CurrentGateWayId = device.CurrentGateWayId;
|
| | |
|
| | | var result = HdlDeviceBindLogic.Current.ReadPanelConfigureInfoAsync(panel);
|
| | | panel = null;
|
| | | var result = HdlDeviceBindLogic.Current.ReadPanelConfigureInfoAsync(device);
|
| | |
|
| | | //共通错误检测
|
| | | string error = HdlCheckLogic.Current.CheckCommonErrorCode(result);
|
| | |
| | | //如果是虚拟住宅
|
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | return ModelData.DeviceModelDataLogic.Current.GetPanelVibrationInfo(device);
|
| | | return TemplateData.TemplateDeviceDataLogic.Current.GetPanelVibrationInfo(device.DeviceAddr, 200);
|
| | | }
|
| | | //发送数据
|
| | | var jObject = new Newtonsoft.Json.Linq.JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } };
|
| | |
| | | //如果是虚拟住宅
|
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | return ModelData.DeviceModelDataLogic.Current.SetPanelVibrationInfo(device, datainfo, "ClientDataPassthrough");
|
| | | return TemplateData.TemplateDeviceDataLogic.Current.SetPanelVibrationInfo(device.DeviceAddr, 200, datainfo, null);
|
| | | }
|
| | | //获取编辑面板震动功能的命令字符
|
| | | var sendData = this.GetPanelVibrationCommandText(device.DeviceAddr, datainfo);
|
| | |
| | | this.ShowTipMsg(errorMsg);
|
| | | return false;
|
| | | }
|
| | | //添加缓存
|
| | | TemplateData.TemplateDeviceDataLogic.Current.SetPanelVibrationInfo(device.DeviceAddr, 200, datainfo, result.JsonData[0]);
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | |
| | | /// </summary>
|
| | | private void SaveDryContactFunctionToLocaltion()
|
| | | {
|
| | | var file = Newtonsoft.Json.JsonConvert.SerializeObject(dicDryContactFunction);
|
| | |
|
| | | var bytes = System.Text.Encoding.UTF8.GetBytes(file);
|
| | | Common.Global.WriteFileByBytesByHomeId(DirNameResourse.DryContactFunctionFile, bytes);
|
| | | HdlFileLogic.Current.SaveFileContent(DirNameResourse.DryContactFunctionFile, dicDryContactFunction);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | /// </summary>
|
| | | private void LoadDryContactFunctionFromLocaltion()
|
| | | {
|
| | | if (Common.Global.IsExistsByHomeId(DirNameResourse.DryContactFunctionFile) == false)
|
| | | this.dicDryContactFunction = new Dictionary<string, DryContactFunctionInfo>();
|
| | | byte[] filebyte = HdlFileLogic.Current.ReadFileByteContent(DirNameResourse.DryContactFunctionFile);
|
| | | if (filebyte == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | byte[] filebyte = Common.Global.ReadFileByHomeId(DirNameResourse.DryContactFunctionFile);
|
| | | string strvalue = System.Text.Encoding.UTF8.GetString(filebyte);
|
| | | this.dicDryContactFunction = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, DryContactFunctionInfo>>(strvalue);
|
| | | }
|