| | |
| | | /// <param name="listdevice">设备对象(MAC地址必须要相同)</param>
|
| | | public async Task<bool> DeleteDevice(List<CommonDevice> listdevice)
|
| | | {
|
| | | var data = new CommonDevice.RemoveDeviceData();
|
| | | var info = new CommonDevice.RemoveDeviceListInfo();
|
| | | info.DeviceAddr = listdevice[0].DeviceAddr;
|
| | | data.DeviceAddrList.Add(info);
|
| | |
|
| | | //删一次的时候,它会把MAC地址下面全部的设备都删除
|
| | | var result = await listdevice[0].DeleteDeviceAsync(data);
|
| | | if (result == null || result.removeDeviceResponseData == null || result.removeDeviceResponseData.Result != 0)
|
| | | //虚拟住宅的话,不需要删除网关的设备
|
| | | if (Config.Instance.Home.IsVirtually == false)
|
| | | {
|
| | | //设备删除失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uDeviceDeleteFail);
|
| | | //拼接上【网关回复超时】的Msg
|
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
|
| | | var data = new CommonDevice.RemoveDeviceData();
|
| | | var info = new CommonDevice.RemoveDeviceListInfo();
|
| | | info.DeviceAddr = listdevice[0].DeviceAddr;
|
| | | data.DeviceAddrList.Add(info);
|
| | |
|
| | | this.ShowErrorMsg(msg);
|
| | | return false;
|
| | | //删一次的时候,它会把MAC地址下面全部的设备都删除
|
| | | var result = await listdevice[0].DeleteDeviceAsync(data);
|
| | | if (result == null || result.removeDeviceResponseData == null || result.removeDeviceResponseData.Result != 0)
|
| | | {
|
| | | //设备删除失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uDeviceDeleteFail);
|
| | | //拼接上【网关回复超时】的Msg
|
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
|
| | |
|
| | | this.ShowErrorMsg(msg);
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | //删除缓存的Ota设备
|
| | |
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 根据MAC地址,获取简约面板全部回路的设备对象
|
| | | /// </summary>
|
| | | /// <param name="listDevice"></param>
|
| | | /// <returns></returns>
|
| | | public List<CommonDevice> GetMutilfunctionPanelByMac(List<CommonDevice> listDevice, bool sort = true)
|
| | | {
|
| | | //和彪哥、设备和产品部同事确认:
|
| | | //简约多功能面板[不显示多余的回路,只显示携带的2个继电器和1个温湿度传感器
|
| | | var list = new List<CommonDevice>();
|
| | | foreach (var dev in listDevice)
|
| | | {
|
| | | if (dev.Type == DeviceType.TemperatureSensor)
|
| | | {
|
| | | if (dev.DeviceEpoint == 64)
|
| | | {
|
| | | list.Add(dev);
|
| | | }
|
| | | }
|
| | | else if (dev.Type == DeviceType.OnOffOutput)
|
| | | {
|
| | | list.Add(dev);
|
| | | }
|
| | | }
|
| | |
|
| | | if (sort == false)
|
| | | {
|
| | | return list;
|
| | | }
|
| | | list.Sort((obj1, obj2) =>
|
| | | {
|
| | | if (obj1.DeviceEpoint > obj2.DeviceEpoint)
|
| | | {
|
| | | return 1;
|
| | | }
|
| | | return -1;
|
| | | });
|
| | |
|
| | | return list;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 根据MAC地址,获取全部回路的设备对象(强制排序)
|
| | | /// </summary>
|
| | | /// <param name="DeviceAddr">Mac地址</param>
|
| | |
| | | {
|
| | | return dName;
|
| | | }
|
| | | if (this.IsMiniLight(device) == true)
|
| | | {
|
| | | //Mini夜灯
|
| | | return Language.StringByID(R.MyInternationalizationString.uMiniNightLight);
|
| | | }
|
| | |
|
| | | //如果这个设备只有一个回路的话,返回Mac名字给它
|
| | | if (this.GetDevicesCountByMac(device.DeviceAddr) <= 1)
|
| | | {
|
| | |
| | | {
|
| | | //2020.05.18追加:如果记录的房间ID是不存在的话,则重新覆盖
|
| | | var room = HdlRoomLogic.Current.GetRoomById(this.dicDeviceRoomId[listDevice[0].DeviceAddr]);
|
| | | if (room == null)
|
| | | if (room == null || this.dicDeviceRoomId[listDevice[0].DeviceAddr] != roomId)
|
| | | {
|
| | | this.dicDeviceRoomId[listDevice[0].DeviceAddr] = roomId;
|
| | | save = true;
|
| | |
| | | public bool IsHdlDevice(CommonDevice device)
|
| | | {
|
| | | return device.ManufacturerName == "HDL";
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 是否是Mini夜灯
|
| | | /// </summary>
|
| | | /// <param name="device"></param>
|
| | | /// <returns></returns>
|
| | | public bool IsMiniLight(CommonDevice device)
|
| | | {
|
| | | return device.DeviceAddr == "3737363534333231";
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | if (mainDevice.IsCustomizeImage == false)
|
| | | {
|
| | | mainDevice.IconPath = "Device/Light.png";
|
| | | if (this.IsMiniLight(mainDevice) == true)
|
| | | {
|
| | | //mini夜灯
|
| | | mainDevice.IconPath = "Device/MiniNightLight.png";
|
| | | }
|
| | | }
|
| | | }
|
| | | //如果是三路继电器的回路的话,默认为灯光
|
| | |
| | | this.dicDeviceModelIdEnum["MPFA/TILE-ZB.18"] = "250-200-60003";//方悦新风面板
|
| | | this.dicDeviceModelIdEnum["MPTE3/TILE-ZB.18"] = "253-200-60003";//方悦环境面板
|
| | | this.dicDeviceModelIdEnum["MP2W/TILE-ZB.18"] = "256-200-60003";//窗帘面板
|
| | | this.dicDeviceModelIdEnum["MPTL4C/S-ZB.18"] = "212-200-60003";//简约多功能面板
|
| | | this.dicDeviceModelIdEnum["MPTE3/S-ZB.18"] = "230-200-60003";//简约环境面板
|
| | |
|
| | |
|
| | | //=========★★PIR传感器类(1200-1299)★★=========
|
| | | this.dicDeviceModelIdEnum["MSPIR01-ZB.10"] = "1200-1200-60000";//pir传感器220
|
| | |
| | | /// 窗帘面板 镜像id:256
|
| | | /// </summary>
|
| | | ButtonPanel_Curtain = 256,
|
| | |
|
| | | /// <summary>
|
| | | /// 简约多功能面板 镜像ID:212
|
| | | /// </summary>
|
| | | ButtonPanel_SimpleMultifunction = 212,
|
| | | /// <summary>
|
| | | /// 简约环境面板
|
| | | /// </summary>
|
| | | ButtonPanel_SimpleEnvironment = 230,
|
| | | //=========★★PIR传感器类(1200-1299)★★=========
|
| | | /// <summary>
|
| | | /// 传感器
|