/// <summary>
        /// 添加摄像头信息
        /// </summary>
        /// <param name="cameraInfo"></param>
        /// <returns></returns>
        public Dev_CameraInfo AddCameraInfo(Dev_CameraInfo cameraInfo)
        {
            DbModel.Location.AreaAndDev.Dev_CameraInfo dbCamera = cameraInfo.ToDbModel();
            var result = db.Dev_CameraInfos.Add(dbCamera);

            return(result ? dbCamera.ToTModel() : null);
        }
Exemplo n.º 2
0
    /// <summary>
    /// 保存其他信息
    /// </summary>
    /// <param name="devInfo"></param>
    /// <param name="service"></param>
    private void SaveDevSubInfo(List <GameObject> copyDevList, CommunicationObject service)
    {
        List <Dev_CameraInfo> cameraInfoList = new List <Dev_CameraInfo>();

        foreach (var devObjT in copyDevList)
        {
            DevNode devInfoT = devObjT.GetComponent <DevNode>();
            if (devInfoT == null)
            {
                continue;
            }
            DevInfo devInfo = devInfoT.Info;
            if (TypeCodeHelper.IsCamera(devInfo.TypeCode.ToString()))
            {
                Dev_CameraInfo cameraInfoT = new Dev_CameraInfo();
                cameraInfoT.Ip          = "127.0.0.1";
                cameraInfoT.DevInfoId   = devInfo.Id;
                cameraInfoT.UserName    = "******";
                cameraInfoT.PassWord    = "******";
                cameraInfoT.Port        = 80;
                cameraInfoT.CameraIndex = 0;
                cameraInfoT.Local_DevID = devInfo.Abutment_DevID;
                cameraInfoT.ParentId    = devInfo.ParentId;
                //CameraDevController camera = devInfoT as CameraDevController;
                //Dev_CameraInfo value = service.AddCameraInfo(cameraInfo);
                cameraInfoList.Add(cameraInfoT);
                //Debug.Log("Add cameraInfo value:" + value == null);
            }
        }
        if (cameraInfoList.Count != 0)
        {
            service.AddCameraInfo(cameraInfoList);
        }
    }
 /// <summary>
 /// 显示摄像头视频
 /// </summary>
 /// <param name="cameraInfo"></param>
 public void Show(DevInfo cameraInfo)
 {
     try
     {
         if (SystemSettingHelper.honeyWellSetting.EnableHoneyWell)
         {
             if (honeyWellVideo)
             {
                 honeyWellVideo.ShowVideo(cameraInfo.Abutment_DevID);
             }
         }
         else
         {
             if (rtspVideo)
             {
                 recordTime = DateTime.Now;
                 Dev_CameraInfo info = CommunicationObject.Instance.GetCameraInfoByDevInfo(cameraInfo);
                 Debug.LogErrorFormat("GetCameraByDevInfo,Cost Time:{0}ms", (DateTime.Now - recordTime).TotalMilliseconds);
                 recordTime = DateTime.Now;
                 if (info != null)
                 {
                     rtspVideo.ShowVideo(info.RtspUrl, cameraInfo);
                     Debug.LogErrorFormat("rtspVideo.ShowVideo,Cost Time:{0}ms", (DateTime.Now - recordTime).TotalMilliseconds);
                 }
                 else
                 {
                     Debug.LogError("Error:CameraVideoManage.Show->Dev_Camerainfo is null,ID:" + cameraInfo == null ? "null" : cameraInfo.Id.ToString());
                 }
             }
         }
     }catch (Exception e)
     {
         Debug.LogError("Error:CameraVideoManage.Show->" + e.ToString());
     }
 }
Exemplo n.º 4
0
    /// <summary>
    /// 显示摄像头信息
    /// </summary>
    private void ShowInfo()
    {
        if (CameraDev == null)
        {
            UGUIMessageBox.Show("Camera.Devinfo is null...");
            return;
        }
        DevInfo devInfo = CameraDev.Info;

        TitleText.text = devInfo.Name;
        string info = "";

        if (devInfo.ParentId != null)
        {
            DepNode node = RoomFactory.Instance.GetDepNodeById((int)devInfo.ParentId);
            if (node != null)
            {
                info = node.NodeName + "/";
            }
        }
        CameraDevController cameraInfo = CameraDev as CameraDevController;
        Dev_CameraInfo      camInfo    = cameraInfo.GetCameraInfo(CameraDev.Info);

        if (camInfo != null)
        {
            info += camInfo.Ip;
        }
        InfoText.text = info;
    }
    public void ShowCameraAlarmList()
    {
        if (!CameraAlarmWindow.activeInHierarchy)
        {
            return;                                      //界面被外部关闭,不刷新
        }
        Log.Info("ShowCameraAlarmList:" + isRefresh);
        if (isRefresh)
        {
            return;
        }
        isRefresh = true;
        DelectChildItem();
        CameraHistoryAlarm = new List <CameraAlarmInfo>();
        int     id      = CurrentCameraDevID.ToInt();
        DevInfo devInfo = new DevInfo();

        devInfo.Id = id;
        recordTag  = DateTime.Now;
        Dev_CameraInfo info = CommunicationObject.Instance.GetCameraInfoByDevInfo(devInfo);

        ThreadManager.Run(() =>
        {
            CameraHistoryAlarm = CommunicationObject.Instance.GetCameraAlarms(info.Ip, true);
        }, () =>
        {
            Debug.LogError("CommunicationObject.Instance.GetCameraAlarms,cost :" + (DateTime.Now - recordTag).TotalSeconds + " s");
            if (CameraHistoryAlarm != null)
            {
                //CameraHistoryAlarm.Reverse();
                ShowCurrentCameraAlarm(CameraHistoryAlarm);
            }
        }, "ShowCameraAlarmList");
    }
    public void RefreshCameraAlarmList()
    {
        if (isRefresh)
        {
            return;
        }
        isRefresh = true;
        Debug.LogError("刷新Max摄像机告警信息");
        DelectChildItem();

        CameraHistoryAlarm = new List <CameraAlarmInfo>();
        int     id      = CurrentDevID.ToInt();
        DevInfo devInfo = new DevInfo();

        devInfo.Id = id;
        Dev_CameraInfo info = CommunicationObject.Instance.GetCameraInfoByDevInfo(devInfo);

        recordTag          = DateTime.Now;
        CameraHistoryAlarm = CommunicationObject.Instance.GetCameraAlarms(info.Ip, true);
        Debug.LogError("CommunicationObject.Instance.GetTags,cost :" + (DateTime.Now - recordTag).TotalSeconds + " s");
        CurrentCameraHistoryAlarm = new List <CameraAlarmInfo>();
        if (CameraHistoryAlarm != null)
        {
            for (int i = 0; i < CameraHistoryAlarm.Count; i++)
            {
                if (SmallCameraAlarmFollow.IsSameCamera(CurrentDevID, CameraHistoryAlarm[i]))
                {
                    CurrentCameraHistoryAlarm.Add(CameraHistoryAlarm[i]);
                }
            }
        }
        //CurrentCameraHistoryAlarm.Reverse();
        if (CurrentCameraHistoryAlarm.Count == 0)
        {
            pegeNumText.text   = "1";
            pegeTotalText.text = "1";
            isRefresh          = false;
            return;
        }

        if (ScreenList == null)
        {
            ScreenList = new List <CameraAlarmInfo>();
        }
        else
        {
            ScreenList.Clear();
        }
        ScreenList.AddRange(CurrentCameraHistoryAlarm);
        int      level     = CameraAlarmDropdown.CameraTypeDropdown.value;
        string   AlarmTime = AlarmTimeText.GetComponent <Text>().text;
        DateTime dateTime  = Convert.ToDateTime(AlarmTime);

        ScreenCameraAlarmInfo(level, dateTime);
        //  GetCurrentCameraDevAlarm();
    }
Exemplo n.º 7
0
    private void GetIpAndChannel(Dev_CameraInfo info)
    {
        string rtsp = info.RtspUrl;

        Debug.Log("rtsp:" + rtsp);
        string[] parts  = rtsp.Split('@');
        string[] parts2 = parts[1].Split('/');
        ip      = parts2[0];
        channel = parts2[1];
    }
Exemplo n.º 8
0
    /// <summary>
    /// 更新摄像机参数
    /// </summary>
    private void SaveCameraInfo()
    {
        Dev_CameraInfo info = CameraTemp.GetCameraInfo(CameraTemp.Info);

        info.Ip          = IP.text;
        info.UserName    = UserName.text;
        info.PassWord    = PassWord.text;
        info.Port        = TryParseInt(Port.text);
        info.CameraIndex = TryParseInt(CameraIndex.text);
        info.RtspUrl     = RtspURL.text;
    }
    /// <summary>
    /// 保存其他信息
    /// </summary>
    /// <param name="devInfo"></param>
    /// <param name="service"></param>
    private void SaveDevSubInfo(DevNode devNode, CommunicationObject service)
    {
        DevInfo devInfo = devNode.Info;

        if (devInfo == null)
        {
            return;
        }
        if (TypeCodeHelper.IsLocationDev(devInfo.TypeCode.ToString()))
        {
            Archor archor = new Archor();
            archor.Code       = "";
            archor.DevInfoId  = devInfo.Id;
            archor.ParentId   = (int)devInfo.ParentId;
            archor.X          = 0;
            archor.Y          = 0;
            archor.Z          = 0;
            archor.Name       = devInfo.Name;
            archor.Type       = ArchorTypes.副基站;
            archor.IsAutoIp   = true;
            archor.Ip         = "";
            archor.ServerIp   = "";
            archor.ServerPort = 0;
            archor.Power      = 0;
            archor.AliveTime  = 0;
            archor.Enable     = IsStart.是;
            //archor.DevInfo = devInfo;
            bool value = service.AddArchor(archor);
            Debug.Log("Add archor value:" + value);
        }
        else if (TypeCodeHelper.IsCamera(devInfo.TypeCode.ToString()))
        {
            Dev_CameraInfo cameraInfo = new Dev_CameraInfo();
            cameraInfo.Ip          = "";
            cameraInfo.DevInfoId   = devInfo.Id;
            cameraInfo.UserName    = "";
            cameraInfo.PassWord    = "";
            cameraInfo.Port        = 0;
            cameraInfo.CameraIndex = 0;
            cameraInfo.Local_DevID = devInfo.Abutment_DevID;
            cameraInfo.ParentId    = devInfo.ParentId;
            CameraDevController camera = devNode as CameraDevController;
            //camera.SetCameraInfo(cameraInfo);
            Dev_CameraInfo value = service.AddCameraInfo(cameraInfo);
            if (value != null)
            {
                camera.SetCameraInfo(value);
            }
            Debug.Log("Add cameraInfo value:" + value == null);
        }
    }
Exemplo n.º 10
0
 /// <summary>
 /// 添加摄像头信息
 /// </summary>
 /// <param name="cameraDev"></param>
 /// <param name="bll"></param>
 private static void AddCameraInfo(CameraInfoBackup cameraDev, Bll bll)
 {
     try
     {
         DevInfoBackup dev     = CameraToDevInfo(cameraDev);
         DevInfo       devInfo = GetDevInfo(dev);
         DevPos        devPos  = GetDevPos(dev);
         devInfo.SetPos(devPos);
         DevInfo infoTemp = bll.DevInfos.Find(i => i.Local_DevID == devInfo.Local_DevID);
         //Devinfo中,能通过Devid找到的就更新。找不到就新增
         if (infoTemp == null)
         {
             bll.DevInfos.Add(devInfo);
             Dev_CameraInfo cameraBackup = GetCameraInfo(cameraDev, devInfo);
             cameraBackup.RtspUrl = cameraDev.RtspURL;
             bll.Dev_CameraInfos.Add(cameraBackup);
         }
         else
         {
             UpgradeDevInfo(infoTemp, devInfo);
             bool value = bll.DevInfos.Edit(infoTemp);
             if (!value)
             {
                 Log.Info("Error: EditDevinfo Error");
             }
             Dev_CameraInfo cameraBackup = GetCameraInfo(cameraDev, infoTemp);
             if (!string.IsNullOrEmpty(cameraDev.RtspURL))
             {
                 cameraBackup.RtspUrl = cameraDev.RtspURL;
             }
             Dev_CameraInfo cameraDatabase = bll.Dev_CameraInfos.Find(cameraT => cameraT.Local_DevID == infoTemp.Local_DevID);
             if (cameraDatabase == null)
             {
                 bll.Dev_CameraInfos.Add(cameraBackup);
             }
             else
             {
                 UpgradeCameraInfo(cameraBackup, cameraDatabase);
                 bool valueT = bll.Dev_CameraInfos.Edit(cameraDatabase);
                 if (!valueT)
                 {
                     Log.Info("Error: EditDevinfo Error");
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Info("Error in DevInfoHelper.AddDevInfo:" + e.ToString());
     }
 }
Exemplo n.º 11
0
        /// <summary>
        /// 获取摄像头数据
        /// </summary>
        /// <param name="camDev"></param>
        /// <param name="dev"></param>
        /// <returns></returns>
        private static Dev_CameraInfo GetCameraInfo(CameraInfoBackup camDev, DevInfo dev)
        {
            Dev_CameraInfo info = new Dev_CameraInfo();

            info.Ip          = camDev.IP;
            info.UserName    = camDev.UserName;
            info.PassWord    = camDev.PassWord;
            info.CameraIndex = TryParseInt(camDev.CameraIndex);
            info.Port        = TryParseInt(camDev.Port);
            info.DevInfoId   = dev.Id;
            info.ParentId    = dev.ParentId;
            info.Local_DevID = dev.Local_DevID;
            return(info);
        }
Exemplo n.º 12
0
 /// <summary>
 /// 更新门禁数据库信息
 /// </summary>
 /// <param name="backup"></param>
 /// <param name="database"></param>
 private static void UpgradeCameraInfo(Dev_CameraInfo backup, Dev_CameraInfo database)
 {
     database.Ip          = backup.Ip;
     database.UserName    = backup.UserName;
     database.PassWord    = backup.PassWord;
     database.CameraIndex = backup.CameraIndex;
     database.Port        = backup.Port;
     database.DevInfoId   = backup.DevInfoId;
     database.ParentId    = backup.ParentId;
     database.Local_DevID = backup.Local_DevID;
     if (!string.IsNullOrEmpty(backup.RtspUrl))
     {
         database.RtspUrl = backup.RtspUrl;
     }
 }
    /// <summary>
    /// 打开当前设备的监控视频
    /// </summary>
    /// <param name="cameraDev"></param>
    public void ShowCurrentCameraVedio(CameraDevController cameraDev)
    {
        if (CameraVideoManage.Instance)
        {
            Dev_CameraInfo camInfo = cameraDev.GetCameraInfo(cameraDev.Info);
            //   if (camInfo != null) CameraVideoManage.Instance.rtspVideo.ShowVideo(camInfo.RtspUrl, cameraDev.Info);
            if (IsMinPrompt)
            {
                if (string.IsNullOrEmpty(camInfo.RtspUrl))
                {
                    Debug.LogError("Error : RtspVideo.ShowVideo-> rtspURL is null!");
                    UGUIMessageBox.Show("Rtsp地址未输入!");
                    if (VedioPrompt)
                    {
                        VedioPrompt.text = "Rtsp地址未输入!";
                    }
                    if (CameraAlarmManage.Instance.VedioPrompt)
                    {
                        CameraAlarmManage.Instance.VedioPrompt.text = "Rtsp地址未输入!";
                    }
                    IsMinPrompt = true;
                    return;
                }
                if (!IsEffectiveURL(camInfo.RtspUrl))
                {
                    UGUIMessageBox.Show("Rtsp地址无效!");
                    if (VedioPrompt)
                    {
                        VedioPrompt.text = "Rtsp地址无效!";
                    }
                    IsMinPrompt = true;
                    return;
                }
            }


            GameObject Obj = Instantiate(VedioPrefabs, PlayParent.transform) as GameObject;
            Obj.transform.SetAsFirstSibling();
            Obj.SetActive(true);
            VedioPrefabs.SetActive(false);
            player = Obj.GetComponent <UniversalMediaPlayer>();
            AddEncounteredEvent(player, () =>
            {
                ShowVideo(camInfo.RtspUrl, player);
            });
        }
    }
Exemplo n.º 14
0
 /// <summary>
 /// 添加摄像头信息
 /// </summary>
 /// <param name="cameraDev"></param>
 /// <param name="bll"></param>
 private static void AddCameraInfo(CameraInfoBackup cameraDev, Bll bll)
 {
     try
     {
         DevInfoBackup dev     = CameraToDevInfo(cameraDev);
         DevInfo       devInfo = GetDevInfo(dev);
         DevPos        devPos  = GetDevPos(dev);
         devInfo.SetPos(devPos);
         bll.DevInfos.Add(devInfo);
         Dev_CameraInfo camera = GetCameraInfo(cameraDev, devInfo);
         bll.Dev_CameraInfos.Add(camera);
     }
     catch (Exception e)
     {
         Console.WriteLine("Error in DevInfoHelper.AddDevInfo:" + e.ToString());
     }
 }
Exemplo n.º 15
0
    /// <summary>
    /// 打开当前设备的监控视频
    /// </summary>
    /// <param name="cameraDev"></param>
    private void ShowCurrentCameraVedio()
    {
        try
        {
            if (CurrentCameraDev == null)
            {
                return;
            }
            if (CurrentCameraDev.Info != null)
            {
                TitleText.text = CurrentCameraDev.Info.Name;
            }
            else
            {
                TitleText.text = "监控视频";
                Debug.LogError("Error.VideofollowItem.ShowCurrentCameraVideo: CurrentCameraDev.Info is null:" + CurrentCameraDev.transform.name);
                return;
            }
            Dev_CameraInfo camInfo = CurrentCameraDev.GetCameraInfo(CurrentCameraDev.Info);
            if (string.IsNullOrEmpty(camInfo.RtspUrl))
            {
                Debug.LogError("Error : RtspVideo.ShowVideo-> rtspURL is null!");
                UGUIMessageBox.Show("Rtsp地址未输入!");
                return;
            }
            if (!IsEffectiveURL(camInfo.RtspUrl))
            {
                UGUIMessageBox.Show("Rtsp地址无效!");
                return;
            }

            GameObject Obj = Instantiate(VedioPrefab, VideoWindow.transform) as GameObject;
            Obj.transform.SetAsFirstSibling();
            Obj.SetActive(true);
            VedioPrefab.SetActive(false);
            player = Obj.GetComponent <UniversalMediaPlayer>();
            AddEncounteredEvent(player, () =>
            {
                ShowVideo(camInfo.RtspUrl, player);
            });
        }catch (Exception e)
        {
            Debug.LogErrorFormat("VideofollowItem.ShowCurrentCameraVideo.ErrorInfo:{0}", e.ToString());
        }
    }
Exemplo n.º 16
0
 /// <summary>
 /// 根据设备信息,获取摄像头信息
 /// </summary>
 /// <param name="dev"></param>
 public Dev_CameraInfo GetCameraInfo(DevInfo dev)
 {
     if (CameraInfo != null)
     {
         return(CameraInfo);
     }
     if (dev != null)
     {
         CommunicationObject service = CommunicationObject.Instance;
         if (service)
         {
             CameraInfo = service.GetCameraInfoByDevInfo(dev);
             if (CameraInfo == null)
             {
                 Debug.LogError(string.Format("CamerInfo not find-> DevName:{0} DevId:{1}", dev.Name, dev.Id));
             }
         }
     }
     return(CameraInfo);
 }
    /// <summary>
    /// 通过rtspUrl获取设备ID
    /// </summary>
    /// <param name="url"></param>
    /// <returns></returns>
    private int?GetCameraInfoId(string url)
    {
        //"rtsp://*****:*****@ 192.168.1.27:554/ch1/main/h264",
        if (string.IsNullOrEmpty(url))
        {
            return(null);
        }
        string[] ips = url.Split('@');
        if (ips == null || ips.Length < 2)
        {
            return(null);
        }
        string[] ipTemp = ips[1].Split(':');
        if (ipTemp == null || ipTemp.Length < 2)
        {
            return(null);
        }
        string ipFinal;

        ipFinal = ipTemp[0];
        if (string.IsNullOrEmpty(ipFinal))
        {
            return(null);
        }
        CommunicationObject service = CommunicationObject.Instance;

        if (service)
        {
            Dev_CameraInfo info = service.GetCameraInfoByIp(ipFinal);
            if (info != null)
            {
                return(info.DevInfoId);
            }
            else
            {
                return(null);
            }
        }
        return(null);
    }
Exemplo n.º 18
0
    /// <summary>
    /// 设置信息
    /// </summary>
    /// <param name="camDev"></param>
    public void Show(CameraDevController camDev)
    {
        SettingToggle.gameObject.SetActive(true);
        if (camDev == null || camDev.Info == null)
        {
            Debug.LogError("CameraDev==null||camDev.Info==null");
            return;
        }
        CameraTemp = camDev;
        Dev_CameraInfo info = CameraTemp.GetCameraInfo(camDev.Info);

        isInitValue = true;
        if (info != null)
        {
            SetInputFiledValue(info.Ip, info.UserName, info.PassWord, info.Port.ToString(), info.CameraIndex.ToString(), info.RtspUrl);
        }
        else
        {
            SetInputFiledValue("", "", "", "", "", "");
        }
        isInitValue = false;
    }
 public void Show(CameraDevController devController)
 {
     if (devController == null || devController.Info == null)
     {
         return;
     }
     if (SystemSettingHelper.honeyWellSetting.EnableHoneyWell)
     {
         if (honeyWellVideo)
         {
             honeyWellVideo.ShowVideo(devController.Info.Abutment_DevID);
         }
     }
     else
     {
         Dev_CameraInfo camInfo = devController.GetCameraInfo(devController.Info);
         if (camInfo != null)
         {
             rtspVideo.ShowVideo(camInfo.RtspUrl, devController.Info);
         }
     }
 }
Exemplo n.º 20
0
        public static void SetDevice(device item, DevInfo devinfo)
        {
            item.id   = devinfo.Abutment_Id ?? 0;
            item.code = devinfo.Code;
            item.type = (int)devinfo.Abutment_Type;
            if (item.type == 0)
            {
                item.type = GetDeviceType(devinfo);
            }
            item.state         = (int)devinfo.Status;
            item.running_state = (int)devinfo.RunStatus;
            item.placed        = devinfo.Placed;
            item.raw_id        = devinfo.Abutment_DevID;
            item.ip            = devinfo.IP;
            //devinfo.Manufactor = "霍尼韦尔";

            //devinfo.ModifyTime = DateTime.Now;
            //devinfo.ModifyTimeStamp = TimeConvert.DateTimeToTimeStamp(devinfo.ModifyTime);

            //devinfo.ParentId = area.Id;
            item.kks  = devinfo.KKS;
            item.name = devinfo.Name;
            item.pid  = devinfo.ParentId ?? 0;

            if (devinfo.DevDetail is Dev_CameraInfo)
            {
                Dev_CameraInfo camera = devinfo.DevDetail as Dev_CameraInfo;
                item.uri = camera.RtspUrl;

                if (string.IsNullOrEmpty(item.uri))
                {
                    item.uri = "rtsp://*****:*****@192.168.1.56/h264/ch1/main/av_stream";
                }

                item.ip = camera.Ip;
            }
        }
Exemplo n.º 21
0
    /// <summary>
    /// 参数是否变化
    /// </summary>
    /// <returns></returns>
    private bool IsValueChanged()
    {
        Dev_CameraInfo info = CameraTemp.GetCameraInfo(CameraTemp.Info);

        if (info == null)
        {
            return(false);
        }
        if (info.Ip != IP.text)
        {
            return(true);
        }
        else if (info.UserName != UserName.text)
        {
            return(true);
        }
        else if (info.PassWord != PassWord.text)
        {
            return(true);
        }
        else if (info.Port.ToString() != Port.text)
        {
            return(true);
        }
        else if (info.CameraIndex.ToString() != CameraIndex.text)
        {
            return(true);
        }
        else if (info.RtspUrl != RtspURL.text)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
Exemplo n.º 22
0
 /// <summary>
 /// 输入框信息改变
 /// </summary>
 /// <param name="value"></param>
 private void OnCameraInfoValueChanged(string value)
 {
     if (isInitValue || string.IsNullOrEmpty(value) || CameraTemp == null)
     {
         return;
     }
     if (IsValueChanged())
     {
         SaveCameraInfo();
         CommunicationObject service = CommunicationObject.Instance;
         if (service)
         {
             Dev_CameraInfo info   = CameraTemp.GetCameraInfo(CameraTemp.Info);
             Dev_CameraInfo isSave = service.ModifyCameraInfo(info);
             RtspURL.text = isSave.RtspUrl;
             info.RtspUrl = isSave.RtspUrl;
             Debug.Log("Save CameraInfo:" + isSave);
         }
     }
     else
     {
         Debug.Log("CameraInfo not change...");
     }
 }
    /// <summary>
    /// 打开摄像头监控视频
    /// </summary>
    /// <param name="cameraDev"></param>
    public void ShowCameraVedio(CameraDevController cameraDev, CameraAlarmFollowUI SmallUI)
    {
        Log.Debug("ShowCameraVedio", string.Format("{0},{1}", cameraDev, SmallUI));
        if (VedioPrompt != null)
        {
            VedioPrompt.text = "视频连接中...";
        }
        SmallCameraAlarmFollow = SmallUI;
        currentCameraDev       = cameraDev;
        CurrentDevID           = currentCameraDev.Info.Id.ToString();
        if (MaxCameraAlarmList.Count != 0)
        {
            MaxCameraAlarmList.Clear();
        }
        if (AlarmPushManage.Instance.NewestCameraAlarmPush != null)
        {
            MaxCameraAlarmList.AddRange(AlarmPushManage.Instance.NewestCameraAlarmPush);
        }


        if (!VedioWindow.activeSelf)
        {
            VedioWindow.SetActive(true);
        }
        VideoTog.isOn = true;

        TitleText.text = cameraDev.Info.Name;
        if (CameraVideoManage.Instance)
        {
            Dev_CameraInfo camInfo = cameraDev.GetCameraInfo(cameraDev.Info);
            //   if (camInfo != null) CameraVideoManage.Instance.rtspVideo.ShowVideo(camInfo.RtspUrl, cameraDev.Info);
            if (IsPrompt)
            {
                if (string.IsNullOrEmpty(camInfo.RtspUrl))
                {
                    Debug.LogError("Error : RtspVideo.ShowVideo-> rtspURL is null!");
                    if (VedioPrompt)
                    {
                        VedioPrompt.text = "Rtsp地址未输入!";
                    }
                    UGUIMessageBox.Show("Rtsp地址未输入!");
                    if (SmallCameraAlarmFollow.VedioPrompt)
                    {
                        SmallCameraAlarmFollow.VedioPrompt.text = "Rtsp地址未输入!";
                    }

                    return;
                }

                if (!IsEffectiveURL(camInfo.RtspUrl))
                {
                    UGUIMessageBox.Show("Rtsp地址无效!");
                    VedioPrompt.text = "Rtsp地址无效!";

                    return;
                }
            }

            GameObject Obj = Instantiate(VedioPrefabs, PlayParent.transform) as GameObject;
            Obj.transform.SetAsFirstSibling();
            Obj.SetActive(true);
            VedioPrefabs.SetActive(false);
            player = Obj.GetComponent <UniversalMediaPlayer>();
            AddEncounteredEvent(player, () =>
            {
                ShowVideo(camInfo.RtspUrl, player);
            });
        }
    }
Exemplo n.º 24
0
 /// <summary>
 /// 设置摄像头信息
 /// </summary>
 /// <param name="info"></param>
 public void SetCameraInfo(Dev_CameraInfo info)
 {
     CameraInfo = info;
 }
 public bool ModifyCameraInfo(Dev_CameraInfo camInfo)
 {
     return(db.Dev_CameraInfos.Edit(camInfo.ToDbModel()));
 }
        /// <summary>
        /// 通过设备信息,获取摄像头信息
        /// </summary>
        /// <param name="dev"></param>
        /// <returns></returns>
        public Dev_CameraInfo GetCameraInfoByDevInfo(DevInfo dev)
        {
            Dev_CameraInfo cameraInfo = db.Dev_CameraInfos.DbSet.FirstOrDefault(item => item.DevInfoId == dev.Id).ToTModel();

            return(cameraInfo);
        }