예제 #1
0
 /// <summary>
 /// 环境事件 显示和存储
 /// </summary>
 public void NewEventRecord(EventType eventType, string area, DeviceRunModel runModel, string strContent)
 {
     commonCls.NewEnvirEventRecord(eventType, area, runModel, strContent);
     if (NewEventShowEvent != null)
     {
         NewEventShowEvent(new NewEventEventArgs(eventType, area, strContent, "", "", DateTime.Now));
     }
 }
예제 #2
0
        ///// <summary>
        ///// 新告警显示 事件
        ///// </summary>
        //public event NewEventShowEventHandler NewAlarmShowEvent;

        #endregion

        /// <summary>
        /// 空调控制 及SQL 存储
        /// </summary>
        public bool AirControl(AirFactoryType factory, byte btAddr, EventContent content, byte btSetTemp, string strArea, DeviceRunModel runMode, bool blMoreAir, IsWait isWait)
        {
            bool   blRet      = false;
            string strContent = content.ToString();

            #region  大金 空调控制

            if (factory == AirFactoryType.大金)
            {
                if (content == EventContent.开启 || content == EventContent.关闭)
                {
                    if (content == EventContent.开启)
                    {
                        blRet = DjAirControl(btAddr, DjControlType.开关, (byte)DjOnOff.开启, isWait);
                    }
                    else if (content == EventContent.关闭)
                    {
                        blRet = DjAirControl(btAddr, DjControlType.开关, (byte)DjOnOff.关闭, isWait);
                    }
                }
                else if (content == EventContent.设置制冷 || content == EventContent.设置制热 || content == EventContent.设置除湿)
                {
                    if (content == EventContent.设置制冷)
                    {
                        blRet = DjAirControl(btAddr, DjControlType.模式, (byte)DjModel.制冷, isWait);
                    }
                    else if (content == EventContent.设置制热)
                    {
                        blRet = DjAirControl(btAddr, DjControlType.模式, (byte)DjModel.制热, isWait);
                    }
                    else if (content == EventContent.设置除湿)
                    {
                    }
                }
                else if (content == EventContent.设置温度)
                {
                    blRet      = DjAirControl(btAddr, DjControlType.温度, btSetTemp, isWait);
                    strContent = content.ToString() + btSetTemp.ToString();
                }
            }

            #endregion

            #region  其他 空调控制

            else if (factory == AirFactoryType.其他)
            {
                if (content == EventContent.开启 || content == EventContent.关闭)
                {
                    if (content == EventContent.开启)
                    {
                        blRet = OtherAirControl(btAddr, OtherAirControlType.开关, (byte)OtherAirOnOff.开启, isWait);
                    }
                    else if (content == EventContent.关闭)
                    {
                        blRet = OtherAirControl(btAddr, OtherAirControlType.开关, (byte)OtherAirOnOff.关闭, isWait);
                    }
                }
                else if (content == EventContent.设置制冷 || content == EventContent.设置制热 || content == EventContent.设置除湿)
                {
                    if (content == EventContent.设置制冷)
                    {
                        blRet = OtherAirControl(btAddr, OtherAirControlType.模式, (byte)OtherAirModelType.制冷, isWait);
                    }
                    else if (content == EventContent.设置制热)
                    {
                        blRet = OtherAirControl(btAddr, OtherAirControlType.模式, (byte)OtherAirModelType.制热, isWait);
                    }
                    else if (content == EventContent.设置除湿)
                    {
                    }
                }
                else if (content == EventContent.设置温度)
                {
                    blRet      = OtherAirControl(btAddr, OtherAirControlType.温度, btSetTemp, isWait);
                    strContent = content.ToString() + btSetTemp.ToString();
                }
            }

            #endregion

            if (blRet)
            {
                commonCls.NewEnvirEventRecord(EventType.空调, strArea, runMode, strContent);

                if (NewEventShowEvent != null)
                {
                    string strPoint = strArea + " ";
                    if (blMoreAir)
                    {
                        strPoint += btAddr.ToString();
                        strPoint += "#空调";
                    }

                    if (content == EventContent.设置温度)
                    {
                        NewEventShowEvent(new NewEventEventArgs(EventType.空调, strPoint, content.ToString() + btSetTemp.ToString(), "", "", DateTime.Now));
                    }
                    else
                    {
                        NewEventShowEvent(new NewEventEventArgs(EventType.空调, strPoint, content.ToString(), "", "", DateTime.Now));
                    }
                }
            }

            return(blRet);
        }