| | |
| | | listDriveDevice.Add(device);
|
| | | }
|
| | | }
|
| | | //设置虚拟设备的默认名字
|
| | | this.SetDriveDeviceDefultName(listDriveDevice);
|
| | | 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 (statu != 1)
|
| | |
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 设置虚拟设备的默认名字
|
| | | /// </summary>
|
| | | /// <param name="listDriveDevice">虚拟设备列表</param>
|
| | | private void SetDriveDeviceDefultName(List<CommonDevice> listDriveDevice)
|
| | | {
|
| | | if (listDriveDevice.Count == 0)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //如果虚拟设备还没有名字的话
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //如果不这样放在一个线程里,有可能对Dictionary产生影响
|
| | | foreach (var myDevice in listDriveDevice)
|
| | | {
|
| | | string dName = string.Empty;
|
| | | if (this.IsMiniLight(myDevice) == true)
|
| | | {
|
| | | //Mini夜灯
|
| | | dName = Language.StringByID(R.MyInternationalizationString.uMiniNightLight);
|
| | | }
|
| | | else
|
| | | {
|
| | | //根据设备类型获取名称
|
| | | dName = this.GetDeviceObjectText(new List<CommonDevice>() { myDevice }, false);
|
| | | //在端点名字的后面附加【回路】字样
|
| | | dName += "(" + myDevice.DeviceEpoint + Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + ")";
|
| | | }
|
| | | this.ReName(myDevice, dName, ShowErrorMode.NO);
|
| | |
|
| | | System.Threading.Thread.Sleep(100);
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | ///<summary >
|
| | | /// 修改设备mac名称
|
| | | /// <para>macName:设备名称</para>
|
| | | /// </summary>
|
| | |
| | | //如果当前是虚拟住宅
|
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | return Phone.TemplateData.TemplateDeviceDataLogic.Current.ReDeviceMacName(device, macName);
|
| | | return Phone.ModelData.DeviceModelDataLogic.Current.ReDeviceMacName(device, macName, "MacRename");
|
| | | }
|
| | |
|
| | | //获取编辑设备Mac名字的命令字符
|
| | |
| | | return null;
|
| | | }
|
| | | //加缓存
|
| | | Phone.TemplateData.TemplateDeviceDataLogic.Current.ReDeviceMacName(device, macName);
|
| | | Phone.ModelData.DeviceModelDataLogic.Current.ReDeviceMacName(device, macName, "MacRename");
|
| | |
|
| | | var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.RenameDeviceMacNameData>(result.ReceiptData);
|
| | | return new CommonDevice.RenameDeviceMacNameAllData { renameDeviceMacNameData = tempData };
|
| | |
| | | //如果当前是虚拟住宅
|
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | return Phone.TemplateData.TemplateDeviceDataLogic.Current.ReDeviceEpointName(device, deviceName);
|
| | | return Phone.ModelData.DeviceModelDataLogic.Current.ReDeviceEpointName(device, deviceName, "DeviceRename");
|
| | | }
|
| | | //获取编辑设备端点名字的命令字符
|
| | | var sendData = this.GetReDeviceEpointNameCommandText(device.DeviceAddr, device.DeviceEpoint, deviceName);
|
| | |
| | | return null;
|
| | | }
|
| | | //加缓存
|
| | | Phone.TemplateData.TemplateDeviceDataLogic.Current.ReDeviceEpointName(device, deviceName);
|
| | | Phone.ModelData.DeviceModelDataLogic.Current.ReDeviceEpointName(device, deviceName, "DeviceRename");
|
| | |
|
| | | var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.DeviceRenameResponseData>(result.ReceiptData);
|
| | | return new CommonDevice.DeviceRenameAllData { deviceRenameData = tempData };
|
| | |
| | | //门锁没有定位功能
|
| | | return false;
|
| | | }
|
| | | var myTypeInfo = this.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
|
| | | if (device.Type == DeviceType.IASZone)
|
| | | {
|
| | | var myTypeInfo = this.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
|
| | | if (myTypeInfo.ConcreteType == DeviceConcreteType.Sensor_Pir)
|
| | | {
|
| | | //传感器除了Pir都没有定位功能
|
| | |
| | | //球型移动传感器虽然是电池设备,但是它有定位功能
|
| | | return true;
|
| | | }
|
| | | return false;
|
| | | }
|
| | | //温湿度传感器没有定位功能
|
| | | if (myTypeInfo.ConcreteType == DeviceConcreteType.Sensor_TemperatureHumidity)
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | |
| | | //面板的温度探头叫 面板名字+温度
|
| | | return deviceInfoType.DeviceDefultName + Language.StringByID(R.MyInternationalizationString.uTemperature);
|
| | | }
|
| | | else if (((TemperatureSensor)device).SensorDiv == 1)
|
| | | {
|
| | | //温度传感器
|
| | | return Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
|
| | | }
|
| | | else if (((TemperatureSensor)device).SensorDiv == 2)
|
| | | {
|
| | | //湿度传感器
|
| | | return Language.StringByID(R.MyInternationalizationString.HumiditySensor);
|
| | | }
|
| | | }
|
| | | //其他情况,使用它的默认名称
|
| | | return deviceInfoType.DeviceDefultName + epointNo;
|
| | |
| | | /// <param name="device">设备对象</param>
|
| | | /// <param name="macName">Mac名字</param>
|
| | | /// <returns></returns>
|
| | | public void SetMacName(CommonDevice device, string macName)
|
| | | private void SetMacName(CommonDevice device, string macName)
|
| | | {
|
| | | device.DeviceName = macName;
|
| | | }
|
| | |
| | | /// <param name="device">设备对象</param>
|
| | | /// <param name="epointName">端点名字</param>
|
| | | /// <returns></returns>
|
| | | public void SetEpointName(CommonDevice device, string epointName)
|
| | | private void SetEpointName(CommonDevice device, string epointName)
|
| | | {
|
| | | device.DeviceEpointName = epointName;
|
| | | }
|
| | |
| | | info.ObjectTypeName = this.dicDeviceModelIdEnum["A418"].A类型名字;//调光模块
|
| | | }
|
| | | else if (info.BeloneType == DeviceBeloneType.A传感器
|
| | | || device.Type == DeviceType.TemperatureSensor
|
| | | || device.Type == DeviceType.FreshAirHumiditySensor)
|
| | | || device.Type == DeviceType.TemperatureSensor)
|
| | | {
|
| | | //传感器合并
|
| | | info.ConcreteType = DeviceConcreteType.Sensor;
|
| | |
| | | //门窗传感器
|
| | | info.ConcreteType = DeviceConcreteType.Sensor_DoorWindow;
|
| | | info.ConcreteText = Language.StringByID(R.MyInternationalizationString.uSensorDoorWindow);
|
| | | }
|
| | | else if (iasZone.IasDeviceType == 541)
|
| | | {
|
| | | //球型移动传感器
|
| | | info.ConcreteType = DeviceConcreteType.Sensor_SphericalMotion;
|
| | | info.ConcreteText = this.dicDeviceModelIdEnum["MSPIRB-ZB.10"].A官方名字;
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | listCheck.Add(mainkeys);
|
| | | //刷新一下本地缓存
|
| | | var localDevice = this.GetDevice(mainkeys);
|
| | | var tempDevice = localDevice == null ? device : localDevice;
|
| | |
|
| | | if (localDevice != null)
|
| | | {
|
| | | //刷新属性
|
| | | this.SetDeviceInfoToMain(tempDevice, device);
|
| | | if (this.RefreshDeviceFunctionType(tempDevice, device, false) == true)
|
| | | this.SetDeviceInfoToMain(localDevice, device);
|
| | | if (this.RefreshDeviceFunctionType(localDevice, device, false) == true)
|
| | | {
|
| | | //需要发送功能类型给网关
|
| | | listFucDevice.Add(tempDevice);
|
| | | listFucDevice.Add(localDevice);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | /// <param name="device">设置源设备对象</param>
|
| | | public void SetDeviceInfoToMain(CommonDevice mainDevice, CommonDevice device)
|
| | | {
|
| | | if (string.IsNullOrEmpty(device.DeviceInfo.MacName) == false)
|
| | | {
|
| | | mainDevice.DeviceName = device.DeviceInfo.MacName;
|
| | | }
|
| | | if (string.IsNullOrEmpty(device.DeviceInfo.DeviceName) == false)
|
| | | {
|
| | | mainDevice.DeviceEpointName = device.DeviceInfo.DeviceName;
|
| | | }
|
| | | mainDevice.CurrentGateWayId = device.CurrentGateWayId;
|
| | | mainDevice.ZigbeeType = device.DeviceInfo.ZigbeeType;
|
| | | mainDevice.IsOnline = device.DeviceInfo.IsOnline;
|
| | |
| | | /// PM2.5空气质量传感器
|
| | | /// </summary>
|
| | | Sensor_PMTwoPointFive = 1307,
|
| | | /// <summary>
|
| | | /// 温湿度传感器(这个单词拼错了,但是错了就错了呗,就这样了)
|
| | | /// </summary>
|
| | | Sensor_TemperatureHumidity = 1308,
|
| | |
|
| | | /// <summary>
|
| | | /// 运动传感器
|
| | |
| | | /// </summary>
|
| | | Sensor_Keyfob = -1307,
|
| | | /// <summary>
|
| | | /// 温度传感器(这个单词拼错了,但是错了就错了呗,就这样了)
|
| | | /// 温湿度传感器
|
| | | /// </summary>
|
| | | Sensor_TemperatureHumidity = -1308,
|
| | | /// <summary>
|
| | | /// 温度传感器
|
| | | /// </summary>
|
| | | Sensor_Temperature = -1309,
|
| | | /// <summary>
|