Exemple #1
0
    /// <summary>
    /// 设置设备信息
    /// </summary>
    /// <param name="devList"></param>
    public void SetDevInfo(List <DevNode> devList)
    {
        Window.SetActive(true);
        ClearDevList();
        int normalDev = 0;
        int cameraDev = 0;
        int doorDev   = 0;
        int borderDev = 0;
        int fireDev   = 0;

        foreach (DevNode dev in devList)
        {
            if (dev != null && dev.Info != null)
            {
                string typeCode = dev.Info.TypeCode.ToString();
                if (TypeCodeHelper.IsCamera(typeCode))
                {
                    cameraDev++;
                    cameraDevTemp.Add(dev.gameObject);
                }
                else if (TypeCodeHelper.IsDoorAccess(typeCode))
                {
                    doorDev++;
                    doorDevTemp.Add(dev.gameObject);
                }
                else if (TypeCodeHelper.IsBorderAlarmDev(typeCode))
                {
                    borderDev++;
                    borderDevTemp.Add(dev.gameObject);
                }
                else if (TypeCodeHelper.IsAlarmDev(typeCode))
                {
                    fireDev++;
                    fireDevTemp.Add(dev.gameObject);
                }
                else
                {
                    normalDev++;
                    normalDevTemp.Add(dev.gameObject);
                }
            }
        }
        SetSelections(normalDev, cameraDev, doorDev, borderDev, fireDev);
        NormalDevText.text  = normalDev.ToString();
        CameraDevText.text  = cameraDev.ToString();
        DoorAccessText.text = doorDev.ToString();
        BorderDevText.text  = borderDev.ToString();
        FireAlarmText.text  = fireDev.ToString();
    }
Exemple #2
0
        /// <summary>
        /// 获取告警信息
        /// </summary>
        /// <param name="dev"></param>
        /// <returns></returns>
        private string GetAlarmMsg(DevInfo dev)
        {
            string msg      = "设备告警";
            string typecode = dev.TypeCode.ToString();

            if (TypeCodeHelper.IsBorderAlarmDev(typecode))
            {
                msg = string.Format("边界告警 : {0} 检测到非法越界.", dev.Name);
            }
            else if (TypeCodeHelper.IsAlarmDev(typecode))
            {
                msg = string.Format("消防告警 : {0} 消防装置被触发.", dev.Name);
            }
            return(msg);
        }
Exemple #3
0
    /// <summary>
    /// 区域告警/消警
    /// </summary>
    private void AlarmMonitorRange(bool isAlarm)
    {
        if (currentDev == null || currentDev.ParentDepNode == null)
        {
            return;
        }
        if (!TypeCodeHelper.IsAlarmDev(currentDev.Info.TypeCode.ToString()))
        {
            return;
        }
        DepNode dep = currentDev.ParentDepNode;

        if (isAlarm)
        {
            if ((dep is RoomController || dep is FloorController) && dep.monitorRangeObject != null)
            {
                dep.monitorRangeObject.AlarmOn();
            }
        }
        else
        {
            if ((dep is RoomController || dep is FloorController))
            {
                List <DevNode> roomDevs = RoomFactory.Instance.GetDepDevs(dep);
                if (roomDevs == null || roomDevs.Count == 0)
                {
                    return;
                }
                bool isOtherDevAlarm = false;
                for (int i = 0; i < roomDevs.Count; i++)
                {
                    if (roomDevs[i].isAlarm && roomDevs[i] != currentDev)
                    {
                        isOtherDevAlarm = true;
                        break;
                    }
                }
                //区域下没有告警设备,取消告警
                if (!isOtherDevAlarm && dep.monitorRangeObject != null)
                {
                    dep.monitorRangeObject.AlarmOff();
                }
            }
        }
    }