| | |
| | | this.DeleteGatewayFileByMemberModel(); |
| | | //初始化物理设备所属房间的记录 |
| | | this.InitRealDeviceRoomId(); |
| | |
|
| | | #if DEBUG
|
| | | if (UserCenterResourse.HideOption.CenterHideMenu == 1)
|
| | | {
|
| | | //检测一些代码配置(debug)
|
| | | this.CheckOhtherSettion();
|
| | | }
|
| | | #endif
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | {
|
| | | //这个网关对于当前这个成员来说是非法的
|
| | | HdlGatewayLogic.Current.DeleteGatewayFile(gwId);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 检测一些代码配置(debug)
|
| | | /// </summary>
|
| | | private void CheckOhtherSettion()
|
| | | {
|
| | | foreach (var item in Enum.GetValues(typeof(DeviceType)))
|
| | | {
|
| | | string itemName = item.ToString();
|
| | | int itemValue = (int)item;
|
| | | if (itemName == "UnKown" || itemName == "ZbGateway")
|
| | | {
|
| | | continue;
|
| | | }
|
| | | var device = this.NewDeviceObjectByDeviceId((DeviceType)itemValue);
|
| | | string strMsg = string.Empty;
|
| | | if (device == null)
|
| | | {
|
| | | strMsg = itemName + "没有实装(1)";
|
| | | }
|
| | | device = CommonDevice.CommonDeviceByByteString(itemName, "{}");
|
| | | if (device == null)
|
| | | {
|
| | | strMsg += "\r\n" + itemName + "没有实装(2)";
|
| | | }
|
| | | if (strMsg != string.Empty)
|
| | | {
|
| | | this.ShowErrorMsg(strMsg);
|
| | | return;
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | public void AddVirtualDeviceToMemory(CommonDevice device)
|
| | | {
|
| | | string mainKeys = this.GetDeviceMainKeys(device);
|
| | | if (device is OTADevice)
|
| | | {
|
| | | this.dicOTADevice[mainKeys] = (OTADevice)device;
|
| | | device.ReSave();
|
| | | return;
|
| | | }
|
| | | this.dicAllDevice[mainKeys] = device;
|
| | |
|
| | | //设备回路收集
|
| | |
| | | this.dicDeviceEpoint[device.DeviceAddr].Remove(device.DeviceEpoint);
|
| | | }
|
| | | }
|
| | | //删除模板数据
|
| | | Phone.TemplateData.TemplateCommonLogic.Current.DeleteDevice(device);
|
| | |
|
| | | //删除设备文件
|
| | | string filePath = device.FilePath;
|
| | |
| | | /// <summary>
|
| | | /// 发送定位指令到设备
|
| | | /// </summary>
|
| | | /// <param name="device"></param>
|
| | | public void SetFixedPositionCommand(CommonDevice device)
|
| | | /// <param name="device">设备回路</param>
|
| | | /// <param name="isRealDevice">是否是定位真实设备</param>
|
| | | public void SetFixedPositionCommand(CommonDevice device, bool isRealDevice = false)
|
| | | {
|
| | | //如果当前住宅不是虚拟住宅
|
| | | if (Common.Config.Instance.Home.IsVirtually == false)
|
| | | {
|
| | | device.IdentifyControl(device.DeviceAddr, device.DeviceEpoint, 5);
|
| | | int epoint = device.DeviceEpoint;
|
| | | //如果是定位真实设备的话
|
| | | if (isRealDevice == true)
|
| | | {
|
| | | var myType = this.GetMyDeviceEnumInfo(new List<CommonDevice> { device });
|
| | | if (myType.ConcreteType == DeviceConcreteType.DimmableLight_OneLoad)
|
| | | {
|
| | | //一路调光器需要发8回路
|
| | | epoint = 8;
|
| | | }
|
| | | }
|
| | | device.IdentifyControl(device.DeviceAddr, epoint, 5);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | else
|
| | | {
|
| | | var infoContent = this.GetDeviceModelIdNameInfo("A419");
|
| | | return infoContent != null ? infoContent.A官方名字 : string.Empty;
|
| | | return infoContent != null ? infoContent.A官方名字 + epointNo : string.Empty;
|
| | | }
|
| | | }
|
| | | else if (device.Type == DeviceType.FreshAirHumiditySensor)
|
| | |
| | | /// <summary>
|
| | | /// 获取【设备功能类型】的菜单图标
|
| | | /// </summary>
|
| | | /// <param name="specificType">自定义设备类型</param>
|
| | | /// <param name="deviceEnumInfo">自定义设备类型</param>
|
| | | /// <param name="unSelectPath">图片地址</param>
|
| | | /// <param name="selectPath">图片地址</param>
|
| | | /// <returns></returns>
|
| | | public void GetDeviceFunctionTypeMenuIcon(DeviceConcreteType specificType, ref string unSelectPath, ref string selectPath)
|
| | | public void GetDeviceFunctionTypeMenuIcon(DeviceEnumInfo deviceEnumInfo, ref string unSelectPath, ref string selectPath)
|
| | | {
|
| | | //新风小模块
|
| | | if (specificType == DeviceConcreteType.Relay_FangyueFreshAirModul)
|
| | | if (deviceEnumInfo.ConcreteType == DeviceConcreteType.Relay_FangyueFreshAirModul)
|
| | | {
|
| | | unSelectPath = "Device/FreshAirEpoint.png";
|
| | | selectPath = "Device/FreshAirEpointSelected.png";
|
| | | return;
|
| | | }
|
| | | //PM2.5空气质量传感器
|
| | | else if (specificType == DeviceConcreteType.Sensor_PMTwoPointFive)
|
| | | else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.Sensor_PMTwoPointFive)
|
| | | {
|
| | | unSelectPath = "Device/AirQualitySensorEpoint.png";
|
| | | selectPath = "Device/AirQualitySensorEpointSelected.png";
|
| | | return;
|
| | | }
|
| | | else if (deviceEnumInfo.BeloneType == DeviceBeloneType.A窗帘)
|
| | | {
|
| | | unSelectPath = "ZigeeLogic/curtain.png";
|
| | | selectPath = "ZigeeLogic/selectedcurtain.png";
|
| | | return;
|
| | | }
|
| | | //上面需要特殊处理
|
| | |
|
| | | //获取【设备类型】的图标
|
| | | this.GetDeviceObjectIcon(specificType, ref unSelectPath, ref selectPath);
|
| | | this.GetDeviceObjectIcon(deviceEnumInfo.ConcreteType, ref unSelectPath, ref selectPath);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | /// <param name="saveRoadDevice">如果只有一个回路,是否把回路的房间一起修改</param>
|
| | | public void SaveRealDeviceRoomId(List<CommonDevice> listDevice, string roomId, bool saveRoadDevice = true)
|
| | | {
|
| | | if (listDevice == null)
|
| | | if (listDevice == null || listDevice.Count == 0)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //如果设备只有一个回路,如果改变了真实设备区域,则它的回路的区域也一起改了
|
| | | if (saveRoadDevice == true && listDevice != null && listDevice.Count == 1)
|
| | | if (saveRoadDevice == true && listDevice.Count == 1)
|
| | | {
|
| | | if (listDevice[0] is OTADevice)
|
| | | if ((listDevice[0] is OTADevice) == false)
|
| | | {
|
| | | //单纯只是Ota设备则不处理
|
| | | return;
|
| | | //ota设备不需要处理
|
| | | HdlRoomLogic.Current.ChangedRoom(listDevice[0], roomId, false);
|
| | | }
|
| | | HdlRoomLogic.Current.ChangedRoom(listDevice[0], roomId, false);
|
| | | }
|
| | | bool save = false;
|
| | | if (roomId == string.Empty)
|
| | |
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | var contr = new ShowMsgControl(ShowMsgType.Error, msg);
|
| | | var contr = new ShowMsgControl(Phone.ShowMsgType.Error, msg);
|
| | | contr.Show();
|
| | | });
|
| | | }
|
| | |
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | var contr = new ShowMsgControl(ShowMsgType.Tip, msg);
|
| | | var contr = new ShowMsgControl(Phone.ShowMsgType.Tip, msg);
|
| | | contr.Show();
|
| | | });
|
| | | }
|
| | |
| | | else if (deviceType == DeviceType.FreshAirHumiditySensor) { device = new HumiditySensor(); }
|
| | | else if (deviceType == DeviceType.ColorTemperatureLight) { device = new ColorTemperatureLight(); }
|
| | | else if (deviceType == DeviceType.Buzzer) { device = new Buzzer(); }
|
| | | else if (deviceType == DeviceType.Transverter) { device = new Transverter(); }
|
| | | else if (deviceType == DeviceType.DimmerSwitch) { device = new DimmerSwitch(); }
|
| | | else if (deviceType == DeviceType.OtaDevice || deviceType == DeviceType.OtaPanelDevice) { device = new OTADevice(); }
|
| | | else { return null; }
|
| | |
|
| | |
| | | mainDevice.IconPath = "Device/Light.png";
|
| | | }
|
| | | mainDevice.DfunctionType = DeviceFunctionType.A灯光;
|
| | | if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A灯光)
|
| | | if (device.DeviceInfo != null && device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A灯光)
|
| | | {
|
| | | //调光器固定灯光
|
| | | if (sendFucType == true)
|
| | |
| | | mainDevice.IconPath = "Device/ColorLightTemperature.png";
|
| | | }
|
| | | mainDevice.DfunctionType = DeviceFunctionType.A灯光;
|
| | | if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A灯光)
|
| | | if (device.DeviceInfo != null && device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A灯光)
|
| | | {
|
| | | //色温灯固定灯光
|
| | | if (sendFucType == true)
|
| | |
| | | if (mainDevice.DfunctionType == DeviceFunctionType.A未定义)
|
| | | {
|
| | | mainDevice.DfunctionType = DeviceFunctionType.A灯光;
|
| | | if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A灯光)
|
| | | if (device.DeviceInfo != null && device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A灯光)
|
| | | {
|
| | | //继电器默认为灯光
|
| | | if (sendFucType == true)
|
| | |
| | | if (mainDevice.DfunctionType == DeviceFunctionType.A未定义)
|
| | | {
|
| | | mainDevice.DfunctionType = DeviceFunctionType.A开关;
|
| | | if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A开关)
|
| | | if (device.DeviceInfo != null && device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A开关)
|
| | | {
|
| | | //空气开关默认为开关
|
| | | if (sendFucType == true)
|
| | |
| | | mainDevice.IconPath = "Device/ColorLight.png";
|
| | | }
|
| | | mainDevice.DfunctionType = DeviceFunctionType.A灯光;
|
| | | if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A灯光)
|
| | | if (device.DeviceInfo != null && device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A灯光)
|
| | | {
|
| | | //彩灯默认为开关
|
| | | if (sendFucType == true)
|