Merge remote-tracking branch 'origin/dev-tzy' into DEV_GXC
| | |
| | | 226=确认删除按键模式及{0}清空所有目标 |
| | | 227=清空所有目标 |
| | | 228=确认 |
| | | 229=分享成功 |
| | | 229=分配成功 |
| | | 230=确定要将该账户解冻? |
| | | 548=提醒设置 |
| | | 550=新增用户 |
| | |
| | | |
| | | |
| | | 5097=取消 |
| | | 5098=确认 |
| | | 5098=确定 |
| | | 5099=提示 |
| | | 5100=逻辑列表 |
| | | 5101=无 |
| | |
| | | 5138=时间条件 |
| | | 5139=条件 |
| | | 5140=推送设置 |
| | | 5141=推送开关 |
| | | 5141=推送消息 |
| | | 5142=自定义推送 |
| | | 5143=日出前 |
| | | 5144=日出后 |
| | |
| | | 5266=布防 |
| | | 5267=请选择布防或撤防为条件 |
| | | 5268=请选择安防类型 |
| | | 5269=有人 |
| | | 5269=检测有人时 |
| | | 5270=无人 |
| | | 5271=开启 |
| | | 5272=关闭 |
| | |
| | | 5280=立即执行 |
| | | 5281=时间范围 |
| | | 5282=自定义房间 |
| | | 5283=设置周期 |
| | | 5283=生效时间 |
| | | 5284=自动化 |
| | | 5285=自动化名称 |
| | | 5286=如果 |
| | |
| | | 5370=请选择用户,否则无法执行下一步. |
| | | 5371=请选择场景,否则无法执行下一步. |
| | | 5372=请选择安防模式,否则无法执行下一步. |
| | | 5373=自动化已执行. |
| | | 5373=已执行. |
| | | 5374=添加传感器 |
| | | 5375=添加开关/灯光 |
| | | 5376=应用 |
| | | 5377=没有自动化{\r\n} 请点击右上角添加 |
| | | 5378=推送内容不能为空. |
| | | 5379=暂无门锁联动事件{\r\n} 请点击右上角添加 |
| | | |
| | | |
| | | |
| | |
| | | 15920=邮箱地址 |
| | | 15921=请输入您的邮箱地址 |
| | | 15922=提交 |
| | | 15923=提交成功,感谢您的意见 |
| | | 15923=您的反馈已成功提交 |
| | | 15924=上传 |
| | | 15925=自动备份 |
| | | 15926=今日提交次数已上限 |
| | |
| | | 16058=我的家 |
| | | 16059=长按“我的家”{0}可切换我的住宅 |
| | | 16060=办公室 |
| | | 16061=电机数据异常,请重置电机 |
| | | 16062=获取空调摆风状态失败 |
| | | 16063=设置空调摆风失败 |
| | | |
| | | ;★★★★下面这些是接口的返回信息翻译,从18000开始★★★★
|
| | | 18004=指定网关已经被绑定
|
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.home" android:versionCode="2019123101" android:installLocation="auto" android:versionName="1.0.19123101"> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.home" android:versionCode="2020010701" android:installLocation="auto" android:versionName="1.0.20010701"> |
| | | <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="26" /> |
| | | <permission android:name="com.hdl.home.permission.JPUSH_MESSAGE" android:protectionLevel="signature" /> |
| | | <uses-permission android:name="android.permission.WAKE_LOCK" /> |
| | |
| | | 226=确认删除按键模式及{0}清空所有目标 |
| | | 227=清空所有目标 |
| | | 228=确认 |
| | | 229=分享成功 |
| | | 229=分配成功 |
| | | 230=确定要将该账户解冻? |
| | | 548=提醒设置 |
| | | 550=新增用户 |
| | |
| | | |
| | | |
| | | 5097=取消 |
| | | 5098=确认 |
| | | 5098=确定 |
| | | 5099=提示 |
| | | 5100=逻辑列表 |
| | | 5101=无 |
| | |
| | | 5138=时间条件 |
| | | 5139=条件 |
| | | 5140=推送设置 |
| | | 5141=推送开关 |
| | | 5141=推送消息 |
| | | 5142=自定义推送 |
| | | 5143=日出前 |
| | | 5144=日出后 |
| | |
| | | 5266=布防 |
| | | 5267=请选择布防或撤防为条件 |
| | | 5268=请选择安防类型 |
| | | 5269=有人 |
| | | 5269=检测有人时 |
| | | 5270=无人 |
| | | 5271=开启 |
| | | 5272=关闭 |
| | |
| | | 5280=立即执行 |
| | | 5281=时间范围 |
| | | 5282=自定义房间 |
| | | 5283=设置周期 |
| | | 5283=生效时间 |
| | | 5284=自动化 |
| | | 5285=自动化名称 |
| | | 5286=如果 |
| | |
| | | 5370=请选择用户,否则无法执行下一步. |
| | | 5371=请选择场景,否则无法执行下一步. |
| | | 5372=请选择安防模式,否则无法执行下一步. |
| | | 5373=自动化已执行. |
| | | 5373=已执行. |
| | | 5374=添加传感器 |
| | | 5375=添加开关/灯光 |
| | | 5376=应用 |
| | | 5377=没有自动化{\r\n} 请点击右上角添加 |
| | | 5378=推送内容不能为空. |
| | | 5379=暂无门锁联动事件{\r\n} 请点击右上角添加 |
| | | |
| | | |
| | | |
| | |
| | | 11001=场景 |
| | | 11002=自动化 |
| | | |
| | | 11010=没有功能 {\r\n} 请在个人中心中--设备管理处添加 |
| | | 11010=没有功能 {\r\n} 请在个人中心--设备管理处添加 |
| | | 11011=编辑 |
| | | 11012=设置功能 |
| | | 11012=功能设置 |
| | | 11013=信息编辑 |
| | | 11014=功能名称 |
| | | 11015=所属区域 |
| | |
| | | 11034=确定要移除该功能? |
| | | 11035=添加功能 |
| | | 11036=添加延时 |
| | | |
| | | 11037=空调模式为空,请先配置 |
| | | |
| | | |
| | | 12100=未知设备 |
| | |
| | | 15920=邮箱地址 |
| | | 15921=请输入您的邮箱地址 |
| | | 15922=提交 |
| | | 15923=提交成功,感谢您的意见 |
| | | 15923=您的反馈已成功提交 |
| | | 15924=上传 |
| | | 15925=自动备份 |
| | | 15926=今日提交次数已上限 |
| | |
| | | 16058=我的家 |
| | | 16059=长按“我的家”{0}可切换我的住宅 |
| | | 16060=办公室 |
| | | 16061=电机数据异常,请重置电机 |
| | | 16062=获取空调摆风状态失败 |
| | | 16063=设置空调摆风失败 |
| | | |
| | | ;★★★★下面这些是接口的返回信息翻译,从18000开始★★★★
|
| | | 18004=指定网关已经被绑定
|
| | |
| | | /// <summary> |
| | | /// 版本号 |
| | | /// </summary> |
| | | public static string CodeIDString = "1.0.19123101"; |
| | | public static string CodeIDString = "1.0.20011001"; |
| | | /// <summary> |
| | | /// 注册来源(0:HDL On 1:Zigbee) |
| | | /// </summary> |
| | |
| | | }
|
| | | }
|
| | | /// <summary>
|
| | | /// 本地所有设备的缓存(排序)
|
| | | /// 本地所有设备的缓存
|
| | | /// </summary>
|
| | | public List<CommonDevice> listAllDevice
|
| | | {
|
| | |
| | | #region ■ 添加设备___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 将指定网关的设备存入缓存中(从新获取镜像)
|
| | | /// <para>将指定网关的设备存入缓存中(从新获取镜像)</para>
|
| | | /// <para>-1:异常 1:正常 2:设备信息缺损</para>
|
| | | /// </summary>
|
| | | /// <param name="zbGateway">网关对象</param>
|
| | | /// <param name="deviceComingAction">接收到设备时的事件,设备对象为null时,代表接收完成</param>
|
| | | /// <returns>一直返回true</returns>
|
| | | public bool SetDeviceToMemmoryByGateway(ZbGateway zbGateway, Action<CommonDevice> deviceComingAction = null)
|
| | | public int SetDeviceToMemmoryByGateway(ZbGateway zbGateway)
|
| | | {
|
| | | //从网关获取全部的设备
|
| | | int statu = 0;
|
| | | List<CommonDevice> listDevice = new List<CommonDevice>();
|
| | | List<CommonDevice> list = this.GetDeviceListFromGateway(zbGateway, true, deviceComingAction);
|
| | |
|
| | | List<CommonDevice> list = this.GetDeviceListFromGateway(zbGateway, ref statu, true);
|
| | | if (list == null)
|
| | | {
|
| | | return false;
|
| | | return -1;
|
| | | }
|
| | | listDevice.AddRange(list);
|
| | |
|
| | | //获取这个网关的本地所有设备
|
| | | string gwID = HdlGatewayLogic.Current.GetGatewayId(zbGateway);
|
| | | List<CommonDevice> listLocalDevices = this.GetDeviceByGatewayID(gwID);
|
| | | List<CommonDevice> listLocalDevices = this.GetDeviceByGatewayID(gwID, true);
|
| | | Dictionary<string, CommonDevice> dicExist = new Dictionary<string, CommonDevice>();
|
| | | foreach (var device in listLocalDevices)
|
| | | {
|
| | |
| | | for (int i = 0; i < listDevice.Count; i++)
|
| | | {
|
| | | var device = listDevice[i];
|
| | | //对未命名的设备重新命名
|
| | | if (this.GetSimpleEpointName(device) == string.Empty)
|
| | | //对未命名的虚拟设备重新命名
|
| | | if (device.DriveCode > 0 && this.GetSimpleEpointName(device) == string.Empty)
|
| | | {
|
| | | //根据设备类型获取名称
|
| | | var dName = this.GetDeviceObjectText(new List<CommonDevice>() { device }, false);
|
| | | //虚拟设备的话,附加回路号
|
| | | if (device.DriveCode > 0)
|
| | | {
|
| | | //在端点名字的后面附加【回路】字样
|
| | | dName += "(" + device.DeviceEpoint + Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + ")";
|
| | | }
|
| | | //多回路设备的话,附加回路号
|
| | | else if (dicDeviceEpoint.ContainsKey(device.DeviceAddr) == true && dicDeviceEpoint[device.DeviceAddr].Count > 1)
|
| | | {
|
| | | var arry = dName.Split(new string[] { "(" }, StringSplitOptions.RemoveEmptyEntries);
|
| | | dName = arry[0].Trim();
|
| | | //在端点名字的后面附加【回路】字样
|
| | | dName += "(" + device.DeviceEpoint + Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + ")";
|
| | | }
|
| | | //在端点名字的后面附加【回路】字样
|
| | | dName += "(" + device.DeviceEpoint + Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + ")";
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | //如果本地和网关的设备不一致的时候,暂时删除本地的设备
|
| | | //注意:只是删除设备文件,房间内容什么的还存在着
|
| | | foreach (var device in dicExist.Values)
|
| | | //只有完全获取的时候,才会去处理删除的问题
|
| | | if (statu != 1)
|
| | | {
|
| | | this.DeleteMemmoryDevice(device, false);
|
| | | return statu;
|
| | | }
|
| | |
|
| | | return true;
|
| | | //如果本地和网关的设备不一致的时候,删除本地的设备
|
| | | foreach (var device in dicExist.Values)
|
| | | {
|
| | | if (device is OTADevice)
|
| | | {
|
| | | this.DeleteMemmoryOtaDevice(device.DeviceAddr);
|
| | | }
|
| | | else
|
| | | {
|
| | | this.DeleteMemmoryDevice(device, true);
|
| | | }
|
| | | }
|
| | |
|
| | | return statu;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | lock (dicAllDevice)
|
| | | {
|
| | | string mainKeys = this.GetDeviceMainKeys(device);
|
| | | if (this.dicAllDevice.ContainsKey(mainKeys) == false)
|
| | | if (this.dicAllDevice.ContainsKey(mainKeys) == true)
|
| | | {
|
| | | return;
|
| | | }
|
| | | this.dicAllDevice[mainKeys] = device;
|
| | | device.ReSave();
|
| | | //一般设备
|
| | | this.dicAllDevice[mainKeys] = device;
|
| | | device.ReSave();
|
| | |
|
| | | //添加自动备份
|
| | | HdlAutoBackupLogic.AddOrEditorFile(device.FilePath);
|
| | | //添加自动备份
|
| | | HdlAutoBackupLogic.AddOrEditorFile(device.FilePath);
|
| | | }
|
| | | else if (this.dicOTADevice.ContainsKey(mainKeys) == true)
|
| | | {
|
| | | //Ota设备
|
| | | this.dicOTADevice[mainKeys] = (OTADevice)device;
|
| | | device.ReSave();
|
| | |
|
| | | //添加自动备份
|
| | | HdlAutoBackupLogic.AddOrEditorFile(device.FilePath);
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | return false;
|
| | | }
|
| | |
|
| | | //删除文件
|
| | | //删除缓存的Ota设备
|
| | | this.DeleteMemmoryOtaDevice(listdevice[0].DeviceAddr);
|
| | | //删除一般设备文件
|
| | | foreach (CommonDevice device in listdevice)
|
| | | {
|
| | | this.DeleteMemmoryDevice(device);
|
| | | }
|
| | |
|
| | | if (this.dicDeviceRoomId.ContainsKey(listdevice[0].DeviceAddr) == true)
|
| | | {
|
| | | //移除真实设备的房间索引
|
| | |
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 删除缓存的设备
|
| | | /// 删除缓存的一般设备
|
| | | /// </summary>
|
| | | /// <param name="device">设备对象</param>
|
| | | /// <param name="deleteRoom">是否从房间删除</param>
|
| | |
| | | {
|
| | | this.dicAllDevice.Remove(mainKeys);
|
| | | }
|
| | | if (this.dicDeviceEpoint.ContainsKey(device.DeviceAddr) == true)
|
| | | {
|
| | | //变更端点数
|
| | | this.dicDeviceEpoint[device.DeviceAddr].Remove(device.DeviceEpoint);
|
| | | }
|
| | | }
|
| | |
|
| | | //删除设备文件
|
| | |
| | | HdlAutoBackupLogic.DeleteFile(device.FilePath);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 删除缓存的Ota设备
|
| | | /// </summary>
|
| | | /// <param name="macAdrr"></param>
|
| | | /// <param name="ePoint"></param>
|
| | | public void DeleteMemmoryOtaDevice(string macAdrr, int ePoint = 200)
|
| | | {
|
| | | //删除200端口文件
|
| | | string otaKeys = this.GetDeviceMainKeys(device.DeviceAddr, 200);
|
| | | string otaKeys = this.GetDeviceMainKeys(macAdrr, ePoint);
|
| | | if (this.dicOTADevice.ContainsKey(otaKeys) == true)
|
| | | {
|
| | | string otaFile = this.dicOTADevice[otaKeys].FilePath;
|
| | |
| | | if (UserCenterResourse.UserInfo.AuthorityNo == 3)
|
| | | {
|
| | | //成员的话,直接删除,没有商量的余地
|
| | | Global.DeleteFilebyHomeId(filePath);
|
| | | Global.DeleteFilebyHomeId(otaFile);
|
| | | }
|
| | | else
|
| | | {
|
| | | //变更:搞掉它,不留了
|
| | | Global.DeleteFilebyHomeId(filePath);
|
| | | Global.DeleteFilebyHomeId(otaFile);
|
| | | //删除自动备份
|
| | | HdlAutoBackupLogic.DeleteFile(otaFile);
|
| | | }
|
| | |
| | | /// 根据网关ID获取所有的设备
|
| | | /// </summary>
|
| | | /// <param name="gwId">网关ID</param>
|
| | | /// <param name="getOtaDevice">是否获取ota设备</param>
|
| | | /// <returns></returns>
|
| | | public List<CommonDevice> GetDeviceByGatewayID(string gwId)
|
| | | public List<CommonDevice> GetDeviceByGatewayID(string gwId, bool getOtaDevice = false)
|
| | | {
|
| | | List<CommonDevice> list = new List<CommonDevice>();
|
| | | lock (dicAllDevice)
|
| | |
| | | if (gwId == device.CurrentGateWayId)
|
| | | {
|
| | | list.Add(device);
|
| | | }
|
| | | }
|
| | | if (getOtaDevice == true)
|
| | | {
|
| | | //获取ota设备
|
| | | foreach (var ota in this.dicOTADevice.Values)
|
| | | {
|
| | | if (ota.CurrentGateWayId == gwId)
|
| | | {
|
| | | list.Add(ota);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | return this.dicOTADevice[mainkeys];
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 获取特殊的,没有其他回路,单纯只有200端点的OTA设备
|
| | | /// </summary>
|
| | | /// <param name="gwId">网关ID</param>
|
| | | /// <returns></returns>
|
| | | public List<OTADevice> GetSpecialOtaDevice(string gwId)
|
| | | {
|
| | | var list = new List<OTADevice>();
|
| | | foreach (var ota in this.dicOTADevice.Values)
|
| | | {
|
| | | if (ota.CurrentGateWayId != gwId)
|
| | | {
|
| | | //不是同一个网关
|
| | | continue;
|
| | | }
|
| | | if (dicDeviceEpoint.ContainsKey(ota.DeviceAddr) == false
|
| | | || dicDeviceEpoint[ota.DeviceAddr].Count == 0)
|
| | | {
|
| | | list.Add(ota);
|
| | | }
|
| | | }
|
| | | return list;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 获取设备名称_______________________
|
| | |
| | | return dName;
|
| | | }
|
| | | //根据设备类型获取名称
|
| | | dName = this.GetDeviceObjectText(new List<CommonDevice>() { device }, false);
|
| | | var tempValue = this.GetDeviceObjectText(new List<CommonDevice>() { device }, false);
|
| | | var arry = tempValue.Split(new string[] { "(" }, StringSplitOptions.RemoveEmptyEntries);
|
| | | dName = arry[0].Trim();
|
| | |
|
| | | //如果是虚拟设备
|
| | | if (device.DriveCode > 0
|
| | | || (this.dicDeviceEpoint.ContainsKey(device.DeviceAddr) == true && this.dicDeviceEpoint[device.DeviceAddr].Count > 1))
|
| | | if (device.DriveCode > 0)
|
| | | {
|
| | | var arry = dName.Split(new string[] { "(" }, StringSplitOptions.RemoveEmptyEntries);
|
| | | dName = arry[0].Trim();
|
| | | //在端点名字的后面附加【回路】字样
|
| | | dName += "(" + device.DeviceEpoint + Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + ")";
|
| | | return dName;
|
| | | }
|
| | |
|
| | | //获取设备类型
|
| | | var deviceInfoType = this.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
|
| | | if (deviceInfoType.BeloneType == Common.DeviceBeloneType.A按键面板 && device.Type == DeviceType.TemperatureSensor)
|
| | | {
|
| | | //面板的最后一个回路是温度传感器
|
| | | dName += Language.StringByID(R.MyInternationalizationString.uDeviceBelongId11);
|
| | | }
|
| | | else if (deviceInfoType.ConcreteType == Common.DeviceConcreteType.Sensor_Pir)
|
| | | {
|
| | | //pir传感器,它又搞特殊东西,传感器自身用自己的名字,继电器回路的话……
|
| | | if (device.Type == DeviceType.OnOffOutput)
|
| | | {
|
| | | dName += Language.StringByID(R.MyInternationalizationString.uDeviceBelongId2300);
|
| | | }
|
| | | }
|
| | | else if (this.dicDeviceEpoint.ContainsKey(device.DeviceAddr) == true && this.dicDeviceEpoint[device.DeviceAddr].Count > 1)
|
| | | {
|
| | | //XXXXX(N回路)
|
| | | dName += "(" + device.DeviceEpoint + Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + ")";
|
| | | }
|
| | |
|
| | | return dName;
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | //不存在则使用共通图片
|
| | | string[] arry = strSpecific.Split(new string[] { "_" }, StringSplitOptions.None);
|
| | | if (arry.Length == 1)
|
| | | //如果它自己就是共通图片的话,不再处理
|
| | | if (arry.Length > 1)
|
| | | {
|
| | | //如果它自己就是共通图片的话,不再处理
|
| | | return;
|
| | | imageFilePath = "Device/" + arry[0] + ".png";
|
| | | imageSelectFilePath = "Device/" + arry[0] + "Selected.png";
|
| | | }
|
| | | imageFilePath = "Device/" + arry[0] + ".png";
|
| | | imageSelectFilePath = "Device/" + arry[0] + "Selected.png";
|
| | | }
|
| | | //如果那款设备连共通图片都没有的话
|
| | | if (string.IsNullOrEmpty(IO.FileUtils.GetImageFilePath(imageFilePath)) == true)
|
| | | {
|
| | | imageFilePath = "Device/ThirdPartyDevice.png";
|
| | | imageSelectFilePath = "Device/ThirdPartyDeviceSelected.png";
|
| | | }
|
| | | //设置图片
|
| | | unSelectPath = imageFilePath;
|
| | |
| | | //如果设备只有一个回路,如果改变了真实设备区域,则它的回路的区域也一起改了
|
| | | if (saveRoadDevice == true && listDevice != null && listDevice.Count == 1)
|
| | | {
|
| | | if (listDevice[0] is OTADevice)
|
| | | {
|
| | | //单纯只是Ota设备则不处理
|
| | | return;
|
| | | }
|
| | | Common.Room.CurrentRoom.ChangedRoom(listDevice[0], roomId, false);
|
| | | }
|
| | | }
|
| | |
| | | #region ■ 获取设备列表的接口_________________
|
| | |
|
| | | /// <summary>
|
| | | /// 从网关重新获取设备列表(★★★★★★★接收到设备时的事件★★★★★★★)
|
| | | /// <para>从网关重新获取设备列表(返回的设备为虚拟出来的)</para>
|
| | | /// <para>statu状态 -1:异常,会返回null, 1:没有异常, 2:数据接收不全</para>
|
| | | /// </summary>
|
| | | /// <param name="zbGateway">网关对象</param>
|
| | | /// <param name="ignoreTime">是否无视时间,true:每次调用都去网关获取,false:3分钟内返回的是本地的设备</param>
|
| | | /// <param name="deviceComingAction">接收到设备时的事件</param>
|
| | | /// <param name="statu">状态-> -1:异常,会返回null, 1:没有异常, 2:数据接收不全</param>
|
| | | /// <param name="ignoreTime">是否无视时间(此变量是给获取在线状态用的),true:每次调用都去网关获取,false:3分钟内返回的是本地的设备</param>
|
| | | /// <param name="mode">是否显示错误</param>
|
| | | /// <returns></returns> |
| | | public List<CommonDevice> GetDeviceListFromGateway(ZbGateway zbGateway, bool ignoreTime, Action<CommonDevice> deviceComingAction = null, ShowErrorMode mode = ShowErrorMode.YES) |
| | | public List<CommonDevice> GetDeviceListFromGateway(ZbGateway zbGateway, ref int statu, bool ignoreTime, ShowErrorMode mode = ShowErrorMode.YES) |
| | | {
|
| | | if (ignoreTime == false)
|
| | | {
|
| | | if ((DateTime.Now - zbGateway.LastDateTime).TotalMilliseconds < 3 * 60 * 1000)
|
| | | {
|
| | | //不无视时间,返回本地设备列表
|
| | | var listTemp = this.GetDeviceByGatewayID(HdlGatewayLogic.Current.GetGatewayId(zbGateway));
|
| | | if (deviceComingAction != null)
|
| | | {
|
| | | for (int i = 0; i < listTemp.Count; i++)
|
| | | {
|
| | | try
|
| | | {
|
| | | //回调函数
|
| | | deviceComingAction.Invoke(listTemp[i]);
|
| | | }
|
| | | //Log出力
|
| | | catch (Exception ex) { HdlLogLogic.Current.WriteLog(ex); }
|
| | | }
|
| | | }
|
| | | deviceComingAction = null;
|
| | | return listTemp;
|
| | | statu = 1;
|
| | | return this.GetDeviceByGatewayID(HdlGatewayLogic.Current.GetGatewayId(zbGateway));
|
| | | }
|
| | | }
|
| | | zbGateway.LastDateTime = DateTime.Now;
|
| | |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uErrorGatewayLostMsg);
|
| | | this.ShowTipMsg(msg);
|
| | | }
|
| | | statu = -1;
|
| | | return null;
|
| | | }
|
| | |
|
| | |
| | | //网关里面有可能会有重复的回路
|
| | | if (listCheck.Contains(mainkeys) == false)
|
| | | {
|
| | | //回调函数
|
| | | deviceComingAction?.Invoke(device);
|
| | | listDevice.Add(device);
|
| | |
|
| | | listCheck.Add(mainkeys);
|
| | |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, null, "回复超时", false);
|
| | | this.ShowTipMsg(msg);
|
| | | }
|
| | | statu = -1;
|
| | | return null;
|
| | | }
|
| | | else
|
| | |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uNetworkUnStableAndDeviceInfoIsNotFull);
|
| | | this.ShowTipMsg(msg);
|
| | | }
|
| | | statu = 2;
|
| | | }
|
| | | }
|
| | |
|
| | | //回调函数(接收完成) |
| | | deviceComingAction = null; |
| | | |
| | | } |
| | | return listDevice; |
| | | }
|
| | |
|
| | |
| | | this.dicDeviceModelIdEnum["MPT2/R2-ZB.18"] = "202-200";//2按键触摸面板
|
| | | this.dicDeviceModelIdEnum["MPT1/R1-ZB.18"] = "203-200";//12按键触摸面板
|
| | | this.dicDeviceModelIdEnum["MPT4-ZB.18"] = "210-200";//4按键触摸面板(只带电源底座)
|
| | | this.dicDeviceModelIdEnum["MPT4R4L/S-ZB1.8"] = "220-200";//简约4按键面板
|
| | | this.dicDeviceModelIdEnum["MPT3R3L/S-ZB1.8"] = "221-200";//简约3按键面板
|
| | | this.dicDeviceModelIdEnum["MPT2R2L/S-ZB1.8"] = "222-200";//简约2按键面板
|
| | | this.dicDeviceModelIdEnum["MPT4R4L/S-ZB.18"] = "220-200";//简约4按键面板
|
| | | this.dicDeviceModelIdEnum["MPT3R3L/S-ZB.18"] = "221-200";//简约3按键面板
|
| | | this.dicDeviceModelIdEnum["MPT2R2L/S-ZB.18"] = "222-200";//简约2按键面板
|
| | |
|
| | | //=========★★PIR传感器类(1200-1299)★★=========
|
| | | this.dicDeviceModelIdEnum["MSPIR01-ZB.10"] = "1200-1200";//pir传感器220
|
| | |
| | | this.dicDeviceModelIdEnum["MBUS/GW-ZB.10"] = "4200-4200";//zigbee转buspro协议转换器
|
| | | this.dicDeviceModelIdEnum["M485/GW-ZB.10"] = "4201-4200";//zigbee转485协议转换器
|
| | |
|
| | |
|
| | |
|
| | | //✩✩✩✩✩需要交换的模块ID✩✩✩✩✩
|
| | | this.dicDeviceModelIdChanged = new Dictionary<string, string>();
|
| | | //=========★★安防类传感器类★★=========
|
| | |
| | | this.dicDeviceModelIdChanged["MULTI-MOTI--EA04"] = "MSPIR01/M-ZB.10";//红外传感器
|
| | | this.dicDeviceModelIdChanged["MULTI-WATE--EA02"] = "MSW01/M-ZB.10";//水浸传感器
|
| | | this.dicDeviceModelIdChanged["MULTI-BURO--EA06"] = "MBU01/M-ZB.10";//紧急按键
|
| | |
|
| | |
|
| | |
|
| | | //✩✩✩✩✩需要共有的图片对象✩✩✩✩✩
|
| | | this.dicPictrueShard = new Dictionary<string, string>();
|
| | |
| | |
|
| | | //=========★★其他类(????-????)★★=========
|
| | | /// <summary>
|
| | | /// 干接点
|
| | | /// 干接点(注意,它属于其他类,不是设备类型)
|
| | | /// </summary>
|
| | | DryContact = -10000,
|
| | | /// <summary>
|
| | | /// 灯光(注意,它输入其他类,不是设备类型)
|
| | | /// 灯光(注意,它属于其他类,不是设备类型)
|
| | | /// </summary>
|
| | | Light = -10001,
|
| | | /// <summary>
|
| | | /// 插座
|
| | | /// 插座(注意,它属于其他类,不是设备类型)
|
| | | /// </summary>
|
| | | Socket1 = -10002,
|
| | | /// <summary>
|
| | | /// 开关
|
| | | /// 开关(注意,它属于其他类,不是设备类型)
|
| | | /// </summary>
|
| | | Switch = -10003,
|
| | | }
|
| | |
| | | {
|
| | | if (m_CurrentRoom == null && Lists.Count > 0)
|
| | | {
|
| | | if (m_CurrentRoom == null) { m_CurrentRoom = Lists[0]; }
|
| | | return Lists[0];
|
| | | }
|
| | | return m_CurrentRoom;
|
| | |
| | | /// </summary> |
| | | public static void RefreshAllRoomByLocation()
|
| | | {
|
| | | Lists.Clear();
|
| | | var homeTemp = Config.Instance.Home;
|
| | | homeTemp.RoomFilePathList.Clear();
|
| | |
|
| | |
| | | if (listFile.Contains(fRoom) == true)
|
| | | {
|
| | | listFile.Remove(fRoom);
|
| | | homeTemp.AddRoomListFilePath(fRoom);
|
| | | homeTemp.RoomFilePathList.Add(fRoom);
|
| | | }
|
| | |
|
| | | var listRoomFile = new List<string>();
|
| | |
| | | {
|
| | | if (fileName.StartsWith("Room_"))
|
| | | {
|
| | | homeTemp.AddRoomListFilePath(fileName);
|
| | | homeTemp.RoomFilePathList.Add(fileName);
|
| | | listRoomFile.Add(fileName);
|
| | | }
|
| | | }
|
| | |
| | | System.Console.WriteLine(ex.Message); |
| | | return null; |
| | | } |
| | | |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 获取当前楼层的房间名称 |
| | |
| | | //保存到本地 |
| | | Save(); |
| | | |
| | | //添加自动备份 |
| | | HdlAutoBackupLogic.AddOrEditorFile(FileName); |
| | | if (saveRealRoom == true && LocalDevice.Current.GetDevicesCountByMac(device.DeviceAddr) == 1)
|
| | | {
|
| | | //如果只有一个回路,则修改真实物理设备的房间
|
| | |
| | | SceneUIList.Remove(sceneUI); |
| | | SceneUIFilePathList.Remove(sceneUI.FileName); |
| | | Save(); |
| | | |
| | | |
| | | Global.DeleteFilebyHomeId(sceneUI.FileName); |
| | | HdlAutoBackupLogic.DeleteFile(sceneUI.FileName); |
| | | } |
| | |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | |
| | | var deviceRow = new CategoryFunctionRow(0, 35); |
| | | deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | |
| | | Common.Logic.CurrentLogic.IsEnable = 1;//默认为开 |
| | | if (logiciocnBtn.Tag.ToString() == "3") |
| | | { |
| | | Common.Logic.CurrentLogic.LogicName = logicnameBtn.Text;// Language.StringByID(MyInternationalizationString.automation1); |
| | | Common.Logic.CurrentLogic.LogicName = logicnameBtn.Text; |
| | | Common.Logic.CurrentLogic.LogicCustomPushText = Common.Logic.CurrentLogic.LogicName + Language.StringByID(MyInternationalizationString.defaulttext); |
| | | var addLogicPage = new Logic.AddLogicPage(); |
| | | HomePage.Instance.AddChidren(addLogicPage); |
| | | HomePage.Instance.PageIndex += 1; |
| | |
| | | { |
| | | |
| | | Common.Logic.CurrentLogic.LogicName = logicnameBtn.Text; |
| | | Common.Logic.CurrentLogic.LogicCustomPushText = Common.Logic.CurrentLogic.LogicName + Language.StringByID(MyInternationalizationString.defaulttext); |
| | | Logic.TemplatePage templatePage = new Logic.TemplatePage(); |
| | | Logic.TemplatePage.s = logiciocnBtn.Tag.ToString(); |
| | | HomePage.Instance.AddChidren(templatePage); |
| | |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | }; |
| | | bodyFrameLayout.AddChidren(deviceIMG); |
| | | |
| | | var info = Common.LocalDevice.Current.GetNotHdlMyDeviceEnumInfo(new List<CommonDevice> { device.CommonDevice }); |
| | | var info = Common.LocalDevice.Current.GetDeviceBelongEnumInfo(device.CommonDevice); |
| | | |
| | | var deviceTypeName = new Button() |
| | | { |
| | |
| | | nameRow.SetTitle(string.IsNullOrEmpty(device.CommonDevice.DeviceEpointName) ? Language.StringByID(R.MyInternationalizationString.UNKnown) : device.CommonDevice.DeviceEpointName); |
| | | nameFL.AddChidren(nameRow); |
| | | |
| | | |
| | | |
| | | var zoneFL = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(127 + 12) |
| | |
| | | /// </summary>
|
| | | public Action<LeftIconButtonRow, MouseEventArgs> ButtonClickEvent; |
| | | /// <summary> |
| | | /// 点击事件 |
| | | /// </summary> |
| | | public Action<LeftIconButtonRow, MouseEventArgs> ButtonClickEvent; |
| | | /// <summary> |
| | | /// ClickBtn |
| | | /// </summary> |
| | | public Button ClickBtn; |
| | |
| | | ProgressBtn.Text = mProgress + "%";
|
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 添加进度按钮 |
| | | /// </summary> |
| | | private void InitProgressBtnForCurtain(FrameLayout layout) |
| | | { |
| | | ProgressBtnX = curtainSeekBar.X - Application.GetMinReal(20); |
| | | ProgressBtn = new Button() |
| | | { |
| | | X = ProgressBtnX, |
| | | Y = curtainSeekBar.Y + curtainSeekBar.Height / 2 - Application.GetMinReal(180), |
| | | Width = Application.GetMinReal(135), |
| | | Height = Application.GetMinReal(104), |
| | | UnSelectedImagePath = "Item/ProgressBubbles.png", |
| | | Visible = false, |
| | | TextSize = 14, |
| | | IsBold = true, |
| | | TextColor = ZigbeeColor.Current.GXCTextWhiteColor |
| | | }; |
| | | layout.AddChidren(ProgressBtn); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// OnProgressButtonMove |
| | | /// </summary> |
| | | private void OnProgressButtonMoveForCurtain(int mProgress) |
| | | { |
| | | ProgressBtn.X = ProgressBtnX + curtainSeekBar.NowProgressX- Application.GetMinReal(5); |
| | | ProgressBtn.Text = mProgress + "%"; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 收藏到主页_______________________ |
| | |
| | | WavePadding = Application.GetRealWidth(8), |
| | | MaxValue=100, |
| | | Progress = (int)(dimmableLight.Level*1.0/MaxLevel*100), |
| | | |
| | | |
| | | CornerRadius= Application.GetRealHeight(58) |
| | | }; |
| | | |
| | |
| | | middle.AddChidren(textBtn); |
| | | string s1 = ""; |
| | | string s2 = ""; |
| | | textBox.TextChangeEventHandler += (sender, e) =>
|
| | | textBox.TextChangeEventHandler += (sender, e) => |
| | | { |
| | | var leng = e.Length; |
| | | if (leng > 50) |
| | |
| | | } |
| | | }; |
| | | |
| | | |
| | | var btnsave = new Button |
| | | { |
| | | Y = middle.Height - Application.GetRealHeight(260), |
| | |
| | | alert.Show(); |
| | | return; |
| | | } |
| | | if (Common.Logic.CurrentLogic.LogicId != 0) |
| | | { |
| | | ///只改推送内容; |
| | | Send.LogicControlSwitch(Common.Logic.CurrentLogic); |
| | | Send.Data("添加/更新", "/App/HomeLogicConfig", "POST"); |
| | | } |
| | | Send.Zj(true, Common.Logic.CurrentLogic); |
| | | RemoveFromParent(); |
| | | |
| | | }; |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * membershipIfon.UserIdMode.Count) - 20 - 50); |
| | | lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * membershipIfon.UserIdMode.Count) + 20 + 50); |
| | | if (membershipIfon.UserIdMode.Count > 10) |
| | | if (membershipIfon.UserIdMode.Count > 9) |
| | | { |
| | | ///元素超出10个,暂时默认显示10; |
| | | lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * 10) - 20 - 50); |
| | | lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * 10) + 20 + 50); |
| | | lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * 9) - 20 - 50); |
| | | lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * 9) + 20 + 50); |
| | | } |
| | | string SelectedLockStatus = ""; |
| | | ///定义两个变量记录选中状态; |
| | |
| | | tag = true; |
| | | custompushFrameLayout.Height = Application.GetRealHeight(160); |
| | | Common.Logic.CurrentLogic.LogicIsCustomPushText = 1; |
| | | if (Common.Logic.CurrentLogic.LogicId != 0) |
| | | { |
| | | Send.Data("添加/更新", "/App/HomeLogicConfig", "POST"); |
| | | } |
| | | |
| | | } |
| | | else |
| | |
| | | tag = false; |
| | | custompushFrameLayout.Height = Application.GetRealHeight(0); |
| | | Common.Logic.CurrentLogic.LogicIsCustomPushText = 0; |
| | | if (Common.Logic.CurrentLogic.LogicId != 0) |
| | | { |
| | | Send.Data("删除", "/App/DelHomeLogicConfig", "POST"); |
| | | } |
| | | |
| | | } |
| | | Send.Zj(tag, Common.Logic.CurrentLogic); |
| | | }; |
| | | if (Common.Logic.CurrentLogic.LogicIsCustomPushText == 0) |
| | | { |
| | | tag = false; |
| | | btnswitch.IsSelected = false; |
| | | custompushFrameLayout.Height = Application.GetRealHeight(0); |
| | | } |
| | | else |
| | | { |
| | | tag = true; |
| | | btnswitch.IsSelected = true; |
| | | custompushFrameLayout.Height = Application.GetRealHeight(160); |
| | | } |
| | | var saveFrameLayout = new FrameLayout |
| | | { |
| | |
| | | Common.Logic.LockLogicList.Add(Common.Logic.CurrentLogic); |
| | | if (tag) |
| | | { |
| | | Send.Data("添加/更新", "/App/HomeLogicConfig", "POST"); |
| | | Send.Zj(tag, Common.Logic.CurrentLogic); |
| | | } |
| | | } |
| | | } |
| | |
| | | Common.Logic.CurrentLogic.LogicType = 1; |
| | | Common.Logic.CurrentLogic.Relationship = 1; |
| | | Common.Logic.CurrentLogic.LogicName = Language.StringByID(MyInternationalizationString.automation1); |
| | | Common.Logic.CurrentLogic.LogicCustomPushText = Common.Logic.CurrentLogic.LogicName + Language.StringByID(MyInternationalizationString.defaulttext); |
| | | var lockLogicCommunalPage = new LockLogicCommunalPage(); |
| | | UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | |
| | | Height = Application.GetRealHeight(200) + Application.GetRealHeight(32), |
| | | Width = Application.GetRealWidth(700), |
| | | //Gravity = Gravity.CenterHorizontal, |
| | | Text = Language.StringByID(MyInternationalizationString.automationaddtext).Replace("{\\r\\n}", "\r\n"), |
| | | Text = Language.StringByID(MyInternationalizationString.tiplocktextnull).Replace("{\\r\\n}", "\r\n"), |
| | | TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | IsMoreLines = true, |
| | |
| | | custompushback.MouseUpEventHandler += customclick; |
| | | custompushRowLayout.MouseUpEventHandler += customclick; |
| | | bool tag = false;//标记开关状态; |
| | | btnswitch.MouseUpEventHandler += (sender1, e1) => |
| | | btnswitch.MouseUpEventHandler +=(sender1, e1) => |
| | | { |
| | | btnswitch.IsSelected = !btnswitch.IsSelected; |
| | | if (btnswitch.IsSelected) |
| | |
| | | tag = true; |
| | | custompushFrameLayout.Height = Application.GetRealHeight(160); |
| | | Common.Logic.CurrentLogic.LogicIsCustomPushText = 1; |
| | | if (Common.Logic.CurrentLogic.LogicId != 0) |
| | | { |
| | | Send.Data("添加/更新", "/App/HomeLogicConfig", "POST"); |
| | | } |
| | | |
| | | } |
| | | else |
| | |
| | | tag = false; |
| | | custompushFrameLayout.Height = Application.GetRealHeight(0); |
| | | Common.Logic.CurrentLogic.LogicIsCustomPushText = 0; |
| | | if (Common.Logic.CurrentLogic.LogicId != 0) |
| | | { |
| | | Send.Data("删除", "/App/DelHomeLogicConfig", "POST"); |
| | | } |
| | | |
| | | } |
| | | Send.Zj(tag,Common.Logic.CurrentLogic); |
| | | }; |
| | | |
| | | if (Common.Logic.CurrentLogic.LogicIsCustomPushText == 0) |
| | | { |
| | | tag = false; |
| | | btnswitch.IsSelected = false; |
| | | custompushFrameLayout.Height = Application.GetRealHeight(0); |
| | | } |
| | | else |
| | | { |
| | | tag = true; |
| | | btnswitch.IsSelected = true; |
| | | custompushFrameLayout.Height = Application.GetRealHeight(160); |
| | | } |
| | | #endregion |
| | | |
| | |
| | | Common.Logic.LogicList.Add(Common.Logic.CurrentLogic); |
| | | if (tag) |
| | | { |
| | | Send.Data("添加/更新", "/App/HomeLogicConfig", "POST"); |
| | | Send.Zj(tag, Common.Logic.CurrentLogic); |
| | | } |
| | | } |
| | | } |
| | |
| | | string SelectedDeviceStatuscondition = ""; |
| | | lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * user.UserIdMode.Count) - 20 - 50); |
| | | lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * user.UserIdMode.Count) + 20 + 50); |
| | | if (user.UserIdMode.Count > 10) |
| | | if (user.UserIdMode.Count > 9) |
| | | { |
| | | ///元素超出10个,暂时默认显示10; |
| | | lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * 10) - 20 - 50); |
| | | lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * 10) + 20 + 50); |
| | | lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * 9) - 20 - 50); |
| | | lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * 9) + 20 + 50); |
| | | } |
| | | |
| | | for (int i = 0; i < user.UserIdMode.Count; i++) |
| | |
| | | } |
| | | else if (actions["SecuritySetting"].ToString() == "1") |
| | | { |
| | | if (actions["SecurityModeId"].ToString() == "1") { |
| | | athomedefenceSelected.Visible = true; |
| | | leavehomedefenceSelected.Visible = false; |
| | | withdrawalSelected.Visible = false; |
| | | urgentwithdrawalSelected.Visible = false; |
| | | } |
| | | else if (actions["SecuritySetting"].ToString() == "2") |
| | | { |
| | | athomedefenceSelected.Visible = false; |
| | | leavehomedefenceSelected.Visible = true; |
| | | withdrawalSelected.Visible = false; |
| | | urgentwithdrawalSelected.Visible = false; |
| | | |
| | | } |
| | | else { |
| | | athomedefenceSelected.Visible = false; |
| | | leavehomedefenceSelected.Visible = true; |
| | | withdrawalSelected.Visible = false; |
| | | urgentwithdrawalSelected.Visible = false; |
| | | } |
| | | } |
| | | break; |
| | | |
| | |
| | | /// </summary> |
| | | public static UserCenter.MemberInfoRes UserMemberInfoRes = null; |
| | | #endregion |
| | | /// <summary> |
| | | /// 自己用 |
| | | /// </summary> |
| | | public static void Zj(bool tag, Common.Logic logic) |
| | | { |
| | | new System.Threading.Thread(() => |
| | | { |
| | | if (logic.LogicId != 0) |
| | | { |
| | | if (tag) |
| | | { |
| | | Data("添加/更新", "/App/HomeLogicConfig", "POST"); |
| | | } |
| | | else |
| | | { |
| | | Data("删除", "/App/DelHomeLogicConfig", "POST"); |
| | | } |
| | | ///只改推送内容; |
| | | LogicControlSwitch(logic); |
| | | } |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | #region 请求服务器方法--- |
| | | /// <summary> |
| | | /// 请求数据的封装方法 |
| | |
| | | /// <param name="method">请求方式为POST/GET</param> |
| | | /// <param name="obj">存储发送数据的对象</param> |
| | | /// <returns></returns> |
| | | public static async System.Threading.Tasks.Task<string>Data(string command, string url, string method, object obj = null) |
| | | public static async System.Threading.Tasks.Task<string> Data(string command, string url, string method, object obj = null) |
| | | { |
| | | var getUrl =""; |
| | | var getUrl = ""; |
| | | var jObject = new JObject(); |
| | | if (UserCenter.UserCenterResourse.UserInfo.AuthorityNo == 1) |
| | | { |
| | |
| | | Width = Application.GetRealWidth(600), |
| | | Height = Application.GetRealHeight(69), |
| | | Y = Application.GetRealHeight(92), |
| | | TextID = MyInternationalizationString.devicestate, |
| | | TextID = MyInternationalizationString.addsensor, |
| | | IsBold = true, |
| | | }; |
| | | topRowLayout.AddChidren(titleName); |
| | |
| | | tag = true; |
| | | custompushFrameLayout.Height = Application.GetRealHeight(160); |
| | | Common.Logic.CurrentLogic.LogicIsCustomPushText = 1; |
| | | if (Common.Logic.CurrentLogic.LogicId != 0) |
| | | { |
| | | Send.Data("添加/更新", "/App/HomeLogicConfig", "POST"); |
| | | } |
| | | |
| | | } |
| | | else |
| | |
| | | tag = false; |
| | | custompushFrameLayout.Height = Application.GetRealHeight(0); |
| | | Common.Logic.CurrentLogic.LogicIsCustomPushText = 0; |
| | | if (Common.Logic.CurrentLogic.LogicId != 0) |
| | | { |
| | | Send.Data("删除", "/App/DelHomeLogicConfig", "POST"); |
| | | } |
| | | |
| | | } |
| | | Send.Zj(tag, Common.Logic.CurrentLogic); |
| | | }; |
| | | if (Common.Logic.CurrentLogic.LogicIsCustomPushText == 0) |
| | | { |
| | | tag = false; |
| | | btnswitch.IsSelected = false; |
| | | custompushFrameLayout.Height = Application.GetRealHeight(0); |
| | | } |
| | | else |
| | | { |
| | | tag = true; |
| | | btnswitch.IsSelected = true; |
| | | custompushFrameLayout.Height = Application.GetRealHeight(160); |
| | | } |
| | | var saveFrameLayout = new FrameLayout |
| | | { |
| | |
| | | Common.Logic.LogicList.Add(Common.Logic.CurrentLogic); |
| | | if (tag) |
| | | { |
| | | Send.Data("添加/更新", "/App/HomeLogicConfig", "POST"); |
| | | Send.Zj(tag, Common.Logic.CurrentLogic); |
| | | } |
| | | } |
| | | } |
| | |
| | | /// </summary>
|
| | | A干接点节能模式 = 6,
|
| | | /// <summary>
|
| | | /// 干接点私有属性
|
| | | /// 干接点第三级别私有属性
|
| | | /// </summary>
|
| | | A干接点私有属性 = 7,
|
| | | A干接点第三级别私有属性 = 7,
|
| | | /// <summary>
|
| | | /// 窗帘上下限位(这个东西需要在第一)
|
| | | /// </summary>
|
| | |
| | | /// <summary>
|
| | | /// 空调自定义模式
|
| | | /// </summary>
|
| | | A空调自定义模式 = 11
|
| | | A空调自定义模式 = 11,
|
| | | /// <summary>
|
| | | /// 简约面板震动功能
|
| | | /// </summary>
|
| | | A简约面板震动功能 = 12,
|
| | | /// <summary>
|
| | | /// 空调摆风功能
|
| | | /// </summary>
|
| | | A空调摆风功能 = 13,
|
| | | }
|
| | | }
|
| | |
| | | /// <summary>
|
| | | /// DistributedMark
|
| | | /// </summary>
|
| | | [Newtonsoft.Json.JsonIgnore]
|
| | | public string DistributedMark = string.Empty;
|
| | | /// <summary>
|
| | | /// 邮箱
|
| | |
| | | /// </summary>
|
| | | public string AuthorityText = string.Empty;
|
| | | /// <summary>
|
| | | /// 用户图标文件
|
| | | /// </summary>
|
| | | [Newtonsoft.Json.JsonIgnore]
|
| | | public string UserIconFile = string.Empty;
|
| | | /// <summary>
|
| | | /// 用户图标文件是否改变
|
| | | /// </summary>
|
| | | [Newtonsoft.Json.JsonIgnore]
|
| | | public bool UserIconFileChanged = false;
|
| | | /// <summary>
|
| | | /// 用户头像数据(临时用,会置空)
|
| | | /// </summary>
|
| | | public byte[] HeadImage = null;
|
| | |
| | | /// 密码验证(临时用,会置空)
|
| | | /// </summary>
|
| | | public string StringPwd = string.Empty;
|
| | |
|
| | |
|
| | | /// <summary>
|
| | | /// 用户图标文件
|
| | | /// </summary>
|
| | | [Newtonsoft.Json.JsonIgnore]
|
| | | public string UserIconFile = string.Empty;
|
| | | /// <summary>
|
| | | /// 用户图标文件是否改变
|
| | | /// </summary>
|
| | | [Newtonsoft.Json.JsonIgnore]
|
| | | public bool UserIconFileChanged = false;
|
| | | /// <summary>
|
| | | /// 是否初始化用户信息成功
|
| | | /// </summary>
|
| | | [Newtonsoft.Json.JsonIgnore]
|
| | | public bool InitUserInfoSuccess = false;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | |
|
| | | public MessageInfoPra()
|
| | | {
|
| | | PageSetting.PageSize = 10;
|
| | | PageSetting.PageSize = 50;
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | /// 是否出力详细Log 1 -> 出力
|
| | | /// </summary>
|
| | | public int DetailedLog = 0;
|
| | | /// <summary>
|
| | | /// 显示设备历史版本 1 -> 显示
|
| | | /// </summary>
|
| | | public int DeviceHistory = 0;
|
| | | }
|
| | | #endregion
|
| | | }
|
| | |
| | | {
|
| | | return;
|
| | | }
|
| | | string strMsg = reportInfo.AlarmMsg;
|
| | | if (reportInfo.DemolishmenMsg != null)
|
| | | {
|
| | | //被拆报警
|
| | | strMsg = reportInfo.DemolishmenMsg;
|
| | | }
|
| | | else if (reportInfo.BatteryMsg != null)
|
| | | {
|
| | | //电池报警
|
| | | strMsg = reportInfo.BatteryMsg;
|
| | | }
|
| | | if (strMsg == null || strMsg == string.Empty)
|
| | | {
|
| | | //不是在册的报警消息
|
| | | return;
|
| | | }
|
| | |
|
| | | //在线状态的控件隐藏
|
| | | btnOnline.Visible = false;
|
| | |
|
| | |
| | | btnMsg.Y = Application.GetRealHeight(141);
|
| | | this.AddChidren(btnMsg);
|
| | | }
|
| | | if (reportInfo.DemolishmenMsg != null)
|
| | | {
|
| | | btnMsg.Text = reportInfo.DemolishmenMsg;
|
| | | }
|
| | | else if (reportInfo.BatteryMsg != null)
|
| | | {
|
| | | btnMsg.Text = reportInfo.BatteryMsg;
|
| | | }
|
| | | else
|
| | | {
|
| | | btnMsg.Text = reportInfo.AlarmMsg;
|
| | | }
|
| | | btnMsg.Text = strMsg;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 添加底线___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// <para>添加底线(如果左边有图标,则先添加图标,再添加底线)</para>
|
| | | /// <para>它的长度为:当前控件宽度-左右固定间距-左边图片宽度(如果有)-右边的偏移量</para>
|
| | | /// </summary>
|
| | | public override NormalViewControl AddBottomLine()
|
| | | {
|
| | | var btnLine = base.AddBottomLine();
|
| | | //联动线的状态
|
| | | txtInput.btnLine = btnLine;
|
| | |
|
| | | return btnLine;
|
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | | }
|
| | |
| | | /// <para>添加底线(如果左边有图标,则先添加图标,再添加底线)</para>
|
| | | /// <para>它的长度为:当前控件宽度-左右固定间距-左边图片宽度(如果有)-右边的偏移量</para>
|
| | | /// </summary> |
| | | public NormalViewControl AddBottomLine()
|
| | | public virtual NormalViewControl AddBottomLine()
|
| | | {
|
| | | int lineWidth = this.Width - ControlCommonResourse.XXLeft * 2 - LeftOffset - RightOffset;
|
| | | int XX = ControlCommonResourse.XXLeft + LeftOffset;
|
| | |
| | | {
|
| | | if (dataInfo.PageData[i].IsReading == false)
|
| | | {
|
| | | if (dataInfo.PageData[i].Topic == "/DoorLock/DoorLockOperatingEventNotificationCommand")
|
| | | {
|
| | | //暂时不处理这个主题
|
| | | continue;
|
| | | }
|
| | | ControlCommonResourse.HadNewMessage = true;
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | |
| | | public ScenePictrueControl()
|
| | | {
|
| | | this.UseClickStatu = false;
|
| | | this.Height = Application.GetRealHeight(470);
|
| | | this.Height = Application.GetRealHeight(420);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | var btnPic = new ImageView();
|
| | | btnPic.X = Application.GetRealWidth(179);
|
| | | btnPic.Width = Application.GetRealWidth(844);
|
| | | btnPic.Height = Application.GetRealHeight(420);
|
| | | btnPic.Height = Application.GetRealHeight(397);
|
| | | if (sceneUI.IconPathType == 0)
|
| | | {
|
| | | btnPic.ImagePath = sceneUI.IconPath;
|
| | |
| | | /// </summary> |
| | | public FrameLayout bodyFrameLayout = null; |
| | | /// <summary>
|
| | | /// 左滑使能
|
| | | /// </summary> |
| | | private bool m_ScrollEnabled = true; |
| | | /// <summary>
|
| | | /// 左滑使能
|
| | | /// </summary> |
| | | public bool ScrollEnabled
|
| | | {
|
| | | get { return m_ScrollEnabled; }
|
| | | set
|
| | | {
|
| | | if (UserView.HomePage.Instance.ScrollEnabled != value)
|
| | | {
|
| | | UserView.HomePage.Instance.ScrollEnabled = value;
|
| | | this.m_ScrollEnabled = value;
|
| | | }
|
| | | }
|
| | | } |
| | | /// <summary>
|
| | | /// 缓存启动参数
|
| | | /// </summary> |
| | | private object[] m_parameter = null;
|
| | |
| | | |
| | | //初始化中部控件 |
| | | this.InitBodyFrameLayout(); |
| | | |
| | | //初始左滑使能可 |
| | | this.ScrollEnabled = true; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | 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);
|
| | |
| | | IMessageCommon.Current.IgnoreError = false;
|
| | | return false;
|
| | | }
|
| | | if (listFile.Count == 0)
|
| | | {
|
| | | //恢复
|
| | | IMessageCommon.Current.IgnoreError = false;
|
| | | return true;
|
| | | }
|
| | |
|
| | | //检测
|
| | | string checkKeys = UserCenterLogic.EncryptPassword(UserCenterResourse.FileEncryptKey, DirNameResourse.ShowOptionMenuFile + UserCenterResourse.UserInfo.Account);
|
| | |
| | | //出力详细Log(Debug用)
|
| | | UserCenterResourse.HideOption.DetailedLog = 1;
|
| | | }
|
| | | checkKeys = UserCenterLogic.EncryptPassword(UserCenterResourse.FileEncryptKey, DirNameResourse.DeviceHistoryFile + UserCenterResourse.UserInfo.Account);
|
| | | if (listFile.Contains(checkKeys) == true)
|
| | | {
|
| | | //显示设备历史版本(Debug用)
|
| | | UserCenterResourse.HideOption.DeviceHistory = 1;
|
| | | }
|
| | |
|
| | | //恢复
|
| | | IMessageCommon.Current.IgnoreError = false;
|
| | |
| | | using System;
|
| | | using Newtonsoft.Json.Linq;
|
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Text;
|
| | | using System.Threading.Tasks;
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 打开空调___________________________
|
| | | #region ■ 关闭空调___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 打开空调
|
| | | /// 关闭空调
|
| | | /// </summary>
|
| | | /// <param name="device">空调对象</param>
|
| | | /// <returns></returns>
|
| | |
| | | /// <returns></returns>
|
| | | public async Task<bool> SetAcModeSupport(AC device, int data)
|
| | | {
|
| | | var result = await HdlDeviceAttributeLogic.Current.WriteDeviceAttribute(device, 513, 4099, 25, data);
|
| | | var result = await HdlDeviceAttributeLogic.Current.WriteDeviceAttribute(device, 513, 4099, 25, data.ToString());
|
| | | //检测网关返回的共通错误状态码
|
| | | string error = HdlCheckLogic.Current.CheckCommonErrorCode(result);
|
| | | if (error != null)
|
| | |
| | | return false;
|
| | | }
|
| | | await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(device, GatewayBackupEnum.A空调自定义模式, data);
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 设置启用空调的摆风功能_____________
|
| | |
|
| | | /// <summary>
|
| | | /// 设置启用空调的摆风功能
|
| | | /// </summary>
|
| | | /// <param name="device">空调对象</param>
|
| | | /// <param name="data">从二进制转换的十进制值</param>
|
| | | /// <returns></returns>
|
| | | public async Task<bool> SetUseAcSwingFunctionStatu(AC device, int data)
|
| | | {
|
| | | var result = await HdlDeviceAttributeLogic.Current.WriteDeviceAttribute(device, 514, 4097, 25, data.ToString());
|
| | | //检测网关返回的共通错误状态码
|
| | | string error = HdlCheckLogic.Current.CheckCommonErrorCode(result);
|
| | | if (error != null)
|
| | | {
|
| | | this.ShowTipMsg(error);
|
| | | return false;
|
| | | }
|
| | | if (result == null || result.setWritableValueResponData == null)
|
| | | {
|
| | | //设置空调摆风失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uSetAirConditionerSwingFunctionFail);
|
| | | //拼接上【网关回复超时】的Msg
|
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
|
| | | this.ShowTipMsg(msg);
|
| | | return false;
|
| | | }
|
| | | if (result.setWritableValueResponData.Status != 0)
|
| | | {
|
| | | //设置空调摆风失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uSetAirConditionerSwingFunctionFail);
|
| | | this.ShowTipMsg(msg);
|
| | | return false;
|
| | | }
|
| | | await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(device, GatewayBackupEnum.A空调摆风功能, data);
|
| | |
|
| | | return true;
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | |
|
| | | #region ■ 升级空调第三方模块的接口___________
|
| | |
|
| | | #region 读取IRACC模块固件版本(APP -> Zigbee MCU)
|
| | | ///<summary >
|
| | | ///读取IRACC模块固件版本
|
| | | /// </summary>
|
| | | public async System.Threading.Tasks.Task<ReadACFirewareVersionResponAllData> ReadACFirewareVersionAsync(CommonDevice device)
|
| | | {
|
| | | ReadACFirewareVersionResponAllData result = null;
|
| | | var Gateway = device.Gateway;
|
| | | if (Gateway == null)
|
| | | {
|
| | | result = new ReadACFirewareVersionResponAllData { errorMessageBase = "当前没有网关" };
|
| | | return result;
|
| | | }
|
| | | return await System.Threading.Tasks.Task.Run(async () =>
|
| | | {
|
| | | Action<string, string> action = (topic, message) =>
|
| | | {
|
| | | var gatewayID = topic.Split('/')[0];
|
| | | var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
|
| | |
|
| | | if (topic == gatewayID + "/" + "ZbDataPassthrough")
|
| | | {
|
| | | var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
|
| | | gatewayTemp.clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ClientDataPassthroughResponseData>(jobject["Data"].ToString());
|
| | |
|
| | | if (gatewayTemp.clientDataPassthroughResponseData == null)
|
| | | {
|
| | | result = new ReadACFirewareVersionResponAllData { errorMessageBase = "网关返回的数据为空" };
|
| | | }
|
| | | else
|
| | | {
|
| | | if (gatewayTemp.clientDataPassthroughResponseData?.PassData != null)
|
| | | {
|
| | | var data = gatewayTemp.clientDataPassthroughResponseData.PassData;
|
| | | var command = data[4].ToString() + data[5].ToString() + data[2].ToString() + data[3].ToString();
|
| | | if (command == "0259")
|
| | | {
|
| | | var tempD = new ReadACFirewareVersionResponData();
|
| | | tempD.Status = Convert.ToInt32(data[10].ToString() + data[11].ToString(), 16);
|
| | | if (data.Length == 82)
|
| | | {
|
| | | var firewareString = data.Substring(12);
|
| | | var aa = firewareString.Length;
|
| | | firewareVersion = firewareString;
|
| | | var bytes = new byte[firewareString.Length / 2];
|
| | | for (int i = 0; i < bytes.Length; i++)
|
| | | {
|
| | | bytes[i] = Convert.ToByte(firewareString.Substring(i * 2, 2), 16);
|
| | | }
|
| | |
|
| | | var firewareVersionTemp = System.Text.Encoding.ASCII.GetString(bytes);
|
| | | tempD.FirewareVersion = firewareVersionTemp.Replace('\0', ' ').Trim();
|
| | | }
|
| | | result = new ReadACFirewareVersionResponAllData { readACFirewareVersionResponData = tempD };
|
| | | System.Console.WriteLine($"UI收到通知后的主题_command:0258_{topic}");
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | };
|
| | |
|
| | | Gateway.Actions += action;
|
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 启动" + System.DateTime.Now.ToString());
|
| | |
|
| | | try
|
| | | {
|
| | | var passData = ReadACFirewareVersionData("01");
|
| | | var jObject = new JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } };
|
| | | var data = new JObject { { "PassData", passData } };
|
| | | jObject.Add("Data", data);
|
| | | Gateway.Send(("ClientDataPassthrough"), jObject.ToString());
|
| | | }
|
| | | catch { }
|
| | |
|
| | | var dateTime = DateTime.Now;
|
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < 3000)
|
| | | {
|
| | | await System.Threading.Tasks.Task.Delay(10);
|
| | | if (result != null)
|
| | | {
|
| | | break;
|
| | | }
|
| | | }
|
| | | if ((DateTime.Now - dateTime).TotalMilliseconds > 3000)
|
| | | {
|
| | | result = new ReadACFirewareVersionResponAllData { errorMessageBase = " 回复超时,请重新操作" };
|
| | | }
|
| | | Gateway.Actions -= action;
|
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 退出" + System.DateTime.Now.ToString());
|
| | |
|
| | | return result;
|
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 读取IRACC模块固件版本
|
| | | /// </summary>
|
| | | string ReadACFirewareVersionData(string reserve)
|
| | | {
|
| | | string data = "";
|
| | | string dataLength = "05";
|
| | | string dataComand1 = "58";
|
| | | string dataComand2 = "02";
|
| | | string dataSerialNum = "01";
|
| | | string addDataLength = "01";
|
| | | string reserveData = reserve;
|
| | |
|
| | | try
|
| | | {
|
| | | data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength +
|
| | | reserveData;
|
| | | }
|
| | | catch { };
|
| | |
|
| | | return data;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// IRACC模块固件版本,网关反馈信息
|
| | | /// </summary>
|
| | | public ReadACFirewareVersionResponAllData readACFirewareVersionResponAllData;
|
| | | /// <summary>
|
| | | /// IRACC模块固件版本,网关反馈信息
|
| | | /// </summary>
|
| | | [System.Serializable]
|
| | | public class ReadACFirewareVersionResponAllData
|
| | | {
|
| | | /// <summary>
|
| | | /// 错误信息
|
| | | /// </summary>
|
| | | public string errorMessageBase;
|
| | | /// <summary>
|
| | | /// 网关信息错误反馈
|
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
|
| | | /// </summary>
|
| | | public CommonDevice.ErrorResponData errorResponData;
|
| | | /// <summary>
|
| | | /// IRACC模块固件版本信息
|
| | | /// </summary>
|
| | | public ReadACFirewareVersionResponData readACFirewareVersionResponData;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// IRACC模块固件版本的数据
|
| | | /// </summary>
|
| | | [System.Serializable]
|
| | | public class ReadACFirewareVersionResponData
|
| | | {
|
| | | /// <summary>
|
| | | /// 状态
|
| | | ///<para>0--成功</para>
|
| | | ///<para>1--失败</para>
|
| | | ///<para>ff--无效</para>
|
| | | /// </summary>
|
| | | public int Status;
|
| | | /// <summary>
|
| | | /// 固件版本
|
| | | /// </summary>
|
| | | public string FirewareVersion;
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 升级IRACC模块通知(APP -> Zigbee MCU)
|
| | | ///<summary >
|
| | | ///升级IRACC模块通知
|
| | | /// <para>firewareVer:固件版本</para>
|
| | | /// <para>firewareSize:固件大小</para>
|
| | | /// </summary>
|
| | | public async System.Threading.Tasks.Task<ResponseAllData> UpggradeACNotificationAsync(CommonDevice device, string firewareVer, long firewareSize)
|
| | | {
|
| | | ResponseAllData result = null;
|
| | | var Gateway = device.Gateway;
|
| | | if (Gateway == null)
|
| | | {
|
| | | result = new ResponseAllData { errorMessageBase = "当前没有网关" };
|
| | | return result;
|
| | | }
|
| | | return await System.Threading.Tasks.Task.Run(async () =>
|
| | | {
|
| | | Action<string, string> action = (topic, message) =>
|
| | | {
|
| | | var gatewayID = topic.Split('/')[0];
|
| | | var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
|
| | |
|
| | | if (topic == gatewayID + "/" + "ZbDataPassthrough")
|
| | | {
|
| | | var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
|
| | | gatewayTemp.clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ClientDataPassthroughResponseData>(jobject["Data"].ToString());
|
| | |
|
| | | if (gatewayTemp.clientDataPassthroughResponseData == null)
|
| | | {
|
| | | result = new ResponseAllData { errorMessageBase = "网关返回的数据为空" };
|
| | | }
|
| | | else
|
| | | {
|
| | | if (gatewayTemp.clientDataPassthroughResponseData?.PassData != null)
|
| | | {
|
| | | var data = gatewayTemp.clientDataPassthroughResponseData.PassData;
|
| | | var command = data[4].ToString() + data[5].ToString() + data[2].ToString() + data[3].ToString();
|
| | | if (command == "025b")
|
| | | {
|
| | | var tempD = new ResponseData();
|
| | | if (data.Length == 12)
|
| | | {
|
| | | tempD.status = Convert.ToInt32(data[10].ToString() + data[11].ToString(), 16);
|
| | | }
|
| | | result = new ResponseAllData { responseData = tempD };
|
| | | System.Console.WriteLine($"UI收到通知后的主题_{ topic}");
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | };
|
| | |
|
| | | Gateway.Actions += action;
|
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 启动" + System.DateTime.Now.ToString());
|
| | |
|
| | | try
|
| | | {
|
| | | var passData = UpggradeACNotificationData(firewareVer, firewareSize);
|
| | | var jObject = new JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } };
|
| | | var data = new JObject { { "PassData", passData } };
|
| | | jObject.Add("Data", data);
|
| | | Gateway.Send(("ClientDataPassthrough"), jObject.ToString());
|
| | | }
|
| | | catch { }
|
| | |
|
| | | var dateTime = DateTime.Now;
|
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < 3000)
|
| | | {
|
| | | await System.Threading.Tasks.Task.Delay(10);
|
| | | if (result != null)
|
| | | {
|
| | | break;
|
| | | }
|
| | | }
|
| | | if ((DateTime.Now - dateTime).TotalMilliseconds > 3000)
|
| | | {
|
| | | result = new ResponseAllData { errorMessageBase = " 回复超时,请重新操作" };
|
| | | }
|
| | | Gateway.Actions -= action;
|
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 退出" + System.DateTime.Now.ToString());
|
| | |
|
| | | return result;
|
| | | });
|
| | | }
|
| | |
|
| | | private string firewareVersion = string.Empty;
|
| | | /// <summary>
|
| | | /// 升级IRACC模块通知返回
|
| | | /// </summary>
|
| | | string UpggradeACNotificationData(string firewareVer, long firewareSize)
|
| | | {
|
| | | string data = "";
|
| | | string dataLength = "2C";
|
| | | string dataComand1 = "5A";
|
| | | string dataComand2 = "02";
|
| | | string dataSerialNum = "01";
|
| | | string addDataLength = "28";
|
| | | string deviceUpgradeMethod = "01";
|
| | | string firewareVersionData = "";
|
| | | string firewareSizeData = "";
|
| | |
|
| | | try
|
| | | {
|
| | | //固件版本
|
| | | var firewareVerBytes = System.Text.Encoding.ASCII.GetBytes(firewareVer);
|
| | | for (int i = 0; i < firewareVerBytes.Length; i++)
|
| | | {
|
| | | var fw = Convert.ToString(firewareVerBytes[i], 16);
|
| | | if (fw.Length == 1)
|
| | | {
|
| | | fw = "0" + fw;
|
| | | }
|
| | | firewareVersionData += fw;
|
| | | }
|
| | |
|
| | | var aa = firewareVersionData.Length;
|
| | | firewareVersionData = firewareVersionData.PadRight(70, '0');
|
| | |
|
| | | //固件尺寸
|
| | | var tempFwSize = Convert.ToString(firewareSize, 16);
|
| | | tempFwSize = tempFwSize.PadLeft(8, '0');
|
| | | for (int i = 6; i >= 0; i = i - 2)
|
| | | {
|
| | | firewareSizeData += tempFwSize.Substring(i, 2);
|
| | | }
|
| | |
|
| | | data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength +
|
| | | deviceUpgradeMethod + firewareVersionData + firewareSizeData;
|
| | |
|
| | | }
|
| | | catch { };
|
| | |
|
| | | return data;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | ///升级IRACC模块通知回复
|
| | | /// </summary>
|
| | | public ResponseAllData keyColorDataResponseAllData;
|
| | | [System.Serializable]
|
| | | public class ResponseAllData
|
| | | {
|
| | | /// <summary>
|
| | | /// 错误信息
|
| | | /// </summary>
|
| | | public string errorMessageBase;
|
| | | /// <summary>
|
| | | /// 网关信息错误反馈
|
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
|
| | | /// </summary>
|
| | | public CommonDevice.ErrorResponData errorResponData;
|
| | | /// <summary>
|
| | | /// 升级IRACC模块通知信息
|
| | | /// </summary>
|
| | | public ResponseData responseData;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 升级IRACC模块通知回复(Zigbee MCU -> APP)
|
| | | /// </summary>
|
| | | [System.Serializable]
|
| | | public class ResponseData
|
| | | {
|
| | | /// <summary>
|
| | | /// 状态值
|
| | | /// <para>0--版本号不一致(可以升级</para>
|
| | | /// <para>1--版本号一致(不用升级</para>
|
| | | /// <para>2--预留(暂时不用到</para>
|
| | | /// <para>ff--无效(暂时不用到)</para>
|
| | | /// </summary>
|
| | | public int status = -1;
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 设备请求APP获取升级数据 (Zigbee MCU -> APP,主动上报)
|
| | | /// <summary>
|
| | | ///设备请求APP获取升级数据(Zigbee MCU -> APP,主动上报)
|
| | | /// </summary>
|
| | | [System.Serializable]
|
| | | public class DeviceRequestUpgradeResponseData
|
| | | {
|
| | | /// <summary>
|
| | | /// 数据偏移量,每个分包偏移量+(1-43)
|
| | | /// </summary>
|
| | | public string offset = string.Empty;
|
| | | /// <summary>
|
| | | /// 数据长度len
|
| | | /// </summary>
|
| | | public int dataLength = -1;
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 发升级数据到设备(APP -> Zigbee MCU)
|
| | | ///<summary >
|
| | | ///读取IRACC模块固件版本
|
| | | /// <para>reserve:0-ff</para>
|
| | | /// </summary>
|
| | | public async void UpgradeAsync(CommonDevice device, SendUpgradeData upgradeData)
|
| | | {
|
| | | var Gateway = device.Gateway;
|
| | | if (Gateway == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | Action<string, string> action = (topic, message) => { };
|
| | | Gateway.Actions += action;
|
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 启动" + System.DateTime.Now.ToString());
|
| | |
|
| | | try
|
| | | {
|
| | | string passData = "";
|
| | | if (upgradeData != null)
|
| | | {
|
| | | passData = SendUpgrade(upgradeData);
|
| | | }
|
| | |
|
| | | var jObject = new JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } };
|
| | | var data = new JObject { { "PassData", passData } };
|
| | | jObject.Add("Data", data);
|
| | | Gateway.Send(("ClientDataPassthrough"), jObject.ToString());
|
| | | }
|
| | | catch { }
|
| | |
|
| | | Gateway.Actions -= action;
|
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 退出" + System.DateTime.Now.ToString());
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 发升级数据到设备
|
| | | /// </summary>
|
| | | string SendUpgrade(SendUpgradeData upgradeData)
|
| | | {
|
| | | string data = "";
|
| | | string dataLength = "";
|
| | | string dataComand1 = "5D";
|
| | | string dataComand2 = "02";
|
| | | string dataSerialNum = "01";
|
| | | string addDataLength = "";
|
| | |
|
| | | string status = "";
|
| | | string offset = "";
|
| | | string upgradeDataLength = "";
|
| | | string dataString = "";
|
| | |
|
| | | try
|
| | | {
|
| | | var len = 4 + 1 + 4 + 1 + upgradeData.dataLength;
|
| | | dataLength = Convert.ToString(len, 16);
|
| | | if (dataLength.Length == 1)
|
| | | {
|
| | | dataLength = "0" + dataLength;
|
| | | }
|
| | |
|
| | | addDataLength = Convert.ToString(6 + upgradeData.dataLength, 16);
|
| | | if (addDataLength.Length == 1)
|
| | | {
|
| | | addDataLength = "0" + addDataLength;
|
| | | }
|
| | |
|
| | | if (upgradeData.status == 0)
|
| | | {
|
| | | status = "00";
|
| | | }
|
| | | else if (upgradeData.status == 1)
|
| | | {
|
| | | status = "01";
|
| | | }
|
| | | else
|
| | | {
|
| | | status = "ff";
|
| | | }
|
| | |
|
| | |
|
| | | offset = upgradeData.offset;
|
| | |
|
| | | var dl = Convert.ToString(upgradeData.dataLength, 16);
|
| | | if (dl.Length == 1)
|
| | | {
|
| | | upgradeDataLength = "0" + dl;
|
| | | }
|
| | | else
|
| | | {
|
| | | upgradeDataLength = dl;
|
| | | }
|
| | |
|
| | | for (int i = 0; i < upgradeData.databytes.Length; i++)
|
| | | {
|
| | | var dataB = Convert.ToString(upgradeData.databytes[i], 16);
|
| | | if (dataB.Length == 1)
|
| | | {
|
| | | dataB = "0" + dataB;
|
| | | }
|
| | | dataString += dataB;
|
| | | }
|
| | |
|
| | | data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength +
|
| | | status + offset + upgradeDataLength + dataString;
|
| | | }
|
| | | catch { };
|
| | |
|
| | | return data;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 发送升级数据到设备(APP -> Zigbee MCU)
|
| | | /// </summary>
|
| | | [System.Serializable]
|
| | | public class SendUpgradeData
|
| | | {
|
| | | /// <summary>
|
| | | /// 0--成功
|
| | | ///<para>1--失败</para>
|
| | | ///<para>ff--无效</para>
|
| | | /// </summary>
|
| | | public int status = 0;
|
| | | /// <summary>
|
| | | /// 数据偏移量,每个分包偏移量+(1-43)
|
| | | /// </summary>
|
| | | public string offset;
|
| | | /// <summary>
|
| | | /// 数据长度len
|
| | | /// </summary>
|
| | | public int dataLength = -1;
|
| | |
|
| | | /// <summary>
|
| | | /// 分包数据
|
| | | /// </summary>
|
| | | public byte[] databytes;
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 分包结束(Zigbee MCU -> APP,主动上报)
|
| | | /// <summary>
|
| | | /// 设备请求APP获取分包结束命令(Zigbee MCU -> APP)
|
| | | /// </summary>
|
| | | [System.Serializable]
|
| | | public class DeviceRequestFinishResponseData
|
| | | {
|
| | | /// <summary>
|
| | | /// 0-ff
|
| | | /// </summary>
|
| | | public int reserve = -1;
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 分包结束(APP -> Zigbee MCU)
|
| | | ///<summary >
|
| | | ///读取IRACC模块固件版本
|
| | | /// <para>status:0--成功;1--失败;ff--无效 .</para>
|
| | | /// </summary>
|
| | | public async void SendFinishAsync(CommonDevice device, int status)
|
| | | {
|
| | | var Gateway = device.Gateway;
|
| | | if (Gateway == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | Action<string, string> action = (topic, message) => { };
|
| | | Gateway.Actions += action;
|
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 启动" + System.DateTime.Now.ToString());
|
| | |
|
| | | try
|
| | | {
|
| | | var passData = SendFinishDataString(status);
|
| | | var jObject = new JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } };
|
| | | var data = new JObject { { "PassData", passData } };
|
| | | jObject.Add("Data", data);
|
| | | Gateway.Send(("ClientDataPassthrough"), jObject.ToString());
|
| | | }
|
| | | catch { }
|
| | |
|
| | | Gateway.Actions -= action;
|
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 退出" + System.DateTime.Now.ToString());
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 发升级数据到设备
|
| | | /// </summary>
|
| | | string SendFinishDataString(int status)
|
| | | {
|
| | | string data = "";
|
| | | string dataLength = "05";
|
| | | string dataComand1 = "5F";
|
| | | string dataComand2 = "02";
|
| | | string dataSerialNum = "01";
|
| | | string addDataLength = "01";
|
| | | string statusString = "";
|
| | | try
|
| | | {
|
| | | if (status == 0)
|
| | | {
|
| | | statusString = "00";
|
| | | }
|
| | | else if (status == 1)
|
| | | {
|
| | | statusString = "01";
|
| | | }
|
| | | else
|
| | | {
|
| | | statusString = "ff";
|
| | | }
|
| | | data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength +
|
| | | statusString;
|
| | | }
|
| | | catch { };
|
| | |
|
| | | return data;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 分包结束返回(APP -> Zigbee MCU
|
| | | /// </summary>
|
| | | //[System.Serializable]
|
| | | public class SendFinishData
|
| | | {
|
| | | /// <summary>
|
| | | /// 状态:成功/失败
|
| | | ///<para>0--成功<<para>
|
| | | ///<para>1--失败<<para>
|
| | | ///<para>ff--无效<<para>
|
| | | /// </summary>
|
| | | public int status = -1;
|
| | | }
|
| | |
|
| | | #endregion
|
| | | #endregion
|
| | | }
|
| | | }
|
| | |
| | | /// <param name="attributeDataType">数据类型</param>
|
| | | /// <param name="attributeData">需要写入的数据</param>
|
| | | /// <returns></returns>
|
| | | public async System.Threading.Tasks.Task<CommonDevice.SetWritableValueResponAllData> WriteDeviceAttribute(CommonDevice device, int clusterId, int attributeId, int attributeDataType, int attributeData)
|
| | | public async System.Threading.Tasks.Task<CommonDevice.SetWritableValueResponAllData> WriteDeviceAttribute(CommonDevice device, int clusterId, int attributeId, int attributeDataType, string attributeData)
|
| | | {
|
| | | var MyGateway = device.Gateway;
|
| | | if (MyGateway == null)
|
| | |
| | | /// </summary>
|
| | | /// <param name="rollershade">窗帘对象</param>
|
| | | /// <param name="limiType">确认及覆盖上限位还是下限位</param>
|
| | | /// <param name="upLimit">上限位的值,百分比(备份用)</param>
|
| | | /// <param name="downLimit">下限位的值,百分比(备份用)</param>
|
| | | /// <param name="upLimit">上限位的值(长度值,不是百分比)</param>
|
| | | /// <param name="downLimit">下限位的值(长度值,不是百分比)</param>
|
| | | /// <returns></returns>
|
| | | public async Task<bool> CommitCurtainLimitPoint(Rollershade rollershade, Rollershade.CurtainPrivateInstalledLimi limiType, int upLimit, int downLimit)
|
| | | {
|
| | | var result = await rollershade.SetCurtainInstalledLimitAsync(limiType);
|
| | | CommonDevice.SetWritableValueResponAllData result = null;
|
| | | if (upLimit == -1 && upLimit == -1)
|
| | | {
|
| | | //这个是卷帘
|
| | | result = await rollershade.SetCurtainInstalledLimitAsync(limiType);
|
| | | }
|
| | | else
|
| | | {
|
| | | //这个是开合帘 "2,0x00ff,0x00ff"格式 合限位在前,开限位在后
|
| | | string convertData = "\"2,0x" + Convert.ToString(downLimit, 16).PadLeft(4, '0');
|
| | | convertData += ",0x" + Convert.ToString(upLimit, 16).PadLeft(4, '0') + "\"";
|
| | | //然后将它们转为ASK码数值,然后再转为16进制
|
| | | //总计长度为17(这里是16进制)
|
| | | string sendData = "11";
|
| | | foreach (char c in convertData)
|
| | | {
|
| | | sendData += Convert.ToString((int)c, 16).PadLeft(2, '0');
|
| | | }
|
| | | result = await HdlDeviceAttributeLogic.Current.WriteDeviceAttribute(rollershade, 258, 24, 65, sendData);
|
| | | }
|
| | | //检测网关返回的共通错误状态码
|
| | | string error = HdlCheckLogic.Current.CheckCommonErrorCode(result);
|
| | | if (error != null)
|
| | |
| | | {
|
| | | //先移除
|
| | | this.RemoveDeviceHardInfoThread(device);
|
| | |
|
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
|
| | | this.hsGetHardInfoDevice.Add(mainkeys);
|
| | |
|
| | | if (HdlGatewayReceiveLogic.Current.IsEsixt("DeviceGetFixedAttribute") == false)
|
| | | {
|
| | | //添加事件
|
| | |
| | | //不需要发送
|
| | | return;
|
| | | }
|
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
|
| | | this.hsGetHardInfoDevice.Add(mainkeys);
|
| | | //发送
|
| | | var data = new Newtonsoft.Json.Linq.JObject { { "AttriBute", attriBute } };
|
| | | jObject.Add("Data", data);
|
| | |
| | | #region ■ 修改干接点私有属性_________________
|
| | |
|
| | | /// <summary>
|
| | | /// 修改干接点私有属性
|
| | | /// 修改干接点第三级别的私有属性
|
| | | /// </summary>
|
| | | /// <param name="panel">干接点对象</param>
|
| | | /// <param name="i_value">干接点的第三级别属性的值,具体请参照第三级别属性</param>
|
| | | /// <returns></returns>
|
| | | public async Task<bool> EditorDryContactFunction(Panel panel, int i_value)
|
| | | public async Task<bool> EditorDryContactThirdFunction(Panel panel, int i_value)
|
| | | {
|
| | | var result = await panel.ConfigureHdlKeyValueAsync((Panel.KeyMode)i_value);
|
| | | //共通错误检测
|
| | |
| | | return false;
|
| | | }
|
| | | //备份设备
|
| | | await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(panel, GatewayBackupEnum.A干接点私有属性, i_value);
|
| | | await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(panel, GatewayBackupEnum.A干接点第三级别私有属性, i_value);
|
| | |
|
| | | return true;
|
| | | }
|
| | |
| | | errorMsg = UserCenterLogic.CombineGatewayTimeOutMsg(errorMsg, null, "回复超时", false);
|
| | | }
|
| | | this.ShowTipMsg(errorMsg);
|
| | | return false;
|
| | | }
|
| | | //备份设备
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(device, GatewayBackupEnum.A简约面板震动功能, datainfo);
|
| | | }, ShowErrorMode.NO);
|
| | |
|
| | | return success;
|
| | | }
|
| | |
| | | return data.configureParamates;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 获取配置信息_______________________
|
| | |
|
| | | /// <summary>
|
| | | /// 获取PIR传感器的【lux值】,错误时返回-1
|
| | | /// </summary>
|
| | | /// <param name="iASZone"></param>
|
| | | /// <param name="mode"></param>
|
| | | /// <returns></returns>
|
| | | public async Task<int> GetPirSensorLux(IASZone iASZone)
|
| | | public async Task<int> GetPirSensorLux(IASZone iASZone, ShowErrorMode mode = ShowErrorMode.YES)
|
| | | {
|
| | | var data = await iASZone.GetPirLuxAbilitySizeAsync();
|
| | | if (data == null || data.pirLux == -1)
|
| | |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uGetPirSensorLuxFail);
|
| | | //拼接上【网关回复超时】的Msg
|
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, data);
|
| | |
|
| | | this.ShowErrorMsg(msg);
|
| | | if (mode == ShowErrorMode.YES)
|
| | | {
|
| | | this.ShowErrorMsg(msg);
|
| | | }
|
| | | return -1;
|
| | | }
|
| | | return data.pirLux;
|
| | |
| | | List<CommonDevice> list = Common.LocalDevice.Current.GetDeviceByGatewayID(gatewayId);
|
| | | foreach (var device in list)
|
| | | {
|
| | | //删除设备,不删除房间信息
|
| | | Common.LocalDevice.Current.DeleteMemmoryDevice(device, false);
|
| | | //删除一般设备
|
| | | Common.LocalDevice.Current.DeleteMemmoryDevice(device, true);
|
| | | //删除Ota设备
|
| | | Common.LocalDevice.Current.DeleteMemmoryOtaDevice(device.DeviceAddr);
|
| | | }
|
| | | //删除网关文件
|
| | | this.DeleteGatewayFile(gatewayId);
|
| | |
| | | /// 重新绑定网关(1:正常 -1:异常 0:当前的网关绑定在了当前账号下的不同住宅里面) |
| | | /// </summary> |
| | | /// <param name="zbGateway">网关</param> |
| | | /// <param name="btnMsg">消息控件</param> |
| | | public async Task<int> ReBindNewGateway(ZbGateway zbGateway, NormalViewControl btnMsg = null) |
| | | {
|
| | | if (zbGateway == null)
|
| | |
| | | }
|
| | |
|
| | | //获取全部设备
|
| | | bool result = LocalDevice.Current.SetDeviceToMemmoryByGateway(realWay);
|
| | | int result = LocalDevice.Current.SetDeviceToMemmoryByGateway(realWay);
|
| | | //关闭进度条
|
| | | ProgressBar.Close();
|
| | | if (result == false)
|
| | | if (result == -1)
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
| | | {
|
| | | //删除设备文件
|
| | | Common.LocalDevice.Current.DeleteMemmoryDevice(device, true);
|
| | | //删除Ota设备
|
| | | Common.LocalDevice.Current.DeleteMemmoryOtaDevice(device.DeviceAddr);
|
| | | }
|
| | | //如果是主网关
|
| | | if (this.IsMainGateway(zbGatewayID) == 1)
|
| | |
| | | /// <returns></returns>
|
| | | public async Task<bool> UpLoadDeviceBackupDataToGateway(CommonDevice device, GatewayBackupEnum backupEnum, object upLaodData)
|
| | | {
|
| | | //ZbGateway realWay = null;
|
| | | //if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, device.CurrentGateWayId) == false)
|
| | | //{
|
| | | // //没有找到真实物理网关
|
| | | // return false;
|
| | | //}
|
| | | //string fileName = device.FilePath + ((int)backupEnum).ToString().PadLeft(5, '0');
|
| | | ////创建文件对象
|
| | | //var result = await realWay.CreateFileAsync(fileName);
|
| | | //if (result == null || result.Result != 0)
|
| | | //{
|
| | | // return false;
|
| | | //}
|
| | | ////发送数据流
|
| | | //var data = Newtonsoft.Json.JsonConvert.SerializeObject(upLaodData);
|
| | | //var byteData = System.Text.Encoding.UTF8.GetBytes(data);
|
| | | //var result2 = await realWay.SendFileAsync(byteData);
|
| | | //if (result2 == null || result2.Result != 0)
|
| | | //{
|
| | | // return false;
|
| | | //}
|
| | | ZbGateway realWay = null;
|
| | | if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, device.CurrentGateWayId) == false)
|
| | | {
|
| | | //没有找到真实物理网关
|
| | | return false;
|
| | | }
|
| | | string fileName = device.FilePath + ((int)backupEnum).ToString().PadLeft(5, '0');
|
| | | //创建文件对象
|
| | | var result = await realWay.CreateFileAsync(fileName);
|
| | | if (result == null || result.Result != 0)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | //发送数据流
|
| | | var data = Newtonsoft.Json.JsonConvert.SerializeObject(upLaodData);
|
| | | var byteData = System.Text.Encoding.UTF8.GetBytes(data);
|
| | | var result2 = await realWay.SendFileAsync(byteData);
|
| | | if (result2 == null || result2.Result != 0)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | return true;
|
| | | }
|
| | |
|
| | |
| | | int level = Convert.ToInt32(recoverData["level"]);
|
| | | result = await HdlDevicePanelLogic.Current.SetDeviceEnergyConservationMode((Panel)device, modeEnable, modeTime, level);
|
| | | }
|
| | | else if (backType == GatewayBackupEnum.A干接点私有属性)
|
| | | else if (backType == GatewayBackupEnum.A干接点第三级别私有属性)
|
| | | {
|
| | | var recoverData = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(System.Text.Encoding.UTF8.GetString(byteData));
|
| | | result = await HdlDevicePanelLogic.Current.EditorDryContactFunction((Panel)device, recoverData);
|
| | | result = await HdlDevicePanelLogic.Current.EditorDryContactThirdFunction((Panel)device, recoverData);
|
| | | }
|
| | | else if (backType == GatewayBackupEnum.A窗帘方向)
|
| | | {
|
| | |
| | | /// <param name="gatewayId">网关ID</param>
|
| | | /// <param name="topic">整个主题</param>
|
| | | /// <param name="reportTopic">上报数据的主题</param>
|
| | | /// <param name="receiveData">接收的数据</param>
|
| | | public void GatewayOverallMsgReceive(string gatewayId, string topic, string reportTopic, JObject receiveData)
|
| | | /// <param name="msgData">接收的数据</param>
|
| | | public void GatewayOverallMsgReceive(string gatewayId, string topic, string reportTopic, string msgData)
|
| | | {
|
| | | if (topic == "AppNoLogin")
|
| | | {
|
| | |
| | | });
|
| | | return;
|
| | | }
|
| | | else if (topic == "BeingSqueezedOffline")
|
| | | else if (topic == "ZigbeeGateWayToClient/" + Common.Config.Instance.ConnEmqClientId + "/Push/NotifySqueeze")
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | |
| | | });
|
| | | return;
|
| | | }
|
| | | else if (topic == "/ZigbeeGateWayToClient/" + Common.Config.Instance.Guid + "/Push/Deleted"
|
| | | || topic == "/ZigbeeGateWayToClient/" + Common.Config.Instance.Guid + "/Push/DeletedShareData")
|
| | | else if (topic == "ZigbeeGateWayToClient/" + Common.Config.Instance.Guid + "/Push/Deleted"
|
| | | || topic == "ZigbeeGateWayToClient/" + Common.Config.Instance.Guid + "/Push/DeletedShareData")
|
| | | {
|
| | | if (UserCenterResourse.UserInfo.AuthorityNo == 3)
|
| | | {
|
| | |
| | | //不是自己绑定的网关,则不处理
|
| | | return;
|
| | | }
|
| | |
|
| | | //设备属性上报
|
| | | if (reportTopic == "DeviceStatusReport")
|
| | | {
|
| | | //设备属性上报
|
| | | this.DeviceAttributeReportPush(receiveData);
|
| | | this.DeviceAttributeReportPush(JObject.Parse(msgData));
|
| | | }
|
| | | //传感器上报
|
| | | else if (reportTopic == "IASInfoReport")
|
| | | {
|
| | | this.SensorDeviceReportPush(receiveData);
|
| | | this.SensorDeviceReportPush(JObject.Parse(msgData));
|
| | | }
|
| | | //门锁上报
|
| | | else if (topic == gatewayId + "/Alarms/SendAlarmInform")
|
| | | {
|
| | | this.DoorLockDeviceReportPush(receiveData);
|
| | | this.DoorLockDeviceReportPush(null);
|
| | | }
|
| | | //通过外部方式布防撤防成功时报告
|
| | | else if (topic == gatewayId + "/Security/EnOrWithdrawSucceedReport")
|
| | | {
|
| | | this.SecurityEnOrWithdrawSucceedReport(receiveData);
|
| | | this.SecurityEnOrWithdrawSucceedReport(JObject.Parse(msgData));
|
| | | }
|
| | | //设备在线状态更新反馈
|
| | | else if (reportTopic == "OnlineStatusChange_Respon")
|
| | | {
|
| | | this.DeviceOnlineChangePush(receiveData);
|
| | | this.DeviceOnlineChangePush(JObject.Parse(msgData));
|
| | | }
|
| | | //撤防
|
| | | else if (topic == gatewayId + "/Security/WithdrawMode_Respon")
|
| | | {
|
| | | this.RemoveSafetyGarrisonPush(receiveData);
|
| | | this.RemoveSafetyGarrisonPush(JObject.Parse(msgData));
|
| | | }
|
| | | //布防
|
| | | else if (topic == gatewayId + "/Security/EnableMode_Respon")
|
| | | {
|
| | | this.SetSafetyGarrisonPush(receiveData);
|
| | | this.SetSafetyGarrisonPush(JObject.Parse(msgData));
|
| | | }
|
| | | //逻辑触发上报
|
| | | else if (topic == gatewayId + "/Logic/Execute_Respon")
|
| | | {
|
| | | this.LogicExecutePush(receiveData);
|
| | | this.LogicExecutePush(null);
|
| | | }
|
| | | //场景触发上报
|
| | | else if (topic == gatewayId + "/Scene/Exec_Respon")
|
| | | {
|
| | | this.SceneExecPush(receiveData);
|
| | | this.SceneExecPush(null);
|
| | | }
|
| | | }
|
| | | catch (Exception ex)
|
| | |
| | | private void DoorLockDeviceReportPush(JObject receiveData)
|
| | | {
|
| | | //保存门锁信息到本地
|
| | | HdlAlarmsLogic.Current.SaveDoorLockAlarmInfo(receiveData);
|
| | | //HdlAlarmsLogic.Current.SaveDoorLockAlarmInfo(receiveData);
|
| | |
|
| | | //显示有新消息的特效
|
| | | this.ShowHadNewMessageAppeal();
|
| | |
| | | /// </param>
|
| | | public static async Task<bool> GetResultStatuByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null)
|
| | | {
|
| | | //检测是否已经完成账号信息初始化
|
| | | if (UserCenterResourse.UserInfo.InitUserInfoSuccess == false)
|
| | | {
|
| | | //不管结果怎么样,如果调用了这个函数,需要重头获取Token,所以必须返回失败
|
| | | await ReInitUserAccoutInfo();
|
| | | return false;
|
| | | }
|
| | | //获取接口的连接模式
|
| | | var connectMode = GetHttpConnectMode(checkAuthority);
|
| | | //获取从接口那里取到的比特数据
|
| | |
| | | /// </param>
|
| | | public static async Task<string> GetResultCodeByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null)
|
| | | {
|
| | | //检测是否已经完成账号信息初始化
|
| | | if (UserCenterResourse.UserInfo.InitUserInfoSuccess == false)
|
| | | {
|
| | | //不管结果怎么样,如果调用了这个函数,需要重头获取Token,所以必须返回失败
|
| | | await ReInitUserAccoutInfo();
|
| | | return "Error";
|
| | | }
|
| | |
|
| | | //获取接口的连接模式
|
| | | var connectMode = GetHttpConnectMode(checkAuthority);
|
| | | //获取从接口那里取到的比特数据
|
| | |
| | | /// </param>
|
| | | public static async Task<string> GetResponseDataByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null)
|
| | | {
|
| | | //检测是否已经完成账号信息初始化
|
| | | if (UserCenterResourse.UserInfo.InitUserInfoSuccess == false)
|
| | | {
|
| | | //不管结果怎么样,如果调用了这个函数,需要重头获取Token,所以必须返回失败
|
| | | await ReInitUserAccoutInfo();
|
| | | return null;
|
| | | }
|
| | | //获取接口的连接模式
|
| | | var connectMode = GetHttpConnectMode(checkAuthority);
|
| | | //获取从接口那里取到的比特数据
|
| | |
| | | /// </param>
|
| | | public static async Task<byte[]> GetByteResponseDataByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null)
|
| | | {
|
| | | //检测是否已经完成账号信息初始化
|
| | | if (UserCenterResourse.UserInfo.InitUserInfoSuccess == false)
|
| | | {
|
| | | //不管结果怎么样,如果调用了这个函数,需要重头获取Token,所以必须返回失败
|
| | | await ReInitUserAccoutInfo();
|
| | | return null;
|
| | | }
|
| | | //获取接口的连接模式
|
| | | var connectMode = GetHttpConnectMode(checkAuthority);
|
| | | //获取从接口那里取到的比特数据
|
| | |
| | | {
|
| | | try
|
| | | {
|
| | | var Myform = UserCenterResourse.DicActionForm[UserCenterResourse.NowActionFormID];
|
| | | if (Myform is EditorCommonForm)
|
| | | EditorCommonForm Myform = UserCenterResourse.DicActionForm[UserCenterResourse.NowActionFormID] as EditorCommonForm;
|
| | | if (Myform != null)
|
| | | {
|
| | | //重置左滑使能
|
| | | Myform.ScrollEnabled = Myform.ScrollEnabled;
|
| | | //触发界面再次激活的事件
|
| | | int value = ((EditorCommonForm)Myform).FormActionAgainEvent();
|
| | | int value = Myform.FormActionAgainEvent();
|
| | | if (value == 1)
|
| | | {
|
| | | //Log出力
|
| | |
| | | {
|
| | | try
|
| | | {
|
| | | var Myform = UserCenterResourse.DicActionForm[UserCenterResourse.NowActionFormID];
|
| | | if (Myform is EditorCommonForm)
|
| | | EditorCommonForm Myform = UserCenterResourse.DicActionForm[UserCenterResourse.NowActionFormID] as EditorCommonForm;
|
| | | if (Myform != null)
|
| | | {
|
| | | //重置左滑使能
|
| | | Myform.ScrollEnabled = Myform.ScrollEnabled;
|
| | | //触发界面再次激活的事件
|
| | | int value = ((EditorCommonForm)Myform).FormActionAgainEvent();
|
| | | int value = Myform.FormActionAgainEvent();
|
| | | if (value == 1)
|
| | | {
|
| | | //Log出力
|
| | |
| | |
|
| | | //消息记录重新读取及检测
|
| | | ControlCommonResourse.ReadMessageAgain = true;
|
| | | ControlCommonResourse.HadNewMessage = false;
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | for (int i = 0; i < ControlCommonResourse.listMessageManaContr.Count; i++)
|
| | | {
|
| | | //显示角标特效
|
| | | ControlCommonResourse.listMessageManaContr[i].IsSelected = false;
|
| | | }
|
| | | });
|
| | |
|
| | | //加载账号配置信息
|
| | | var optionInfo = UserCenterResourse.Option.Load();
|
| | | UserCenterResourse.Option = optionInfo;
|
| | |
| | | /// <returns></returns>
|
| | | private async static Task<bool> InitUserAccoutInfo()
|
| | | {
|
| | | //初始化个人信息的标识
|
| | | UserCenterResourse.UserInfo.InitUserInfoSuccess = false;
|
| | | //获取本地记录的用户信息
|
| | | UserCenterResourse.UserInfo = GetUserInformationFromLocation();
|
| | | UserCenterResourse.UserInfo.UserIconFile = System.IO.Path.Combine(UserCenterResourse.Option.UserPictruePath, "Admin.png");
|
| | | //先根据本地缓存设置初始值
|
| | | Config.Instance.isAdministrator = UserCenterResourse.UserInfo.AuthorityNo != 1;
|
| | |
|
| | | //获取登录账号的信息
|
| | | var pra = new AccountInfoPra();
|
| | | var listNotShow = new List<string>() { "NotSetAgain" };
|
| | | string result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetAccountInfo", false, pra, listNotShow);
|
| | | if (string.IsNullOrEmpty(result) == true)
|
| | | //序列化对象
|
| | | var requestJson = JsonConvert.SerializeObject(pra);
|
| | | //访问接口
|
| | | byte[] byteData = await CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync("ZigbeeUsers/GetAccountInfo", Encoding.UTF8.GetBytes(requestJson));
|
| | | if (byteData == null)
|
| | | {
|
| | | //断网的话,该干嘛就干嘛吧,总之不能控主人的东西
|
| | | Config.Instance.isAdministrator = false;
|
| | | return false;
|
| | | }
|
| | | //检测错误
|
| | | var revertObj = JsonConvert.DeserializeObject<ResponsePack>(Encoding.UTF8.GetString(byteData));
|
| | | if (revertObj.StateCode.ToUpper() != "SUCCESS")
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | var userInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<UserInformation>(result);
|
| | | var userInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<UserInformation>(revertObj.ResponseData.ToString());
|
| | | userInfo.Account = Common.Config.Instance.Account;
|
| | | if (string.IsNullOrEmpty(userInfo.UserName) == true)
|
| | | {
|
| | |
| | | string dirPath = CombinePath();
|
| | | if (System.IO.Directory.Exists(dirPath) == true)
|
| | | {
|
| | | //先记录起住宅的一些信息
|
| | | var house = House.GetHouseByHouseId(Config.Instance.HomeId);
|
| | | //删除整个文件夹
|
| | | System.IO.Directory.Delete(dirPath, true);
|
| | | try
|
| | | {
|
| | | //同步数据的判断文件(以防万一删除整个文件夹失败的时候,这个文件被删的话,应该没什么大问题)
|
| | | string SynchronizeFile = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoDownLoadBackupCheckFile);
|
| | | //如果本地已经拥有了这个文件,则说明不是新手机,不再自动还原
|
| | | if (System.IO.File.Exists(SynchronizeFile) == true)
|
| | | {
|
| | | System.IO.File.Delete(SynchronizeFile);
|
| | | }
|
| | | //删除整个文件夹
|
| | | System.IO.Directory.Delete(dirPath, true);
|
| | | }
|
| | | catch { }
|
| | | //创建住宅文件夹
|
| | | Global.CreateHomeDirectory(Config.Instance.HomeId);
|
| | | //预创建个人中心全部的文件夹
|
| | | CreatAllUserCenterDirectory();
|
| | |
|
| | | var newHouse = new House();
|
| | | newHouse.Id = house.Id;
|
| | | newHouse.Name = house.Name;
|
| | | newHouse.IsOthreShare = house.IsOthreShare;
|
| | | newHouse.AccountType = house.AccountType;
|
| | | newHouse.MainUserDistributedMark = house.MainUserDistributedMark;
|
| | | newHouse.Save(false);
|
| | | }
|
| | | }
|
| | | if (string.IsNullOrEmpty(userInfo.UserName) == true)
|
| | |
| | | UserCenterResourse.UserInfo.StringPwd = null;
|
| | |
|
| | | //初始化管理员控制主人的连接地址(因为这个连接Token是不会改变的,所以只需要初始化一次)
|
| | | await InitAdminConnectMainInfo();
|
| | | bool flage = await InitAdminConnectMainInfo();
|
| | | //初始化个人信息的标识
|
| | | UserCenterResourse.UserInfo.InitUserInfoSuccess = flage;
|
| | |
|
| | | return true;
|
| | | return flage;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | }
|
| | | var info = Newtonsoft.Json.JsonConvert.DeserializeObject<UserInformation>(value);
|
| | | return info;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 重新初始化登陆账号的信息(旨在对应那一瞬间,网络不好,导致误判的情况)
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | private async static Task<bool> ReInitUserAccoutInfo()
|
| | | {
|
| | | //重新初始化账号信息
|
| | | var result = await InitUserAccoutInfo();
|
| | | if (result == false)
|
| | | {
|
| | | return result;
|
| | | }
|
| | | //同步云端的网关id,如果本地拥有云端不存在的id,则表示应该被换绑了,直接删除
|
| | | HdlGatewayLogic.Current.SynchronizeDbGateway();
|
| | | //初始化个人信息的标识
|
| | | UserCenterResourse.UserInfo.InitUserInfoSuccess = true;
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | /// 初始化管理员权限远程连接主人的信息
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | public static async Task<bool> InitAdminConnectMainInfo()
|
| | | private static async Task<bool> InitAdminConnectMainInfo()
|
| | | {
|
| | | //先清空
|
| | | Config.Instance.isAdministrator = false;
|
| | | Config.Instance.AdminRequestBaseUrl = string.Empty;
|
| | | Config.Instance.AdminRequestToken = string.Empty;
|
| | |
|
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 2 && UserCenterResourse.UserInfo.AuthorityNo != 3)
|
| | | {
|
| | | //时代变了,这里管理员和成员都能调用
|
| | |
| | | SharedHid = Config.Instance.Home.Id
|
| | | };
|
| | |
|
| | | var listNotShow = new List<string>() { "NotSetAgain" };
|
| | | var result = await GetResponseDataByRequestHttps("App/GetSharedHomeApiControl", false, pra, listNotShow);
|
| | | if (string.IsNullOrEmpty(result) == true)
|
| | | //序列化对象
|
| | | var requestJson = JsonConvert.SerializeObject(pra);
|
| | | //访问接口
|
| | | byte[] byteData = await CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync("App/GetSharedHomeApiControl", Encoding.UTF8.GetBytes(requestJson));
|
| | | if (byteData == null)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | //检测错误
|
| | | var revertObj = JsonConvert.DeserializeObject<ResponsePack>(Encoding.UTF8.GetString(byteData));
|
| | | if (revertObj.StateCode.ToUpper() != "SUCCESS")
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | Config.Instance.isAdministrator = true;
|
| | | //分享链接
|
| | | var info = JsonConvert.DeserializeObject<MemberAdministratorResult>(result);
|
| | | var info = JsonConvert.DeserializeObject<MemberAdministratorResult>(revertObj.ResponseData.ToString());
|
| | | Config.Instance.AdminRequestBaseUrl = info.RequestBaseUrl;
|
| | | Config.Instance.AdminRequestToken = info.RequestToken;
|
| | |
|
| | |
| | | }
|
| | | #endregion
|
| | |
|
| | | #region ■ 时间转换___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 将utc时间类型的字符串,转换为本地时间
|
| | | /// </summary>
|
| | | /// <param name="timeText"></param>
|
| | | /// <returns></returns>
|
| | | public static DateTime ConvertUtcTimeToLocalTime(string timeText)
|
| | | {
|
| | | var utcTime = Convert.ToDateTime(timeText);
|
| | | return TimeZoneInfo.ConvertTimeFromUtc(utcTime, TimeZoneInfo.Local);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 文件保存和读取_____________________
|
| | |
|
| | | /// <summary>
|
| | |
| | | /// </summary>
|
| | | public const string DetailedLogFile = "DetailedLogFile";
|
| | | /// <summary>
|
| | | /// 显示设备历史版本的【标识文件】,不加密
|
| | | /// </summary>
|
| | | public const string DeviceHistoryFile = "DeviceHistoryFile";
|
| | | /// <summary>
|
| | | /// 功能备份的名字 这个东西不加密
|
| | | /// </summary>
|
| | | public const string OptionBackupName = "##Option##";
|
| | |
| | | rowInfo.btnIcon = btnIcon;
|
| | |
|
| | | //设备名称
|
| | | var btnDeviceName = new NormalViewControl(400, 60, true);
|
| | | var btnDeviceName = new NormalViewControl(700, 60, true);
|
| | | btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device);
|
| | | btnDeviceName.X = Application.GetRealWidth(193);
|
| | | btnDeviceName.Y = Application.GetRealHeight(45);
|
| | |
| | | {
|
| | | for (int i = 0; i < listDevice.Count; i++)
|
| | | {
|
| | | if (i != 0 && i % 5 == 0)
|
| | | if (i != 0 && i % 3 == 0)
|
| | | {
|
| | | //读取5个后,间隔一段时间
|
| | | System.Threading.Thread.Sleep(200);
|
| | |
| | | /// 当前选择的网关
|
| | | /// </summary>
|
| | | private AC deviceAc = null;
|
| | | /// <summary>
|
| | | /// 摆风模式(用二进制来玩自定义模式 0:不使用 1:使用)
|
| | | /// </summary>
|
| | | private int swingMode = 0;
|
| | | /// <summary>
|
| | | /// 固定预留的数据
|
| | | /// </summary>
|
| | | private string fixValue = null;
|
| | |
|
| | | #endregion
|
| | |
|
| | |
| | | //初始化右上角菜单
|
| | | this.InitTopRightMenu();
|
| | |
|
| | | //初始化中部控件
|
| | | this.InitMiddleFrame();
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //开启进度条
|
| | | this.ShowProgressBar();
|
| | | //读取空调摆风模式
|
| | | var result = this.ReadAirConditionerSwingModeSupport();
|
| | | if (result == false)
|
| | | {
|
| | | //关闭进度条
|
| | | this.CloseProgressBar(ShowReLoadMode.YES);
|
| | | return;
|
| | | }
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //初始化中部控件
|
| | | this.InitMiddleFrame();
|
| | | });
|
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | form.AddForm(deviceAc);
|
| | | };
|
| | |
|
| | | //摆风
|
| | | var rowSwing = new FrameRowControl(listview.rowSpace / 2);
|
| | | rowSwing.UseClickStatu = false;
|
| | | listview.AddChidren(rowSwing);
|
| | | rowSwing.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uAirConditionerSwing), 400);
|
| | | rowSwing.AddBottomLine();
|
| | | var btnSwingSwitch = rowSwing.AddMostRightSwitchIcon();
|
| | | if (this.swingMode == 1)
|
| | | {
|
| | | btnSwingSwitch.IsSelected = true;
|
| | | }
|
| | | btnSwingSwitch.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //不能再点击
|
| | | btnSwingSwitch.CanClick = false;
|
| | | string statu = btnSwingSwitch.IsSelected == true ? "0" : "1";
|
| | | //将二进制转换为十进制
|
| | | int sendData = Convert.ToInt32(this.fixValue + statu, 2);
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | var result = await HdlDeviceAirConditionerLogic.Current.SetUseAcSwingFunctionStatu(deviceAc, sendData);
|
| | | if (result == true)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | btnSwingSwitch.IsSelected = !btnSwingSwitch.IsSelected;
|
| | | this.swingMode = this.swingMode == 1 ? 0 : 1;
|
| | |
|
| | | deviceAc.UseSwingFunction = btnSwingSwitch.IsSelected;
|
| | | deviceAc.ReSave();
|
| | | });
|
| | | }
|
| | | //能够继续点击
|
| | | btnSwingSwitch.CanClick = true;
|
| | | });
|
| | | };
|
| | |
|
| | | //初始化桌布完成
|
| | | tableContr.FinishInitControl(bodyFrameLayout, this.listview);
|
| | | tableContr = null;
|
| | |
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 读取空调摆风模式___________________
|
| | |
|
| | | /// <summary>
|
| | | /// 读取空调摆风模式
|
| | | /// </summary>
|
| | | private bool ReadAirConditionerSwingModeSupport()
|
| | | {
|
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(deviceAc);
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("ReadAirConditionerModeSupport", ReceiveComandDiv.A设备属性上报, (report) =>
|
| | | {
|
| | | string checkKeys = Common.LocalDevice.Current.GetDeviceMainKeys(report);
|
| | | if (checkKeys != mainkeys || report.DeviceStatusReport.CluterID != 514)
|
| | | {
|
| | | return;
|
| | | }
|
| | | for (int i = 0; i < report.DeviceStatusReport.AttriBute.Count; i++)
|
| | | {
|
| | | var data = report.DeviceStatusReport.AttriBute[i];
|
| | | if (data.AttributeId == 4097)
|
| | | {
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("ReadAirConditionerModeSupport");
|
| | | //转换为二进制
|
| | | var value = Convert.ToString(data.AttriButeData, 2).PadLeft(16, '0');
|
| | | //这个设置是放在后面的
|
| | | this.fixValue = value.Substring(0, value.Length - 1);
|
| | | this.swingMode = Convert.ToInt32(value.Substring(this.fixValue.Length));
|
| | | }
|
| | | }
|
| | | });
|
| | | //获取是否启用空调摆风模式的状态(打开 或者 关闭)
|
| | | deviceAc.ReadUseSwingFunctionStatu();
|
| | |
|
| | | int timeOut = 0;
|
| | | while (this.fixValue == null && timeOut <= 30)
|
| | | {
|
| | | System.Threading.Thread.Sleep(100);
|
| | | timeOut++;
|
| | | }
|
| | | if (this.fixValue == null)
|
| | | {
|
| | | //获取空调摆风状态失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uGetAirConditionerSwingFunctionFail);
|
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, null, "回复超时");
|
| | | this.ShowMassage(ShowMsgType.Tip, msg);
|
| | | return false;
|
| | | }
|
| | | return true;
|
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | | }
|
| | |
| | | |
| | | var btnBindName = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(500 - 120), |
| | | Width = Application.GetRealWidth(790), |
| | | X = devicePic.Right + Application.GetRealWidth(20), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.TextBlack, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | |
| | | btnBindName.MouseUpEventHandler += hander; |
| | | btnChoose.MouseUpEventHandler += hander; |
| | | |
| | | if (device.CommonDevice?.DeviceEpointName == "") |
| | | if (string.IsNullOrEmpty(device.CommonDevice?.DeviceEpointName)) |
| | | { |
| | | btnBindName.Text = device.CommonDevice?.DeviceAddr + "_" + device.CommonDevice?.DeviceEpoint; |
| | | } |
| | |
| | | Text = Language.StringByID(R.MyInternationalizationString.FirstFloor), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | TextSize = 14, |
| | | IsBold =true, |
| | | IsBold = true, |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | }; |
| | | btnAddFrameLayout.AddChidren(btnFloorText); |
| | |
| | | TextID = R.MyInternationalizationString.Save, |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMWhite, |
| | | IsBold =true, |
| | | IsBold = true, |
| | | TextSize = 16, |
| | | }; |
| | | bottomFrameLayout.AddChidren(btnFinifh); |
| | |
| | | |
| | | var btnBindName = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(500 - 120), |
| | | Width = Application.GetRealWidth(790), |
| | | X = devicePic.Right + Application.GetRealWidth(20), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.TextBlack, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize =15, |
| | | TextSize = 15, |
| | | }; |
| | | rowLayout.AddChidren(btnBindName); |
| | | |
| | |
| | | FrameLayout blankFrameLayout;//空数据显示布局 |
| | | List<int> typeModeList;//动态获取按键支持的模式大类型 |
| | | public List<ScenesListInfo> gwScenesList = new List<ScenesListInfo>();//网关中的场景列表 |
| | | bool IsRead = false; |
| | | |
| | | #endregion |
| | | |
| | | //初始化按键数据 |
| | | private void InitListInfo() |
| | | void InitListInfo() |
| | | { |
| | | System.Threading.Tasks.Task.Run(async () => |
| | | { |
| | | try |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | }); |
| | | localDeviceList.Clear(); |
| | | scList.Clear(); |
| | | //获取本地设备列表 |
| | |
| | | { |
| | | gwScenesList = gwSceneObj.getSceneInfo.ScenesList; |
| | | } |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | CommonPage.Loading.Hide(); |
| | | |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); |
| | | }); |
| | | } |
| | | //动态获取按键支持的大类 |
| | | typeModeList = await GetTypeMode(); |
| | | #region 读取面板当前模式 |
| | | //读取按键当前模式 |
| | | var tempDeata = await currentKey.ReadPanelConfigureInfoAsync(); |
| | |
| | | { |
| | | currentClusterID = 258; |
| | | } |
| | | currentKey.ReSave(); |
| | | //读取按键当前绑定目标 |
| | | var getBindList = await currentKey.GetDeviceBindAsync(); |
| | | var bindDeviceListTemp = new System.Collections.Generic.List<BindListResponseObj> { }; |
| | | var bindSceneListTemp = new System.Collections.Generic.List<BindListResponseObj> { }; |
| | | if (getBindList != null && getBindList.getAllBindResponseData != null) |
| | | { |
| | | currentKey.bindList.Clear(); |
| | | foreach (var b in getBindList.getAllBindResponseData.BindList) |
| | | { |
| | | if (b.BindCluster == currentClusterID) |
| | | { |
| | | if (b.BindCluster == 6) |
| | | { |
| | | |
| | | if (b.BindType == 2) |
| | | { |
| | | bindSceneListTemp.Add(b); |
| | | } |
| | | else |
| | | { |
| | | bindDeviceListTemp.Add(b); |
| | | } |
| | | } |
| | | else |
| | | //读取按键当前绑定目标 |
| | | GetDeviceBindResponseAllData getBindList = null; |
| | | if (IsRead) |
| | | { |
| | | getBindList = await currentKey.GetDeviceBindAsync(); |
| | | var bindDeviceListTemp = new System.Collections.Generic.List<BindListResponseObj> { }; |
| | | var bindSceneListTemp = new System.Collections.Generic.List<BindListResponseObj> { }; |
| | | if (getBindList != null && getBindList.getAllBindResponseData != null) |
| | | { |
| | | currentKey.bindList.Clear(); |
| | | foreach (var b in getBindList.getAllBindResponseData.BindList) |
| | | { |
| | | if (b.BindCluster == currentClusterID) |
| | | { |
| | | if (currentClusterID == 8) |
| | | if (b.BindCluster == 6) |
| | | { |
| | | if (b.BindCluster == 8) |
| | | |
| | | if (b.BindType == 2) |
| | | { |
| | | currentKey.bindList.Add(b); |
| | | bindSceneListTemp.Add(b); |
| | | } |
| | | else |
| | | { |
| | | bindDeviceListTemp.Add(b); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | currentKey.bindList.Add(b); |
| | | if (currentClusterID == 8) |
| | | { |
| | | if (b.BindCluster == 8) |
| | | { |
| | | currentKey.bindList.Add(b); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | currentKey.bindList.Add(b); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); |
| | | }); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | CommonPage.Loading.Hide(); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); |
| | | return; |
| | | }); |
| | | } |
| | | if (currentKey.panelMode == 1) |
| | | { |
| | | currentKey.bindList = bindSceneListTemp; |
| | | currentKey.currentKeySelectModeText = Language.StringByID(R.MyInternationalizationString.AddScene); |
| | | } |
| | | else if (currentKey.panelMode == 100 || currentKey.panelMode == 101 || currentKey.panelMode == 102) |
| | | { |
| | | currentKey.bindList = bindDeviceListTemp; |
| | | currentKey.currentKeySelectModeText = Language.StringByID(R.MyInternationalizationString.AddSwitch); |
| | | } |
| | | else if (currentKey.panelMode == 200 || currentKey.panelMode == 201 || currentKey.panelMode == 203 || currentKey.panelMode == 204 || currentKey.panelMode == 205) |
| | | { |
| | | currentKey.currentKeySelectModeText = Language.StringByID(R.MyInternationalizationString.AddDimmer); |
| | | } |
| | | else if (currentKey.panelMode == 300 || currentKey.panelMode == 301 || currentKey.panelMode == 302 || currentKey.panelMode == 303 || currentKey.panelMode == 304) |
| | | { |
| | | currentKey.currentKeySelectModeText = Language.StringByID(R.MyInternationalizationString.AddCurtain); |
| | | } |
| | | } |
| | | |
| | | if (currentKey.panelMode == 1) |
| | | { |
| | | currentKey.bindList = bindSceneListTemp; |
| | | currentKey.currentKeySelectModeText = Language.StringByID(R.MyInternationalizationString.AddScene); |
| | | } |
| | | else if (currentKey.panelMode == 100 || currentKey.panelMode == 101 || currentKey.panelMode == 102) |
| | | { |
| | | currentKey.bindList = bindDeviceListTemp; |
| | | currentKey.currentKeySelectModeText = Language.StringByID(R.MyInternationalizationString.AddSwitch); |
| | | } |
| | | else if (currentKey.panelMode == 200 || currentKey.panelMode == 201 || currentKey.panelMode == 203 || currentKey.panelMode == 204 || currentKey.panelMode == 205) |
| | | { |
| | | currentKey.currentKeySelectModeText = Language.StringByID(R.MyInternationalizationString.AddDimmer); |
| | | } |
| | | else if (currentKey.panelMode == 300 || currentKey.panelMode == 301 || currentKey.panelMode == 302 || currentKey.panelMode == 303 || currentKey.panelMode == 304) |
| | | { |
| | | currentKey.currentKeySelectModeText = Language.StringByID(R.MyInternationalizationString.AddCurtain); |
| | | } |
| | | currentKey.ReSave(); |
| | | } |
| | | #endregion |
| | | |
| | | //动态获取按键支持的大类 |
| | | typeModeList = await GetTypeMode(); |
| | | #endregion |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | RefreshList(); |
| | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | CommonPage.Loading.Hide(); |
| | | |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); |
| | | }); |
| | | return; |
| | |
| | | |
| | | var btnAddFrameLayout = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(913), |
| | | X = Application.GetRealWidth(888), |
| | | Width = Application.GetRealWidth(192), |
| | | }; |
| | | this.titleFrameLayout.AddChidren(btnAddFrameLayout); |
| | | |
| | | var btnBindAdd = new Button |
| | | { |
| | | X = Application.GetRealWidth(62), |
| | | Height = Application.GetRealHeight(72), |
| | | Width = Application.GetRealWidth(72), |
| | | UnSelectedImagePath = "BindPic/BindAdd.png", |
| | |
| | | #endregion |
| | | CommonPage.Loading.Start(""); |
| | | middleFrameLayout(); |
| | | if (currentKey.bindList.Count == 0) |
| | | { |
| | | IsRead = true; |
| | | } |
| | | else |
| | | { |
| | | IsRead = false; |
| | | } |
| | | InitListInfo(); |
| | | |
| | | } |
| | |
| | | midVerticalRefreshLayout.BeginHeaderRefreshingAction += () => |
| | | { |
| | | midVerticalRefreshLayout.BeginHeaderRefreshing(); |
| | | IsRead = true; |
| | | InitListInfo(); |
| | | midVerticalRefreshLayout.EndHeaderRefreshing(); |
| | | }; |
| | |
| | | devicePic.Width = Application.GetRealWidth(110); |
| | | devicePic.Text = ""; |
| | | } |
| | | if (tempDev.DeviceEpointName == "") |
| | | if (string.IsNullOrEmpty(tempDev.DeviceEpointName)) |
| | | { |
| | | btnBindNameText = tempDev.DeviceEpoint + Language.StringByID(R.MyInternationalizationString.uDeviceCircuit); |
| | | } |
| | |
| | | modeRowLayout.BackgroundColor = ZigbeeColor.Current.XMWhite; |
| | | midVerticalRefreshLayout.AddChidrenRow(modeRowLayout); |
| | | modeRowLayout.frameTable.UseClickStatu = false; |
| | | modeRowLayout.frameTable.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.keyMode), 500); |
| | | modeRowLayout.frameTable.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.keyMode), 400); |
| | | var btnKeyModeTipText = ""; |
| | | #region 当前模式文本显示 |
| | | switch (currentKey.panelMode) |
| | |
| | | break; |
| | | } |
| | | #endregion |
| | | modeRowLayout.frameTable.AddMostRightView(btnKeyModeTipText, 500); |
| | | modeRowLayout.frameTable.AddMostRightView(btnKeyModeTipText, 800); |
| | | modeRowLayout.frameTable.AddBottomLine(); |
| | | var btnDel = modeRowLayout.AddDeleteControl(); |
| | | //一键清除按键事件 |
| | |
| | | } |
| | | CommonPage.Loading.Hide(); |
| | | } |
| | | }; |
| | | }; |
| | | }; |
| | | } |
| | | |
| | |
| | | currentKey.currentKeySelectModeText = oldKeySelectModeText; |
| | | dialog.Close(); |
| | | } |
| | | }; |
| | | }; |
| | | } |
| | | } |
| | | else |
| | |
| | | currentKey.currentKeySelectModeText = oldKeySelectModeText; |
| | | dialog.Close(); |
| | | } |
| | | }; |
| | | }; |
| | | } |
| | | } |
| | | else |
| | |
| | | /// <param name="i_listdevice">窗帘的回路</param>
|
| | | public void ShowForm(Rollershade i_CurtainDevice)
|
| | | {
|
| | | UserView.HomePage.Instance.ScrollEnabled = false;
|
| | | this.ScrollEnabled = false;
|
| | |
|
| | | this.curtainDevice = i_CurtainDevice;
|
| | |
|
| | |
| | | //Log出力
|
| | | string msg = "当前激活的界面[" + UserCenterResourse.NowActionFormID + "]";
|
| | | HdlLogLogic.Current.WriteLog(ex, msg);
|
| | | //出现未知错误
|
| | | this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError));
|
| | | this.listView.RemoveAll();
|
| | | //设备异常补救 -> 添加重置电机行
|
| | | this.AddElectricalMachineryRow();
|
| | | //电机数据异常,请重置电机
|
| | | this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uCurtainDataIsErrorPleaseResetCurtain));
|
| | | try
|
| | | {
|
| | | this.listView.RemoveAll();
|
| | | //设备异常补救 -> 添加重置电机行
|
| | | this.AddElectricalMachineryRow();
|
| | | }
|
| | | catch (Exception ex2) { HdlLogLogic.Current.WriteLog(ex2, "开合帘补救异常"); }
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | btnProgress1.Text = progressValue + "%";
|
| | | frameBack.AddChidren(btnProgress1);
|
| | | //进度条
|
| | | this.openSeekBar = new SeekBarControl(965);
|
| | | this.openSeekBar = new SeekBarControl(965);
|
| | | openSeekBar.Y = btnProgressView.Bottom + Application.GetRealHeight(46);
|
| | | openSeekBar.ProgressBarColor = 0xff288bfd;
|
| | | openSeekBar.Progress = progressValue;
|
| | |
| | | }
|
| | | oldProValue = nowValue;
|
| | | checking = true;
|
| | | if (curtainData.DeleteOpenLimit == true)
|
| | | {
|
| | | //重置开限位点
|
| | | var result = await HdlDeviceCurtainLogic.Current.DeleteCurtainLimitPoint(curtainDevice, Rollershade.LimiType.UpLimit);
|
| | | if (result == false)
|
| | | {
|
| | | checking = false;
|
| | | continue;
|
| | | }
|
| | | curtainData.DeleteOpenLimit = false;
|
| | | }
|
| | |
|
| | | //将窗帘调整到指定百分比
|
| | | this.sendDiv = 1;
|
| | | curtainDevice.WcdGoToTiltValue(nowValue);
|
| | |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainOpenLimitMsg);
|
| | | this.ShowMassage(ShowMsgType.Confirm, msg, async () =>
|
| | | {
|
| | | decimal openValue = ((decimal)curtainData.OpenLimitPersent / 100) * curtainData.CurtainLength;
|
| | | decimal closeValue = ((decimal)curtainData.CloseLimitPersent / 100) * curtainData.CurtainLength;
|
| | | if (openValue < 0) { openValue = 0; }
|
| | | if (closeValue < 0) { closeValue = curtainData.CurtainLength; }
|
| | | //执行确认及覆盖上限位点
|
| | | var result = await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.UpLimit,
|
| | | curtainData.OpenLimitPersent, curtainData.CloseLimitPersent);
|
| | | (int)openValue, (int)closeValue);
|
| | | if (result == true)
|
| | | {
|
| | | curtainData.DeleteOpenLimit = true;
|
| | | this.receiveOpenlimit = false;
|
| | | }
|
| | | });
|
| | |
| | | btnProgress1.Text = progressValue + "%";
|
| | | frameBack.AddChidren(btnProgress1);
|
| | | //进度条
|
| | | this.closeSeekBar = new SeekBarControl(965);
|
| | | this.closeSeekBar = new SeekBarControl(965);
|
| | | closeSeekBar.Y = btnProgressView.Bottom + Application.GetRealHeight(46);
|
| | | closeSeekBar.ProgressBarColor = 0xff288bfd;
|
| | | closeSeekBar.Progress = progressValue;
|
| | |
| | | frameBack.AddChidren(btnPlus);
|
| | | btnPlus.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | if (closeSeekBar.Progress >=100)
|
| | | if (closeSeekBar.Progress >= 100)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
| | | }
|
| | | checking = true;
|
| | | oldProValue = nowValue;
|
| | | if (curtainData.DeleteCloseLimit == true)
|
| | | {
|
| | | //重置合限位点
|
| | | var result = await HdlDeviceCurtainLogic.Current.DeleteCurtainLimitPoint(curtainDevice, Rollershade.LimiType.DownLimit);
|
| | | if (result == false)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | curtainData.DeleteCloseLimit = false;
|
| | | }
|
| | |
|
| | | //将窗帘调整到指定百分比
|
| | | this.sendDiv = 2;
|
| | | curtainDevice.WcdGoToTiltValue(nowValue);
|
| | |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainCloseLimitMsg);
|
| | | this.ShowMassage(ShowMsgType.Confirm, msg, async () =>
|
| | | {
|
| | | //执行确认及覆盖合限位点
|
| | | decimal openValue = ((decimal)curtainData.OpenLimitPersent / 100) * curtainData.CurtainLength;
|
| | | decimal closeValue = ((decimal)curtainData.CloseLimitPersent / 100) * curtainData.CurtainLength;
|
| | | if (openValue < 0) { openValue = 0; }
|
| | | if (closeValue < 0) { closeValue = curtainData.CurtainLength; }
|
| | | //执行确认及覆盖上限位点
|
| | | var result = await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.DownLimit,
|
| | | curtainData.OpenLimitPersent, curtainData.CloseLimitPersent);
|
| | | (int)openValue, (int)closeValue);
|
| | |
|
| | | if (result == true)
|
| | | {
|
| | | curtainData.DeleteCloseLimit = true;
|
| | | this.receiveCloseLimit = false;
|
| | | }
|
| | | });
|
| | |
| | | //方向备份
|
| | | await HdlDeviceCurtainLogic.Current.BackupCurtainDirection(curtainDevice, curtainData.Direction);
|
| | | //限位备份
|
| | | int uplimit= (int)(curtainData.OpenLimitValue / (curtainData.CurtainLength * 1.0) * 100);
|
| | | int uplimit = (int)(curtainData.OpenLimitValue / (curtainData.CurtainLength * 1.0) * 100);
|
| | | int downlimit = (int)(curtainData.CloseLimitValue / (curtainData.CurtainLength * 1.0) * 100);
|
| | | await HdlDeviceCurtainLogic.Current.BackupCurtainLimitPoint(curtainDevice, uplimit, downlimit);
|
| | | });
|
| | |
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("CurtainDeviceAttribute");
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("ReceiveLimitData");
|
| | |
|
| | | UserView.HomePage.Instance.ScrollEnabled = true;
|
| | |
|
| | | base.CloseFormBefore();
|
| | | }
|
| | |
|
| | |
| | | /// false:电机方向正向;true:电机方向反向
|
| | | /// </summary>
|
| | | public bool Direction = false;
|
| | | /// <summary>
|
| | | /// 是否重置开限位点
|
| | | /// </summary>
|
| | | public bool DeleteOpenLimit = true;
|
| | | /// <summary>
|
| | | /// 是否重置合限位点
|
| | | /// </summary>
|
| | | public bool DeleteCloseLimit = true;
|
| | | /// <summary>
|
| | | /// 开限位的值
|
| | | /// </summary>
|
| | |
| | | };
|
| | | }
|
| | |
|
| | | #endregion
|
| | | #endregion
|
| | |
|
| | | #region ■ 修改名字___________________________
|
| | | #region ■ 修改名字___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 设备重命名然后打开新的画面
|
| | |
| | | /// </summary>
|
| | | private async void SetAllEpointName()
|
| | | {
|
| | | var tempValue = Common.LocalDevice.Current.GetDeviceObjectText(this.listNewDevice);
|
| | | var arry = tempValue.Split(new string[] { "(" }, StringSplitOptions.RemoveEmptyEntries);
|
| | | var objName = arry[0].Trim();
|
| | |
|
| | | //获取设备类型
|
| | | var deviceInfoType = Common.LocalDevice.Current.GetMyDeviceEnumInfo(this.listNewDevice);
|
| | | foreach (var device in this.listNewDevice)
|
| | | {
|
| | | if (Common.LocalDevice.Current.GetSimpleEpointName(device) != string.Empty)
|
| | | {
|
| | | //有名字不处理
|
| | | continue;
|
| | | }
|
| | | var epointName = objName;
|
| | | if (this.listNewDevice.Count > 1)
|
| | | {
|
| | | if (deviceInfoType.BeloneType == Common.DeviceBeloneType.A按键面板 && device.Type == DeviceType.TemperatureSensor)
|
| | | {
|
| | | //面板的最后一个回路是温度传感器
|
| | | epointName += Language.StringByID(R.MyInternationalizationString.uDeviceBelongId11);
|
| | | }
|
| | | else if (deviceInfoType.ConcreteType == Common.DeviceConcreteType.Sensor_Pir)
|
| | | {
|
| | | //pir传感器,它又搞特殊东西,传感器自身用自己的名字,继电器回路的话……
|
| | | if (device.Type == DeviceType.OnOffOutput)
|
| | | {
|
| | | epointName += Language.StringByID(R.MyInternationalizationString.uDeviceBelongId2300);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | //XXXXX(N回路)
|
| | | epointName += "(" + device.DeviceEpoint + Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + ")";
|
| | | }
|
| | | }
|
| | | //获取端点名字
|
| | | var epointName = Common.LocalDevice.Current.GetDeviceEpointName(device);
|
| | | await Common.LocalDevice.Current.ReName(device, epointName, ShowErrorMode.NO);
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | | #endregion
|
| | |
|
| | | #region ■ 画面关闭___________________________
|
| | | #region ■ 画面关闭___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 画面关闭
|
| | |
| | |
|
| | | base.CloseFormBefore();
|
| | | }
|
| | | #endregion
|
| | | #endregion
|
| | | }
|
| | | }
|
| | |
| | | //选择的是传感器输入
|
| | | value = 65535;
|
| | | }
|
| | | var result = await HdlDevicePanelLogic.Current.EditorDryContactFunction((Panel)nowSelectDevice, value);
|
| | | var result = await HdlDevicePanelLogic.Current.EditorDryContactThirdFunction((Panel)nowSelectDevice, value);
|
| | | if (result == true)
|
| | | {
|
| | | //重新初始化菜单行,隐藏或者开放绑定目标菜单
|
| | |
| | | /// </summary> |
| | | private void InitTopRightMenu()
|
| | | {
|
| | | if (UserCenterResourse.HideOption.DeviceHistory != 1)
|
| | | {
|
| | | return;
|
| | | }
|
| | | var btnIcon = new MostRightIconControl(69, 69);
|
| | | btnIcon.UnSelectedImagePath = "Item/More.png";
|
| | | topFrameLayout.AddChidren(btnIcon);
|
| | |
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame(); |
| | | |
| | | var listDevice = Common.LocalDevice.Current.GetDevicesByMac(i_deviceMac); |
| | | var listDevice = Common.LocalDevice.Current.GetDevicesByMac(i_deviceMac);
|
| | | |
| | | var listView = new VerticalListControl(12); |
| | | listView.BackgroundColor = UserCenterColor.Current.White; |
| | |
| | | /// </summary>
|
| | | public void ShowForm()
|
| | | {
|
| | | this.ScrollEnabled = false;
|
| | |
|
| | | //设置标题信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.DeviceManagement));
|
| | |
|
| | |
| | | frame.AddChidren(listView);
|
| | | listView.BeginHeaderRefreshingAction += () =>
|
| | | {
|
| | | //下拉刷新
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //获取全部设备
|
| | | bool result = LocalDevice.Current.SetDeviceToMemmoryByGateway(GatewayResourse.NowSelectGateway);
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //隐藏下拉刷新特效
|
| | | listView.EndHeaderRefreshing();
|
| | | if (result == true)
|
| | | {
|
| | | //重新刷新界面
|
| | | this.InitMiddleFrame(false);
|
| | | }
|
| | | });
|
| | | //下拉刷新
|
| | | this.ListViewBeginHeaderRefreshing();
|
| | | });
|
| | | };
|
| | | }
|
| | |
| | | //根据MAC合并设备列表
|
| | | this.MargeAllDeviceByMac(listDevice);
|
| | |
|
| | | if (this.Parent == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | var listOta = new List<OTADevice>();
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 下拉刷新___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 滑动控件下拉刷新
|
| | | /// </summary>
|
| | | private async void ListViewBeginHeaderRefreshing()
|
| | | {
|
| | | //如果是在线的
|
| | | if (HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(GatewayResourse.NowSelectGateway) == true)
|
| | | {
|
| | | //检测广播到的这个网关是否拥有住宅ID
|
| | | ZbGateway realWay = null;
|
| | | if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, GatewayResourse.NowSelectGateway) == true)
|
| | | {
|
| | | //重新设置住宅ID(这个应该是不经过APP,直接把网关恢复了出厂设置)
|
| | | if (HdlGatewayLogic.Current.HomeIdIsEmpty(realWay.getGatewayBaseInfo.HomeId) == true)
|
| | | {
|
| | | //显示进度条
|
| | | ProgressBar.Show();
|
| | | int result2 = await HdlGatewayLogic.Current.ReBindNewGateway(realWay);
|
| | | //关闭进度条
|
| | | ProgressBar.Close();
|
| | | if (result2 == -1)
|
| | | {
|
| | | return;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | if (this.Parent == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | //获取全部设备
|
| | | int result = LocalDevice.Current.SetDeviceToMemmoryByGateway(GatewayResourse.NowSelectGateway);
|
| | | if (this.Parent == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //隐藏下拉刷新特效
|
| | | listView.EndHeaderRefreshing();
|
| | | if (result != -1)
|
| | | {
|
| | | //重新刷新界面
|
| | | this.InitMiddleFrame(false);
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 网关在线检测_______________________
|
| | |
|
| | | /// <summary>
|
| | |
| | | {
|
| | | //这里主要只是获取在线状态
|
| | | var zbway = HdlGatewayLogic.Current.GetLocalGateway(gwId);
|
| | | var result = Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, false, this.ReceiveDeviceStatu, ShowErrorMode.NO);
|
| | | int statu = 0;
|
| | | var list = LocalDevice.Current.GetDeviceListFromGateway(zbway, ref statu, false, ShowErrorMode.NO);
|
| | | if (statu != -1)
|
| | | {
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | {
|
| | | //设置设备在线状态
|
| | | this.ReceiveDeviceStatu(list[i]);
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | |
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | //读取空调模块版本
|
| | | var result = await ((AC)listNewDevice[0]).ReadACFirewareVersionAsync();
|
| | | var result = await HdlDeviceAirConditionerLogic.Current.ReadACFirewareVersionAsync(listNewDevice[0]);
|
| | | if (result == null || result.readACFirewareVersionResponData == null || result.readACFirewareVersionResponData.Status != 0)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | |
| | | /// </summary>
|
| | | private bool isDeviceThreadStart = false;
|
| | | /// <summary>
|
| | | /// 等待设备的回馈的超时时间(单位:秒)
|
| | | /// 等待设备的回馈的超时时间(单位:百毫秒)
|
| | | /// </summary>
|
| | | private int waitDeviceTimeOut = 3;
|
| | | private int waitDeviceTimeOut = 20;
|
| | | /// <summary>
|
| | | /// 主题超时的线程是否开启
|
| | | /// </summary>
|
| | |
| | | }
|
| | |
|
| | | //刷新超时时间
|
| | | this.waitDeviceTimeOut = 3;
|
| | | this.waitDeviceTimeOut = 20;
|
| | |
|
| | | //获取设备的固定属性
|
| | | HdlDeviceFixedAttributeLogic.Current.SetAllFixedAttributeToDevice(device);
|
| | |
| | | while (this.waitDeviceTimeOut >= 0)
|
| | | {
|
| | | //等待下一个回路
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | System.Threading.Thread.Sleep(100);
|
| | | this.waitDeviceTimeOut--;
|
| | | }
|
| | | //停止接收
|
| | | this.realGateway.GwResDataAction -= this.AdjustGatewayResultData;
|
| | | System.Threading.Thread.Sleep(500);
|
| | | System.Threading.Thread.Sleep(200);
|
| | |
|
| | | //目前就弄一个
|
| | | Application.RunOnMainThread(() =>
|
| | |
| | | /// <param name="i_listdevice">面板设备的全部回路</param>
|
| | | public void ShowForm(Panel i_panel)
|
| | | {
|
| | | UserView.HomePage.Instance.ScrollEnabled = false;
|
| | | this.ScrollEnabled = false;
|
| | |
|
| | | this.panelDevice = i_panel;
|
| | |
|
| | |
| | | private uint GetColorByRGB(byte R, byte G, byte B)
|
| | | {
|
| | | return (uint)(0xFF000000 + R * 256 * 256 + G * 256 + B);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 界面关闭___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 界面关闭
|
| | | /// </summary>
|
| | | public override void CloseFormBefore()
|
| | | {
|
| | | UserView.HomePage.Instance.ScrollEnabled = true;
|
| | |
|
| | | base.CloseFormBefore();
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | /// <param name="i_iasZone">传感器设备</param> |
| | | public void ShowForm(IASZone i_iasZone) |
| | | {
|
| | | UserView.HomePage.Instance.ScrollEnabled = false;
|
| | | this.ScrollEnabled = false;
|
| | | deviceIASZone = i_iasZone;
|
| | |
|
| | | //设置头部信息
|
| | |
| | | this.ClearBodyFrame();
|
| | |
|
| | | //当前亮度值
|
| | | string txtValue = Language.StringByID(R.MyInternationalizationString.uNowBrightnessValue);
|
| | | var frameNowLinght = new FrameRowControl();
|
| | | frameNowLinght.UseClickStatu = false;
|
| | | frameNowLinght.BackgroundColor = UserCenterColor.Current.White;
|
| | | bodyFrameLayout.AddChidren(frameNowLinght);
|
| | | frameNowLinght.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uNowBrightnessValue) + ":" + pirLuxValue + "lux", 900);
|
| | | var btnLux = frameNowLinght.AddLeftCaption(txtValue + ":" + pirLuxValue + "lux", 900);
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | while (this.Parent != null)
|
| | | {
|
| | | //他们说这个东西要2秒刷新一次 获取PIR传感器的【lux值】
|
| | | this.pirLuxValue = await HdlDevicePirSensorLogic.Current.GetPirSensorLux(deviceIASZone, ShowErrorMode.NO);
|
| | | if (pirLuxValue != -1)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | btnLux.Text = txtValue + ":" + pirLuxValue + "lux";
|
| | | }, ShowErrorMode.NO);
|
| | | }
|
| | | await Task.Delay(2000);
|
| | | }
|
| | | }, ShowErrorMode.NO);
|
| | |
|
| | |
|
| | | var listView = new VerticalListControl(0);
|
| | | listView.Y = Application.GetRealHeight(150);
|
| | |
| | | #endregion
|
| | |
|
| | | #region ■ 一般方法___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 界面关闭
|
| | | /// </summary>
|
| | | public override void CloseFormBefore()
|
| | | {
|
| | | UserView.HomePage.Instance.ScrollEnabled = true;
|
| | | base.CloseFormBefore();
|
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | |
| | | /// </summary>
|
| | | public void ShowForm(string i_deviceMac)
|
| | | {
|
| | | UserView.HomePage.Instance.ScrollEnabled = false;
|
| | | this.ScrollEnabled = false;
|
| | |
|
| | | this.deviceMac = i_deviceMac;
|
| | | this.listDevice = Common.LocalDevice.Current.GetDevicesByMac(i_deviceMac);
|
| | |
| | | this.CloseProgressBar();
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 界面关闭___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 界面关闭
|
| | | /// </summary>
|
| | | public override void CloseFormBefore()
|
| | | {
|
| | | UserView.HomePage.Instance.ScrollEnabled = true;
|
| | |
|
| | | base.CloseFormBefore();
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | { |
| | | foreach (var curDoorLockUser in getDoorLockInfoAllList) |
| | | { |
| | | if (curDoorLockUser.DoorLockLocalUserId == null || curDoorLockUser.DoorLockLocalUserId == "") |
| | | if (string.IsNullOrEmpty(curDoorLockUser.DoorLockLocalUserId)) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | { |
| | | foreach (var curDoorLockUser in getDoorLockInfoList.PageData) |
| | | { |
| | | if (curDoorLockUser.DoorLockLocalUserId == null || curDoorLockUser.DoorLockLocalUserId == "") |
| | | if (string.IsNullOrEmpty(curDoorLockUser.DoorLockLocalUserId)) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | { |
| | | foreach (var curDoorLockUser in getDoorLockInfoAllList) |
| | | { |
| | | if (curDoorLockUser.DoorLockLocalUserId == null || curDoorLockUser.DoorLockLocalUserId == "") |
| | | if (string.IsNullOrEmpty(curDoorLockUser.DoorLockLocalUserId)) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | //获取云端存储的门锁成员信息 |
| | | foreach (var curDoorLockUser in getDoorLockInfoList.PageData) |
| | | { |
| | | if (curDoorLockUser.CloudAccountId == "" || curDoorLockUser.CloudAccountId != subAccountDistributedMark) |
| | | if (string.IsNullOrEmpty(curDoorLockUser.CloudAccountId) || curDoorLockUser.CloudAccountId != subAccountDistributedMark) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | { |
| | | var curDoorLockUser = doorLock.localDoorLockAccountList[curUserId]; |
| | | |
| | | if (curDoorLockUser.ConnectedAccount == "" || curDoorLockUser.ConnectedAccount != curAccountObj.SubAccountDistributedMark) |
| | | if (string.IsNullOrEmpty(curDoorLockUser.ConnectedAccount) || curDoorLockUser.ConnectedAccount != curAccountObj.SubAccountDistributedMark) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | |
| | | public FrameLayout bottomRadiusFrameLayout = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(906), |
| | | Height = Application.GetRealHeight(806), |
| | | Y = Application.GetRealHeight(930), |
| | | BackgroundColor = ZigbeeColor.Current.XMWhite, |
| | | }; |
| | |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMOrange, |
| | | TextSize = 14, |
| | | }; |
| | | |
| | | public Button line = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(138), |
| | | Height = 1, |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine, |
| | | }; |
| | | |
| | | #endregion |
| | | |
| | | /// <summary> |
| | |
| | | this.bottomRadiusFrameLayout.AddChidren(btnCancel); |
| | | this.bottomRadiusFrameLayout.AddChidren(btnBottomTitle); |
| | | this.bottomRadiusFrameLayout.AddChidren(btnFinish); |
| | | this.bottomRadiusFrameLayout.AddChidren(line); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | alert.ConfirmClickEvent += () => |
| | | { |
| | | var form = new UserCenter.UserMain.SecondAuthenticationForm(); |
| | | form.AddForm(); |
| | | }; |
| | | form.AddForm(); |
| | | }; |
| | | } |
| | | doorLock.ReSave(); |
| | | } |
| | |
| | | { |
| | | var form = new UserCenter.UserMain.SecondAuthenticationForm(); |
| | | form.AddForm(); |
| | | }; |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="btnDoorLockPic">门锁图片开/关显示</param> |
| | | public void RemoteUnlockRequest(ZigBee.Device.DoorLock doorLock, Action action, Button progressButton = null, Button btnDoorLockPic = null, Button btnStatus = null, Button btnDoorLockTitle = null) |
| | | { |
| | | if (doorLock.RemoteUnlockPassword == "") |
| | | if (string.IsNullOrEmpty(doorLock.RemoteUnlockPassword)) |
| | | { |
| | | string msgRemoteUnlockRequest = Language.StringByID(R.MyInternationalizationString.BindRemoteUnlockDoorlock); |
| | | var alertRemoteUnlockRequest = new Shared.Phone.UserCenter.ShowMsgControl(ShowMsgType.Confirm, msgRemoteUnlockRequest, Language.StringByID(R.MyInternationalizationString.GoSetting)); |
| | |
| | | { |
| | | var form = new UserCenter.UserMain.SecondAuthenticationForm(); |
| | | form.AddForm(); |
| | | }; |
| | | }; |
| | | return; |
| | | } |
| | | |
| | |
| | | }); |
| | | }; |
| | | HdlCheckLogic.Current.CheckSecondarySecurity(action); |
| | | }; |
| | | }; |
| | | } |
| | | // 获取到到名称更改回调通知 |
| | | public Action<string> devicNameSecAction; |
| | |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | Gravity = Gravity.CenterHorizontal, |
| | | TextSize = 20, |
| | | IsBold =true, |
| | | IsBold = true, |
| | | }; |
| | | this.midFrameLayout.AddChidren(btnPicTip); |
| | | |
| | |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | Radius = (uint)Application.GetRealHeight(127 / 2), |
| | | TextSize = 16, |
| | | IsBold =true, |
| | | IsBold = true, |
| | | }; |
| | | bottomFrameLayout.AddChidren(completeBtn); |
| | | |
| | | if (currentType == "password") |
| | | { |
| | | btnPasswordRemark.Text = Language.StringByID(R.MyInternationalizationString.PasswordRemark); |
| | | btnPasswordRemarkContent.PlaceholderText = Language.StringByID(R.MyInternationalizationString.Password) + "-" + doorLock.doorLockProgrammingEventNotificationCommand.UserID; |
| | | btnPasswordRemarkContent.PlaceholderText = Language.StringByID(R.MyInternationalizationString.Password) + "ID" + doorLock.doorLockProgrammingEventNotificationCommand.UserID; |
| | | } |
| | | else if (currentType == "fingerprint") |
| | | { |
| | | btnPasswordRemark.Text = Language.StringByID(R.MyInternationalizationString.FingerprintRemark); |
| | | btnPasswordRemarkContent.PlaceholderText = Language.StringByID(R.MyInternationalizationString.Fingerprint) + "-" + doorLock.doorLockProgrammingEventNotificationCommand.UserID; |
| | | btnPasswordRemarkContent.PlaceholderText = Language.StringByID(R.MyInternationalizationString.Fingerprint) + "ID" + doorLock.doorLockProgrammingEventNotificationCommand.UserID; |
| | | } |
| | | else |
| | | { |
| | | btnPasswordRemark.Text = Language.StringByID(R.MyInternationalizationString.ProximityRemark); |
| | | btnPasswordRemarkContent.PlaceholderText = Language.StringByID(R.MyInternationalizationString.ProximityCard) + "-" + doorLock.doorLockProgrammingEventNotificationCommand.UserID; |
| | | btnPasswordRemarkContent.PlaceholderText = Language.StringByID(R.MyInternationalizationString.IcCard) + "ID" + doorLock.doorLockProgrammingEventNotificationCommand.UserID; |
| | | } |
| | | if (curAccountObj.UserName != "" && curAccountObj.UserName != null) |
| | | |
| | | if (!string.IsNullOrEmpty(curAccountObj.UserName)) |
| | | { |
| | | btnMatchPersonContent.Text = curAccountObj.UserName; |
| | | } |
| | |
| | | addLockInfo.OpenLockMode = doorLock.doorLockProgrammingEventNotificationCommand.ProgramEventSoure; |
| | | addLockInfo.DoorLockLocalUserId = doorLock.doorLockProgrammingEventNotificationCommand.UserID.ToString(); |
| | | addLockInfo.EntryTime = System.DateTime.Now; |
| | | if (btnPasswordRemarkContent.Text != "") |
| | | if (!string.IsNullOrEmpty(btnPasswordRemarkContent.Text)) |
| | | { |
| | | addLockInfo.UserIdRemarks = btnPasswordRemarkContent.Text; |
| | | } |
| | |
| | | Height = Application.GetRealHeight(1319), |
| | | Y = Application.GetRealHeight(418), |
| | | BackgroundColor = ZigbeeColor.Current.XMWhite, |
| | | }; |
| | | }; |
| | | this.midFrameLayout.AddChidren(bottomFrameLayout); |
| | | bottomFrameLayout.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); |
| | | |
| | | |
| | | var informationEdit = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(60), |
| | |
| | | btnNext.SelectedImagePath = "DoorLock/SwitchOn.png"; |
| | | btnLine.Visible = true; |
| | | btnLine.Y = Application.GetRealHeight(853); |
| | | if (doorLock.RemoteUnlockPassword == "") |
| | | if (string.IsNullOrEmpty(doorLock.RemoteUnlockPassword)) |
| | | { |
| | | btnNext.IsSelected = false; |
| | | } |
| | |
| | | btnNext.IsSelected = !btnNext.IsSelected; |
| | | if (btnNext.IsSelected) |
| | | { |
| | | if (doorLock.RemoteUnlockPassword == "") |
| | | if (string.IsNullOrEmpty(doorLock.RemoteUnlockPassword)) |
| | | { |
| | | RemotePasswordDialog(doorLock, btnNext); |
| | | } |
| | |
| | | btnNext.IsSelected = !btnNext.IsSelected; |
| | | if (btnNext.IsSelected) |
| | | { |
| | | if (doorLock.RemoteUnlockPassword == "") |
| | | if (string.IsNullOrEmpty(doorLock.RemoteUnlockPassword)) |
| | | { |
| | | RemotePasswordDialog(doorLock, btnNext); |
| | | } |
| | |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMWhite, |
| | | TextSize = 16, |
| | | IsBold =true, |
| | | IsBold = true, |
| | | }; |
| | | this.midFrameLayout.AddChidren(btnFinifh); |
| | | btnFinifh.MouseUpEventHandler += (sender, e) => |
| | |
| | | |
| | | public void BottomFrameLayout() |
| | | { |
| | | #region UI |
| | | //var bottomFrameLayout = new FrameLayout() |
| | | //{ |
| | | // Height = Application.GetRealHeight(100), |
| | | // Y = Application.GetRealHeight(418), |
| | | // Radius = 17, |
| | | // BackgroundColor = ZigbeeColor.Current.XMWhite, |
| | | //}; |
| | | //this.midFrameLayout.AddChidren(bottomFrameLayout); |
| | | |
| | | //var bottomFrameLayout1 = new FrameLayout() |
| | | //{ |
| | | // Height = Application.GetRealHeight(1319 - 50), |
| | | // Y = Application.GetRealHeight(418 + 48), |
| | | // BackgroundColor = ZigbeeColor.Current.XMWhite, |
| | | //}; |
| | | //this.midFrameLayout.AddChidren(bottomFrameLayout1); |
| | | |
| | | #region UI |
| | | var bottomFrameLayout = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(1319), |
| | |
| | | btnNext.SelectedImagePath = "DoorLock/SwitchOn.png"; |
| | | btnLine.Visible = true; |
| | | btnLine.Y = Application.GetRealHeight(714); |
| | | if (doorLock.RemoteUnlockPassword == "") |
| | | if (string.IsNullOrEmpty(doorLock.RemoteUnlockPassword)) |
| | | { |
| | | btnNext.IsSelected = false; |
| | | } |
| | |
| | | btnNext.IsSelected = !btnNext.IsSelected; |
| | | if (btnNext.IsSelected) |
| | | { |
| | | if (doorLock.RemoteUnlockPassword == "") |
| | | if (string.IsNullOrEmpty(doorLock.RemoteUnlockPassword)) |
| | | { |
| | | RemotePasswordDialog(doorLock, btnNext); |
| | | } |
| | |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMWhite, |
| | | TextSize = 16, |
| | | IsBold =true, |
| | | IsBold = true, |
| | | }; |
| | | this.midFrameLayout.AddChidren(btnFinifh); |
| | | btnFinifh.MouseUpEventHandler += (sender, e) => |
| | |
| | | foreach (var curDoorLockUser in curAccountDoorLockUserList)
|
| | | {
|
| | | // 账户中没有门锁用户
|
| | | if (curDoorLockUser.DoorLockLocalUserId == null || curDoorLockUser.DoorLockLocalUserId == "")
|
| | | if (string.IsNullOrEmpty(curDoorLockUser.DoorLockLocalUserId))
|
| | | {
|
| | | }
|
| | | else
|
| | |
| | | }
|
| | | //冻结/解冻用户
|
| | | int count1 = tempGroupId.Count; |
| | | if (tempGroupId.Count==1) |
| | | if (tempGroupId.Count == 1) |
| | | { |
| | | foreach (var a in tempGroupId) |
| | | { |
| | | if(a.Count ==0) |
| | | if (a.Count == 0) |
| | | { |
| | | count1 = 0; |
| | | break; |
| | |
| | | var mUIPickerView = new UIPickerView() |
| | | { |
| | | X = Application.GetRealWidth(0), |
| | | Height = Application.GetRealHeight(440), |
| | | }; |
| | | this.bottomRadiusFrameLayout.AddChidren(mUIPickerView); |
| | | |
| | |
| | | this.btnBottomTitle.TextID = R.MyInternationalizationString.CurrentDate; |
| | | } |
| | | |
| | | mUIPickerView.Y = Application.GetRealWidth(110); |
| | | mUIPickerView.Y = Application.GetRealWidth(245); |
| | | var mList1 = new List<string>(); |
| | | var mList2 = new List<string>(); |
| | | var mList3 = new List<string>(); |
| | |
| | | int year = dtNow.Year + 1; |
| | | int days = DateTime.DaysInMonth(dtNow.Year, dtNow.Month); |
| | | |
| | | for (int y = dtNow.Year - 10; y < dtNow.Year + 1; y++) |
| | | for (int y = dtNow.Year - 9; y < dtNow.Year + 1; y++) |
| | | { |
| | | mList1.Add(y.ToString()); |
| | | } |
| | | for (int m = 1; m < 13; m++) |
| | | { |
| | | if(Language .CurrentLanguage == "Chinese") |
| | | if (Language.CurrentLanguage == "Chinese") |
| | | { |
| | | mList2.Add(m.ToString()+"月"); |
| | | mList2.Add(m.ToString() + "月"); |
| | | } |
| | | else |
| | | { |
| | | mList2.Add(m.ToString()); |
| | | } |
| | | } |
| | | } |
| | | for (int d = 1; d < days + 1; d++) |
| | | { |
| | |
| | | else |
| | | { |
| | | mList3.Add(d.ToString()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (setTimeType != "DoorLockTime") |
| | |
| | | else |
| | | { |
| | | mUIPickerView.setNPicker(mList1, mList2, mList3); |
| | | mUIPickerView.setCurrentItems(dtNow.Year, dtNow.Month - 1, dtNow.Day - 1); |
| | | mUIPickerView.setCurrentItems(9, dtNow.Month - 1, dtNow.Day - 1); |
| | | curYear = dtNow.Year; |
| | | curMonth = dtNow.Month; |
| | | curDay = dtNow.Day; |
| | |
| | | else |
| | | { |
| | | mUIPickerView.setNPicker(mList1, mList2, mList3); |
| | | mUIPickerView.setCurrentItems(curYear, curMonth - 1, curDay - 1); |
| | | mUIPickerView.setCurrentItems(9, curMonth - 1, curDay - 1); |
| | | } |
| | | } |
| | | }; |
| | |
| | | this.btnBottomTitle.TextID = R.MyInternationalizationString.CurrentTime; |
| | | } |
| | | |
| | | mUIPickerView.Y = Application.GetRealWidth(95); |
| | | mUIPickerView.Y = Application.GetRealWidth(245); |
| | | var mList1 = new List<string>(); |
| | | var mList2 = new List<string>(); |
| | | for (int h = 0; h < 24; h++) |
| | |
| | | textDisplayDateFrameLayout.MouseDownEventHandler += hander; |
| | | btnNextFrameLayout.MouseDownEventHandler += hander; |
| | | btnNext.MouseDownEventHandler += hander; |
| | | if (curIndex == 0) |
| | | { |
| | | textDisplayDate.MouseDownEventHandler += hander; |
| | | } |
| | | else |
| | | { |
| | | textDisplayTime.MouseDownEventHandler += hander; |
| | | } |
| | | } |
| | | |
| | | btnCancel.MouseUpEventHandler += (sender1, e1) => |
| | |
| | | var doorLock = tempDevice as ZigBee.Device.DoorLock; |
| | | if (doorLock.doorLockProgrammingEventNotificationCommand != null) |
| | | { |
| | | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | }); |
| | | } |
| | | } |
| | | } |
| | |
| | | }; |
| | | midTopFrameLayout.AddChidren(btnNext); |
| | | |
| | | btnNext.MouseUpEventHandler += (sender, e) => |
| | | EventHandler<MouseEventArgs> handerSideLip = (sender, e) => |
| | | { |
| | | SideslipFramelayout(); |
| | | }; |
| | | btnNext.MouseUpEventHandler += handerSideLip; |
| | | btnAllMethod.MouseUpEventHandler += handerSideLip; |
| | | var btnLine = new Button |
| | | { |
| | | Y = midTopFrameLayout.Bottom, |
| | |
| | | { |
| | | var curDoorLockUser = doorLock.localDoorLockUserList[curUserId]; |
| | | |
| | | if (curDoorLockUser.ConnectedAccount == "" || curDoorLockUser.ConnectedAccount != curAccountObj.SubAccountDistributedMark) |
| | | if (string.IsNullOrEmpty(curDoorLockUser.ConnectedAccount) || curDoorLockUser.ConnectedAccount != curAccountObj.SubAccountDistributedMark) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | break; |
| | | } |
| | | |
| | | #region UI |
| | | |
| | | #region UI |
| | | var rowFrameLayout = new RowLayoutControl(bodyView.rowSpace / 2); |
| | | rowFrameLayout.BackgroundColor = ZigbeeColor.Current.XMWhite; |
| | | bodyView.AddChidren(rowFrameLayout); |
| | |
| | | btnicon.UnSelectedImagePath = "DoorLock/DoorLockUserPic.png"; |
| | | //上面门锁用户名称一行 |
| | | var memberText = ""; |
| | | if (curAccountObj.UserName == "" || curAccountObj.UserName == null) |
| | | if (string.IsNullOrEmpty(curAccountObj.UserName)) |
| | | { |
| | | memberText = curAccountObj.Account; |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | //开关图标 |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | //开关图标 |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | } |
| | | } |
| | | else |
| | |
| | | { |
| | | CommonPage.Loading.Hide(); |
| | | } |
| | | }; |
| | | }; |
| | | }; |
| | | #endregion |
| | | |
| | |
| | | switch (curDoorLockUser.UnlockType) |
| | | { |
| | | case 0: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | if (!string.IsNullOrEmpty(curDoorLockUser.UserName)) |
| | | { |
| | | btnDoorlockUser.Text = curDoorLockUser.UserName; |
| | | } |
| | |
| | | } |
| | | break; |
| | | case 3: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | if (!string.IsNullOrEmpty(curDoorLockUser.UserName)) |
| | | { |
| | | btnDoorlockUser.Text = curDoorLockUser.UserName; |
| | | } |
| | |
| | | } |
| | | break; |
| | | case 15: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | if (!string.IsNullOrEmpty(curDoorLockUser.UserName)) |
| | | { |
| | | btnDoorlockUser.Text = curDoorLockUser.UserName; |
| | | } |
| | |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | } |
| | | }; |
| | | btnDoorlockUser.EditorEnterAction += action; |
| | | btnDoorlockUser.EditorEnterAction += action; |
| | | #endregion |
| | | i++; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | break; |
| | | } |
| | | |
| | | if (doorLock.currentUserDisplayMethod == "" && i == 0) |
| | | if (string.IsNullOrEmpty(doorLock.currentUserDisplayMethod) && i == 0) |
| | | { |
| | | btnAllMethod.IsSelected = true; |
| | | btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | TextSize = 12, |
| | | IsBold =true, |
| | | IsBold = true, |
| | | }; |
| | | midTopFrameLayout.AddChidren(btnAllMethod); |
| | | // 类型区分 |
| | |
| | | SelectedImagePath = "DoorLock/UnLockSideslipIcon.png", |
| | | }; |
| | | midTopFrameLayout.AddChidren(btnNext); |
| | | btnNext.MouseUpEventHandler += (sender, e) => |
| | | EventHandler<MouseEventArgs> handerSideLip = (sender, e) => |
| | | { |
| | | SideslipFramelayout(); |
| | | }; |
| | | |
| | | btnNext.MouseUpEventHandler += handerSideLip; |
| | | btnAllMethod.MouseUpEventHandler += handerSideLip; |
| | | var btnLine = new Button |
| | | { |
| | | Y = midTopFrameLayout.Bottom, |
| | |
| | | foreach (var curUserId in doorLock.localDoorLockUserList.Keys) |
| | | { |
| | | var curDoorLockUser = doorLock.localDoorLockUserList[curUserId]; |
| | | if (curDoorLockUser.ConnectedAccount != "") |
| | | if (!string.IsNullOrEmpty(curDoorLockUser.ConnectedAccount)) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | Gravity = Gravity.CenterVertical, |
| | | TextSize =15, |
| | | TextSize = 15, |
| | | }; |
| | | rowFrameLayout.AddChidren(btnText); |
| | | |
| | |
| | | switch (curDoorLockUser.UnlockType) |
| | | { |
| | | case 0: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | if (!string.IsNullOrEmpty(curDoorLockUser.UserName)) |
| | | { |
| | | btnText.Text = curDoorLockUser.UserName; |
| | | } |
| | |
| | | } |
| | | break; |
| | | case 3: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | if (!string.IsNullOrEmpty(curDoorLockUser.UserName)) |
| | | { |
| | | btnText.Text = curDoorLockUser.UserName; |
| | | } |
| | |
| | | } |
| | | break; |
| | | case 15: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | if (!string.IsNullOrEmpty(curDoorLockUser.UserName)) |
| | | { |
| | | btnText.Text = curDoorLockUser.UserName; |
| | | } |
| | |
| | | { |
| | | Height = Application.GetRealHeight(100), |
| | | Y = Application.GetRealHeight(1253), |
| | | Radius =(uint) Application.GetRealHeight(100/2), |
| | | Radius = (uint)Application.GetRealHeight(100 / 2), |
| | | BackgroundColor = ZigbeeColor.Current.XMWhite, |
| | | }; |
| | | flMain.AddChidren(bottomFrameLayout); |
| | |
| | | var bottomFrameLayout1 = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(668 - 60), |
| | | Y = Application.GetRealHeight(1253+58), |
| | | Y = Application.GetRealHeight(1253 + 58), |
| | | BackgroundColor = ZigbeeColor.Current.XMWhite, |
| | | }; |
| | | flMain.AddChidren(bottomFrameLayout1); |
| | |
| | | btnLine.Visible = false; |
| | | } |
| | | |
| | | if (currentAccount.UserName != "" && currentAccount.UserName != null) |
| | | if (!string.IsNullOrEmpty(currentAccount.UserName)) |
| | | { |
| | | btnUserName.Text = currentAccount.UserName; |
| | | } |
| | |
| | | switch (curDoorLockUser.UnlockType) |
| | | { |
| | | case 0: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | if (!string.IsNullOrEmpty(curDoorLockUser.UserName)) |
| | | { |
| | | addLockInfo.UserIdRemarks = curDoorLockUser.UserName; |
| | | } |
| | |
| | | } |
| | | break; |
| | | case 3: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | if (!string.IsNullOrEmpty(curDoorLockUser.UserName)) |
| | | { |
| | | addLockInfo.UserIdRemarks = curDoorLockUser.UserName; |
| | | } |
| | |
| | | } |
| | | break; |
| | | case 15: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | if (!string.IsNullOrEmpty(curDoorLockUser.UserName)) |
| | | { |
| | | addLockInfo.UserIdRemarks = curDoorLockUser.UserName; |
| | | } |
| | |
| | | break; |
| | | } |
| | | |
| | | if (doorLock.currentUserDisplayMethod == "" && i == 0) |
| | | if (string.IsNullOrEmpty(doorLock.currentUserDisplayMethod) && i == 0) |
| | | { |
| | | btnAllMethod.IsSelected = true; |
| | | btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | |
| | | public UserManagement(ZigBee.Device.DoorLock doorLock) |
| | | { |
| | | this.doorLock = doorLock; |
| | | localAllAccountListTemp = doorLock.localAllAccountList; |
| | | localDoorLockUserListTemp = doorLock.localDoorLockUserList; |
| | | } |
| | | |
| | | #region ◆ 变量申明__________________________ |
| | | ZigBee.Device.DoorLock doorLock; |
| | | VerticalRefreshLayout midVerticalScrolViewLayout; |
| | | public List<Shared.Phone.UserCenter.MemberInfoRes> localAllAccountListTemp = new List<Shared.Phone.UserCenter.MemberInfoRes> { }; |
| | | public Dictionary<int, DoorLockCommonInfo.LocaDoorLockObj> localDoorLockUserListTemp = new Dictionary<int, DoorLockCommonInfo.LocaDoorLockObj>(); |
| | | |
| | | |
| | | #endregion |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | doorLock.localAllAccountList.Clear(); |
| | | doorLock.localAllAccountList = localAccountListTemp; |
| | | localAllAccountListTemp = doorLock.localAllAccountList; |
| | | |
| | | //初始化权限信息 |
| | | foreach (var sub in localAccountListTemp) |
| | |
| | | } |
| | | |
| | | //获取本地门锁列表 |
| | | var list = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockAllAcountUserlist(doorLock); |
| | | if (localDoorLockUserListTemp.Count == 0) |
| | | { |
| | | var list = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockAllAcountUserlist(doorLock); |
| | | localDoorLockUserListTemp = doorLock.localDoorLockUserList; |
| | | } |
| | | doorLock.ReSave(); |
| | | } |
| | | else |
| | |
| | | TextID = R.MyInternationalizationString.Undistributed, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMTopTitleText, |
| | | X = btnUndistributeIcon.Right, |
| | | IsBold =true, |
| | | TextSize =13, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | IsBold = true, |
| | | TextSize = 13, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | btnAddFrameLayout.AddChidren(btnUndistributeText); |
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1) |
| | | { |
| | |
| | | }; |
| | | this.midFrameLayout.AddChidren(midVerticalScrolViewLayout); |
| | | |
| | | CommonPage.Loading.Start("Loading..."); |
| | | ReadAccountDoorLockInfoList(); |
| | | if (localAllAccountListTemp.Count == 0) |
| | | { |
| | | CommonPage.Loading.Start("Loading..."); |
| | | ReadAccountDoorLockInfoList(); |
| | | } |
| | | else |
| | | { |
| | | MidFrameLayoutContent(); |
| | | } |
| | | |
| | | midVerticalScrolViewLayout.BeginHeaderRefreshingAction += () => |
| | | { |
| | |
| | | /// </summary> |
| | | private void InitTopRightMenu()
|
| | | {
|
| | | if (UserCenterResourse.HideOption.DeviceHistory != 1)
|
| | | {
|
| | | return;
|
| | | }
|
| | | var btnIcon = new MostRightIconControl(69, 69);
|
| | | btnIcon.UnSelectedImagePath = "Item/More.png";
|
| | | topFrameLayout.AddChidren(btnIcon);
|
| | |
| | |
|
| | | row1 = new FrameRowControl(listView.rowSpace / 2);
|
| | | listView.AddChidren(row1);
|
| | | row1.AddLeftCaption("清除缓存文件", 500);
|
| | | row1.AddRightArrow();
|
| | | row1.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | this.ShowMassage(ShowMsgType.Confirm, "是否清除缓存文件", () =>
|
| | | {
|
| | | var myPath = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory);
|
| | | try
|
| | | {
|
| | | System.IO.Directory.Delete(myPath, true);
|
| | | System.IO.Directory.CreateDirectory(myPath);
|
| | | this.ShowMassage(ShowMsgType.Tip, "清除缓存文件完成,请重新登陆");
|
| | | UserCenterLogic.ReLoginAgain(UserCenterResourse.UserInfo.Account);
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | this.ShowMassage(ShowMsgType.Error, "清除缓存文件异常");
|
| | | HdlLogLogic.Current.WriteLog(ex, "清除缓存文件异常");
|
| | | }
|
| | | });
|
| | | };
|
| | |
|
| | | row1 = new FrameRowControl(listView.rowSpace / 2);
|
| | | listView.AddChidren(row1);
|
| | | row1.AddLeftCaption("上传Log", 500);
|
| | | row1.AddRightArrow();
|
| | | row1.ButtonClickEvent += (sender, e) =>
|
| | |
| | | public void ShowForm()
|
| | | {
|
| | | //界面右划不可
|
| | | UserView.HomePage.Instance.ScrollEnabled = false;
|
| | | this.ScrollEnabled = false;
|
| | |
|
| | | //设置头部信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uGestureAuthentication));
|
| | |
| | | });
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 界面关闭___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 界面关闭
|
| | | /// </summary>
|
| | | public override void CloseFormBefore()
|
| | | {
|
| | | //界面右划可
|
| | | UserView.HomePage.Instance.ScrollEnabled = true;
|
| | |
|
| | | base.CloseFormBefore();
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | }
|
| | | //这里主要只是获取在线状态
|
| | | var zbway = HdlGatewayLogic.Current.GetLocalGateway(listGwId[i]);
|
| | | var result = Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, false, (device) =>
|
| | | {
|
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
|
| | | if (listView.Parent == null || dicData.ContainsKey(mainkeys) == false || listCheck.Contains(mainkeys) == true)
|
| | | {
|
| | | return;
|
| | | }
|
| | | listCheck.Add(mainkeys);
|
| | | int statu = 0;
|
| | | var list = Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, ref statu, false, ShowErrorMode.NO);
|
| | | if (statu != -1)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | for (int j = 0; j < list.Count; j++)
|
| | | {
|
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(list[i]);
|
| | | if (listView.Parent == null || dicData.ContainsKey(mainkeys) == false || listCheck.Contains(mainkeys) == true)
|
| | | {
|
| | | return;
|
| | | }
|
| | | listCheck.Add(mainkeys);
|
| | |
|
| | | var localDevice = Common.LocalDevice.Current.GetDevice(mainkeys);
|
| | | if (localDevice != null && localDevice.IsOnline != device.IsOnline)
|
| | | {
|
| | | //在线状态一样的话,不需要刷新
|
| | | localDevice.IsOnline = device.IsOnline;
|
| | | localDevice.ReSave();
|
| | | }
|
| | | if (device.IsOnline == 1)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | dicData[mainkeys].OnlineCount += 1;
|
| | | dicData[mainkeys].btnOnline.Text = dicData[mainkeys].OnlineCount + "/" + dicData[mainkeys].listDeviceKeys.Count;
|
| | | });
|
| | | }
|
| | | }, ShowErrorMode.NO);
|
| | | var localDevice = Common.LocalDevice.Current.GetDevice(mainkeys);
|
| | | if (localDevice != null && localDevice.IsOnline != list[i].IsOnline)
|
| | | {
|
| | | //在线状态一样的话,不需要刷新
|
| | | localDevice.IsOnline = list[i].IsOnline;
|
| | | localDevice.ReSave();
|
| | | }
|
| | | if (list[i].IsOnline == 1)
|
| | | {
|
| | | dicData[mainkeys].OnlineCount += 1;
|
| | | dicData[mainkeys].btnOnline.Text = dicData[mainkeys].OnlineCount + "/" + dicData[mainkeys].listDeviceKeys.Count;
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | {
|
| | | //移除楼层
|
| | | Common.Config.Instance.Home.FloorDics.Remove(keys);
|
| | | if (Common.Config.Instance.Home.CurrentFloorId == keys)
|
| | | {
|
| | | //如果删除的是当前楼层的话
|
| | | Common.Config.Instance.Home.CurrentFloorId = string.Empty;
|
| | | foreach (string floorId in Common.Config.Instance.Home.FloorDics.Keys)
|
| | | {
|
| | | //把第一个楼层ID给它
|
| | | Common.Config.Instance.Home.CurrentFloorId = floorId;
|
| | | break;
|
| | | }
|
| | | }
|
| | | |
| | | if (Common.Room.CurrentRoom == null)
|
| | | {
|
| | | Common.Room.CurrentRoom = Common.Room.Lists[0];
|
| | |
| | | //界面关闭
|
| | | return;
|
| | | }
|
| | | Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, false, this.ReceiveDeviceStatuPush, ShowErrorMode.NO);
|
| | | int statu = 0;
|
| | | var list = Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, ref statu, false, ShowErrorMode.NO);
|
| | | if (statu != -1)
|
| | | {
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | {
|
| | | //设置设备在线状态
|
| | | this.ReceiveDeviceStatuPush(list[i]);
|
| | | }
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | |
| | | //字数
|
| | | var btnFild = new NormalViewControl(120, 60, true);
|
| | | btnFild.X = frameInput.Width - ControlCommonResourse.XXLeft - Application.GetRealWidth(80);
|
| | | btnFild.X = frameInput.Width - ControlCommonResourse.XXLeft - Application.GetRealWidth(120);
|
| | | btnFild.Y = Application.GetRealHeight(503);
|
| | | btnFild.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | btnFild.TextSize = 12;
|
| | |
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uSubmitSuccessMsg));
|
| | | //关闭界面
|
| | | this.CloseForm();
|
| | | //显示成功的界面
|
| | | this.ShowSuccessMsg();
|
| | | });
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 显示成功的界面
|
| | | /// </summary>
|
| | | private void ShowSuccessMsg()
|
| | | {
|
| | | var frameBack = new FrameLayout();
|
| | | frameBack.BackgroundColor = 0x80000000;
|
| | | this.AddChidren(frameBack);
|
| | |
|
| | | var frameMsg = new FrameLayout();
|
| | | frameMsg.BackgroundColor = UserCenterColor.Current.White;
|
| | | frameMsg.Width = Application.GetRealWidth(622);
|
| | | frameMsg.Height = Application.GetRealHeight(317);
|
| | | frameMsg.Radius = (uint)Application.GetRealHeight(17);
|
| | | frameMsg.Gravity = Gravity.CenterHorizontal;
|
| | | frameMsg.Y = Application.GetRealHeight(792);
|
| | | frameBack.AddChidren(frameMsg);
|
| | |
|
| | | //提示
|
| | | var btnTitle = new NormalViewControl(492, 65, true);
|
| | | btnTitle.Y = Application.GetRealHeight(68);
|
| | | btnTitle.Gravity = Gravity.CenterHorizontal;
|
| | | btnTitle.TextID = R.MyInternationalizationString.NormalTip;
|
| | | btnTitle.TextAlignment = TextAlignment.Center;
|
| | | btnTitle.TextColor = 0xFF333443;
|
| | | frameMsg.AddChidren(btnTitle);
|
| | |
|
| | | //您的反馈已成功提交
|
| | | var btnSuccess = new NormalViewControl(frameMsg.Width, Application.GetRealHeight(60), false);
|
| | | btnSuccess.Y = Application.GetRealHeight(166);
|
| | | btnSuccess.TextAlignment = TextAlignment.Center;
|
| | | btnSuccess.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | btnSuccess.TextID = R.MyInternationalizationString.uSubmitSuccessMsg;
|
| | | frameMsg.AddChidren(btnSuccess);
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | System.Threading.Thread.Sleep(2000);
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | this.CloseForm();
|
| | | });
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | | }
|
| | |
| | | //数据异常
|
| | | return;
|
| | | }
|
| | | if (this.Parent == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //清空
|
| | | listView.RemoveAll();
|
| | | });
|
| | | if (dicData.Count == 0)
|
| | | {
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //关闭刷新特效
|
| | | listView.EndHeaderRefreshing();
|
| | | listView.frameTable.Height = listView.Height;
|
| | | });
|
| | | return;
|
| | | }
|
| | | //初始化中部控件
|
| | | this.InitMiddleFrame(dicData);
|
| | | }
|
| | |
| | | maxCount += data.Count;
|
| | | }
|
| | |
|
| | | int waiTime = 1000;
|
| | | int waiTime = 500;
|
| | | foreach (var keys in dicData.Keys)
|
| | | {
|
| | | var listGroup = dicData[keys];
|
| | |
| | | });
|
| | | //第一次的时候,等待的时候久一点
|
| | | System.Threading.Thread.Sleep(waiTime);
|
| | | waiTime = 500;
|
| | | waiTime = 300;
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | var btnTime = rowControl.frameTable.AddMostRightView("", 200, 50);
|
| | | btnTime.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | btnTime.Y = btnMsg.Bottom + Application.GetRealHeight(12);
|
| | | btnTime.Text = Convert.ToDateTime(recordInfo.CreatedOnUtc).ToString("HH:mm");
|
| | | var convertTime = UserCenterLogic.ConvertUtcTimeToLocalTime(recordInfo.CreatedOnUtc);
|
| | | btnTime.Text = convertTime.ToString("HH:mm");
|
| | | rowControl.frameTable.AddChidren(btnTime, ChidrenBindMode.BindEventOnly);
|
| | | //底线
|
| | | if (addLine == true)
|
| | | {
|
| | | rowControl.frameTable.AddBottomLine();
|
| | | rowControl.frameTable.AddBottomLine(); |
| | | }
|
| | | //已读
|
| | | if (recordInfo.IsReading == true)
|
| | |
| | | } |
| | | } |
| | | break;
|
| | | |
| | | case DeviceType.TemperatureSensor: |
| | | //温度 |
| | | if (common.DeviceStatusReport.CluterID == 1026) |
| | | { |
| | | var tempera = (TemperatureSensor)myDevice; |
| | | foreach (var data in common.DeviceStatusReport.AttriBute) |
| | | { |
| | | if (data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue) |
| | | { |
| | | if (data.AttriButeData == 0) |
| | | { |
| | | tempera.Temperatrue = 0; |
| | | } |
| | | else if (data.AttriButeData > 32767) |
| | | { |
| | | //负数(特殊处理) |
| | | string strValue = (data.AttriButeData - 65536).ToString(); |
| | | //小数点需要一位 |
| | | strValue = strValue.Substring(0, strValue.Length - 1); |
| | | tempera.Temperatrue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); |
| | | } |
| | | else |
| | | { |
| | | //小数点需要一位 |
| | | string strValue = data.AttriButeData.ToString(); |
| | | strValue = strValue.Substring(0, strValue.Length - 1); |
| | | tempera.Temperatrue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //湿度 |
| | | if (common.DeviceStatusReport.CluterID == 1029) |
| | | { |
| | | var tempera = (TemperatureSensor)myDevice; |
| | | foreach (var data in common.DeviceStatusReport.AttriBute) |
| | | { |
| | | if (data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue) |
| | | { |
| | | if (data.AttriButeData == 0) |
| | | { |
| | | tempera.Humidity = 0; |
| | | } |
| | | else |
| | | { |
| | | //小数点需要一位(湿度没有负数) |
| | | string strValue = data.AttriButeData.ToString(); |
| | | strValue = strValue.Substring(0, strValue.Length - 1); |
| | | tempera.Humidity = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); |
| | | tempera.LastDateTime = DateTime.Now; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | /// 成员请求控制主帐号此住宅时请求基地址的LoginAccessToken的值
|
| | | /// </summary> |
| | | public string AdminRequestToken = string.Empty; |
| | | /// <summary>
|
| | | /// 远程连接的Mqtt的客户端ID
|
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public string ConnEmqClientId = string.Empty; |
| | | |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public List<FanMode> fanModes = new List<FanMode> { }; |
| | | /// <summary>
|
| | | /// <para>自定义空调支持的模式(默认全关)</para>
|
| | | /// <para>自定义空调支持的模式(默认全开)</para>
|
| | | /// <para>数组索引 -> 0:制冷 1:制热 2:送风 3:除湿 4:自动</para>
|
| | | /// <para>值 -> 1:代表使用 0:代表不使用</para>
|
| | | /// </summary> |
| | | public int[] listSupportMode = new int[5] { 0, 0, 0, 0, 0 }; |
| | | public int[] listSupportMode = new int[5] { 1, 1, 1, 1, 1 }; |
| | | /// <summary>
|
| | | /// 是否启用摆风功能 false:不使用摆风功能 true:使用摆风功能
|
| | | /// </summary> |
| | | public bool UseSwingFunction = true; |
| | | |
| | | /// <summary> |
| | | /// 过滤网清洗状态 |
| | |
| | | public void ReadCleanStatu() |
| | | { |
| | | ReadAttri(Device.Cluster_ID.Thermostat, AttriButeId.CleanStatu); |
| | | }
|
| | |
|
| | | /// <summary> |
| | | /// 获取是否启用空调摆风模式的状态(打开 或者 关闭) |
| | | /// </summary> |
| | | public void ReadUseSwingFunctionStatu() |
| | | { |
| | | ReadAttri(Device.Cluster_ID.FanControl, AttriButeId.UseAcSwingFunctionStatu); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | {
|
| | | return await SetSystemModeAsync(acMode);
|
| | | } |
| | | |
| | | #region 升级空调第三方模块的接口 |
| | | |
| | | #region 读取IRACC模块固件版本(APP -> Zigbee MCU) |
| | | ///<summary > |
| | | ///读取IRACC模块固件版本 |
| | | /// <para>reserve:0-ff</para> |
| | | /// </summary> |
| | | public async System.Threading.Tasks.Task<ReadACFirewareVersionResponAllData> ReadACFirewareVersionAsync(string reserve = "01") |
| | | { |
| | | ReadACFirewareVersionResponAllData result = null; |
| | | if (Gateway == null) |
| | | { |
| | | result = new ReadACFirewareVersionResponAllData { errorMessageBase = "当前没有网关" }; |
| | | return result; |
| | | } |
| | | return await System.Threading.Tasks.Task.Run(async () => |
| | | { |
| | | Action<string, string> action = (topic, message) => |
| | | { |
| | | var gatewayID = topic.Split('/')[0]; |
| | | var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); |
| | | |
| | | if (topic == gatewayID + "/" + "Error_Respon") |
| | | { |
| | | var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID }; |
| | | var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString()); |
| | | |
| | | if (temp == null) |
| | | { |
| | | result = new ReadACFirewareVersionResponAllData { errorMessageBase = "网关错误回复,且数据是空" }; |
| | | } |
| | | |
| | | else |
| | | { |
| | | result = new ReadACFirewareVersionResponAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) }; |
| | | } |
| | | } |
| | | if (topic == gatewayID + "/" + "ZbDataPassthrough") |
| | | { |
| | | var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") }; |
| | | gatewayTemp.clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClientDataPassthroughResponseData>(jobject["Data"].ToString()); |
| | | |
| | | if (gatewayTemp.clientDataPassthroughResponseData == null) |
| | | { |
| | | result = new ReadACFirewareVersionResponAllData { errorMessageBase = "网关返回的数据为空" }; |
| | | } |
| | | else |
| | | { |
| | | if (gatewayTemp.clientDataPassthroughResponseData?.PassData != null) |
| | | { |
| | | var data = gatewayTemp.clientDataPassthroughResponseData.PassData; |
| | | var command = data[4].ToString() + data[5].ToString() + data[2].ToString() + data[3].ToString(); |
| | | if (command == "0259") |
| | | { |
| | | var tempD = new ReadACFirewareVersionResponData(); |
| | | tempD.Status = Convert.ToInt32(data[10].ToString() + data[11].ToString(), 16); |
| | | if (data.Length == 82) |
| | | { |
| | | var firewareString = data.Substring(12); |
| | | var aa = firewareString.Length; |
| | | firewareVersion = firewareString; |
| | | var bytes = new byte[firewareString.Length / 2]; |
| | | for (int i = 0; i < bytes.Length; i++) |
| | | { |
| | | bytes[i] = Convert.ToByte(firewareString.Substring(i * 2, 2), 16); |
| | | } |
| | | |
| | | var firewareVersionTemp = System.Text.Encoding.ASCII.GetString(bytes); |
| | | tempD.FirewareVersion = firewareVersionTemp.Replace('\0', ' ').Trim(); |
| | | } |
| | | result = new ReadACFirewareVersionResponAllData { readACFirewareVersionResponData = tempD }; |
| | | System.Console.WriteLine($"UI收到通知后的主题_command:0258_{topic}"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | |
| | | Gateway.Actions += action; |
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 启动" + System.DateTime.Now.ToString()); |
| | | |
| | | try |
| | | { |
| | | var passData = ReadACFirewareVersionData(reserve); |
| | | var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } }; |
| | | var data = new JObject { { "PassData", passData } }; |
| | | jObject.Add("Data", data); |
| | | Gateway.Send(("ClientDataPassthrough"), jObject.ToString()); |
| | | } |
| | | catch { } |
| | | |
| | | var dateTime = DateTime.Now; |
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime) |
| | | { |
| | | await System.Threading.Tasks.Task.Delay(10); |
| | | if (result != null) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime) |
| | | { |
| | | result = new ReadACFirewareVersionResponAllData { errorMessageBase = " 回复超时,请重新操作" }; |
| | | } |
| | | Gateway.Actions -= action; |
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 退出" + System.DateTime.Now.ToString()); |
| | | |
| | | return result; |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 读取IRACC模块固件版本 |
| | | /// </summary> |
| | | string ReadACFirewareVersionData(string reserve) |
| | | { |
| | | string data = ""; |
| | | string dataLength = "05"; |
| | | string dataComand1 = "58"; |
| | | string dataComand2 = "02"; |
| | | string dataSerialNum = "01"; |
| | | string addDataLength = "01"; |
| | | string reserveData = reserve; |
| | | |
| | | try |
| | | { |
| | | data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength + |
| | | reserveData; |
| | | } |
| | | catch { }; |
| | | |
| | | return data; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// IRACC模块固件版本,网关反馈信息 |
| | | /// </summary> |
| | | public ReadACFirewareVersionResponAllData readACFirewareVersionResponAllData; |
| | | /// <summary> |
| | | /// IRACC模块固件版本,网关反馈信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class ReadACFirewareVersionResponAllData |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// IRACC模块固件版本信息 |
| | | /// </summary> |
| | | public ReadACFirewareVersionResponData readACFirewareVersionResponData; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// IRACC模块固件版本的数据 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class ReadACFirewareVersionResponData |
| | | { |
| | | /// <summary> |
| | | /// 状态 |
| | | ///<para>0--成功</para> |
| | | ///<para>1--失败</para> |
| | | ///<para>ff--无效</para> |
| | | /// </summary> |
| | | public int Status; |
| | | /// <summary> |
| | | /// 固件版本 |
| | | /// </summary> |
| | | public string FirewareVersion; |
| | | } |
| | | #endregion |
| | | |
| | | #region 升级IRACC模块通知(APP -> Zigbee MCU) |
| | | ///<summary > |
| | | ///升级IRACC模块通知 |
| | | /// <para>firewareVer:固件版本</para> |
| | | /// <para>firewareSize:固件大小</para> |
| | | /// </summary> |
| | | public async System.Threading.Tasks.Task<ResponseAllData> UpggradeACNotificationAsync(string firewareVer, long firewareSize) |
| | | { |
| | | ResponseAllData result = null; |
| | | if (Gateway == null) |
| | | { |
| | | result = new ResponseAllData { errorMessageBase = "当前没有网关" }; |
| | | return result; |
| | | } |
| | | return await System.Threading.Tasks.Task.Run(async () => |
| | | { |
| | | Action<string, string> action = (topic, message) => |
| | | { |
| | | var gatewayID = topic.Split('/')[0]; |
| | | var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); |
| | | |
| | | if (topic == gatewayID + "/" + "Error_Respon") |
| | | { |
| | | var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID }; |
| | | var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString()); |
| | | |
| | | if (temp == null) |
| | | { |
| | | result = new ResponseAllData { errorMessageBase = "网关错误回复,且数据是空" }; |
| | | } |
| | | |
| | | else |
| | | { |
| | | result = new ResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) }; |
| | | } |
| | | } |
| | | if (topic == gatewayID + "/" + "ZbDataPassthrough") |
| | | { |
| | | var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") }; |
| | | gatewayTemp.clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClientDataPassthroughResponseData>(jobject["Data"].ToString()); |
| | | |
| | | if (gatewayTemp.clientDataPassthroughResponseData == null) |
| | | { |
| | | result = new ResponseAllData { errorMessageBase = "网关返回的数据为空" }; |
| | | } |
| | | else |
| | | { |
| | | if (gatewayTemp.clientDataPassthroughResponseData?.PassData != null) |
| | | { |
| | | var data = gatewayTemp.clientDataPassthroughResponseData.PassData; |
| | | var command = data[4].ToString() + data[5].ToString() + data[2].ToString() + data[3].ToString(); |
| | | if (command == "025b") |
| | | { |
| | | var tempD = new ResponseData(); |
| | | if (data.Length == 12) |
| | | { |
| | | tempD.status = Convert.ToInt32(data[10].ToString() + data[11].ToString(), 16); |
| | | } |
| | | result = new ResponseAllData { responseData = tempD }; |
| | | System.Console.WriteLine($"UI收到通知后的主题_{ topic}"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | |
| | | Gateway.Actions += action; |
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 启动" + System.DateTime.Now.ToString()); |
| | | |
| | | try |
| | | { |
| | | var passData = UpggradeACNotificationData(firewareVer, firewareSize); |
| | | var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } }; |
| | | var data = new JObject { { "PassData", passData } }; |
| | | jObject.Add("Data", data); |
| | | Gateway.Send(("ClientDataPassthrough"), jObject.ToString()); |
| | | } |
| | | catch { } |
| | | |
| | | var dateTime = DateTime.Now; |
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime) |
| | | { |
| | | await System.Threading.Tasks.Task.Delay(10); |
| | | if (result != null) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime) |
| | | { |
| | | result = new ResponseAllData { errorMessageBase = " 回复超时,请重新操作" }; |
| | | } |
| | | Gateway.Actions -= action; |
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 退出" + System.DateTime.Now.ToString()); |
| | | |
| | | return result; |
| | | }); |
| | | } |
| | | |
| | | private string firewareVersion = string.Empty; |
| | | /// <summary> |
| | | /// 升级IRACC模块通知返回 |
| | | /// </summary> |
| | | string UpggradeACNotificationData(string firewareVer, long firewareSize) |
| | | { |
| | | string data = ""; |
| | | string dataLength = "2C"; |
| | | string dataComand1 = "5A"; |
| | | string dataComand2 = "02"; |
| | | string dataSerialNum = "01"; |
| | | string addDataLength = "28"; |
| | | string deviceUpgradeMethod = "01"; |
| | | string firewareVersionData = ""; |
| | | string firewareSizeData = ""; |
| | | |
| | | try |
| | | { |
| | | //固件版本 |
| | | var firewareVerBytes = System.Text.Encoding.ASCII.GetBytes(firewareVer); |
| | | for (int i = 0; i < firewareVerBytes.Length; i++) |
| | | { |
| | | var fw = Convert.ToString(firewareVerBytes[i], 16); |
| | | if (fw.Length == 1) |
| | | { |
| | | fw = "0" + fw; |
| | | } |
| | | firewareVersionData += fw; |
| | | } |
| | | |
| | | var aa = firewareVersionData.Length; |
| | | firewareVersionData = firewareVersionData.PadRight(70, '0'); |
| | | |
| | | //固件尺寸 |
| | | var tempFwSize = Convert.ToString(firewareSize, 16); |
| | | tempFwSize = tempFwSize.PadLeft(8, '0'); |
| | | for (int i = 6; i >= 0; i = i - 2) |
| | | { |
| | | firewareSizeData += tempFwSize.Substring(i, 2); |
| | | } |
| | | |
| | | data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength + |
| | | deviceUpgradeMethod + firewareVersionData + firewareSizeData; |
| | | |
| | | } |
| | | catch { }; |
| | | |
| | | return data; |
| | | } |
| | | |
| | | /// <summary> |
| | | ///升级IRACC模块通知回复 |
| | | /// </summary> |
| | | public ResponseAllData keyColorDataResponseAllData; |
| | | [System.Serializable] |
| | | public class ResponseAllData |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 升级IRACC模块通知信息 |
| | | /// </summary> |
| | | public ResponseData responseData; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 升级IRACC模块通知回复(Zigbee MCU -> APP) |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class ResponseData |
| | | { |
| | | /// <summary> |
| | | /// 状态值 |
| | | /// <para>0--版本号不一致(可以升级</para> |
| | | /// <para>1--版本号一致(不用升级</para> |
| | | /// <para>2--预留(暂时不用到</para> |
| | | /// <para>ff--无效(暂时不用到)</para> |
| | | /// </summary> |
| | | public int status = -1; |
| | | } |
| | | #endregion |
| | | |
| | | #region 设备请求APP获取升级数据 (Zigbee MCU -> APP,主动上报) |
| | | /// <summary> |
| | | ///设备请求APP获取升级数据(Zigbee MCU -> APP,主动上报) |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class DeviceRequestUpgradeResponseData |
| | | { |
| | | /// <summary> |
| | | /// 数据偏移量,每个分包偏移量+(1-43) |
| | | /// </summary> |
| | | public string offset = string.Empty; |
| | | /// <summary> |
| | | /// 数据长度len |
| | | /// </summary> |
| | | public int dataLength = -1; |
| | | } |
| | | #endregion |
| | | |
| | | #region 发升级数据到设备(APP -> Zigbee MCU) |
| | | ///<summary > |
| | | ///读取IRACC模块固件版本 |
| | | /// <para>reserve:0-ff</para> |
| | | /// </summary> |
| | | public async void UpgradeAsync(SendUpgradeData upgradeData) |
| | | { |
| | | if (Gateway == null) |
| | | { |
| | | return; |
| | | } |
| | | Action<string, string> action = (topic, message) => { }; |
| | | Gateway.Actions += action; |
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 启动" + System.DateTime.Now.ToString()); |
| | | |
| | | try |
| | | { |
| | | string passData = ""; |
| | | if (upgradeData != null) |
| | | { |
| | | passData = SendUpgrade(upgradeData); |
| | | } |
| | | |
| | | var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } }; |
| | | var data = new JObject { { "PassData", passData } }; |
| | | jObject.Add("Data", data); |
| | | Gateway.Send(("ClientDataPassthrough"), jObject.ToString()); |
| | | } |
| | | catch { } |
| | | |
| | | Gateway.Actions -= action; |
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 退出" + System.DateTime.Now.ToString()); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 发升级数据到设备 |
| | | /// </summary> |
| | | string SendUpgrade(SendUpgradeData upgradeData) |
| | | { |
| | | string data = ""; |
| | | string dataLength = ""; |
| | | string dataComand1 = "5D"; |
| | | string dataComand2 = "02"; |
| | | string dataSerialNum = "01"; |
| | | string addDataLength = ""; |
| | | |
| | | string status = ""; |
| | | string offset = ""; |
| | | string upgradeDataLength = ""; |
| | | string dataString = ""; |
| | | |
| | | try |
| | | { |
| | | var len = 4 + 1 + 4 + 1 + upgradeData.dataLength; |
| | | dataLength = Convert.ToString(len, 16); |
| | | if (dataLength.Length == 1) |
| | | { |
| | | dataLength = "0" + dataLength; |
| | | } |
| | | |
| | | addDataLength = Convert.ToString(6 + upgradeData.dataLength, 16); |
| | | if (addDataLength.Length == 1) |
| | | { |
| | | addDataLength = "0" + addDataLength; |
| | | } |
| | | |
| | | if (upgradeData.status == 0) |
| | | { |
| | | status = "00"; |
| | | } |
| | | else if (upgradeData.status == 1) |
| | | { |
| | | status = "01"; |
| | | } |
| | | else |
| | | { |
| | | status = "ff"; |
| | | } |
| | | |
| | | |
| | | offset = upgradeData.offset; |
| | | |
| | | var dl = Convert.ToString(upgradeData.dataLength, 16); |
| | | if (dl.Length == 1) |
| | | { |
| | | upgradeDataLength = "0" + dl; |
| | | } |
| | | else |
| | | { |
| | | upgradeDataLength = dl; |
| | | } |
| | | |
| | | for (int i = 0; i < upgradeData.databytes.Length; i++) |
| | | { |
| | | var dataB = Convert.ToString(upgradeData.databytes[i], 16);
if (dataB.Length == 1)
{
dataB = "0" + dataB;
}
dataString += dataB; |
| | | } |
| | | |
| | | data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength + |
| | | status + offset + upgradeDataLength + dataString; |
| | | } |
| | | catch { }; |
| | | |
| | | return data; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 发送升级数据到设备(APP -> Zigbee MCU) |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class SendUpgradeData |
| | | { |
| | | /// <summary> |
| | | /// 0--成功 |
| | | ///<para>1--失败</para> |
| | | ///<para>ff--无效</para> |
| | | /// </summary> |
| | | public int status = 0; |
| | | /// <summary> |
| | | /// 数据偏移量,每个分包偏移量+(1-43) |
| | | /// </summary> |
| | | public string offset; |
| | | /// <summary> |
| | | /// 数据长度len |
| | | /// </summary> |
| | | public int dataLength = -1; |
| | | |
| | | /// <summary> |
| | | /// 分包数据 |
| | | /// </summary> |
| | | public byte[] databytes; |
| | | } |
| | | #endregion |
| | | |
| | | #region 分包结束(Zigbee MCU -> APP,主动上报) |
| | | /// <summary> |
| | | /// 设备请求APP获取分包结束命令(Zigbee MCU -> APP) |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class DeviceRequestFinishResponseData |
| | | { |
| | | /// <summary> |
| | | /// 0-ff |
| | | /// </summary> |
| | | public int reserve = -1; |
| | | } |
| | | #endregion |
| | | |
| | | #region 分包结束(APP -> Zigbee MCU) |
| | | ///<summary > |
| | | ///读取IRACC模块固件版本 |
| | | /// <para>status:0--成功;1--失败;ff--无效 .</para> |
| | | /// </summary> |
| | | public async void SendFinishAsync(int status) |
| | | { |
| | | if (Gateway == null) |
| | | { |
| | | return; |
| | | } |
| | | Action<string, string> action = (topic, message) => { }; |
| | | Gateway.Actions += action; |
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 启动" + System.DateTime.Now.ToString()); |
| | | |
| | | try |
| | | { |
| | | var passData = SendFinishDataString(status); |
| | | var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } }; |
| | | var data = new JObject { { "PassData", passData } }; |
| | | jObject.Add("Data", data); |
| | | Gateway.Send(("ClientDataPassthrough"), jObject.ToString()); |
| | | } |
| | | catch { } |
| | | |
| | | Gateway.Actions -= action; |
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 退出" + System.DateTime.Now.ToString()); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 发升级数据到设备 |
| | | /// </summary> |
| | | string SendFinishDataString(int status) |
| | | { |
| | | string data = ""; |
| | | string dataLength = "05"; |
| | | string dataComand1 = "5F"; |
| | | string dataComand2 = "02"; |
| | | string dataSerialNum = "01"; |
| | | string addDataLength = "01"; |
| | | string statusString = ""; |
| | | try |
| | | { |
| | | if (status == 0) |
| | | { |
| | | statusString = "00"; |
| | | } |
| | | else if (status == 1) |
| | | { |
| | | statusString = "01"; |
| | | } |
| | | else |
| | | { |
| | | statusString = "ff"; |
| | | } |
| | | data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength + |
| | | statusString; |
| | | } |
| | | catch { }; |
| | | |
| | | return data; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 分包结束返回(APP -> Zigbee MCU |
| | | /// </summary> |
| | | //[System.Serializable] |
| | | public class SendFinishData |
| | | { |
| | | /// <summary> |
| | | /// 状态:成功/失败 |
| | | ///<para>0--成功<<para> |
| | | ///<para>1--失败<<para> |
| | | ///<para>ff--无效<<para> |
| | | /// </summary> |
| | | public int status = -1; |
| | | } |
| | | |
| | | #endregion |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | else if (topic == gatewayID + "/" + "Bind/SetBind_Respon") |
| | | { |
| | | var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = ZbGateway.MainGateWay.getGatewayBaseInfo.gwID }; |
| | | //var tempBindList = Newtonsoft.Json.Linq.JArray.Parse(jobject["Data"]["BindList"].ToString()); |
| | | var tempResult = Newtonsoft.Json.JsonConvert.DeserializeObject<AddedDeviceBindResponseData>(jobject["Data"].ToString()); |
| | | if (tempResult == null) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | //var dataBindRes = new AddedDeviceBindResponseData(); |
| | | //for (int m = 0; tempBindList != null && m < tempBindList.Count; m++) |
| | | //{ |
| | | // var tempBind = tempBindList[m]; |
| | | // dataBindRes.BindList.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<AddBindListResponseObj>(tempBind.ToString())); |
| | | //} |
| | | //if (dataBindRes != null) |
| | | //{ |
| | | result = new AddedDeviceBindResponseAllData { addedDeviceBindResponseData = tempResult }; |
| | | DebugPrintLog($"UI收到通知后的主题_{topic}"); |
| | | //} |
| | | } |
| | | } |
| | | //else if (topic == gatewayID + "/" + "Bind/BindResult") |
| | | //{ |
| | | // var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = ZbGateway.MainGateWay.getGatewayBaseInfo.gwID }; |
| | | // var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<AddBindResultResponseData>(jobject["Data"].ToString()); |
| | | |
| | | // if (tempData != null) |
| | | // { |
| | | // result = new AddedDeviceBindResponseAllData { addBindResultResponseData = tempData }; |
| | | // } |
| | | // DebugPrintLog($"UI收到通知后的主题_{topic}"); |
| | | //} |
| | | }; |
| | | mainGateway.Actions += action; |
| | | DebugPrintLog("Bind/SetBind_Actions 启动" + "_" + System.DateTime.Now.ToLongTimeString() + " " + System.DateTime.Now.Millisecond); |
| | |
| | | break; |
| | | } |
| | | } |
| | | if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime) |
| | | { |
| | | result = new AddedDeviceBindResponseAllData { errorMessageBase = " 回复超时,请重新操作" }; |
| | | } |
| | | //while ((DateTime.Now - dateTime).TotalMilliseconds < 20*1000) |
| | | //{ |
| | | //await System.Threading.Tasks.Task.Delay(100); |
| | | //if (result == null || result.addedDeviceBindResponseData == null) |
| | | //{ |
| | | // continue; |
| | | //} |
| | | //if (0 < result.addedDeviceBindResponseData.BindList.FindAll((obj) => obj.BindType == 0 && obj.Result == 1).Count) |
| | | //{ |
| | | // if (result.addBindResultResponseData != null) |
| | | // { |
| | | // break; |
| | | // } |
| | | //} |
| | | //else if (0 < result.addedDeviceBindResponseData.BindList.FindAll((obj) => obj.BindType == 0 && obj.Result == 2).Count) |
| | | //{ |
| | | // if (result.addBindResultResponseData != null) |
| | | // { |
| | | // break; |
| | | // } |
| | | //} |
| | | //else if (0 < result.addedDeviceBindResponseData.BindList.FindAll((obj) => obj.BindType == 0 && obj.Result == 3).Count) |
| | | //{ |
| | | // if (result.addBindResultResponseData != null) |
| | | // { |
| | | // break; |
| | | // } |
| | | //} |
| | | //else |
| | | //{ |
| | | // break; |
| | | //} |
| | | //} |
| | | if ((DateTime.Now - dateTime).TotalMilliseconds > 20 * 1000) |
| | | { |
| | | result = new AddedDeviceBindResponseAllData { errorMessageBase = " 回复超时,请重新操作" }; |
| | |
| | | /// <summary> |
| | | /// 过虑网清洗标志:42 |
| | | /// </summary> |
| | | CleanStatu = 4097, |
| | | CleanStatu = 4097,
|
| | | /// <summary> |
| | | /// 启用空调摆风模式的状态(打开 或者 关闭) |
| | | /// </summary> |
| | | UseAcSwingFunctionStatu = 4097, |
| | | |
| | | #endregion |
| | | |
| | |
| | | //订阅一个分享数据已经变更的主题
|
| | | await RemoteMqttClient.SubscribeAsync("/ZigbeeGateWayToClient/" + myGuid + "/Push/DeletedShareData");
|
| | | }
|
| | | //订阅一个挤下线的主题
|
| | | await RemoteMqttClient.SubscribeAsync("/ZigbeeGateWayToClient/" + Config.Instance.ConnEmqClientId + "/Push/NotifySqueeze");
|
| | |
|
| | | await initGateWayBaseInfomation(); |
| | | Shared.Phone.UserCenter.HdlGatewayLogic.Current.CheckGatewayByConnectChanged(Shared.Phone.UserCenter.GatewayConnectMode.Remote);
|
| | |
| | | var connEmqClientId = responseData["ConnEmqClientId"]?.ToString(); |
| | | var connEmqUserName = responseData["ConnEmqUserName"]?.ToString(); |
| | | var connEmqPwd = responseData["ConnEmqPwd"]?.ToString(); |
| | | //记录起当前的客户端ID |
| | | Config.Instance.ConnEmqClientId = connEmqClientId; |
| | | |
| | | var connEmqDomainPorts = connEmqDomainPort.Replace("//", "").Split(':'); |
| | | var domain = connEmqDomainPorts[1]; |
| | |
| | | epoint = topic.Split('/')[3]; |
| | | cluID = topic.Split('/')[4]; |
| | | attrId = topic.Split('/')[5]; |
| | | } |
| | | }
|
| | |
|
| | | //全局接收网关推送的的逻辑(为了执行速度,尽可能的别加耗时的操作)
|
| | | Shared.Phone.UserCenter.HdlGatewayReceiveLogic.Current.GatewayOverallMsgReceive(gatewayID, topic, reportStatus, message); |
| | | |
| | | var gwa = GateWayList.Find(obj => obj.getGatewayBaseInfo.gwID == gatewayID); |
| | | if (gwa == null) |
| | |
| | | { |
| | | jobject = Newtonsoft.Json.Linq.JObject.Parse(message); |
| | | }
|
| | |
|
| | | //全局接收网关推送的的逻辑(为了执行速度,尽可能的别加耗时的操作)
|
| | | Shared.Phone.UserCenter.HdlGatewayReceiveLogic.Current.GatewayOverallMsgReceive(gatewayID, topic, reportStatus, jobject);
|
| | |
|
| | | #region 远程,主网关上报通知 |
| | | if (IsRemote) |
| | |
| | | public readonly static int Sunrisesunset = 5134; |
| | | public readonly static int cycle = 5135; |
| | | public readonly static int completeNext = 5136; |
| | | public readonly static int Selectedtimetype = 5137; |
| | | public readonly static int Selectedtimetype= 5137; |
| | | public readonly static int Timecondition = 5138; |
| | | public readonly static int condition = 5139; |
| | | public readonly static int pushset = 5140; |
| | |
| | | public readonly static int application = 5376; |
| | | public readonly static int automationaddtext = 5377; |
| | | public readonly static int tiptextnull = 5378; |
| | | public readonly static int tiplocktextnull = 5379; |
| | | |
| | | #region 登录注册 |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public const int uSubmit = 15922; |
| | | /// <summary> |
| | | /// 提交成功,感谢您的意见 |
| | | /// 您的反馈已成功提交 |
| | | /// </summary> |
| | | public const int uSubmitSuccessMsg = 15923; |
| | | /// <summary> |
| | |
| | | /// 办公室
|
| | | /// </summary>
|
| | | public const int uWorkRoom = 16060;
|
| | | /// <summary>
|
| | | /// 电机数据异常,请重置电机
|
| | | /// </summary>
|
| | | public const int uCurtainDataIsErrorPleaseResetCurtain = 16061;
|
| | | /// <summary>
|
| | | /// 获取空调摆风状态失败
|
| | | /// </summary>
|
| | | public const int uGetAirConditionerSwingFunctionFail = 16062;
|
| | | /// <summary>
|
| | | /// 设置空调摆风失败
|
| | | /// </summary>
|
| | | public const int uSetAirConditionerSwingFunctionFail = 16063;
|
| | |
|
| | |
|
| | | //★★★★下面这些是接口的返回信息翻译,从18000开始★★★★
|
| | |
| | | <Import_RootNamespace>Shared</Import_RootNamespace>
|
| | | </PropertyGroup>
|
| | | <ItemGroup>
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Common\Device.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Common\House.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Common\Logic.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Common\ResponseEntity\ApkInfoOBJ.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Common\ResponseEntity\AuthUserRes.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Common\ResponseEntity\FirmwareManaRes.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Common\ResponseEntity\GetAppVersionCode.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Common\ResponseEntity\ResultPack.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Common\ResponseEntity\UserLoginLocalRegionRes.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Pad\MainPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Account\AccountLogic.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\Send.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\EveryyearPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\SelectedLogicState.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\TemplatePage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\SelectedLogicStatus.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Account\AccountRegister.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Account\AccountRegisterSuccess.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Account\AccountResetPWDSuccess.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Account\PhoneEmailForm.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Account\PhoneZone.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\AC\ACControl.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\AC\ACControlBase.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Category\CategorySceneSelectImgByLocal.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Category\SelectDelayTime.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Category\SelectDevice.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Category\SelectFloor.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Category\SelectHouse.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Category\SelectScene.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\ACLeftIconButtonRowLayout.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\BackButton.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\ButtonLineForm.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\CategoryFunctionForWinRow.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\CategoryFunctionRow.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\CommonEnum.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\CommonFormResouce.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\CompleteButton.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\CustomAlert.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\DeviceDetailInfo.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\DeviceIconSelectedIMGByLocal.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\DeviceInfoEditRow.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\DeviceInfoRow.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\DeviceInfoWithZoneRow.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\FunctionButton.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\FunctionIconButton.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\FunctionMainView.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\FunctionRow.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\LeftIconButtonRow.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\RoomButton.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\RoomMainView.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\RoomNoNameMainView.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\RoomView.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\RowLayoutDeleteButton.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\RowLayoutEditButton.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\SceneCategoryView.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\SceneMainView.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\SceneTargetFunctionRow.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\SceneTargetTimeRow.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\SelectDeviceWithPickViewRow.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\SelectDeviceWithSeekBarRow.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\SelectedStatuButton.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\SelectFunctionView.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\SelectSceneRow.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\SelectSceneStatuRow.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\SelectTime.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\SelectZone.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\TopFrameLayout.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\DeviceLogic\ReadDeviceAttributeLogic.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Light\AirSwitchControl.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Light\DimmableLightControl.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Light\LightControl.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Light\OnOffControl.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Light\PlugControl.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\AddLogicPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\AddScenePage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\LogicDevicePage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\SelectedLogic.cs" />
|