Ejemplo n.º 1
0
    /// <summary>
    /// 获取到人员告警信息放到指定的列表里
    /// </summary>
    /// <param name="LocationaList"></param>
    public void OnLocationAlarmRecieved(List <LocationAlarm> LocationaList)
    {
        FullViewController mainPage = FullViewController.Instance;

        AllPerAlarmPushInfo = new List <LocationAlarm>();
        if (mainPage && mainPage.IsFullView)
        {
            foreach (var alarm in LocationaList)
            {
                LocationAlarm PerAlarm = AllPerAlarmPushInfo.Find(a => a.Id == alarm.Id && alarm.AlarmLevel == LocationAlarmLevel.正常 && a.AlarmLevel != LocationAlarmLevel.正常);
                if (PerAlarm != null)
                {
                    AllPerAlarmPushInfo.Remove(PerAlarm);
                }
                else
                {
                    AllPerAlarmPushInfo.Add(alarm);
                }
            }
        }
        else
        {
            foreach (var alarm in LocationaList)
            {
                AllPerAlarmPushInfo.Add(alarm);
            }
            foreach (var per in AllPerAlarmPushInfo)
            {
                if (per.AlarmLevel == LocationAlarmLevel.正常)
                {
                    AlarmPushInfo Alarm         = CurrentAlarmPushInfoList.Find(m => m.AlarmType == AlarmPushInfoType.locationAlarm && m.locationAlarmInfo.Id == per.Id && m.locationAlarmInfo.AlarmLevel != LocationAlarmLevel.正常);
                    AlarmPushInfo CompleteAlarm = CompleteAlarmPushInfoList.Find(n => n.AlarmType == AlarmPushInfoType.locationAlarm && n.locationAlarmInfo.Id == per.Id && n.locationAlarmInfo.AlarmLevel != LocationAlarmLevel.正常);

                    if (Alarm != null || CompleteAlarm != null)
                    {
                        AlarmPushInfo NormalAlarmInformation = new AlarmPushInfo();
                        NormalAlarmInformation.SetAlarmInfo(per);
                        CurrentAlarmPushInfoList.Add(NormalAlarmInformation);
                    }
                }
                else
                {
                    if (ScreenFlashesRedAndAudio.Instance != null)
                    {
                        ScreenFlashesRedAndAudio.Instance.FlashesRedTweenerPlay();
                    }
                    AlarmPushInfo CurrentAlarm = CurrentAlarmPushInfoList.Find(m => m.AlarmType == AlarmPushInfoType.locationAlarm && m.locationAlarmInfo.Id == per.Id && m.locationAlarmInfo.AlarmLevel == per.AlarmLevel);
                    if (CurrentAlarm == null)
                    {
                        AlarmPushInfo AlarmInformation = new AlarmPushInfo();
                        AlarmInformation.SetAlarmInfo(per);
                        CurrentAlarmPushInfoList.Add(AlarmInformation);
                    }
                }
            }
        }
    }
Ejemplo n.º 2
0
    private void CameraAlarmHub_OnCameraAlarmsRecieved(List <CameraAlarmInfo> CameraInfo)
    {
        try
        {
            if (CameraInfo == null || CameraInfo.Count == 0)
            {
                return;
            }
            //string json = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
            Log.Info("CameraAlarmHub_OnCameraAlarmsRecieved", "count:" + CameraInfo.Count);
            //Debug.LogError(json);
            IsBaoXin           = true;
            IsNewAlarm         = true;
            AllCameraAlarmPush = new List <CameraAlarmInfo>();

            if (NewestCameraAlarmPush == null)
            {
                NewestCameraAlarmPush = new List <CameraAlarmInfo>();
            }
            CameraAlarmPushList = new List <CameraAlarmInfo>();

            FullViewController mainPage = FullViewController.Instance;
            foreach (var cam in CameraInfo)
            {
                if (cam.status == 1)
                {
                    AllCameraAlarmPush.Add(cam);
                }
                else
                {
                    Log.Error("CameraAlarmHub_OnCameraAlarmsRecieved", "cam.status != 1 :" + cam.status);
                }
            }

            Log.Info("CameraAlarmHub_OnCameraAlarmsRecieved", "AllCameraAlarmPush:" + AllCameraAlarmPush.Count);
            if (mainPage && mainPage.IsFullView)
            {
                return;
            }
            if (ScreenFlashesRedAndAudio.Instance != null)
            {
                ScreenFlashesRedAndAudio.Instance.FlashesRedTweenerPlay();
            }
            foreach (var camAlarm in AllCameraAlarmPush)
            {
                NewestCameraAlarmPush.Add(camAlarm);
                AlarmPushInfo AlarmInformation = new AlarmPushInfo();
                AlarmInformation.SetAlarmInfo(camAlarm);
                CameraAlarmInfo CurrentCameraAlarm  = new CameraAlarmInfo();
                AlarmPushInfo   CompleteCameraAlarm = new AlarmPushInfo();
                AlarmPushInfo   nullData            = CompleteAlarmPushInfoList.Find(i => i.CameraAlarmInfor != null);
                if (nullData != null)
                {
                    if (camAlarm.AlarmType == 2)
                    {
                        CompleteCameraAlarm = CompleteAlarmPushInfoList.Find(i => i.CameraAlarmInfor != null && i.CameraAlarmInfor.cid == camAlarm.cid && i.CameraAlarmInfor.FlameData != null);
                    }
                    else if (camAlarm.AlarmType == 1)
                    {
                        CompleteCameraAlarm = CompleteAlarmPushInfoList.Find(i => i.CameraAlarmInfor != null && i.CameraAlarmInfor.cid == camAlarm.cid && i.CameraAlarmInfor.HeadData != null);
                    }
                    else if (camAlarm.AlarmType == 3)
                    {
                        CompleteCameraAlarm = CompleteAlarmPushInfoList.Find(i => i.CameraAlarmInfor != null && i.CameraAlarmInfor.cid == camAlarm.cid && i.CameraAlarmInfor.SmogData != null);
                    }
                    if (CompleteCameraAlarm == null)
                    {
                        CurrentAlarmPushInfoList.Add(AlarmInformation);
                        CameraAlarmPushList.AddRange(AllCameraAlarmPush);
                    }
                }
                else
                {
                    CurrentAlarmPushInfoList.Add(AlarmInformation);
                    CameraAlarmPushList.AddRange(AllCameraAlarmPush);
                }
                CameraAlarmFollowUI.RefreshAll();
            }
        }
        catch (Exception ex)
        {
            Log.Error("CameraAlarmHub_OnCameraAlarmsRecieved", "Exception :" + ex);
        }
    }
Ejemplo n.º 3
0
    /// <summary>
    /// 设备告警
    /// </summary>
    /// <param name="devList"></param>
    public void OnDeviceAlarmRecieved(List <DeviceAlarm> devList)
    {
        try
        {
            FullViewController mainPage = FullViewController.Instance;
            AllDevAlarmPushInfo = new List <DeviceAlarm>();
            if (mainPage && mainPage.IsFullView)
            {
                foreach (var dev in devList)
                {
                    if (dev == null)
                    {
                        continue;
                    }
                    if (AllDevAlarmPushInfo.Count != 0)
                    {
                        DeviceAlarm devAlarm = AllDevAlarmPushInfo.Find(m => m != null && m.Level == Abutment_DevAlarmLevel.无 && m.DevId == dev.DevId);
                        if (devAlarm == null)
                        {
                            AllDevAlarmPushInfo.Remove(devAlarm);
                        }
                        else
                        {
                            AllDevAlarmPushInfo.Add(devAlarm);
                        }
                    }
                }
            }
            else
            {
                foreach (var alarm in devList)
                {
                    if (alarm == null)
                    {
                        continue;
                    }
                    AllDevAlarmPushInfo.Add(alarm);
                }
                foreach (var dev in AllDevAlarmPushInfo)
                {
                    if (dev == null)
                    {
                        continue;
                    }
                    if (dev.Level == Abutment_DevAlarmLevel.无)
                    {
                        AlarmPushInfo Alarm         = CurrentAlarmPushInfoList.Find(m => m != null && m.devAlarmInfo.Level == Abutment_DevAlarmLevel.无 && m.devAlarmInfo.DevId == dev.DevId);
                        AlarmPushInfo CompleteAlarm = CompleteAlarmPushInfoList.Find(n => n != null && n.devAlarmInfo.DevId == dev.DevId && n.devAlarmInfo.Level != Abutment_DevAlarmLevel.无);

                        if (Alarm != null || CompleteAlarm != null)
                        {
                            AlarmPushInfo NormalAlarmInformation = new AlarmPushInfo();
                            NormalAlarmInformation.SetAlarmInfo(dev);
                            CurrentAlarmPushInfoList.Add(NormalAlarmInformation);
                        }
                    }
                    else
                    {
                        AlarmPushInfo CurrentAlarm = CurrentAlarmPushInfoList.Find(m => m != null && m.devAlarmInfo.DevId == dev.DevId && m.devAlarmInfo.Level == dev.Level);
                        if (CurrentAlarm == null)
                        {
                            AlarmPushInfo AlarmInformation = new AlarmPushInfo();
                            AlarmInformation.SetAlarmInfo(dev);
                            CurrentAlarmPushInfoList.Add(AlarmInformation);
                        }
                    }
                }
            }
        }
        catch (Exception e)
        {
            Log.Error("AlarmPushManage.Error:" + e.ToString());
        }
    }