黄学彪
2020-07-06 f23ad1b3f9f6193f35f72104d690b21dc67d5c1f
ZigbeeApp/Shared/Common/Device.cs
@@ -551,7 +551,7 @@
            //获取编辑设备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;
@@ -578,7 +578,7 @@
            }
            //获取编辑设备端点名字的命令字符
            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;
@@ -2161,6 +2161,12 @@
                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
@@ -2400,39 +2406,6 @@
            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 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
@@ -2862,6 +2835,8 @@
            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);
@@ -2888,6 +2863,11 @@
            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";
@@ -2897,6 +2877,11 @@
            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";
@@ -2912,6 +2897,11 @@
                    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)
                    {
@@ -2926,6 +2916,11 @@
                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)
                {
@@ -2936,6 +2931,11 @@
            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";
@@ -3060,6 +3060,7 @@
            //=========★★PIR传感器类(1200-1299)★★=========
            this.dicDeviceModelIdEnum["MSPIR01-ZB.10"] = "1200-1200-60000";//pir传感器220
            this.dicDeviceModelIdEnum["MSPIRB-ZB.10"] = "1205-1200-60000";//球型移动传感器
            //=========★★安防类传感器类(1300-2299)★★=========
            //这里是麦乐克的
@@ -3249,6 +3250,10 @@
        /// pir传感器220 镜像id:1200
        /// </summary>
        Sensor_Pir = 1200,
        /// <summary>
        /// 球形移动传感器 镜像id:1205
        /// </summary>
        Sensor_SphericalMotion = 1205,
        //=========★★安防类传感器类(1300-2299)★★=========
        /// <summary>