old mode 100644
new mode 100755
| | |
| | | {
|
| | | CommonDevice device = null;
|
| | | //反序列化为指定的类,不然数据会丢失而导致无法强转
|
| | | try |
| | | try |
| | | {
|
| | | device = CommonDevice.CommonDeviceByFilePath(file);
|
| | | }
|
| | |
| | | //添加缓存
|
| | | this.AddDeviceToMemory(ref device);
|
| | |
|
| | | //移除存在的设备内存
|
| | | //移除存在的设备内存 |
| | | string maikey = this.GetDeviceMainKeys(device);
|
| | | if (dicExist.ContainsKey(maikey) == true)
|
| | | {
|
| | |
| | | this.SaveRealDeviceRoomId(null, null);
|
| | | }
|
| | | return true;
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 删除缓存的一般设备
|
| | | /// </summary>
|
| | |
| | | }
|
| | | this.dicOTADevice.Remove(otaKeys);
|
| | | }
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | #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)
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | | return true;
|
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | }
|
| | | #endregion
|
| | |
|
| | |
|
| | |
|
| | | #region ■ 测试设备___________________________
|
| | | |
| | |
|
| | | /// <summary>
|
| | | /// 发送定位指令到设备
|
| | | /// </summary>
|
| | |
| | | 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;
|
| | | }
|
| | |
|
| | |
| | | /// <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)
|
| | | {
|
| | |
| | | else if (dev.Type == DeviceType.FreshAirHumiditySensor)
|
| | | {
|
| | | list.Add(dev);
|
| | | } |
| | | } |
| | | }
|
| | | if (sort == false)
|
| | | {
|
| | | return list;
|
| | | } |
| | | list.Sort((obj1, obj2) => |
| | | }
|
| | | list.Sort((obj1, obj2) =>
|
| | | {
|
| | |
|
| | | if (obj1.DeviceEpoint > obj2.DeviceEpoint)
|
| | |
| | | return 1;
|
| | | }
|
| | | return -1;
|
| | | }); |
| | | }); |
| | | return list;
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | if (device.Type == DeviceType.OnOffOutput
|
| | | || device.Type == DeviceType.DimmableLight |
| | | || device.Type == DeviceType.DimmableLight |
| | | || device.Type == DeviceType.ColorDimmableLight
|
| | | || device.Type == DeviceType.ColorTemperatureLight)
|
| | | {
|
| | |
| | | {
|
| | | //空调都叫室内机
|
| | | return Language.StringByID(R.MyInternationalizationString.uIndoorUnit) + epointNo;
|
| | | } |
| | | |
| | | //获取设备类型 |
| | | } |
| | |
|
| | | //获取设备类型
|
| | | var deviceInfoType = this.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
|
| | | if (device.Type == DeviceType.OnOffSwitch)
|
| | | {
|
| | |
| | | list.Add(DeviceBeloneType.A传感器);
|
| | |
|
| | | //其他的看着办呗,都是排在后面的,都归为这个属性
|
| | | list.Add(DeviceBeloneType.A未知设备); |
| | | |
| | | list.Add(DeviceBeloneType.A未知设备);
|
| | | |
| | | return list;
|
| | | }
|
| | |
|
| | |
| | | var listDevice = this.GetDevicesByMac(i_device.DeviceAddr, false);
|
| | | foreach (var device in listDevice)
|
| | | {
|
| | | //0:离线 1:在线 2:正在刷新状态
|
| | | //0:离线 1:在线 2:正在刷新状态 |
| | | bool statu = i_device.IsOnline == 1 || i_device.IsOnline == 2;
|
| | | if (statu == true)
|
| | | {
|
| | |
| | | {
|
| | | return false;
|
| | | }
|
| | | } |
| | | //2020.03.30追加式样:如果是面板的温度探头,不显示 |
| | | }
|
| | | //2020.03.30追加式样:如果是面板的温度探头,不显示
|
| | | else if (i_device.Type == DeviceType.TemperatureSensor && ((TemperatureSensor)i_device).SensorDiv == 1)
|
| | | {
|
| | | var myInfoType = LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { i_device });
|
| | |
| | | {
|
| | | //新风的湿度传感器不显示
|
| | | 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; |
| | | } |
| | | }
|
| | |
|
| | | //如果是新风面板或环境面板,则都不显示任何回路
|
| | |
| | | this.dicDeviceModelIdEnum["MGCD01/M-ZB.10"] = "1306-1200-60000";//吸顶燃气传感器
|
| | |
|
| | | //PM2.5空气质量传感器 【该设备属于第三方设备,没有镜像ID】
|
| | | this.dicDeviceModelIdEnum["MSPM25/M-ZB.10"] = "1307-1200-60000";//PM2.5空气质量传感器
|
| | | this.dicDeviceModelIdEnum["MSPM25/M-ZB.10"] = "1307-1200-60000";//PM2.5空气质量传感器 |
| | |
|
| | | //=========★★继电器类(2300-2499)★★=========
|
| | | this.dicDeviceModelIdEnum["MPR0310-ZB.10"] = "2300-2300-60001";//3路继电器小模块
|
| | |
| | | /// <summary>
|
| | | /// 方悦新风小模块 镜像id:2310
|
| | | /// </summary>
|
| | | Relay_FangyueFreshAirModul = 2310, |
| | | |
| | | //=========★★调光器类(2500-2799)★★========= |
| | | Relay_FangyueFreshAirModul = 2310,
|
| | | |
| | | //=========★★调光器类(2500-2799)★★=========
|
| | | /// <summary>
|
| | | /// 调光器
|
| | | /// </summary>
|