| | |
| | | } |
| | | //备份数据 |
| | | await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(device, GatewayBackupEnum.AMac名称, newMacName); |
| | | //如果它只有一个回路,则更改端点名字 |
| | | if (this.dicDeviceEpoint.ContainsKey(device.DeviceAddr) == true && this.dicDeviceEpoint[device.DeviceAddr].Count == 1) |
| | | { |
| | | return await this.ReName(device, newMacName); |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | |
| | | return -1; |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据MAC地址,获取全部回路的数量 |
| | | /// </summary> |
| | | /// <param name="DeviceAddr">Mac地址</param> |
| | | /// <returns></returns> |
| | | public int GetDevicesCountByMac(string DeviceAddr) |
| | | { |
| | | if (dicDeviceEpoint.ContainsKey(DeviceAddr) == false) |
| | | { |
| | | return 0; |
| | | } |
| | | return dicDeviceEpoint[DeviceAddr].Count; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="roomId">需要保存的哪个设备的房间ID</param> |
| | | public void SaveRealDeviceRoomId(List<CommonDevice> listDevice, string roomId) |
| | | { |
| | | this.dicDeviceRoomId[listDevice[0].DeviceAddr] = roomId; |
| | | if (listDevice != null) |
| | | { |
| | | this.dicDeviceRoomId[listDevice[0].DeviceAddr] = roomId; |
| | | } |
| | | |
| | | //保存记录 |
| | | string fullName = UserCenterLogic.CombinePath(DirNameResourse.DeviceRoomIdFile); |
| | | UserCenterLogic.SaveFileContent(fullName, this.dicDeviceRoomId); |
| | | |
| | | //如果设备只有一个回路,如果改变了真实设备区域,则它的回路的区域也一起改了 |
| | | if (listDevice.Count == 1) |
| | | if (listDevice != null && listDevice.Count == 1) |
| | | { |
| | | Common.Room.CurrentRoom.ChangedRoom(listDevice[0], roomId); |
| | | } |