| | |
| | | }
|
| | |
|
| | | //添加设备的缓存
|
| | | var listDriveDevice = new List<CommonDevice>();
|
| | | for (int i = 0; i < listDevice.Count; i++)
|
| | | {
|
| | | var device = listDevice[i];
|
| | |
| | | }
|
| | | //获取设备的固定属性
|
| | | HdlDeviceFixedAttributeLogic.Current.SetAllFixedAttributeToDevice(device);
|
| | | }
|
| | |
|
| | | for (int i = 0; i < listDevice.Count; i++)
|
| | | {
|
| | | var device = listDevice[i];
|
| | | //对未命名的虚拟设备重新命名
|
| | | if (device.DriveCode > 0 && this.GetSimpleEpointName(device) == string.Empty)
|
| | | {
|
| | | //根据设备类型获取名称
|
| | | var dName = this.GetDeviceObjectText(new List<CommonDevice>() { device }, false);
|
| | | //在端点名字的后面附加【回路】字样
|
| | | dName += "(" + device.DeviceEpoint + Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + ")";
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | this.ReName(device, dName, ShowErrorMode.NO);
|
| | | });
|
| | | listDriveDevice.Add(device);
|
| | | }
|
| | | }
|
| | | if (listDriveDevice.Count > 0)
|
| | | {
|
| | | //如果虚拟设备还没有名字的话
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //如果不这样放在一个线程里,有可能对Dictionary产生影响
|
| | | foreach (var myDevice in listDriveDevice)
|
| | | {
|
| | | //根据设备类型获取名称
|
| | | var dName = this.GetDeviceObjectText(new List<CommonDevice>() { myDevice }, false);
|
| | | //在端点名字的后面附加【回路】字样
|
| | | dName += "(" + myDevice.DeviceEpoint + Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + ")";
|
| | | this.ReName(myDevice, dName, ShowErrorMode.NO);
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | //只有完全获取的时候,才会去处理删除的问题
|
| | |
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | //修改设备名字的话,主页需要重新刷新
|
| | | Phone.UserView.UserPage.Instance.RefreshForm = true;
|
| | | Phone.UserView.UserPage.Instance.RefreshAllForm = true;
|
| | | return true;
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | | //修改设备名字的话,主页需要重新刷新
|
| | | Phone.UserView.UserPage.Instance.RefreshForm = true;
|
| | | Phone.UserView.UserPage.Instance.RefreshAllForm = true;
|
| | | return true;
|
| | | }
|
| | |
|
| | |
| | |
|
| | | //获取编辑设备Mac名字的命令字符
|
| | | var sendData = this.GetReDeviceMacNameCommandText(device.DeviceAddr, device.DeviceEpoint, macName);
|
| | | var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway(device, "MacRename", sendData, "MacRename_Respon");
|
| | | var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway(device, "MacRename", sendData, "MacRename_Respon", 8);
|
| | | if (result.ErrorMsg != null || result.ErrorMsgDiv == 0)
|
| | | {
|
| | | return null;
|
| | |
| | | }
|
| | | //获取编辑设备端点名字的命令字符
|
| | | var sendData = this.GetReDeviceEpointNameCommandText(device.DeviceAddr, device.DeviceEpoint, deviceName);
|
| | | var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway(device, "DeviceRename", sendData, "DeviceRenameRespon");
|
| | | var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway(device, "DeviceRename", sendData, "DeviceRenameRespon", 8);
|
| | | if (result.ErrorMsg != null || result.ErrorMsgDiv == 0)
|
| | | {
|
| | | return null;
|
| | |
| | | public void DeleteMemmoryDevice(CommonDevice device, bool deleteRoom = true)
|
| | | {
|
| | | //删除缓存设备的话,主页需要重新刷新
|
| | | Phone.UserView.UserPage.Instance.RefreshForm = true;
|
| | | Phone.UserView.UserPage.Instance.RefreshAllForm = true;
|
| | |
|
| | | if (deleteRoom == true)
|
| | | {
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 同步设备___________________________
|
| | | /// <summary>
|
| | | /// 同步设备并且刷新缓存(同步失败时,会显示信息)
|
| | | /// </summary>
|
| | | /// <param name="litdevice">设备对象(MAC地址必须要相同)</param>
|
| | | public async Task<bool> SynchronizationDevice(List<CommonDevice> listdevice)
|
| | | {
|
| | | //虚拟住宅的话,不需要删除网关的设备
|
| | | if (Config.Instance.Home.IsVirtually == false)
|
| | | {
|
| | | //同步
|
| | | var result = await listdevice[0].SyncMsgToBindSource(listdevice[0].DeviceAddr, listdevice[0].DeviceEpoint);
|
| | | if (result == null || result.result != 0)
|
| | | {
|
| | | //同步删除失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.SynchronizationFailed);
|
| | | //拼接上【网关回复超时】的Msg
|
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
|
| | |
|
| | | this.ShowErrorMsg(msg);
|
| | | return false;
|
| | | }
|
| | | }
|
| | | return true;
|
| | | }
|
| | | #endregion
|
| | |
|
| | |
|
| | |
|
| | | #region ■ 测试设备___________________________
|
| | |
|
| | | /// <summary>
|
| | |
| | | //传感器除了Pir都没有定位功能
|
| | | return true;
|
| | | }
|
| | | else if (myTypeInfo.ConcreteType == DeviceConcreteType.Sensor_SphericalMotion)
|
| | | {
|
| | | //球型移动传感器虽然是电池设备,但是它有定位功能
|
| | | return true;
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | return true;
|
| | | }
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 检测设备是否拥有一键同步功能
|
| | | /// </summary>
|
| | | /// <param name="device"></param>
|
| | | /// <returns></returns>
|
| | | public bool DeviceIsCanSynchronization(CommonDevice device)
|
| | | {
|
| | | //获取设备类型的
|
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
|
| | | if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction)
|
| | | {
|
| | | return true;
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
| | | public List<CommonDevice> GetMutilfunctionPanelByMac(List<CommonDevice> listDevice, bool sort = true)
|
| | | {
|
| | | //和彪哥、设备和产品部同事确认:
|
| | | //简约多功能面板[不显示多余的回路,只显示携带的2个继电器和1个温湿度传感器
|
| | | //简约多功能面板[不显示多余的回路,只显示携带的2个继电器,1个温度传感器,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.FreshAirHumiditySensor)
|
| | | {
|
| | | if (dev.DeviceEpoint == 65)
|
| | | {
|
| | | list.Add(dev);
|
| | | }
|
| | |
| | | return -1;
|
| | | });
|
| | |
|
| | | return list;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 根据MAC地址,获取新风、简约环境面板全部回路的设备对象
|
| | | /// </summary>
|
| | | /// <param name="listDevice"></param>
|
| | | /// <returns></returns>
|
| | | public List<CommonDevice> GetPanelMatchEpointByMac(List<CommonDevice> listDevice, bool sort = true)
|
| | | { |
| | | var list = new List<CommonDevice>();
|
| | | foreach (var dev in listDevice)
|
| | | {
|
| | | if (dev.Type == DeviceType.TemperatureSensor)
|
| | | {
|
| | | list.Add(dev);
|
| | | }
|
| | | else if (dev.Type == DeviceType.FreshAirHumiditySensor)
|
| | | {
|
| | | list.Add(dev);
|
| | | } |
| | | }
|
| | | if (sort == false)
|
| | | {
|
| | | return list;
|
| | | }
|
| | | list.Sort((obj1, obj2) =>
|
| | | {
|
| | |
|
| | | if (obj1.DeviceEpoint > obj2.DeviceEpoint)
|
| | | {
|
| | | return 1;
|
| | | }
|
| | | return -1;
|
| | | }); |
| | | return list;
|
| | | }
|
| | |
|
| | |
| | | public List<string> GetAllDeviceFile()
|
| | | {
|
| | | List<string> listDeviceFile = new List<string>();
|
| | | List<string> listAllFile = Global.FileListByHomeId(); |
| | | List<string> listAllFile = HdlFileLogic.Current.GetRootPathListFile(); |
| | | |
| | | foreach (string file in listAllFile)
|
| | | {
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 获取设备信息_______________________
|
| | |
|
| | | /// <summary>
|
| | | /// 读取单个端点回路设备信息
|
| | | /// </summary>
|
| | | /// <param name="device">设备对象</param>
|
| | | /// <returns></returns>
|
| | | public CommonDevice.DeviceInfoData ReadDeviceEpointDeviceInfo(CommonDevice device)
|
| | | {
|
| | | var jObject = new Newtonsoft.Json.Linq.JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", device.DeviceEpoint }, { "Cluster_ID", 0 }, { "Command", 80 } };
|
| | | var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway(device, "GetStatusRecord", jObject.ToString(), "GetStatusRecord_Respon");
|
| | | if (result.ErrorMsg != null || result.ErrorMsgDiv == 0)
|
| | | {
|
| | | return null;
|
| | | }
|
| | | var info = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.DeviceInfoData>(result.ReceiptData);
|
| | | return info;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 设置设备功能类型___________________
|
| | |
|
| | | /// <summary>
|
| | | /// 设置设备功能类型到网关
|
| | | /// </summary>
|
| | | /// <param name="device">设备回路</param>
|
| | | /// <param name="functionType">功能类型</param>
|
| | | /// <returns></returns>
|
| | | public bool SendDeviceFunctionTypeToGateway(CommonDevice device, DeviceFunctionType functionType)
|
| | | {
|
| | | var jObject = new Newtonsoft.Json.Linq.JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", device.DeviceEpoint }, { "Cluster_ID", 0 }, { "Command", 110 } };
|
| | | var data = new Newtonsoft.Json.Linq.JObject { { "FunctionType", (int)functionType } };
|
| | | jObject.Add("Data", data);
|
| | | var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway(device, "Device/SetEPDeviceFunctionType", jObject.ToString(), "Device/SetEPDeviceFunctionTypeRespon");
|
| | | if (result.ErrorMsg != null || result.ErrorMsgDiv == 0)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | var resultData = Newtonsoft.Json.Linq.JObject.Parse(result.ReceiptData);
|
| | | if (resultData.Property("Result") != null)
|
| | | {
|
| | | //0:修改成功 1:修改失败
|
| | | return resultData["Result"].ToString() == "0";
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 获取设备名称_______________________
|
| | |
|
| | | /// <summary>
|
| | |
| | | {
|
| | | //空调都叫室内机
|
| | | return Language.StringByID(R.MyInternationalizationString.uIndoorUnit) + epointNo;
|
| | | }
|
| | | else if (device.Type == DeviceType.FreshAir)
|
| | | {
|
| | | //新风面板中的按键叫新风
|
| | | return Language.StringByID(R.MyInternationalizationString.FreshAir);
|
| | | }
|
| | | else if (device.Type == DeviceType.FreshAirHumiditySensor)
|
| | | {
|
| | | //新风面板湿度传感器
|
| | | return Language.StringByID(R.MyInternationalizationString.HumiditySensor);
|
| | | }
|
| | | } |
| | |
|
| | | //获取设备类型
|
| | | var deviceInfoType = this.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
|
| | |
| | | return Language.StringByID(R.MyInternationalizationString.uDeviceBelongId16) + epointNo;
|
| | | }
|
| | | }
|
| | | else if (device.Type == DeviceType.FreshAirHumiditySensor)
|
| | | {
|
| | | //新风面板/简约多功能/简约环境面板湿度传感器
|
| | | return Language.StringByID(deviceInfoType.DefultNameId) + Language.StringByID(R.MyInternationalizationString.HumiditySensor);
|
| | | }
|
| | | else if (device.Type == DeviceType.TemperatureSensor)
|
| | | {
|
| | | if (deviceInfoType.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir)
|
| | | if (deviceInfoType.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir
|
| | | || deviceInfoType.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleEnvironment
|
| | | || deviceInfoType.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction)
|
| | | {
|
| | | //新风面板中的Thermostat为温度传感器
|
| | | return Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
|
| | | //新风面板/简约多功能/简约环境面板 温度传感器
|
| | | return Language.StringByID(deviceInfoType.DefultNameId) + Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
|
| | | }
|
| | | else if (deviceInfoType.BeloneType == DeviceBeloneType.A按键面板)
|
| | | {
|
| | |
| | | info.ConcreteType = DeviceConcreteType.Sensor_DoorWindow;
|
| | | info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId1301;
|
| | | }
|
| | | else if (iasZone.IasDeviceType == 541)
|
| | | {
|
| | | //球型移动传感器
|
| | | info.ConcreteType = DeviceConcreteType.Sensor_SphericalMotion;
|
| | | info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId1205;
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | private void InitRealDeviceRoomId()
|
| | | {
|
| | | this.dicDeviceRoomId = new Dictionary<string, string>();
|
| | | string fullName = UserCenterLogic.CombinePath(DirNameResourse.DeviceRoomIdFile);
|
| | | var strData = UserCenterLogic.LoadFileContent(fullName);
|
| | | string fullName = DirNameResourse.DeviceRoomIdFile;
|
| | | var strData = HdlFileLogic.Current.ReadFileTextContent(fullName);
|
| | | if (strData != null)
|
| | | {
|
| | | this.dicDeviceRoomId = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(strData);
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 获取全部物理设备所属房间的记录
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | public Dictionary<string, string> GetAllRealDeviceRoomData()
|
| | | {
|
| | | return this.dicDeviceRoomId;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | if (save == true)
|
| | | {
|
| | | //保存记录
|
| | | string fullName = UserCenterLogic.CombinePath(DirNameResourse.DeviceRoomIdFile);
|
| | | UserCenterLogic.SaveFileContent(fullName, this.dicDeviceRoomId);
|
| | | HdlFileLogic.Current.SaveFileContent(DirNameResourse.DeviceRoomIdFile, this.dicDeviceRoomId);
|
| | |
|
| | | //添加自动备份
|
| | | HdlAutoBackupLogic.AddOrEditorFile(DirNameResourse.DeviceRoomIdFile);
|
| | |
| | | return Language.StringByID(R.MyInternationalizationString.uDeviceNotAssignedRoom);
|
| | | }
|
| | | var room = HdlRoomLogic.Current.GetRoomById(this.dicDeviceRoomId[device.DeviceAddr]);
|
| | | return HdlRoomLogic.Current.GetFloorRoomName(room);
|
| | | return HdlRoomLogic.Current.GetRoomName(room);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | return;
|
| | | }
|
| | | //保存记录
|
| | | string fullName = UserCenterLogic.CombinePath(DirNameResourse.DeviceRoomIdFile);
|
| | | UserCenterLogic.SaveFileContent(fullName, this.dicDeviceRoomId);
|
| | | HdlFileLogic.Current.SaveFileContent(DirNameResourse.DeviceRoomIdFile, this.dicDeviceRoomId);
|
| | |
|
| | | //添加自动备份
|
| | | HdlAutoBackupLogic.AddOrEditorFile(DirNameResourse.DeviceRoomIdFile);
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 获取设备在线状态列表_______________
|
| | |
|
| | | /// <summary>
|
| | | /// 获取设备在线状态列表(注意,一个设备只返回一个回路)
|
| | | /// </summary>
|
| | | /// <param name="gwId">网关id</param>
|
| | | /// <returns></returns>
|
| | | public List<CommonDevice> GetDeviceOnlineList(string gwId)
|
| | | {
|
| | | var zbway = HdlGatewayLogic.Current.GetLocalGateway(gwId);
|
| | | int statu = 0;
|
| | | var listDevice = this.GetDeviceListFromGateway(zbway, ref statu, false, ShowErrorMode.NO);
|
| | | if (statu == -1)
|
| | | {
|
| | | //当出现异常时,使用后备操作,直接获取本地的设备列表
|
| | | listDevice = this.GetDeviceByGatewayID(gwId);
|
| | | }
|
| | |
|
| | | var listCheck = new HashSet<string>();
|
| | | var listReturn = new List<CommonDevice>();
|
| | | foreach (var device in listDevice)
|
| | | {
|
| | | if (listCheck.Contains(device.DeviceAddr) == false)
|
| | | {
|
| | | listCheck.Add(device.DeviceAddr);
|
| | | listReturn.Add(device);
|
| | | }
|
| | | }
|
| | | return listReturn;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 一般方法___________________________
|
| | |
|
| | | /// <summary>
|
| | |
| | | return false;
|
| | | }
|
| | | }
|
| | | //如果是新风面板的新风设备,则不显示
|
| | | else if (i_device.Type == DeviceType.FreshAir)
|
| | | {
|
| | | var myInfoType = LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { i_device });
|
| | | if (myInfoType.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | }
|
| | | //2020.03.30追加式样:如果是面板的温度探头,不显示
|
| | | else if (i_device.Type == DeviceType.TemperatureSensor && ((TemperatureSensor)i_device).SensorDiv == 1)
|
| | | {
|
| | |
| | | {
|
| | | //新风的湿度传感器不显示
|
| | | return false;
|
| | | }
|
| | |
|
| | | //如果是新风面板或环境面板,则都不显示任何回路
|
| | | var myInfoTypeTemp = LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { i_device });
|
| | | if (myInfoTypeTemp.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir || myInfoTypeTemp.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleEnvironment)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | else if (myInfoTypeTemp.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction)
|
| | | {
|
| | | if (i_device.Type != DeviceType.OnOffOutput)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | }
|
| | | return true;
|
| | | }
|
| | |
| | | mainDevice.ModelIdentifier = device.DeviceInfo.ModelIdentifier;
|
| | | //序列号
|
| | | mainDevice.SerialNumber = device.DeviceInfo.ProductCode;
|
| | | //设备功能类型
|
| | | mainDevice.DfunctionType = (DeviceFunctionType)device.DeviceInfo.FunctionType;
|
| | |
|
| | | mainDevice.InClusterList.Clear();
|
| | | mainDevice.InClusterList.AddRange(device.DeviceInfo.InClusterList);
|
| | |
| | | else if (mainDevice.Type == DeviceType.DimmableLight)
|
| | | {
|
| | | mainDevice.DfunctionType = DeviceFunctionType.A灯光;
|
| | | if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A灯光)
|
| | | {
|
| | | //调光器固定灯光
|
| | | this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A灯光);
|
| | | }
|
| | | if (mainDevice.IsCustomizeImage == false)
|
| | | {
|
| | | mainDevice.IconPath = "Device/Light.png";
|
| | |
| | | else if (mainDevice.Type == DeviceType.ColorTemperatureLight)
|
| | | {
|
| | | mainDevice.DfunctionType = DeviceFunctionType.A灯光;
|
| | | if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A灯光)
|
| | | {
|
| | | //色温灯固定灯光
|
| | | this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A灯光);
|
| | | }
|
| | | if (mainDevice.IsCustomizeImage == false)
|
| | | {
|
| | | mainDevice.IconPath = "Device/ColorLightTemperature.png";
|
| | |
| | | else if (mainDevice.Type == DeviceType.OnOffOutput)
|
| | | {
|
| | | //2020.05.13变更:继电器都默认为灯光
|
| | | //var myType = this.GetHdlMyDeviceEnumInfo(mainDevice);
|
| | | //if (myType != null && myType.ConcreteType == DeviceConcreteType.Relay_ThreeLoad)
|
| | | if (mainDevice.DfunctionType == DeviceFunctionType.A未定义)
|
| | | {
|
| | | if (mainDevice.DfunctionType == DeviceFunctionType.A未定义)
|
| | | mainDevice.DfunctionType = DeviceFunctionType.A灯光;
|
| | | if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A灯光)
|
| | | {
|
| | | mainDevice.DfunctionType = DeviceFunctionType.A灯光;
|
| | | }
|
| | | if (mainDevice.IsCustomizeImage == false)
|
| | | {
|
| | | mainDevice.IconPath = "Device/Light.png";
|
| | | //继电器默认为灯光
|
| | | this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A灯光);
|
| | | }
|
| | | }
|
| | | //根据功能类型,重新设置设备回路图标
|
| | | this.ResetIconPathByDeviceFunctionType(mainDevice);
|
| | | }
|
| | | //如果是空气开关的话
|
| | | else if (mainDevice.Type == DeviceType.AirSwitch)
|
| | |
| | | if (mainDevice.DfunctionType == DeviceFunctionType.A未定义)
|
| | | {
|
| | | mainDevice.DfunctionType = DeviceFunctionType.A开关;
|
| | | if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A开关)
|
| | | {
|
| | | //空气开关默认为开关
|
| | | this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A开关);
|
| | | }
|
| | | }
|
| | | if (mainDevice.IsCustomizeImage == false)
|
| | | {
|
| | | mainDevice.IconPath = "Device/Switch.png";
|
| | | }
|
| | | //根据功能类型,重新设置设备回路图标
|
| | | this.ResetIconPathByDeviceFunctionType(mainDevice);
|
| | | }
|
| | | //如果是彩灯的话
|
| | | else if (mainDevice.Type == DeviceType.ColorDimmableLight)
|
| | | {
|
| | | mainDevice.DfunctionType = DeviceFunctionType.A灯光;
|
| | | if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A灯光)
|
| | | {
|
| | | //彩灯默认为开关
|
| | | this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A灯光);
|
| | | }
|
| | | if (mainDevice.IsCustomizeImage == false)
|
| | | {
|
| | | mainDevice.IconPath = "Device/ColorLight.png";
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 根据功能类型,重新设置设备回路图标
|
| | | /// </summary>
|
| | | /// <param name="device"></param>
|
| | | private void ResetIconPathByDeviceFunctionType(CommonDevice device)
|
| | | {
|
| | | if (device.IsCustomizeImage == true)
|
| | | {
|
| | | return;
|
| | | }
|
| | | if (device.DfunctionType == DeviceFunctionType.A开关)
|
| | | {
|
| | | device.IconPath = "Device/Switch.png";
|
| | | }
|
| | | else if (device.DfunctionType == DeviceFunctionType.A插座)
|
| | | {
|
| | | device.IconPath = "Device/Socket1.png";
|
| | | }
|
| | | else
|
| | | {
|
| | | device.IconPath = "Device/Light.png";
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | //根据设备类型创建设备对象的实例
|
| | | if (deviceType == DeviceType.ColorDimmableLight) { device = new ColorDimmableLight(); }
|
| | | else if (deviceType == DeviceType.DimmableLight) { device = new DimmableLight(); }
|
| | | else if (deviceType == DeviceType.ColorDimmerSwitch) { device = new ColorDimmerSwitch(); }
|
| | | else if (deviceType == DeviceType.LevelControlSwitch) { device = new LevelControlSwitch(); }
|
| | | else if (deviceType == DeviceType.OnOffSwitch) { device = new Panel(); }
|
| | | else if (deviceType == DeviceType.OnOffOutput) { device = new ToggleLight(); }
|
| | | else if (deviceType == DeviceType.AirSwitch) { device = new AirSwitch(); }
|
| | | else if (deviceType == DeviceType.WindowCoveringDevice) { device = new Rollershade(); }
|
| | | else if (deviceType == DeviceType.WindowCoveringController) { device = new WindowCoveringController(); }
|
| | | else if (deviceType == DeviceType.IASZone) { device = new IASZone(); }
|
| | | else if (deviceType == DeviceType.Repeater) { device = new Repeater(); }
|
| | | else if (deviceType == DeviceType.Thermostat) { device = new AC(); }
|
| | |
| | |
|
| | | //=========★★PIR传感器类(1200-1299)★★=========
|
| | | this.dicDeviceModelIdEnum["MSPIR01-ZB.10"] = "1200-1200-60000";//pir传感器220
|
| | | this.dicDeviceModelIdEnum["MSPIRB-ZB.10"] = "1205-1200-60000";//球型移动传感器
|
| | |
|
| | | //=========★★安防类传感器类(1300-2299)★★=========
|
| | | //这里是麦乐克的
|
| | |
| | | /// pir传感器220 镜像id:1200
|
| | | /// </summary>
|
| | | Sensor_Pir = 1200,
|
| | | /// <summary>
|
| | | /// 球形移动传感器 镜像id:1205
|
| | | /// </summary>
|
| | | Sensor_SphericalMotion = 1205,
|
| | |
|
| | | //=========★★安防类传感器类(1300-2299)★★=========
|
| | | /// <summary>
|