| | |
| | | /// <param name="deleteRoom">是否从房间删除</param>
|
| | | public void DeleteMemmoryDevice(CommonDevice device, bool deleteRoom = true)
|
| | | {
|
| | | //删除缓存设备的话,主页需要重新刷新
|
| | | Phone.UserView.UserPage.Instance.RefreshForm = true;
|
| | |
|
| | | if (deleteRoom == true)
|
| | | {
|
| | | //从房间中删除
|
| | |
| | | info.ConcreteType = DeviceConcreteType.Relay_FangyueFreshAirModul;
|
| | | info.ObjectTypeNameId = 60011;//新风
|
| | | }
|
| | | //15 PM2.5传感器设备
|
| | | else if (dicType.ContainsKey(DeviceType.PMSensor) == true)
|
| | | {
|
| | | info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId1307;
|
| | | info.BeloneType = DeviceBeloneType.A传感器;
|
| | | info.ConcreteType = DeviceConcreteType.Sensor_PMTwoPointFive;
|
| | | info.ObjectTypeNameId = 60000;//传感器
|
| | | }
|
| | |
|
| | | int value = (int)info.BeloneType;
|
| | | if (dicDeviceAllNameID.ContainsKey("uDeviceBelongId" + value) == true)
|
| | |
| | | list.Add(DeviceBeloneType.A未知设备); |
| | | |
| | | return list;
|
| | | }
|
| | |
|
| | | #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 dicDevice = new Dictionary<string, CommonDevice>();
|
| | | foreach (var device in listDevice)
|
| | | {
|
| | | if (dicDevice.ContainsKey(device.DeviceAddr) == false)
|
| | | {
|
| | | dicDevice[device.DeviceAddr] = device;
|
| | | continue;
|
| | | }
|
| | | //设备是否处于在线状态
|
| | | bool online = this.CheckDeviceIsOnline(device);
|
| | | if (online == true)
|
| | | {
|
| | | //如果设备回路在线,则优先使用在线的回路,后来的直接覆盖
|
| | | dicDevice[device.DeviceAddr] = device;
|
| | | }
|
| | | }
|
| | | var listReturn = new List<CommonDevice>();
|
| | | foreach (var device in dicDevice.Values)
|
| | | {
|
| | | listReturn.Add(device);
|
| | | }
|
| | | return listReturn;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | mainDevice.DeviceEpointName = device.DeviceInfo.DeviceName;
|
| | | }
|
| | | mainDevice.CurrentGateWayId = device.CurrentGateWayId;
|
| | | mainDevice.ZigbeeType = device.DeviceInfo.ZigbeeType;
|
| | | mainDevice.IsOnline = device.DeviceInfo.IsOnline;
|
| | | mainDevice.DriveCode = device.DeviceInfo.DriveCode;
|
| | | mainDevice.IasDeviceType = device.DeviceInfo.DeviceType;
|
| | |
| | | else if (deviceType == DeviceType.FreshAir) { device = new FreshAir(); }
|
| | | else if (deviceType == DeviceType.DoorLock) { device = new DoorLock(); }
|
| | | else if (deviceType == DeviceType.TemperatureSensor) { device = new TemperatureSensor(); }
|
| | | else if (deviceType == DeviceType.PMSensor) { device = new PMSensor(); }
|
| | | else if (deviceType == DeviceType.FreshAirHumiditySensor) { device = new HumiditySensor(); }
|
| | | else if (deviceType == DeviceType.OtaDevice || deviceType == DeviceType.OtaPanelDevice) { device = new OTADevice(); }
|
| | | else { return null; }
|